mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-04 16:44:08 +00:00
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.
This commit is contained in:
parent
5748b37b1c
commit
913ac04764
|
@ -1066,6 +1066,17 @@ struct HierarchyPass : public Pass {
|
|||
mod->attributes[ID::initial_top] = RTLIL::Const(1);
|
||||
else
|
||||
mod->attributes.erase(ID::initial_top);
|
||||
|
||||
std::vector<IdString> abstract_ids;
|
||||
for (auto cell : top_mod->cells()) {
|
||||
IdString abstract_id = "$abstract" + cell->type.str();
|
||||
if (design->module(cell->type) == nullptr && design->module(abstract_id))
|
||||
abstract_ids.push_back(abstract_id);
|
||||
}
|
||||
for (auto abstract_id : abstract_ids)
|
||||
design->module(abstract_id)->derive(design, {});
|
||||
for (auto abstract_id : abstract_ids)
|
||||
design->remove(design->module(abstract_id));
|
||||
}
|
||||
|
||||
bool did_something = true;
|
||||
|
|
Loading…
Reference in a new issue