From da32f21b5908972430e687d805bb84635f2e9b43 Mon Sep 17 00:00:00 2001 From: TaoBi22 Date: Tue, 27 Sep 2022 17:33:28 +0100 Subject: Add plib flag to specify custom primitive library path --- techlibs/fabulous/synth_fabulous.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'techlibs/fabulous') diff --git a/techlibs/fabulous/synth_fabulous.cc b/techlibs/fabulous/synth_fabulous.cc index bd373c410..478569555 100644 --- a/techlibs/fabulous/synth_fabulous.cc +++ b/techlibs/fabulous/synth_fabulous.cc @@ -47,6 +47,9 @@ struct SynthPass : public ScriptPass log(" -lut \n"); log(" perform synthesis for a k-LUT architecture (default 4).\n"); log("\n"); + log(" -plib \n"); + log(" use the specified Verilog file as a primitive library.\n"); + log("\n"); log(" -run [:]\n"); log(" only run the commands between the labels (see below). an empty\n"); log(" from label is synonymous to 'begin', and empty to label is\n"); @@ -58,13 +61,14 @@ struct SynthPass : public ScriptPass log("\n"); } - string top_module; + string top_module, plib; bool autotop, forvpr; int lut; void clear_flags() override { top_module.clear(); + plib.clear(); autotop = false; lut = 4; forvpr = false; @@ -106,6 +110,10 @@ struct SynthPass : public ScriptPass lut = atoi(args[++argidx].c_str()); continue; } + if (args[argidx] == "-plib" && argidx+1 < args.size()) { + plib = args[++argidx]; + continue; + } break; } extra_args(args, argidx, design); @@ -131,6 +139,10 @@ struct SynthPass : public ScriptPass } else run(stringf("hierarchy -check -top %s", top_module.c_str())); + if (plib.empty()) + run("read_verilog -lib +/fabulous/prims.v"); + else + run("read_verilog -lib " + plib); run("proc"); run("tribuf -logic"); run("deminout"); @@ -144,7 +156,7 @@ struct SynthPass : public ScriptPass run("abc -lut $LUT_K -dress"); run("clean"); if (forvpr) - run("yosys techmap -D LUT_K=$LUT_K -map +/fabulous/cells_map.v"); + run("techmap -D LUT_K=$LUT_K -map +/fabulous/cells_map.v"); run("clean"); run("hierarchy -check"); run("stat"); -- cgit v1.2.3