Add plib flag to specify custom primitive library path

This commit is contained in:
TaoBi22 2022-09-27 17:33:28 +01:00 committed by myrtle
parent 950dde3081
commit da32f21b59
1 changed files with 14 additions and 2 deletions

View File

@ -47,6 +47,9 @@ struct SynthPass : public ScriptPass
log(" -lut <k>\n"); log(" -lut <k>\n");
log(" perform synthesis for a k-LUT architecture (default 4).\n"); log(" perform synthesis for a k-LUT architecture (default 4).\n");
log("\n"); log("\n");
log(" -plib <primitive_library.v>\n");
log(" use the specified Verilog file as a primitive library.\n");
log("\n");
log(" -run <from_label>[:<to_label>]\n"); log(" -run <from_label>[:<to_label>]\n");
log(" only run the commands between the labels (see below). an empty\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"); log(" from label is synonymous to 'begin', and empty to label is\n");
@ -58,13 +61,14 @@ struct SynthPass : public ScriptPass
log("\n"); log("\n");
} }
string top_module; string top_module, plib;
bool autotop, forvpr; bool autotop, forvpr;
int lut; int lut;
void clear_flags() override void clear_flags() override
{ {
top_module.clear(); top_module.clear();
plib.clear();
autotop = false; autotop = false;
lut = 4; lut = 4;
forvpr = false; forvpr = false;
@ -106,6 +110,10 @@ struct SynthPass : public ScriptPass
lut = atoi(args[++argidx].c_str()); lut = atoi(args[++argidx].c_str());
continue; continue;
} }
if (args[argidx] == "-plib" && argidx+1 < args.size()) {
plib = args[++argidx];
continue;
}
break; break;
} }
extra_args(args, argidx, design); extra_args(args, argidx, design);
@ -131,6 +139,10 @@ struct SynthPass : public ScriptPass
} else } else
run(stringf("hierarchy -check -top %s", top_module.c_str())); 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("proc");
run("tribuf -logic"); run("tribuf -logic");
run("deminout"); run("deminout");
@ -144,7 +156,7 @@ struct SynthPass : public ScriptPass
run("abc -lut $LUT_K -dress"); run("abc -lut $LUT_K -dress");
run("clean"); run("clean");
if (forvpr) 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("clean");
run("hierarchy -check"); run("hierarchy -check");
run("stat"); run("stat");