3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-07 01:54:10 +00:00

add support for passing flatten -separator to flatten in synth

This commit is contained in:
Peter Gadfort 2025-01-18 10:27:10 -07:00
parent 76d85fefac
commit 63074ccb89

View file

@ -98,7 +98,7 @@ struct SynthPass : public ScriptPass {
log("\n"); log("\n");
} }
string top_module, fsm_opts, memory_opts, abc; string top_module, fsm_opts, memory_opts, abc, flatten_separator;
bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth; bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth;
int lut; int lut;
std::vector<std::string> techmap_maps; std::vector<std::string> techmap_maps;
@ -120,6 +120,7 @@ struct SynthPass : public ScriptPass {
booth = false; booth = false;
abc = "abc"; abc = "abc";
techmap_maps.clear(); techmap_maps.clear();
flatten_separator = "";
} }
void execute(std::vector<std::string> args, RTLIL::Design *design) override void execute(std::vector<std::string> args, RTLIL::Design *design) override
@ -154,6 +155,8 @@ struct SynthPass : public ScriptPass {
} }
if (args[argidx] == "-flatten") { if (args[argidx] == "-flatten") {
flatten = true; flatten = true;
if (design->scratchpad.count("flatten.separator"))
flatten_separator = design->scratchpad_get_string("flatten.separator");
continue; continue;
} }
if (args[argidx] == "-lut" && argidx + 1 < args.size()) { if (args[argidx] == "-lut" && argidx + 1 < args.size()) {
@ -239,8 +242,12 @@ struct SynthPass : public ScriptPass {
if (check_label("coarse")) { if (check_label("coarse")) {
run("proc"); run("proc");
if (flatten || help_mode) if (flatten || help_mode) {
run("flatten", " (if -flatten)"); if (!flatten_separator.empty())
run(stringf("flatten -separator %s", flatten_separator.c_str()), " (if -flatten)");
else
run("flatten", " (if -flatten)");
}
run("opt_expr"); run("opt_expr");
run("opt_clean"); run("opt_clean");
run("check"); run("check");