Download BOOTH MULTIPLICATION and more Assignments Computer science in PDF only on Docsity!
Booth's Algorithm
Example
Points to remember
When using Booth's Algorithm:
You will need twice as many bits in your
product as you have in your original two
operands.
The leftmost bit of your operands (both
your multiplicand and multiplier) is a SIGN
bit, and cannot be used as part of the
value.
Beginning Product
The multiplier is:
Add 5 leading zeros to the multiplier to
get the beginning product :
A Q
Step 1 for each pass
Use the LSB (least significant bit) and the
previous LSB to determine the arithmetic
action.
If it is the FIRST pass, use 0 as the previous LSB.
Possible arithmetic actions:
00 no arithmetic operation
01 add multiplicand to left half of product
10 subtract multiplicand from left half of product
ASR-Arithmetic Shift Right
Negative integers where the high order bit is the "sign bit." An arithmetic right shift replicates the sign bit as needed to fill bit positions.
Booth’s Algorithm
Example
Example of multiplying 2 x (-5)
For our example, let's reverse the operation,
and multiply ( -5) x 2
The numerically larger operand (5) would require 3 bits to represent in binary (101). So we must use AT LEAST 4 bits to represent the operands, to
allow for the sign bit.
Let's use 5-bit 2's complement:
-5 is 11011 (multiplier) 2 is 00010 (multiplicand)
Example: -5x2;
A Q QN-1 M Operations Count 0000 0010 0 1011 Initialization 4 1011 3 1011 1011 2 1011 1 1011 1011 0
No Op; ASR (^001) ASR 0
1 AA +M 110 1
AA - M ASR
Example
Let's continue with our example of multiplying
( -5) x 2
Remember:
- 5 is 11011 (multiplier)
2 is 00010 (multiplicand)
And we added 5 leading zeros to the
multiplier to get the beginning product :
Example continued
Initial Product and previous LSB
(Note: Since this is the first pass, we use 0 for the previous LSB)
Pass 1, Step 1: Examine the last 2
bits
The last two bits are 10 , so we need to: subtract the multiplicand from left half of product
Example: Pass 1 continued
Pass 1, Step 2: ASR (arithmetic shift right)
Before ASR
After ASR
(left-most bit was 1, so a 1 was shifted in on the left)
Pass 1 is complete.
Example: Pass 2
Current Product and previous LSB
Pass 2, Step 1: Examine the last 2
bits
The last two bits are 11 , so we do NOT need to perform an arithmetic action -- just proceed to step 2.
Example: Pass 3
Current Product and previous LSB
Pass 3, Step 1: Examine the last 2
bits
The last two bits are 01 , so we need to: add the multiplicand to the left half of the product
Example: Pass 3
continued
Pass 3, Step 1: Arithmetic action
(1) 11111 (left half of product)
+00010 (mulitplicand)
00001 (drop the leftmost carry)
Place result into left half of product