3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-24 08:24:35 +00:00

fabulous: Add support for mapping carry chains

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2023-02-20 12:49:48 +01:00 committed by myrtle
parent 8216b23fb7
commit 2ab3747cc9
5 changed files with 102 additions and 2 deletions

View file

@ -83,6 +83,9 @@ struct SynthPass : public ScriptPass
log(" do not run 'alumacc' pass. i.e. keep arithmetic operators in\n");
log(" their direct form ($add, $sub, etc.).\n");
log("\n");
log(" -carry <none|ha>\n");
log(" carry mapping style (none, half-adders, ...) default=none\n");
log("\n");
log(" -noregfile\n");
log(" do not map register files\n");
log("\n");
@ -119,7 +122,7 @@ struct SynthPass : public ScriptPass
log("\n");
}
string top_module, json_file, blif_file, plib, fsm_opts, memory_opts;
string top_module, json_file, blif_file, plib, fsm_opts, memory_opts, carry_mode;
std::vector<string> extra_plib, extra_map;
bool autotop, forvpr, noalumacc, nofsm, noshare, noregfile, iopad, complexdff, flatten;
@ -137,6 +140,7 @@ struct SynthPass : public ScriptPass
noshare = false;
iopad = false;
complexdff = false;
carry_mode = "none";
flatten = true;
json_file = "";
blif_file = "";
@ -229,6 +233,12 @@ struct SynthPass : public ScriptPass
complexdff = true;
continue;
}
if (args[argidx] == "-carry") {
carry_mode = args[++argidx];
if (carry_mode != "none" && carry_mode != "ha")
log_cmd_error("Unsupported carry style: %s\n", carry_mode.c_str());
continue;
}
if (args[argidx] == "-noflatten") {
flatten = false;
continue;
@ -326,7 +336,8 @@ struct SynthPass : public ScriptPass
if (check_label("map_gates")) {
run("opt -full");
run("techmap -map +/techmap.v");
run(stringf("techmap -map +/techmap.v -map +/fabulous/arith_map.v -D ARITH_%s",
help_mode ? "<carry>" : carry_mode.c_str()));
run("opt -fast");
}