mirror of https://github.com/YosysHQ/yosys.git
Fixed "share" for complex scenarios with never-active cells
This commit is contained in:
parent
b9811d5aff
commit
9d4362990f
|
@ -686,6 +686,7 @@ struct ShareWorker
|
||||||
|
|
||||||
if (cell_activation_patterns.empty()) {
|
if (cell_activation_patterns.empty()) {
|
||||||
log(" Cell is never active. Sharing is pointless, we simply remove it.\n");
|
log(" Cell is never active. Sharing is pointless, we simply remove it.\n");
|
||||||
|
cells_to_remove.insert(cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,11 +720,13 @@ struct ShareWorker
|
||||||
if (other_cell_activation_patterns.empty()) {
|
if (other_cell_activation_patterns.empty()) {
|
||||||
log(" Cell is never active. Sharing is pointless, we simply remove it.\n");
|
log(" Cell is never active. Sharing is pointless, we simply remove it.\n");
|
||||||
shareable_cells.erase(other_cell);
|
shareable_cells.erase(other_cell);
|
||||||
|
cells_to_remove.insert(other_cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other_cell_activation_patterns.count(std::pair<RTLIL::SigSpec, RTLIL::Const>())) {
|
if (other_cell_activation_patterns.count(std::pair<RTLIL::SigSpec, RTLIL::Const>())) {
|
||||||
log(" Cell is always active. Therefore no sharing is possible.\n");
|
log(" Cell is always active. Therefore no sharing is possible.\n");
|
||||||
|
shareable_cells.erase(other_cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,8 +753,6 @@ struct ShareWorker
|
||||||
optimize_activation_patterns(filtered_other_cell_activation_patterns);
|
optimize_activation_patterns(filtered_other_cell_activation_patterns);
|
||||||
|
|
||||||
ezDefaultSAT ez;
|
ezDefaultSAT ez;
|
||||||
ez.non_incremental();
|
|
||||||
|
|
||||||
SatGen satgen(&ez, &modwalker.sigmap);
|
SatGen satgen(&ez, &modwalker.sigmap);
|
||||||
|
|
||||||
std::set<RTLIL::Cell*> sat_cells;
|
std::set<RTLIL::Cell*> sat_cells;
|
||||||
|
@ -798,6 +799,21 @@ struct ShareWorker
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ez.solve(ez.expression(ez.OpOr, cell_active))) {
|
||||||
|
log(" According to the SAT solver the cell %s is never active. Sharing is pointless, we simply remove it.\n", log_id(cell));
|
||||||
|
cells_to_remove.insert(cell);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ez.solve(ez.expression(ez.OpOr, other_cell_active))) {
|
||||||
|
log(" According to the SAT solver the cell %s is never active. Sharing is pointless, we simply remove it.\n", log_id(other_cell));
|
||||||
|
cells_to_remove.insert(other_cell);
|
||||||
|
shareable_cells.erase(other_cell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ez.non_incremental();
|
||||||
|
|
||||||
all_ctrl_signals.sort_and_unify();
|
all_ctrl_signals.sort_and_unify();
|
||||||
std::vector<int> sat_model = satgen.importSigSpec(all_ctrl_signals);
|
std::vector<int> sat_model = satgen.importSigSpec(all_ctrl_signals);
|
||||||
std::vector<bool> sat_model_values;
|
std::vector<bool> sat_model_values;
|
||||||
|
|
Loading…
Reference in New Issue