From: Marcelina Koƛcielnicka Date: Wed, 8 Jun 2022 18:32:04 +0000 (+0200) Subject: wreduce: Introduce -mux_undef option (aligned with opt_expr). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47efc04a7d86556c4936f4fcfdd1bac4de4c2e16;p=yosys.git wreduce: Introduce -mux_undef option (aligned with opt_expr). --- diff --git a/passes/opt/wreduce.cc b/passes/opt/wreduce.cc index aaad28ef0..08ab6de6f 100644 --- a/passes/opt/wreduce.cc +++ b/passes/opt/wreduce.cc @@ -30,6 +30,7 @@ struct WreduceConfig { pool supported_cell_types; bool keepdc = false; + bool mux_undef = false; WreduceConfig() { @@ -83,7 +84,7 @@ struct WreduceWorker SigBit ref = sig_a[i]; for (int k = 0; k < GetSize(sig_s); k++) { - if ((config->keepdc || (ref != State::Sx && sig_b[k*GetSize(sig_a) + i] != State::Sx)) && ref != sig_b[k*GetSize(sig_a) + i]) + if ((config->keepdc || !config->mux_undef || (ref != State::Sx && sig_b[k*GetSize(sig_a) + i] != State::Sx)) && ref != sig_b[k*GetSize(sig_a) + i]) goto no_match_ab; if (sig_b[k*GetSize(sig_a) + i] != State::Sx) ref = sig_b[k*GetSize(sig_a) + i]; @@ -479,6 +480,9 @@ struct WreducePass : public Pass { log(" Do not change the width of memory address ports. Use this options in\n"); log(" flows that use the 'memory_memx' pass.\n"); log("\n"); + log(" -mux_undef\n"); + log(" remove 'undef' inputs from $mux, $pmux and $_MUX_ cells\n"); + log("\n"); log(" -keepdc\n"); log(" Do not optimize explicit don't-care values.\n"); log("\n"); @@ -500,6 +504,10 @@ struct WreducePass : public Pass { config.keepdc = true; continue; } + if (args[argidx] == "-mux_undef") { + config.mux_undef = true; + continue; + } break; } extra_args(args, argidx, design);