mirror of https://github.com/YosysHQ/yosys.git
Added "prep -flatten" and "synth -flatten"
This commit is contained in:
parent
77aa2031e7
commit
09ffebb995
|
@ -42,6 +42,10 @@ struct PrepPass : public ScriptPass
|
|||
log(" -top <module>\n");
|
||||
log(" use the specified module as top module (default='top')\n");
|
||||
log("\n");
|
||||
log(" -flatten\n");
|
||||
log(" flatten the design before synthesis. this will pass '-auto-top' to\n");
|
||||
log(" 'hierarchy' if no top module is specified.\n");
|
||||
log("\n");
|
||||
log(" -nordff\n");
|
||||
log(" passed to 'memory_dff'. prohibits merging of FFs into memory read ports\n");
|
||||
log("\n");
|
||||
|
@ -57,11 +61,13 @@ struct PrepPass : public ScriptPass
|
|||
}
|
||||
|
||||
string top_module, fsm_opts, memory_opts;
|
||||
bool flatten;
|
||||
|
||||
virtual void clear_flags() YS_OVERRIDE
|
||||
{
|
||||
top_module.clear();
|
||||
memory_opts.clear();
|
||||
flatten = false;
|
||||
}
|
||||
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
|
@ -86,6 +92,10 @@ struct PrepPass : public ScriptPass
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-flatten") {
|
||||
flatten = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-nordff") {
|
||||
memory_opts += " -nordff";
|
||||
continue;
|
||||
|
@ -113,9 +123,12 @@ struct PrepPass : public ScriptPass
|
|||
if (help_mode) {
|
||||
run("hierarchy -check [-top <top>]");
|
||||
} else {
|
||||
if (top_module.empty())
|
||||
run("hierarchy -check");
|
||||
else
|
||||
if (top_module.empty()) {
|
||||
if (flatten)
|
||||
run("hierarchy -check -auto-top");
|
||||
else
|
||||
run("hierarchy -check");
|
||||
} else
|
||||
run(stringf("hierarchy -check -top %s", top_module.c_str()));
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +136,8 @@ struct PrepPass : public ScriptPass
|
|||
if (check_label("coarse"))
|
||||
{
|
||||
run("proc");
|
||||
if (help_mode || flatten)
|
||||
run("flatten", "(if -flatten)");
|
||||
run("opt_expr -keepdc");
|
||||
run("opt_clean");
|
||||
run("check");
|
||||
|
|
|
@ -41,6 +41,10 @@ struct SynthPass : public ScriptPass
|
|||
log(" -top <module>\n");
|
||||
log(" use the specified module as top module (default='top')\n");
|
||||
log("\n");
|
||||
log(" -flatten\n");
|
||||
log(" flatten the design before synthesis. this will pass '-auto-top' to\n");
|
||||
log(" 'hierarchy' if no top module is specified.\n");
|
||||
log("\n");
|
||||
log(" -encfile <file>\n");
|
||||
log(" passed to 'fsm_recode' via 'fsm'\n");
|
||||
log("\n");
|
||||
|
@ -69,7 +73,7 @@ struct SynthPass : public ScriptPass
|
|||
}
|
||||
|
||||
string top_module, fsm_opts, memory_opts;
|
||||
bool noalumacc, nofsm, noabc;
|
||||
bool flatten, noalumacc, nofsm, noabc;
|
||||
|
||||
virtual void clear_flags() YS_OVERRIDE
|
||||
{
|
||||
|
@ -77,6 +81,7 @@ struct SynthPass : public ScriptPass
|
|||
fsm_opts.clear();
|
||||
memory_opts.clear();
|
||||
|
||||
flatten = false;
|
||||
noalumacc = false;
|
||||
nofsm = false;
|
||||
noabc = false;
|
||||
|
@ -109,6 +114,10 @@ struct SynthPass : public ScriptPass
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-flatten") {
|
||||
flatten = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-nofsm") {
|
||||
nofsm = true;
|
||||
continue;
|
||||
|
@ -147,9 +156,12 @@ struct SynthPass : public ScriptPass
|
|||
if (help_mode) {
|
||||
run("hierarchy -check [-top <top>]");
|
||||
} else {
|
||||
if (top_module.empty())
|
||||
run(stringf("hierarchy -check"));
|
||||
else
|
||||
if (top_module.empty()) {
|
||||
if (flatten)
|
||||
run("hierarchy -check -auto-top");
|
||||
else
|
||||
run("hierarchy -check");
|
||||
} else
|
||||
run(stringf("hierarchy -check -top %s", top_module.c_str()));
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +169,8 @@ struct SynthPass : public ScriptPass
|
|||
if (check_label("coarse"))
|
||||
{
|
||||
run("proc");
|
||||
if (help_mode || flatten)
|
||||
run("flatten", "(if -flatten)");
|
||||
run("opt_expr");
|
||||
run("opt_clean");
|
||||
run("check");
|
||||
|
|
Loading…
Reference in New Issue