aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt/opt_reduce.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-07-21 16:34:16 +0200
committerClifford Wolf <clifford@clifford.at>2014-07-21 16:34:16 +0200
commit1241a9fd5073d327d49f1af47db37214a4628ed8 (patch)
tree9a707414febae20d0068860f20feead248787d45 /passes/opt/opt_reduce.cc
parent4147b55c233013dd861172f13d0b9669598d234c (diff)
downloadyosys-1241a9fd5073d327d49f1af47db37214a4628ed8.tar.gz
yosys-1241a9fd5073d327d49f1af47db37214a4628ed8.tar.bz2
yosys-1241a9fd5073d327d49f1af47db37214a4628ed8.zip
Added "opt_const -fine" and "opt_reduce -fine"
Diffstat (limited to 'passes/opt/opt_reduce.cc')
-rw-r--r--passes/opt/opt_reduce.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/passes/opt/opt_reduce.cc b/passes/opt/opt_reduce.cc
index a0c7a027f..93945e49a 100644
--- a/passes/opt/opt_reduce.cc
+++ b/passes/opt/opt_reduce.cc
@@ -244,7 +244,7 @@ struct OptReduceWorker
}
}
- OptReduceWorker(RTLIL::Design *design, RTLIL::Module *module) :
+ OptReduceWorker(RTLIL::Design *design, RTLIL::Module *module, bool do_fine) :
design(design), module(module), assign_map(module)
{
log(" Optimizing cells in module %s.\n", module->name.c_str());
@@ -318,7 +318,7 @@ struct OptReduceWorker
// this optimization is to aggressive for most coarse-grain applications.
// but we always want it for multiplexers driving write enable ports.
- if (mem_wren_sigs.check_any(assign_map(cell->connections.at("\\Y"))))
+ if (do_fine || mem_wren_sigs.check_any(assign_map(cell->connections.at("\\Y"))))
opt_mux_bits(cell);
opt_mux(cell);
@@ -333,7 +333,7 @@ struct OptReducePass : public Pass {
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
- log(" opt_reduce [selection]\n");
+ log(" opt_reduce [options] [selection]\n");
log("\n");
log("This pass performs two interlinked optimizations:\n");
log("\n");
@@ -343,17 +343,31 @@ struct OptReducePass : public Pass {
log("2. it identifies duplicated inputs to MUXes and replaces them with a single\n");
log("input with the original control signals OR'ed together.\n");
log("\n");
+ log(" -fine\n");
+ log(" perform fine-grain optimizations\n");
+ log("\n");
}
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
{
+ bool do_fine = false;
+
log_header("Executing OPT_REDUCE pass (consolidate $*mux and $reduce_* inputs).\n");
- extra_args(args, 1, design);
+
+ size_t argidx;
+ for (argidx = 1; argidx < args.size(); argidx++) {
+ if (args[argidx] == "-fine") {
+ do_fine = true;
+ continue;
+ }
+ break;
+ }
+ extra_args(args, argidx, design);
int total_count = 0;
for (auto &mod_it : design->modules) {
if (!design->selected(mod_it.second))
continue;
- OptReduceWorker worker(design, mod_it.second);
+ OptReduceWorker worker(design, mod_it.second, do_fine);
total_count += worker.total_count;
}