YOSYS_NAMESPACE_END
PRIVATE_NAMESPACE_BEGIN
-void proc_clean(RTLIL::Module *mod, RTLIL::Process *proc, int &total_count)
+void proc_clean(RTLIL::Module *mod, RTLIL::Process *proc, int &total_count, bool quiet)
{
int count = 0;
bool did_something = true;
did_something = false;
proc_clean_case(&proc->root_case, did_something, count, -1);
}
- if (count > 0)
+ if (count > 0 && !quiet)
log("Found and cleaned up %d empty switch%s in `%s.%s'.\n", count, count == 1 ? "" : "es", mod->name.c_str(), proc->name.c_str());
total_count += count;
}
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
- log(" proc_clean [selection]\n");
+ log(" proc_clean [options] [selection]\n");
+ log("\n");
+ log(" -quiet\n");
+ log(" do not print any messages.\n");
log("\n");
log("This pass removes empty parts of processes and ultimately removes a process\n");
log("if it contains only empty structures.\n");
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
{
int total_count = 0;
- log_header(design, "Executing PROC_CLEAN pass (remove empty switches from decision trees).\n");
+ bool quiet = false;
+
+ if (find(args.begin(), args.end(), "-quiet") == args.end())
+ log_header(design, "Executing PROC_CLEAN pass (remove empty switches from decision trees).\n");
- extra_args(args, 1, design);
+ size_t argidx;
+ for (argidx = 1; argidx < args.size(); argidx++)
+ {
+ if (args[argidx] == "-quiet") {
+ quiet = true;
+ continue;
+ }
+ }
+ extra_args(args, argidx, design);
for (auto mod : design->modules()) {
std::vector<RTLIL::IdString> delme;
for (auto &proc_it : mod->processes) {
if (!design->selected(mod, proc_it.second))
continue;
- proc_clean(mod, proc_it.second, total_count);
+ proc_clean(mod, proc_it.second, total_count, quiet);
if (proc_it.second->syncs.size() == 0 && proc_it.second->root_case.switches.size() == 0 &&
proc_it.second->root_case.actions.size() == 0) {
- log("Removing empty process `%s.%s'.\n", log_id(mod), proc_it.second->name.c_str());
+ if (!quiet)
+ log("Removing empty process `%s.%s'.\n", log_id(mod), proc_it.second->name.c_str());
delme.push_back(proc_it.first);
}
}
}
}
- log("Cleaned up %d empty switch%s.\n", total_count, total_count == 1 ? "" : "es");
+ if (!quiet)
+ log("Cleaned up %d empty switch%s.\n", total_count, total_count == 1 ? "" : "es");
}
} ProcCleanPass;