Modified Baugh-Wooley乘法算法:取反项与额外'1'的技术疑问
Great questions about the Modified Baugh-Wooley (MBW) multiplier—this is a clever design for signed two's complement multiplication, so let's break down your questions clearly:
1. Why use inverted product terms like !(A0*B5) instead of direct products?
The short answer: this is how MBW handles the negative contributions from sign-bit cross products in two's complement arithmetic.
Let's unpack that. For a 6-bit signed multiplier (like your example with A0-A5 and B0-B5), the highest bits (A5, B5) are sign bits. Any product term involving a sign bit and an opposite operand's lower bit (e.g., A5B0, A0B5) represents a negative value in two's complement.
If we tried to use the direct product (e.g., A0*B5) in our adder tree, we'd have to handle subtraction alongside addition, which complicates the hardware. Instead, MBW uses the inverted product of these negative terms. Here's why:
- In two's complement, a negative value
-xcan be written as~x + 1(bitwise NOT plus 1). - By using
!(A0*B5)(the bitwise NOT of the product), we're representing the "~x" part of the negative value. Later, we'll add the necessary+1corrections (which ties into your second question). - This lets us use a uniform carry-ripple or carry-lookahead adder tree for all terms—no separate subtractors needed, which saves hardware and simplifies the design.
Note that the product of the two sign bits (A5*B5) doesn't get inverted, because negative * negative = positive, so that term is a positive value and fits directly into the adder tree.
2. Why are there two extra '1's in the algorithm?
Those two '1's are the correction terms needed to fix the inverted negative product terms we talked about.
Remember, each inverted product term !(A_i*B5) (for i=0-4) or !(A5*B_j) (for j=0-4) represents ~(A_i*B5) which equals -(A_i*B5) - 1. That means each of these inverted terms is off by -1 compared to the actual negative value we need.
Instead of adding a +1 for each of the 10 inverted terms (which would be inefficient), MBW combines these corrections into two single +1 terms. Here's how it works:
- The 5 inverted terms from
A5*B0toA5*B4and the 5 fromA0*B5toA4*B5each introduce a collective offset that can be fixed with one+1per group. - These two '1's are placed at specific bit positions in the adder chain to correct the two's complement conversion for both sets of sign-bit cross products. Without these corrections, the final product would be consistently offset, leading to wrong results for signed numbers.
内容的提问来源于stack exchange,提问作者kevin998x

