diff --git a/techlibs/gatemate/mul_map.v b/techlibs/gatemate/mul_map.v index c2dd0a9b4..a28065e7b 100644 --- a/techlibs/gatemate/mul_map.v +++ b/techlibs/gatemate/mul_map.v @@ -26,6 +26,9 @@ module \$__MULMXN (A, B, Y); parameter B_WIDTH = 1; parameter Y_WIDTH = 1; + parameter [A_WIDTH-1:0] _TECHMAP_CONSTMSK_A_ = {A_WIDTH{1'b0}}; + parameter [A_WIDTH-1:0] _TECHMAP_CONSTMSK_B_ = {B_WIDTH{1'b0}}; + (* force_downto *) input [A_WIDTH-1:0] A; (* force_downto *) @@ -37,6 +40,11 @@ module \$__MULMXN (A, B, Y); localparam B_ADJWIDTH = B_WIDTH + (B_SIGNED ? 0 : 1); generate +`ifdef NO_CONST_MULT + if (|_TECHMAP_CONSTMSK_A_ != 0 || |_TECHMAP_CONSTMSK_B_ != 0) begin + wire _TECHMAP_FAIL_ = 1'b1; + end +`endif if (A_SIGNED) begin: blkA wire signed [A_ADJWIDTH-1:0] Aext = $signed(A); end diff --git a/techlibs/gatemate/synth_gatemate.cc b/techlibs/gatemate/synth_gatemate.cc index fa36252f5..e8efe394f 100644 --- a/techlibs/gatemate/synth_gatemate.cc +++ b/techlibs/gatemate/synth_gatemate.cc @@ -41,12 +41,12 @@ struct SynthGateMatePass : public ScriptPass log(" use the specified module as top module.\n"); log("\n"); log(" -vlog \n"); - log(" write the design to the specified verilog file. Writing of an output\n"); - log(" file is omitted if this parameter is not specified.\n"); + log(" write the design to the specified verilog file. Writing of an\n"); + log(" output file is omitted if this parameter is not specified.\n"); log("\n"); log(" -json \n"); - log(" write the design to the specified JSON file. Writing of an output file\n"); - log(" is omitted if this parameter is not specified.\n"); + log(" write the design to the specified JSON file. Writing of an output\n"); + log(" file is omitted if this parameter is not specified.\n"); log("\n"); log(" -run :\n"); log(" only run the commands between the labels (see below). An empty\n"); @@ -65,11 +65,15 @@ struct SynthGateMatePass : public ScriptPass log(" -nomult\n"); log(" do not use CC_MULT multiplier cells in output netlist.\n"); log("\n"); + log(" -noconstmult\n"); + log(" do not use CC_MULT multiplier cells to multiply with a constants\n"); + log(" in output netlist.\n"); + log("\n"); log(" -nomx8, -nomx4\n"); log(" do not use CC_MX{8,4} multiplexer cells in output netlist.\n"); log("\n"); log(" -luttree\n"); - log(" use new LUT tree mapping approach (EXPERIMENTAL).\n"); + log(" use new LUT tree mapping approach (for nextpnr output).\n"); log("\n"); log(" -dff\n"); log(" run 'abc' with -dff option\n"); @@ -90,7 +94,7 @@ struct SynthGateMatePass : public ScriptPass } string top_opt, vlog_file, json_file; - bool noflatten, nobram, noaddf, nomult, nomx4, nomx8, luttree, dff, retime, noiopad, noclkbuf; + bool noflatten, nobram, noaddf, nomult, noconstmult, nomx4, nomx8, luttree, dff, retime, noiopad, noclkbuf; void clear_flags() override { @@ -101,6 +105,7 @@ struct SynthGateMatePass : public ScriptPass nobram = false; noaddf = false; nomult = false; + noconstmult = false; nomx4 = false; nomx8 = false; luttree = false; @@ -154,6 +159,10 @@ struct SynthGateMatePass : public ScriptPass nomult = true; continue; } + if (args[argidx] == "-noconstmult") { + noconstmult = true; + continue; + } if (args[argidx] == "-nomx4") { nomx4 = true; continue; @@ -232,7 +241,10 @@ struct SynthGateMatePass : public ScriptPass if (check_label("map_mult", "(skip if '-nomult')") && !nomult) { - run("techmap -map +/gatemate/mul_map.v"); + if (help_mode) + run("techmap -map +/gatemate/mul_map.v [-D NO_CONST_MULT]", "(-D NO_CONST_MULT if -noconstmult)"); + else + run(stringf("techmap -map +/gatemate/mul_map.v %s", noconstmult ? "-D NO_CONST_MULT" : "")); } if (check_label("coarse"))