Fix signedness bug
authorEddie Hung <eddie@fpgeh.com>
Fri, 20 Sep 2019 17:11:36 +0000 (10:11 -0700)
committerEddie Hung <eddie@fpgeh.com>
Fri, 20 Sep 2019 17:11:36 +0000 (10:11 -0700)
techlibs/common/mul2dsp.v

index f2b44222e1f943a2b96e5380c7f84638cbf996a4..3ca69b7b1ab2817a72d9a589f6959c57658270bb 100644 (file)
@@ -239,9 +239,9 @@ module _80_mul (A, B, Y);
                        );\r
                        //assign partial_sum[n] = (last_partial << n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)) + partial_sum[n-1];\r
                        if (A_SIGNED && B_SIGNED)\r
-                               assign partial_sum[n][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)] = last_partial + partial_sum[n-1][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)];\r
-                       else\r
                                assign partial_sum[n][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)] = last_partial + $signed(partial_sum[n-1][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)]);\r
+                       else\r
+                               assign partial_sum[n][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)] = last_partial + partial_sum[n-1][Y_WIDTH-1:n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)];\r
                        assign partial_sum[n][n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)-1:0] = partial_sum[n-1][n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)-1:0];\r
                        assign Y = partial_sum[n];\r
                end\r