Skip to content

Commit 913ac04

Browse files
hierarchy: Derive abstract cells in top mod
Previously abstract cells would only be derived if there was no top module declared, this means that `-check` would miss certain kinds of errors that it would normally detect. This fixes #4927.
1 parent 5748b37 commit 913ac04

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

passes/hierarchy/hierarchy.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,17 @@ struct HierarchyPass : public Pass {
10661066
mod->attributes[ID::initial_top] = RTLIL::Const(1);
10671067
else
10681068
mod->attributes.erase(ID::initial_top);
1069+
1070+
std::vector<IdString> abstract_ids;
1071+
for (auto cell : top_mod->cells()) {
1072+
IdString abstract_id = "$abstract" + cell->type.str();
1073+
if (design->module(cell->type) == nullptr && design->module(abstract_id))
1074+
abstract_ids.push_back(abstract_id);
1075+
}
1076+
for (auto abstract_id : abstract_ids)
1077+
design->module(abstract_id)->derive(design, {});
1078+
for (auto abstract_id : abstract_ids)
1079+
design->remove(design->module(abstract_id));
10691080
}
10701081

10711082
bool did_something = true;

0 commit comments

Comments
 (0)