3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-19 12:23:39 +00:00

Add noclean option to submod for speedup

This commit is contained in:
Akash Levy 2024-05-02 06:12:09 -07:00
parent e62bc102ca
commit cc5e893db8

View file

@ -351,6 +351,9 @@ struct SubmodPass : public Pass {
log(" private names so that a subsequent 'flatten; clean' call will restore\n"); log(" private names so that a subsequent 'flatten; clean' call will restore\n");
log(" the original module with original public names.\n"); log(" the original module with original public names.\n");
log("\n"); log("\n");
log(" -noclean\n");
log(" by default opt_clean is run after. call with -noclean to skip this pass.\n");
log("\n");
} }
void execute(std::vector<std::string> args, RTLIL::Design *design) override void execute(std::vector<std::string> args, RTLIL::Design *design) override
{ {
@ -360,6 +363,7 @@ struct SubmodPass : public Pass {
std::string opt_name; std::string opt_name;
bool copy_mode = false; bool copy_mode = false;
bool hidden_mode = false; bool hidden_mode = false;
bool noclean_mode = false;
size_t argidx; size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++) { for (argidx = 1; argidx < args.size(); argidx++) {
@ -375,13 +379,18 @@ struct SubmodPass : public Pass {
hidden_mode = true; hidden_mode = true;
continue; continue;
} }
if (args[argidx] == "-noclean") {
noclean_mode = true;
continue;
}
break; break;
} }
extra_args(args, argidx, design); extra_args(args, argidx, design);
if (opt_name.empty()) if (opt_name.empty())
{ {
Pass::call(design, "opt_clean"); if (!noclean_mode)
Pass::call(design, "opt_clean");
log_header(design, "Continuing SUBMOD pass.\n"); log_header(design, "Continuing SUBMOD pass.\n");
std::set<RTLIL::IdString> handled_modules; std::set<RTLIL::IdString> handled_modules;
@ -401,7 +410,8 @@ struct SubmodPass : public Pass {
} }
} }
Pass::call(design, "opt_clean"); if (!noclean_mode)
Pass::call(design, "opt_clean");
} }
else else
{ {
@ -414,7 +424,8 @@ struct SubmodPass : public Pass {
if (module == nullptr) if (module == nullptr)
log("Nothing selected -> do nothing.\n"); log("Nothing selected -> do nothing.\n");
else { else {
Pass::call_on_module(design, module, "opt_clean"); if (!noclean_mode)
Pass::call_on_module(design, module, "opt_clean");
log_header(design, "Continuing SUBMOD pass.\n"); log_header(design, "Continuing SUBMOD pass.\n");
SubmodWorker worker(design, module, copy_mode, hidden_mode, opt_name); SubmodWorker worker(design, module, copy_mode, hidden_mode, opt_name);
} }