mirror of https://github.com/YosysHQ/yosys.git
Using design->selected_modules() in opt_*
This commit is contained in:
parent
5b41470e15
commit
a8f4a099b5
|
@ -347,17 +347,10 @@ struct OptCleanPass : public Pass {
|
||||||
ct_reg.setup_internals_mem();
|
ct_reg.setup_internals_mem();
|
||||||
ct_reg.setup_stdcells_mem();
|
ct_reg.setup_stdcells_mem();
|
||||||
|
|
||||||
for (auto mod : design->modules()) {
|
for (auto module : design->selected_whole_modules_warn()) {
|
||||||
if (!design->selected_whole_module(mod->name)) {
|
if (module->has_processes_warn())
|
||||||
if (design->selected(mod))
|
|
||||||
log("Skipping module %s as it is only partially selected.\n", id2cstr(mod->name));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
rmunused_module(module, purge_mode, true);
|
||||||
if (!mod->processes.empty()) {
|
|
||||||
log("Skipping module %s as it contains processes.\n", mod->name.c_str());
|
|
||||||
} else {
|
|
||||||
rmunused_module(mod, purge_mode, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ct.clear();
|
ct.clear();
|
||||||
|
@ -411,12 +404,13 @@ struct CleanPass : public Pass {
|
||||||
count_rm_cells = 0;
|
count_rm_cells = 0;
|
||||||
count_rm_wires = 0;
|
count_rm_wires = 0;
|
||||||
|
|
||||||
for (auto mod : design->modules()) {
|
for (auto mod : design->selected_whole_modules()) {
|
||||||
if (design->selected_whole_module(mod->name) && mod->processes.empty())
|
if (mod->has_processes())
|
||||||
do {
|
continue;
|
||||||
design->scratchpad_unset("opt.did_something");
|
do {
|
||||||
rmunused_module(mod, purge_mode, false);
|
design->scratchpad_unset("opt.did_something");
|
||||||
} while (design->scratchpad_get_bool("opt.did_something"));
|
rmunused_module(mod, purge_mode, false);
|
||||||
|
} while (design->scratchpad_get_bool("opt.did_something"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count_rm_cells > 0 || count_rm_wires > 0)
|
if (count_rm_cells > 0 || count_rm_wires > 0)
|
||||||
|
|
|
@ -1002,7 +1002,7 @@ struct OptConstPass : public Pass {
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
|
||||||
for (auto module : design->modules())
|
for (auto module : design->selected_modules())
|
||||||
{
|
{
|
||||||
if (undriven)
|
if (undriven)
|
||||||
replace_undriven(design, module);
|
replace_undriven(design, module);
|
||||||
|
|
|
@ -468,15 +468,10 @@ struct OptMuxtreePass : public Pass {
|
||||||
extra_args(args, 1, design);
|
extra_args(args, 1, design);
|
||||||
|
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
for (auto mod : design->modules()) {
|
for (auto module : design->selected_whole_modules_warn()) {
|
||||||
if (!design->selected_whole_module(mod)) {
|
if (module->has_processes_warn())
|
||||||
if (design->selected(mod))
|
|
||||||
log("Skipping module %s as it is only partially selected.\n", log_id(mod));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
OptMuxtreeWorker worker(design, module);
|
||||||
if (mod->has_processes_warn())
|
|
||||||
continue;
|
|
||||||
OptMuxtreeWorker worker(design, mod);
|
|
||||||
total_count += worker.removed_count;
|
total_count += worker.removed_count;
|
||||||
}
|
}
|
||||||
if (total_count)
|
if (total_count)
|
||||||
|
|
|
@ -371,16 +371,13 @@ struct OptReducePass : public Pass {
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
for (auto &mod_it : design->modules_) {
|
for (auto module : design->selected_modules())
|
||||||
if (!design->selected(mod_it.second))
|
while (1) {
|
||||||
continue;
|
OptReduceWorker worker(design, module, do_fine);
|
||||||
do {
|
|
||||||
OptReduceWorker worker(design, mod_it.second, do_fine);
|
|
||||||
total_count += worker.total_count;
|
total_count += worker.total_count;
|
||||||
if (worker.total_count == 0)
|
if (worker.total_count == 0)
|
||||||
break;
|
break;
|
||||||
} while (1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (total_count)
|
if (total_count)
|
||||||
design->scratchpad_set_bool("opt.did_something", true);
|
design->scratchpad_set_bool("opt.did_something", true);
|
||||||
|
|
|
@ -314,10 +314,8 @@ struct OptSharePass : public Pass {
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
for (auto &mod_it : design->modules_) {
|
for (auto module : design->selected_modules()) {
|
||||||
if (!design->selected(mod_it.second))
|
OptShareWorker worker(design, module, mode_nomux);
|
||||||
continue;
|
|
||||||
OptShareWorker worker(design, mod_it.second, mode_nomux);
|
|
||||||
total_count += worker.total_count;
|
total_count += worker.total_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue