mirror of https://github.com/YosysHQ/yosys.git
Added "opt -fast"
This commit is contained in:
parent
dbdf89c705
commit
eb17fbade5
|
@ -37,7 +37,7 @@ struct OptPass : public Pass {
|
||||||
log("a series of trivial optimizations and cleanups. This pass executes the other\n");
|
log("a series of trivial optimizations and cleanups. This pass executes the other\n");
|
||||||
log("passes in the following order:\n");
|
log("passes in the following order:\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" opt_const\n");
|
log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
|
||||||
log(" opt_share -nomux\n");
|
log(" opt_share -nomux\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" do\n");
|
log(" do\n");
|
||||||
|
@ -49,15 +49,26 @@ struct OptPass : public Pass {
|
||||||
log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
|
log(" opt_const [-mux_undef] [-mux_bool] [-undriven] [-fine] [-keepdc]\n");
|
||||||
log(" while <changed design>\n");
|
log(" while <changed design>\n");
|
||||||
log("\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("Note: Options in square brackets (such as [-keepdc]) are passed through to\n");
|
||||||
log("the opt_* commands when given to 'opt'.\n");
|
log("the opt_* commands when given to 'opt'.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log("\n");
|
||||||
}
|
}
|
||||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||||
{
|
{
|
||||||
std::string opt_clean_args;
|
std::string opt_clean_args;
|
||||||
std::string opt_const_args;
|
std::string opt_const_args;
|
||||||
std::string opt_reduce_args;
|
std::string opt_reduce_args;
|
||||||
|
bool fast_mode = false;
|
||||||
|
|
||||||
log_header("Executing OPT pass (performing simple optimizations).\n");
|
log_header("Executing OPT pass (performing simple optimizations).\n");
|
||||||
log_push();
|
log_push();
|
||||||
|
@ -89,14 +100,31 @@ struct OptPass : public Pass {
|
||||||
opt_const_args += " -keepdc";
|
opt_const_args += " -keepdc";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-fast") {
|
||||||
|
fast_mode = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
|
||||||
log_header("Optimizing in-memory representation of design.\n");
|
if (fast_mode)
|
||||||
design->optimize();
|
{
|
||||||
|
while (1) {
|
||||||
Pass::call(design, "opt_const");
|
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);
|
||||||
Pass::call(design, "opt_share -nomux");
|
Pass::call(design, "opt_share -nomux");
|
||||||
while (1) {
|
while (1) {
|
||||||
OPT_DID_SOMETHING = false;
|
OPT_DID_SOMETHING = false;
|
||||||
|
@ -110,11 +138,9 @@ struct OptPass : public Pass {
|
||||||
break;
|
break;
|
||||||
log_header("Rerunning OPT passes. (Maybe there is more to do..)\n");
|
log_header("Rerunning OPT passes. (Maybe there is more to do..)\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log_header("Optimizing in-memory representation of design.\n");
|
log_header(fast_mode ? "Finished fast OPT passes." : "Finished OPT passes. (There is nothing left to do.)\n");
|
||||||
design->optimize();
|
|
||||||
|
|
||||||
log_header("Finished OPT passes. (There is nothing left to do.)\n");
|
|
||||||
log_pop();
|
log_pop();
|
||||||
}
|
}
|
||||||
} OptPass;
|
} OptPass;
|
||||||
|
|
Loading…
Reference in New Issue