From: Clifford Wolf Date: Sun, 11 Aug 2013 11:59:14 +0000 (+0200) Subject: Added "clean -purge" and ";;;" support X-Git-Tag: yosys-0.2.0~507 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a5836af172a154bc0b8f9fdea34e140a5662bc99;p=yosys.git Added "clean -purge" and ";;;" support --- diff --git a/kernel/register.cc b/kernel/register.cc index 9f6fe37d3..4575e4091 100644 --- a/kernel/register.cc +++ b/kernel/register.cc @@ -158,6 +158,8 @@ void Pass::call(RTLIL::Design *design, std::string command) args.clear(); if (num_semikolon == 2) call(design, "clean"); + if (num_semikolon == 3) + call(design, "clean -purge"); } else args.push_back(str); } diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index 17f4168da..96c4c7a18 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -277,6 +277,7 @@ struct OptCleanPass : public Pass { purge_mode = true; continue; } + break; } extra_args(args, argidx, design); @@ -309,17 +310,31 @@ struct CleanPass : public Pass { { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" clean [selection]\n"); + log(" clean [options] [selection]\n"); log("\n"); - log("This is identical to opt_clean, but less verbose.\n"); + log("This is identical to 'opt_clean', but less verbose.\n"); log("\n"); log("When commands are seperated using the ';;' token, this command will be executed\n"); log("between the commands.\n"); log("\n"); + log("When commands are seperated using the ';;;' token, this command will be executed\n"); + log("in -purge mode between the commands.\n"); + log("\n"); } virtual void execute(std::vector args, RTLIL::Design *design) { - extra_args(args, 1, design); + bool purge_mode = false; + + size_t argidx; + for (argidx = 1; argidx < args.size(); argidx++) { + if (args[argidx] == "-purge") { + purge_mode = true; + continue; + } + break; + } + if (argidx < args.size()) + extra_args(args, argidx, design); ct.setup_internals(); ct.setup_internals_mem(); @@ -333,7 +348,7 @@ struct CleanPass : public Pass { if (design->selected_whole_module(mod_it.first) && mod_it.second->processes.size() == 0) do { OPT_DID_SOMETHING = false; - rmunused_module(mod_it.second, false, false); + rmunused_module(mod_it.second, purge_mode, false); } while (OPT_DID_SOMETHING); }