scc to use design->selected_modules() which avoids black/white-boxes

This commit is contained in:
Eddie Hung 2020-01-06 12:36:11 -08:00
parent 4f13ab823f
commit b70e87137d
1 changed files with 25 additions and 26 deletions

View File

@ -301,41 +301,40 @@ struct SccPass : public Pass {
RTLIL::Selection newSelection(false); RTLIL::Selection newSelection(false);
int scc_counter = 0; int scc_counter = 0;
for (auto &mod_it : design->modules_) for (auto mod : design->selected_modules())
if (design->selected(mod_it.second)) {
SccWorker worker(design, mod, nofeedbackMode, allCellTypes, maxDepth);
if (!setAttr.empty())
{ {
SccWorker worker(design, mod_it.second, nofeedbackMode, allCellTypes, maxDepth); for (const auto &cells : worker.sccList)
if (!setAttr.empty())
{ {
for (const auto &cells : worker.sccList) for (auto attr : setAttr)
{ {
for (auto attr : setAttr) IdString attr_name(RTLIL::escape_id(attr.first));
{ string attr_valstr = attr.second;
IdString attr_name(RTLIL::escape_id(attr.first)); string index = stringf("%d", scc_counter);
string attr_valstr = attr.second;
string index = stringf("%d", scc_counter);
for (size_t pos = 0; (pos = attr_valstr.find("{}", pos)) != string::npos; pos += index.size()) for (size_t pos = 0; (pos = attr_valstr.find("{}", pos)) != string::npos; pos += index.size())
attr_valstr.replace(pos, 2, index); attr_valstr.replace(pos, 2, index);
Const attr_value(attr_valstr); Const attr_value(attr_valstr);
for (auto cell : cells) for (auto cell : cells)
cell->attributes[attr_name] = attr_value; cell->attributes[attr_name] = attr_value;
}
scc_counter++;
} }
}
else
{
scc_counter += GetSize(worker.sccList);
}
if (selectMode) scc_counter++;
worker.select(newSelection); }
} }
else
{
scc_counter += GetSize(worker.sccList);
}
if (selectMode)
worker.select(newSelection);
}
if (expect >= 0) { if (expect >= 0) {
if (scc_counter == expect) if (scc_counter == expect)