mirror of https://github.com/YosysHQ/yosys.git
cxxrtl: run hierarchy pass regardless of (*top*) attribute presence.
The hierarchy pass does a lot more than just finding the top module, mainly resolving implicit (positional, wildcard) module connections. Fixes #2589.
This commit is contained in:
parent
10c3214e56
commit
5b003d6e5c
|
@ -2939,9 +2939,9 @@ struct CxxrtlWorker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_design(RTLIL::Design *design, bool &has_top, bool &has_sync_init)
|
void check_design(RTLIL::Design *design, bool &has_sync_init)
|
||||||
{
|
{
|
||||||
has_sync_init = has_top = false;
|
has_sync_init = false;
|
||||||
|
|
||||||
for (auto module : design->modules()) {
|
for (auto module : design->modules()) {
|
||||||
if (module->get_blackbox_attribute() && !module->has_attribute(ID(cxxrtl_blackbox)))
|
if (module->get_blackbox_attribute() && !module->has_attribute(ID(cxxrtl_blackbox)))
|
||||||
|
@ -2953,9 +2953,6 @@ struct CxxrtlWorker {
|
||||||
if (!design->selected_module(module))
|
if (!design->selected_module(module))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (module->get_bool_attribute(ID::top))
|
|
||||||
has_top = true;
|
|
||||||
|
|
||||||
for (auto proc : module->processes)
|
for (auto proc : module->processes)
|
||||||
for (auto sync : proc.second->syncs)
|
for (auto sync : proc.second->syncs)
|
||||||
if (sync->type == RTLIL::STi)
|
if (sync->type == RTLIL::STi)
|
||||||
|
@ -2966,10 +2963,10 @@ struct CxxrtlWorker {
|
||||||
void prepare_design(RTLIL::Design *design)
|
void prepare_design(RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
bool did_anything = false;
|
bool did_anything = false;
|
||||||
bool has_top, has_sync_init;
|
bool has_sync_init;
|
||||||
log_push();
|
log_push();
|
||||||
check_design(design, has_top, has_sync_init);
|
check_design(design, has_sync_init);
|
||||||
if (run_hierarchy && !has_top) {
|
if (run_hierarchy) {
|
||||||
Pass::call(design, "hierarchy -auto-top");
|
Pass::call(design, "hierarchy -auto-top");
|
||||||
did_anything = true;
|
did_anything = true;
|
||||||
}
|
}
|
||||||
|
@ -2990,7 +2987,7 @@ struct CxxrtlWorker {
|
||||||
}
|
}
|
||||||
// Recheck the design if it was modified.
|
// Recheck the design if it was modified.
|
||||||
if (did_anything)
|
if (did_anything)
|
||||||
check_design(design, has_top, has_sync_init);
|
check_design(design, has_sync_init);
|
||||||
log_assert(!has_sync_init);
|
log_assert(!has_sync_init);
|
||||||
log_pop();
|
log_pop();
|
||||||
if (did_anything)
|
if (did_anything)
|
||||||
|
|
Loading…
Reference in New Issue