@@ -10,7 +10,7 @@ For our specialized case of a 5x9x8 MAC unit, $\lceil\log_2 5\rceil + 9 + 8 = 20
...
@@ -10,7 +10,7 @@ For our specialized case of a 5x9x8 MAC unit, $\lceil\log_2 5\rceil + 9 + 8 = 20
I first attempted to use the modified Baugh-Wooley form on slide 64 of
I first attempted to use the modified Baugh-Wooley form on slide 64 of
\url{https://web.ece.ucsb.edu/~parhami/pres_folder/f31-book-arith-pres-pt3.pdf} (a more clear representation of this method is shown at \url{https://en.wikipedia.org/wiki/Binary_multiplier#Signed_integers} with the exception of a missing 1 in the MSB of the last partial sum), but the modified Baugh-Wooley method only holds for the case where `N = M`.
\url{https://web.ece.ucsb.edu/~parhami/pres_folder/f31-book-arith-pres-pt3.pdf} (a more clear representation of this method is shown at \url{https://en.wikipedia.org/wiki/Binary_multiplier#Signed_integers} with the exception of a missing 1 in the MSB of the last partial sum), but the modified Baugh-Wooley method only holds for the case where `N = M`.
Instead, we will just sign extend and allow the synthesis tools to perform the optimizations later as this is all combinational logic and should be optimizable.
Instead, we will just sign extend and rely on the synthesis tools to perform the optimizations later as this is all combinational logic and should be optimizable.
For a given multiply:
For a given multiply:
1) Sign extend the input `a` to the number of output bits, multiply by the bit in b, and shift.
1) Sign extend the input `a` to the number of output bits, multiply by the bit in b, and shift.
...
@@ -25,7 +25,8 @@ p3 = a * b[3] << 3
...
@@ -25,7 +25,8 @@ p3 = a * b[3] << 3
Since we are performing K multiplies, the constants can be pre-added and simplified to `(K << M)`. Therefore, we have an addition of N*M+1 values, each the same length as the output of the MAC unit, with the last one being the constant `(K << M)` term.
Since we are performing K multiplies, the constants can be pre-added and simplified to `(K << M)`. Therefore, we have an addition of N*M+1 values, each the same length as the output of the MAC unit, with the last one being the constant `(K << M)` term.
See this Compiler Explorer example for verification: