DSP_MINWIDTH -> DSP_{A,B,Y}_MINWIDTH
authorEddie Hung <eddie@fpgeh.com>
Thu, 1 Aug 2019 20:20:34 +0000 (13:20 -0700)
committerEddie Hung <eddie@fpgeh.com>
Thu, 1 Aug 2019 20:20:34 +0000 (13:20 -0700)
techlibs/common/mul2dsp.v
techlibs/ice40/synth_ice40.cc

index 99afce18c9171f680742095f38cca12554c2d94a..5ff0e03aa58135f27dfea31dc7659a8bbd5e047c 100644 (file)
@@ -52,7 +52,7 @@ module \$mul (A, B, Y);
        output [Y_WIDTH-1:0] Y;\r
 \r
        generate\r
-       if (A_SIGNED != B_SIGNED || A_WIDTH <= 1 || B_WIDTH <= 1)\r
+       if (A_SIGNED != B_SIGNED)\r
                wire _TECHMAP_FAIL_ = 1;\r
        // NB: A_SIGNED == B_SIGNED from here\r
        else if (A_WIDTH < B_WIDTH)\r
@@ -103,10 +103,17 @@ module \$__mul (A, B, Y);
 \r
        genvar i;\r
        generate\r
-               if (A_WIDTH <= 1 || B_WIDTH <= 1)\r
+        if (0) begin end\r
+`ifdef DSP_A_MINWIDTH\r
+               else if (A_WIDTH < `DSP_A_MINWIDTH)\r
                        wire _TECHMAP_FAIL_ = 1;\r
-`ifdef DSP_MINWIDTH\r
-               else if (A_WIDTH+B_WIDTH < `DSP_MINWIDTH || Y_WIDTH < `DSP_MINWIDTH)\r
+`endif\r
+`ifdef DSP_B_MINWIDTH\r
+               else if (B_WIDTH < `DSP_B_MINWIDTH)\r
+                       wire _TECHMAP_FAIL_ = 1;\r
+`endif\r
+`ifdef DSP_Y_MINWIDTH\r
+               else if (Y_WIDTH < `DSP_Y_MINWIDTH)\r
                        wire _TECHMAP_FAIL_ = 1;\r
 `endif\r
                else if (A_WIDTH > `DSP_A_MAXWIDTH) begin\r
index ce88a0542e6afdd0d959fd2b70677fb107489fb5..2cc5fd5fd169f5e061aa0792b7433783271e1ea5 100644 (file)
@@ -266,7 +266,7 @@ struct SynthIce40Pass : public ScriptPass
                        run("opt_expr");
                        run("opt_clean");
                        if (help_mode || dsp) {
-                               run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=16 -D DSP_B_MAXWIDTH=16 -D DSP_MINWIDTH=11 -D DSP_NAME=$__MUL16X16", "(if -dsp)");
+                               run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=16 -D DSP_B_MAXWIDTH=16 -D DSP_A_MINWIDTH=2 -D DSP_B_MINWIDTH=2 -D DSP_Y_MINWIDTH=11 -D DSP_NAME=$__MUL16X16", "(if -dsp)");
                                run("opt_expr", "                     (if -dsp)");
                                run("wreduce", "                      (if -dsp)");
                                run("ice40_dsp", "                    (if -dsp)");