mirror of https://github.com/YosysHQ/yosys.git
hierarchy interfaces: refactor out used_modules
This commit is contained in:
parent
4d67f7ab95
commit
6488928a9c
|
|
@ -147,6 +147,17 @@ RTLIL::Module *get_module(RTLIL::Design &design,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::set<RTLIL::Module*, IdString::compare_ptr_by_name<Module>> used_modules(Design* design, Module* top_mod) {
|
||||||
|
std::set<RTLIL::Module*, IdString::compare_ptr_by_name<Module>> used;
|
||||||
|
if (top_mod != NULL) {
|
||||||
|
log_header(design, "Analyzing design hierarchy..\n");
|
||||||
|
mark_used(design, used, top_mod, 0);
|
||||||
|
} else {
|
||||||
|
for (auto mod : design->modules())
|
||||||
|
used.insert(mod);
|
||||||
|
}
|
||||||
|
return used;
|
||||||
|
}
|
||||||
|
|
||||||
void expand_all_interfaces(Design* design, Module* top_mod, bool flag_check, bool flag_simcheck, bool flag_smtcheck, const std::vector<std::string> &libdirs) {
|
void expand_all_interfaces(Design* design, Module* top_mod, bool flag_check, bool flag_simcheck, bool flag_smtcheck, const std::vector<std::string> &libdirs) {
|
||||||
bool did_something = true;
|
bool did_something = true;
|
||||||
|
|
@ -154,21 +165,11 @@ void expand_all_interfaces(Design* design, Module* top_mod, bool flag_check, boo
|
||||||
{
|
{
|
||||||
did_something = false;
|
did_something = false;
|
||||||
|
|
||||||
std::set<RTLIL::Module*, IdString::compare_ptr_by_name<Module>> used_modules;
|
for (auto module : used_modules(design, top_mod)) {
|
||||||
if (top_mod != NULL) {
|
|
||||||
log_header(design, "Analyzing design hierarchy..\n");
|
|
||||||
mark_used(design, used_modules, top_mod, 0);
|
|
||||||
} else {
|
|
||||||
for (auto mod : design->modules())
|
|
||||||
used_modules.insert(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto module : used_modules) {
|
|
||||||
if (expand_module(design, module, flag_check, flag_simcheck, flag_smtcheck, libdirs))
|
if (expand_module(design, module, flag_check, flag_simcheck, flag_smtcheck, libdirs))
|
||||||
did_something = true;
|
did_something = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// The top module might have changed if interface instances have been detected in it:
|
// The top module might have changed if interface instances have been detected in it:
|
||||||
RTLIL::Module *tmp_top_mod = check_if_top_has_changed(design, top_mod);
|
RTLIL::Module *tmp_top_mod = check_if_top_has_changed(design, top_mod);
|
||||||
if (tmp_top_mod != NULL) {
|
if (tmp_top_mod != NULL) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue