diff --git a/techlibs/fabulous/synth_fabulous.cc b/techlibs/fabulous/synth_fabulous.cc index 525a2e2e8..f79bf4a73 100644 --- a/techlibs/fabulous/synth_fabulous.cc +++ b/techlibs/fabulous/synth_fabulous.cc @@ -57,6 +57,9 @@ struct SynthPass : public ScriptPass { log(" -ff \n"); log(" convert FFs to cell types via dfflegalize (can be specified multiple times).\n"); log("\n"); + log(" -arith-map \n"); + log(" mapping file for arithmetic operations.\n"); + log("\n"); log(" -clkbuf-map \n"); log(" insert clock buffers using clkbufmap and map to the specified Verilog file.\n"); log("\n"); @@ -114,7 +117,7 @@ struct SynthPass : public ScriptPass { log("\n"); } - string top_module, json_file, blif_file, fsm_opts, memory_opts, carry_mode, clkbuf_map, multiplier_map; + string top_module, json_file, blif_file, fsm_opts, memory_opts, carry_mode, arith_map, clkbuf_map, multiplier_map; std::vector extra_plib, extra_map, extra_mlibmap; std::vector> extra_ffs; @@ -180,6 +183,10 @@ struct SynthPass : public ScriptPass { extra_ffs.push_back({cell, init}); continue; } + if (args[argidx] == "-arith-map" && argidx + 1 < args.size()) { + arith_map = args[++argidx]; + continue; + } if (args[argidx] == "-clkbuf-map" && argidx + 1 < args.size()) { clkbuf_map = args[++argidx]; continue; @@ -347,6 +354,15 @@ struct SynthPass : public ScriptPass { run("opt -undriven -fine"); } + if (check_label("map_arith")) { + if (help_mode) { + run("techmap -map -D ARITH_"); + } else if (!arith_map.empty()) { + run(stringf("techmap -map %s -D ARITH_%s", arith_map.c_str(), carry_mode.c_str())); + } + run("clean"); + } + if (check_label("map_gates")) { run("opt -full"); run("techmap -map +/techmap.v"); @@ -376,12 +392,11 @@ struct SynthPass : public ScriptPass { if (check_label("map_extra")) { if (help_mode) { - run("techmap -map -D ARITH_...", "(for each -extra-map)"); + run("techmap -map ...", "(for each -extra-map)"); } else if (!extra_map.empty()) { std::string map_str = "techmap"; for (auto map : extra_map) map_str += stringf(" -map %s", map); - map_str += stringf(" -D ARITH_%s", carry_mode.c_str()); run(map_str); } run("simplemap");