summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-08-16 15:34:15 +0200
committerClifford Wolf <clifford@clifford.at>2014-08-16 15:34:15 +0200
commiteb17fbade5ef89983993d1e9d47da5f8a2fb32c3 (patch)
tree98c01a9cf3d1c893fbbe76dcaada90ca23f9dcb7
parentdbdf89c7054a3f249d7579cb50d10b72b1ac592d (diff)
Added "opt -fast"
-rw-r--r--passes/opt/opt.cc64
1 files changed, 45 insertions, 19 deletions
diff --git a/passes/opt/opt.cc b/passes/opt/opt.cc
index 33e1507b..b6d36f0e 100644
--- a/passes/opt/opt.cc
+++ b/passes/opt/opt.cc
@@ -37,7 +37,7 @@ struct OptPass : public Pass {
log("a series of trivial optimizations and cleanups. This pass executes the other\n");
log("passes in the following order:\n");
log("\n");
- log(" opt_const\n");
+ log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
log(" opt_share -nomux\n");
log("\n");
log(" do\n");
@@ -49,15 +49,26 @@ struct OptPass : public Pass {
log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
log(" while <changed design>\n");
log("\n");
+ log("When called with -fast the following script is used instead:\n");
+ log("\n");
+ log(" do\n");
+ log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
+ log(" opt_share\n");
+ log(" opt_rmdff\n");
+ log(" opt_clean [-purge]\n");
+ log(" while <changed design in opt_rmdff>\n");
+ log("\n");
log("Note: Options in square brackets (such as [-keepdc]) are passed through to\n");
log("the opt_* commands when given to 'opt'.\n");
log("\n");
+ log("\n");
}
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
{
std::string opt_clean_args;
std::string opt_const_args;
std::string opt_reduce_args;
+ bool fast_mode = false;
log_header("Executing OPT pass (performing simple optimizations).\n");
log_push();
@@ -89,32 +100,47 @@ struct OptPass : public Pass {
opt_const_args += " -keepdc";
continue;
}
+ if (args[argidx] == "-fast") {
+ fast_mode = true;
+ continue;
+ }
break;
}
extra_args(args, argidx, design);
- log_header("Optimizing in-memory representation of design.\n");
- design->optimize();
-
- Pass::call(design, "opt_const");
- Pass::call(design, "opt_share -nomux");
- while (1) {
- OPT_DID_SOMETHING = false;
- Pass::call(design, "opt_muxtree");
- Pass::call(design, "opt_reduce" + opt_reduce_args);
- Pass::call(design, "opt_share");
- Pass::call(design, "opt_rmdff");
+ if (fast_mode)
+ {
+ while (1) {
+ Pass::call(design, "opt_const" + opt_const_args);
+ Pass::call(design, "opt_share");
+ OPT_DID_SOMETHING = false;
+ Pass::call(design, "opt_rmdff");
+ if (OPT_DID_SOMETHING == false)
+ break;
+ Pass::call(design, "opt_clean" + opt_clean_args);
+ log_header("Rerunning OPT passes. (Removed registers in this run.)\n");
+ }
Pass::call(design, "opt_clean" + opt_clean_args);
+ }
+ else
+ {
Pass::call(design, "opt_const" + opt_const_args);
- if (OPT_DID_SOMETHING == false)
- break;
- log_header("Rerunning OPT passes. (Maybe there is more to do..)\n");
+ Pass::call(design, "opt_share -nomux");
+ while (1) {
+ OPT_DID_SOMETHING = false;
+ Pass::call(design, "opt_muxtree");
+ Pass::call(design, "opt_reduce" + opt_reduce_args);
+ Pass::call(design, "opt_share");
+ Pass::call(design, "opt_rmdff");
+ Pass::call(design, "opt_clean" + opt_clean_args);
+ Pass::call(design, "opt_const" + opt_const_args);
+ if (OPT_DID_SOMETHING == false)
+ break;
+ log_header("Rerunning OPT passes. (Maybe there is more to do..)\n");
+ }
}
- log_header("Optimizing in-memory representation of design.\n");
- design->optimize();
-
- log_header("Finished OPT passes. (There is nothing left to do.)\n");
+ log_header(fast_mode ? "Finished fast OPT passes." : "Finished OPT passes. (There is nothing left to do.)\n");
log_pop();
}
} OptPass;