written 2.9 years ago by |
Shift-and-Add Multiplication
Shift-and-add multiplication is similar to the multiplication performed by paper and pencil. This method adds the multiplicand X to itself Y times, where Y denotes the multiplier. To multiply two numbers by paper and pencil, the algorithm is to take the digits of the multiplier one at a time from right to left, multiplying the multiplicand by a single digit of the multiplier and placing the intermediate product in the appropriate positions to the left of the earlier results.
As an example, consider the multiplication of two unsigned 4-bit numbers, 8 (1000) and 9 (1001).
In the case of binary multiplication, since the digits are 0 and 1, each step of the multiplication is simple. If the multiplier digit is 1, a copy of the multiplicand (1 × multiplicand) is placed in the proper positions; if the multiplier digit is 0, a number of 0 digits (0 × multiplicand) are placed in the proper positions.
- Consider the multiplication of positive numbers. The first version of the multiplier circuit, which implements the shift-and-add multiplication method for two n-bit numbers, is shown in Figure
- The 2n-bit product register (A) is initialized to 0. Since the basic algorithm shifts the multiplicand register (B) left one position each step to align the multiplicand with the sum being accumulated in the product register, we use a 2n-bit multiplicand register with the multiplicand placed in the right half of the register and with 0 in the left half.
- Figure shows the basic steps needed for the multiplication. The algorithm starts by loading the multiplicand into the B register, loading the multiplier into the Q register, and initializing the A register to 0. The counter N is initialized to n. The least significant bit of the multiplier register (Q0) determines whether the multiplicand is added to the product register. The left shift of the multiplicand has the effect of shifting the intermediate products to the left, just as when multiplying by paper and pencil. The right shift of the multiplier prepares the next bit of the multiplier to examine in the following iteration.
Example Perform the multiplication 9 × 12 (1001 × 1100) using the final version of the multiplication algorithm. Answer Table shows the revised multiplication example for the final version of the algorithm.
Step | A | Q | B | Operation |
---|---|---|---|---|
0 | 0000 | 1100 | 1001 | Initialization |
1 | 0000 | 0011 | 1001 | Shift right A_Q |
2 | 0000 | 0011 | 1001 | Shift right A_Q |
3 | 1001 | 0011 | 1001 | Add B to A |
0100 | 1001 | 1001 | Shift right A_Q | |
4 | 1101 | 1001 | 1001 | Add B to A |
0110 | 1100 | 1001 | Shift right A_Q |