Recall grade school trick ◦ When multiplying by 9: Multiply by 10 (easy, just shift digits left) Subtract once ◦ E.g. x 9 = x (10 – 1) = – Converts addition of six partial products to one shift and one subtraction Booth’s algorithm applies same principle ◦ Except no ‘9’ in binary, just ‘1’ and ‘0’ ◦ So, it’s actually easier! 2
Search for a run of ‘1’ bits in the multiplier ◦ E.g. ‘0110’ has a run of 2 ‘1’ bits in the middle ◦ Multiplying by ‘0110’ (6 in decimal) is equivalent to multiplying by 8 and subtracting twice, since 6 x m = (8 – 2) x m = 8m – 2m Hence, iterate right to left and: ◦ Subtract multiplicand from product at first ‘1’ ◦ Add multiplicand to product after first ‘1’ ◦ Don’t do either for ‘1’ bits in the middle 3
x n x n-1... x i x i-1... x 0 (0) y n... y i... y 0 y i =x i-1 - x i EXAMPLE (0)
5 Current bit Bit to right ExplanationExampleOperation 10Begins run of ‘1’ Subtract 11Middle of run of ‘1’ Nothing 01End of a run of ‘1’ Add 00Middle of a run of ‘0’ Nothing
Really just a new way to encode numbers ◦ Normally positionally weighted as 2 n ◦ With Booth, each position has a sign bit ◦ Can be extended to multiple bits Binary bit Booth bit Booth
Negative multiplicand: -6 x 6 = x 0110, 0110 in Booth’s encoding is +0-0 Hence: x x – x x Final Sum: (-36)
Negative multiplier: -6 x -2 = x 1110, 1110 in Booth’s encoding is 00-0 Hence: x x – x x Final Sum: (12)
A 1011 (-5 10 ) X 1101 (-3 10 ) Y 0111 (recoded) (-1) Add –A 0101 Shift (+1) Add +A Shift (-1) Add –A Shift ( )
1a. P = P - m shift P (sign ext) 1b > nop, shift > nop, shift > add 4a shift 4b done OperationMultiplicandProductnext? 0. initial value > sub
1a. P = P - m shift P (sign ext) 1b > add a shift P 2b > sub a shift 3b > nop 4a shift 4b done OperationMultiplicandProductnext? 0. initial value > sub
For every pair of multiplier bits ◦ If Booth’s encoding is ‘-2’ Shift multiplicand left by 1, then subtract ◦ If Booth’s encoding is ‘-1’ Subtract ◦ If Booth’s encoding is ‘0’ Do nothing ◦ If Booth’s encoding is ‘1’ Add ◦ If Booth’s encoding is ‘2’ Shift multiplicand left by 1, then add 12
13 CurrentPreviousOperationExplanation 000+0;shift 2[00] => +0, [00] => +0; 2x(+0)+(+0)= M; shift 2[00] => +0, [01] => +M; 2x(+0)+(+M)=+M 010+M; shift 2[01] => +M, [10] => -M; 2x(+M)+(-M)=+M 011+2M; shift 2[01] => +M, [11] => +0; 2x(+M)+(+0)=+2M 100-2M; shift 2[10] => -M, [00] => +0; 2x(-M)+(+0)=-2M 101-M; shift 2[10] => -M, [01] => +M; 2x(-M)+(+M)=-M 110-M; shift 2[11] => +0, [10] => -M; 2x(+0)+(-M)=-M 111+0; shift 2[11] => +0, [11] => +0; 2x(+0)+(+0)=+0 1 bit Booth M; 10-M; 11+0
Booth 2 modified to produce at most n/2+1 partial products. Algorithm: (for unsigned numbers) 1.Pad the LSB with one zero. 2.Pad the MSB with 2 zeros if n is even and 1 zero if n is odd. 3.Divide the multiplier into overlapping groups of 3-bits. 4.Determine partial product scale factor from modified booth 2 encoding table. 5.Compute the Multiplicand Multiples 6.Sum Partial Products
Spring 2006 EE VLSI Design II - © Kia Bazargan15 Can encode the digits by looking at three bits at a time Booth recoding table: ◦ Must be able to add multiplicand times –2, -1, 0, 1 and 2 ◦ Since Booth recoding got rid of 3’s, generating partial products is not that hard (shifting and negating) i+1ii-1add 0000*M 0011*M 0101*M 0112*M 100–2*M 101–1*M 110–1*M 1110*M [©Hauck]
Example: (n=4-bits unsigned) 1. Pad LSB with 1 zero 2. n is even then pad the MSB with two zeros 3. Form 3-bit overlapping groups for n=8 we have 5 groups Y3Y3 Y2Y2 Y1Y1 Y0Y0 Y3Y3 Y2Y2 Y1Y1 Y0Y0 0 0 Y3Y3 Y2Y2 Y1Y1 Y0Y Y7Y7 Y6Y6 Y5Y5 Y4Y4 Y7Y7 Y6Y6 Y5Y5 Y4Y Y7Y7 Y6Y6 Y5Y5 Y4Y