mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-11 12:11:27 +00:00
read_verilog: add -relativeshare for synthesis reproducibility testing
This commit is contained in:
parent
6c4d00ca7a
commit
f8630d0777
5 changed files with 51 additions and 11 deletions
|
@ -98,13 +98,17 @@ struct SynthPass : public ScriptPass {
|
|||
log(" mapping library in the `techmap` step. this option can be\n");
|
||||
log(" repeated.\n");
|
||||
log("\n");
|
||||
log(" -relativeshare\n");
|
||||
log(" use paths relative to share directory for source locations\n");
|
||||
log(" where possible (experimental).\n");
|
||||
log("\n");
|
||||
log("The following commands are executed by this synthesis command:\n");
|
||||
help_script();
|
||||
log("\n");
|
||||
}
|
||||
|
||||
string top_module, fsm_opts, memory_opts, abc;
|
||||
bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth, hieropt;
|
||||
bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth, hieropt, relative_share;
|
||||
int lut;
|
||||
std::vector<std::string> techmap_maps;
|
||||
|
||||
|
@ -124,6 +128,7 @@ struct SynthPass : public ScriptPass {
|
|||
flowmap = false;
|
||||
booth = false;
|
||||
hieropt = false;
|
||||
relative_share = false;
|
||||
abc = "abc";
|
||||
techmap_maps.clear();
|
||||
}
|
||||
|
@ -211,6 +216,11 @@ struct SynthPass : public ScriptPass {
|
|||
hieropt = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-relativeshare") {
|
||||
relative_share = true;
|
||||
log_experimental("synth -relativeshare");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
@ -239,6 +249,10 @@ struct SynthPass : public ScriptPass {
|
|||
else
|
||||
hieropt_flag = hieropt ? " -hier" : "";
|
||||
|
||||
std::string techmap_cmd = "techmap";
|
||||
if (relative_share)
|
||||
techmap_cmd += " -relativeshare";
|
||||
|
||||
if (check_label("begin")) {
|
||||
if (help_mode) {
|
||||
run("hierarchy -check [-top <top> | -auto-top]");
|
||||
|
@ -268,9 +282,9 @@ struct SynthPass : public ScriptPass {
|
|||
run("peepopt");
|
||||
run("opt_clean");
|
||||
if (help_mode)
|
||||
run("techmap -map +/cmp2lut.v -map +/cmp2lcu.v", " (if -lut)");
|
||||
run(techmap_cmd + " -map +/cmp2lut.v -map +/cmp2lcu.v", " (if -lut)");
|
||||
else if (lut)
|
||||
run(stringf("techmap -map +/cmp2lut.v -map +/cmp2lcu.v -D LUT_WIDTH=%d", lut));
|
||||
run(stringf("%s -map +/cmp2lut.v -map +/cmp2lcu.v -D LUT_WIDTH=%d", techmap_cmd, lut));
|
||||
if (booth || help_mode)
|
||||
run("booth", " (if -booth)");
|
||||
if (!noalumacc)
|
||||
|
@ -287,22 +301,22 @@ struct SynthPass : public ScriptPass {
|
|||
run("memory_map");
|
||||
run("opt -full");
|
||||
if (help_mode) {
|
||||
run("techmap", " (unless -extra-map)");
|
||||
run("techmap -map +/techmap.v -map <inject>", " (if -extra-map)");
|
||||
run(techmap_cmd, " (unless -extra-map)");
|
||||
run(techmap_cmd + " -map +/techmap.v -map <inject>", " (if -extra-map)");
|
||||
} else {
|
||||
std::string techmap_opts;
|
||||
if (!techmap_maps.empty())
|
||||
techmap_opts += " -map +/techmap.v";
|
||||
for (auto fn : techmap_maps)
|
||||
techmap_opts += stringf(" -map %s", fn.c_str());
|
||||
run("techmap" + techmap_opts);
|
||||
run(techmap_cmd + techmap_opts);
|
||||
}
|
||||
if (help_mode) {
|
||||
run("techmap -map +/gate2lut.v", "(if -noabc and -lut)");
|
||||
run(techmap_cmd + " -map +/gate2lut.v", "(if -noabc and -lut)");
|
||||
run("clean; opt_lut", " (if -noabc and -lut)");
|
||||
run("flowmap -maxlut K", " (if -flowmap and -lut)");
|
||||
} else if (noabc && lut) {
|
||||
run(stringf("techmap -map +/gate2lut.v -D LUT_WIDTH=%d", lut));
|
||||
run(stringf("%s -map +/gate2lut.v -D LUT_WIDTH=%d", techmap_cmd, lut));
|
||||
run("clean; opt_lut");
|
||||
} else if (flowmap) {
|
||||
run(stringf("flowmap -maxlut %d", lut));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue