Fast Track Fall Semester 2023-24 STS3006 TH AP2023241000457 Reference Material I 30-Jun-2023 Booth's Algorithm
Fast Track Fall Semester 2023-24 STS3006 TH AP2023241000457 Reference Material I 30-Jun-2023 Booth's Algorithm
Fast Track Fall Semester 2023-24 STS3006 TH AP2023241000457 Reference Material I 30-Jun-2023 Booth's Algorithm
Introduction
The booth algorithm is a multiplication algorithm that allows us to multiply the two signed
binary integers in 2's complement, respectively.
It is also used to speed up the performance of the multiplication process. It is very efficient
too.
It works on the string bits 0's in the multiplier that requires no additional bit only shift the right-
most string bits and a string of 1's in a multiplier bit weight 2k to weight 2m that can be
considered as 2k+ 1 - 2m.
Booth's Algorithm
Flowchart
As in all multiplication schemes, booth algorithm requires examination of the multiplier bits
and shifting of the partial product.
Prior to the shifting, the multiplicand may be added to the partial product, subtracted from the
partial product, or left unchanged according to following rules:
1. The multiplicand is subtracted from the partial product upon encountering the first least
significant 1 in a string of 1’s in the multiplier
2. The multiplicand is added to the partial product upon encountering the first 0 (provided that
there was a previous ‘1’) in a string of 0’s in the multiplier.
3. The partial product does not change when the multiplier bit is identical to the previous
multiplier bit.
Booth's Algorithm
Flowchart
1. Initially, AC and Qn + 1 bits are set to 0
2. The SC is a sequence counter that represents the total bits set n, which is equal
to the number of bits in the multiplier.
3. There are BR that represent the multiplicand bits, and QR represents the
multiplier bits.
4. After that, we encountered two bits of the multiplier as Qn and Qn + 1, where Qn
represents the last bit of QR, and Qn + 1 represents the incremented bit of Qn
by 1.
5. Suppose two bits of the multiplier is equal to 10; it means that we have to
subtract the multiplier from the partial product in the accumulator AC and then
perform the arithmetic shift operation (ashr).
6. If the two of the multipliers equal to 01, it means we need to perform the addition
of the multiplicand to the partial product in accumulator AC and then perform the
arithmetic shift operation (ashr), including Qn + 1.
7. The arithmetic shift operation is used in Booth's algorithm to shift AC and QR
bits to the right by one and remains the sign bit in AC unchanged.
8. And the sequence counter is continuously decremented till the computational
loop is repeated, equal to the number of bits (n).
Booth's Algorithm
Algorithm
It shifts the right-most bit of the binary number, and then it is added to the beginning of the binary bits.
It adds the two binary bits and then shift the result to the right by 1-bit position.
Example: 0100 + 0110 => 1010, after adding the binary number shift each bit by 1 to the right and put the first
bit of resultant to the beginning of the new bit.
Booth's Algorithm
Example
Booth's Algorithm
Program
Booth1.java
Sample IO
Input
Enter two integer numbers
7 -7
Output
A : 0111 0000 0
S : 1001 0000 0
P : 0000 1001 0
P : 1100 1100 1
P : 0001 1110 0
P : 0000 1111 0
P : 1100 1111 1
Result : 7 * -7 = -49