ct_reg.setup_internals_mem();
ct_reg.setup_stdcells_mem();
- for (auto mod : design->modules()) {
- if (!design->selected_whole_module(mod->name)) {
- if (design->selected(mod))
- log("Skipping module %s as it is only partially selected.\n", id2cstr(mod->name));
+ for (auto module : design->selected_whole_modules_warn()) {
+ if (module->has_processes_warn())
continue;
- }
- if (!mod->processes.empty()) {
- log("Skipping module %s as it contains processes.\n", mod->name.c_str());
- } else {
- rmunused_module(mod, purge_mode, true);
- }
+ rmunused_module(module, purge_mode, true);
}
ct.clear();
count_rm_cells = 0;
count_rm_wires = 0;
- for (auto mod : design->modules()) {
- if (design->selected_whole_module(mod->name) && mod->processes.empty())
- do {
- design->scratchpad_unset("opt.did_something");
- rmunused_module(mod, purge_mode, false);
- } while (design->scratchpad_get_bool("opt.did_something"));
+ for (auto mod : design->selected_whole_modules()) {
+ if (mod->has_processes())
+ continue;
+ do {
+ design->scratchpad_unset("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)
}
extra_args(args, argidx, design);
- for (auto module : design->modules())
+ for (auto module : design->selected_modules())
{
if (undriven)
replace_undriven(design, module);
extra_args(args, 1, design);
int total_count = 0;
- for (auto mod : design->modules()) {
- if (!design->selected_whole_module(mod)) {
- if (design->selected(mod))
- log("Skipping module %s as it is only partially selected.\n", log_id(mod));
+ for (auto module : design->selected_whole_modules_warn()) {
+ if (module->has_processes_warn())
continue;
- }
- if (mod->has_processes_warn())
- continue;
- OptMuxtreeWorker worker(design, mod);
+ OptMuxtreeWorker worker(design, module);
total_count += worker.removed_count;
}
if (total_count)
extra_args(args, argidx, design);
int total_count = 0;
- for (auto &mod_it : design->modules_) {
- if (!design->selected(mod_it.second))
- continue;
- do {
- OptReduceWorker worker(design, mod_it.second, do_fine);
+ for (auto module : design->selected_modules())
+ while (1) {
+ OptReduceWorker worker(design, module, do_fine);
total_count += worker.total_count;
if (worker.total_count == 0)
break;
- } while (1);
- }
+ }
if (total_count)
design->scratchpad_set_bool("opt.did_something", true);
extra_args(args, argidx, design);
int total_count = 0;
- for (auto &mod_it : design->modules_) {
- if (!design->selected(mod_it.second))
- continue;
- OptShareWorker worker(design, mod_it.second, mode_nomux);
+ for (auto module : design->selected_modules()) {
+ OptShareWorker worker(design, module, mode_nomux);
total_count += worker.total_count;
}