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");
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();
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;