Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Recall grade school trick ◦ When multiplying by 9:  Multiply by 10 (easy, just shift digits left)  Subtract once ◦ E.g.  123454 x 9 = 123454 x (10.

Similar presentations


Presentation on theme: " Recall grade school trick ◦ When multiplying by 9:  Multiply by 10 (easy, just shift digits left)  Subtract once ◦ E.g.  123454 x 9 = 123454 x (10."— Presentation transcript:

1

2  Recall grade school trick ◦ When multiplying by 9:  Multiply by 10 (easy, just shift digits left)  Subtract once ◦ E.g.  123454 x 9 = 123454 x (10 – 1) = 1234540 – 123454  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

3  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

4 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 0011110011(0) 0100010101

5 5 Current bit Bit to right ExplanationExampleOperation 10Begins run of ‘1’00001111000Subtract 11Middle of run of ‘1’00001111000Nothing 01End of a run of ‘1’00001111000Add 00Middle of a run of ‘0’00001111000Nothing

6  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 6 0110Binary +1001-bit Booth +2-22-bit Booth

7  Negative multiplicand: -6 x 6 = -36 1010 x 0110, 0110 in Booth’s encoding is +0-0 Hence: 7 1111 1010x 00000 1111 0100x –10000 1100 1110 1000x 00000 1101 0000x +11101 0000 Final Sum:1101 1100 (-36)

8  Negative multiplier: -6 x -2 = 12 1010 x 1110, 1110 in Booth’s encoding is 00-0 Hence: 8 1111 1010x 00000 1111 0100x –10000 1100 1110 1000x 00000 1101 0000x 00000 Final Sum:0000 1100 (12)

9 A 1011 (-5 10 ) X 1101 (-3 10 ) Y 0111 (recoded) (-1) Add –A 0101 Shift 00101 (+1) Add +A 1011 11011 Shift 111011 (-1) Add –A 0101 001111 Shift 0001111 (+15 10 )

10 1a. P = P - m1110 +1110 1110 0111 0 shift P (sign ext) 1b. 00101111 0011 111 -> nop, shift 2.00101111 1001 111 -> nop, shift 3.00101111 1100 101 -> add 4a.0010 +0010 0001 1100 1shift 4b.00100000 1110 0done OperationMultiplicandProductnext? 0. initial value00100000 0111 010 -> sub

11 1a. P = P - m1110 +1110 1110 1101 0 shift P (sign ext) 1b. 00101111 0110 101 -> add + 0010 2a.0001 0110 1shift P 2b.00100000 1011 010 -> sub +1110 3a.00101110 1011 0shift 3b.0010 1111 0101 111 -> nop 4a1111 0101 1 shift 4b.00101111 1010 1 done OperationMultiplicandProductnext? 0. initial value00100000 1101 010 -> sub

12  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 13 CurrentPreviousOperationExplanation 000+0;shift 2[00] => +0, [00] => +0; 2x(+0)+(+0)=+0 001+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 00+0 01+M; 10-M; 11+0

14  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

15 Spring 2006 EE 5324 - 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]

16  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 Y0Y0 0 01000 Y7Y7 Y6Y6 Y5Y5 Y4Y4 Y7Y7 Y6Y6 Y5Y5 Y4Y4 0001 Y7Y7 Y6Y6 Y5Y5 Y4Y4 00 00 00


Download ppt " Recall grade school trick ◦ When multiplying by 9:  Multiply by 10 (easy, just shift digits left)  Subtract once ◦ E.g.  123454 x 9 = 123454 x (10."

Similar presentations


Ads by Google