From 435f773cc4a9ef11550acd2cd07b72ad6a2273be Mon Sep 17 00:00:00 2001 From: Akash Levy Date: Fri, 27 Jun 2025 14:26:11 -0700 Subject: [PATCH] Add back submod -noclean --- passes/hierarchy/submod.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/passes/hierarchy/submod.cc b/passes/hierarchy/submod.cc index 6783c8b92..95dfc3b7b 100644 --- a/passes/hierarchy/submod.cc +++ b/passes/hierarchy/submod.cc @@ -357,6 +357,10 @@ struct SubmodPass : public Pass { log(" use the specified string as separator between module name and submodule\n"); log(" name when creating submodule names. default is \"_\".\n"); log("\n"); + log(" -noclean\n"); + log(" disable all calls to 'opt_clean' pass. by default, the pass calls\n"); + log(" 'opt_clean' before and after processing modules.\n"); + log("\n"); } void execute(std::vector args, RTLIL::Design *design) override { @@ -366,6 +370,7 @@ struct SubmodPass : public Pass { std::string opt_name; bool copy_mode = false; bool hidden_mode = false; + bool noclean_mode = false; std::string separator = "_"; size_t argidx; @@ -382,6 +387,10 @@ struct SubmodPass : public Pass { hidden_mode = true; continue; } + if (args[argidx] == "-noclean") { + noclean_mode = true; + continue; + } if (args[argidx] == "-separator" && argidx+1 < args.size()) { separator = args[++argidx]; continue; @@ -392,7 +401,8 @@ struct SubmodPass : public Pass { if (opt_name.empty()) { - Pass::call(design, "opt_clean"); + if (!noclean_mode) + Pass::call(design, "opt_clean"); log_header(design, "Continuing SUBMOD pass.\n"); std::set handled_modules; @@ -412,7 +422,8 @@ struct SubmodPass : public Pass { } } - Pass::call(design, "opt_clean"); + if (!noclean_mode) + Pass::call(design, "opt_clean"); } else { @@ -425,7 +436,8 @@ struct SubmodPass : public Pass { if (module == nullptr) log("Nothing selected -> do nothing.\n"); 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"); SubmodWorker worker(design, module, copy_mode, hidden_mode, opt_name, separator); }