Added "prep -auto-top" and "synth -auto-top"

This commit is contained in:
Clifford Wolf 2016-07-11 11:40:55 +02:00
parent a72fb85dc2
commit cdb58f68ab
2 changed files with 23 additions and 6 deletions

View File

@ -42,6 +42,9 @@ struct PrepPass : public ScriptPass
log(" -top <module>\n"); log(" -top <module>\n");
log(" use the specified module as top module (default='top')\n"); log(" use the specified module as top module (default='top')\n");
log("\n"); log("\n");
log(" -auto-top\n");
log(" automatically determine the top of the design hierarchy\n");
log("\n");
log(" -flatten\n"); log(" -flatten\n");
log(" flatten the design before synthesis. this will pass '-auto-top' to\n"); log(" flatten the design before synthesis. this will pass '-auto-top' to\n");
log(" 'hierarchy' if no top module is specified.\n"); log(" 'hierarchy' if no top module is specified.\n");
@ -65,12 +68,14 @@ struct PrepPass : public ScriptPass
} }
string top_module, fsm_opts, memory_opts; string top_module, fsm_opts, memory_opts;
bool flatten, ifxmode; bool autotop, flatten, ifxmode;
virtual void clear_flags() YS_OVERRIDE virtual void clear_flags() YS_OVERRIDE
{ {
top_module.clear(); top_module.clear();
memory_opts.clear(); memory_opts.clear();
autotop = false;
flatten = false; flatten = false;
ifxmode = false; ifxmode = false;
} }
@ -97,6 +102,10 @@ struct PrepPass : public ScriptPass
} }
continue; continue;
} }
if (args[argidx] == "-auto-top") {
autotop = true;
continue;
}
if (args[argidx] == "-flatten") { if (args[argidx] == "-flatten") {
flatten = true; flatten = true;
continue; continue;
@ -130,10 +139,10 @@ struct PrepPass : public ScriptPass
if (check_label("begin")) if (check_label("begin"))
{ {
if (help_mode) { if (help_mode) {
run("hierarchy -check [-top <top>]"); run("hierarchy -check [-top <top> | -auto-top]");
} else { } else {
if (top_module.empty()) { if (top_module.empty()) {
if (flatten) if (flatten || autotop)
run("hierarchy -check -auto-top"); run("hierarchy -check -auto-top");
else else
run("hierarchy -check"); run("hierarchy -check");

View File

@ -41,6 +41,9 @@ struct SynthPass : public ScriptPass
log(" -top <module>\n"); log(" -top <module>\n");
log(" use the specified module as top module (default='top')\n"); log(" use the specified module as top module (default='top')\n");
log("\n"); log("\n");
log(" -auto-top\n");
log(" automatically determine the top of the design hierarchy\n");
log("\n");
log(" -flatten\n"); log(" -flatten\n");
log(" flatten the design before synthesis. this will pass '-auto-top' to\n"); log(" flatten the design before synthesis. this will pass '-auto-top' to\n");
log(" 'hierarchy' if no top module is specified.\n"); log(" 'hierarchy' if no top module is specified.\n");
@ -73,7 +76,7 @@ struct SynthPass : public ScriptPass
} }
string top_module, fsm_opts, memory_opts; string top_module, fsm_opts, memory_opts;
bool flatten, noalumacc, nofsm, noabc; bool autotop, flatten, noalumacc, nofsm, noabc;
virtual void clear_flags() YS_OVERRIDE virtual void clear_flags() YS_OVERRIDE
{ {
@ -81,6 +84,7 @@ struct SynthPass : public ScriptPass
fsm_opts.clear(); fsm_opts.clear();
memory_opts.clear(); memory_opts.clear();
autotop = false;
flatten = false; flatten = false;
noalumacc = false; noalumacc = false;
nofsm = false; nofsm = false;
@ -114,6 +118,10 @@ struct SynthPass : public ScriptPass
} }
continue; continue;
} }
if (args[argidx] == "-auto-top") {
autotop = true;
continue;
}
if (args[argidx] == "-flatten") { if (args[argidx] == "-flatten") {
flatten = true; flatten = true;
continue; continue;
@ -154,10 +162,10 @@ struct SynthPass : public ScriptPass
if (check_label("begin")) if (check_label("begin"))
{ {
if (help_mode) { if (help_mode) {
run("hierarchy -check [-top <top>]"); run("hierarchy -check [-top <top> | -auto-top]");
} else { } else {
if (top_module.empty()) { if (top_module.empty()) {
if (flatten) if (flatten || autotop)
run("hierarchy -check -auto-top"); run("hierarchy -check -auto-top");
else else
run("hierarchy -check"); run("hierarchy -check");