
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Booth Multiplication Algorithm in Computer Architecture
The Booth multiplication algorithm defines a multiplication algorithm that can multiply two signed binary numbers in two’s complement. This algorithm helps in the study of computer architecture.
Booth’s algorithm contains the addition of one of two predetermined values (A and S) to a product (P) continually and then implementing a rightward arithmetic shift on the product (P). Let us consider the predetermined values to be A and S, and the product to be P. Consider that the multiplicand and multiplier are m and r respectively. Let the number of bits in m and r be x and y respectively.
The Booth’s multiplication algorithm involves the following steps −
Step 1 − The values of A and S and the initial value of P are determined. These values should have a length that is equal to (x + y + 1).
- For A, the MSB is filled with the value of m, and the remaining (y+1) bits are filled with zeros.
- For S, the MSB is filled with the value of (-m) in two’s complement notations, and the remaining (y + 1) bits are filled with zeros.
- For P, the MSB for x is filled with zeros. To the right of this value, the value of r is appended. Then, the LSB is filled with a zero.
Step 2 − The LSBs of P are determined.
- In case they are 01, find the value of P + A, and ignore the overflow or carry if any.
- In case they are 10, find the value of P + S, and ignore the overflow or carry if any.
- In case they are 00, use P directly in the next step.
- In case they are 11, use P directly in the next step.
Step 3 − The value obtained in the second step is arithmetically shifted by one place to the right. P is now assigned the new value.
Step 4 − Step 2 and Step 3 are repeated for y number of times. Step 5: The LSB is dropped from P, which gives the product of m and r.
Example − Find the product of 3 x (-4), where m = 3, r = -4, x = 4 and y = -4.
A = 001100001
S = 110100000
P = 000011000
The loop has to be performed four times since y = 4.
P = 000011000
Here, the last two bits are 00.
Therefore, P = 000001100 after performing the arithmetic right shift.
P = 000001100
Here, the last two bits are 00.
Therefore, P = 000000110 after performing the arithmetic right shift.
P = 000000110
Here, the last two bits are 10.
Therefore, P = P + S, which is 110100110.
P = 111010011 after performing the arithmetic right shift.
P = 111010011
Here, the last two bits are 11.
Therefore, P = 111101001 after performing the arithmetic right shift.
The product is 11110100 after dropping the LSB from P.
11110100 is the binary representation of -12.