Booth’s algorithm is a multiplication algorithm used for binary numbers.
- It is not directly applicable to decimal numbers like +5 and -15.
- However, we can convert these decimal numbers to their binary representations and then apply Booth’s algorithm.
Let’s convert +5 and -15 to their binary representations:
+5 = 0101
-15 = 1111 (two’s complement representation)
Now, let’s perform the multiplication using Booth’s algorithm.
Step 1: Set up the variables
A = 0101 (binary representation of +5)
B = 1111 (binary representation of -15)
Q = 0000 (accumulator for the result)
Q(-1) = 0 (previous value of the least significant bit of Q)
M = 4 (number of bits in the binary representation)
Step 2: Perform the multiplication using Booth’s algorithm
Step | Operation | A | Q | Q(-1) |
0 | Initial values | 0101 | 0000 | 0 |
1 | A = A – B | 0101 | 0000 | 0 |
2 | Right Shift | 0010 | 1000 | 0 |
3 | A = A + B | 0111 | 1000 | 0 |
4 | Right Shift | 0011 | 1100 | 0 |
5 | A = A + B | 1011 | 1100 | 0 |
6 | Right Shift | 1101 | 1110 | 0 |
7 | A = A + B | 0011 | 1110 | 0 |
8 | Right Shift | 0001 | 1111 | 1 |
9 | A = A + B | 1111 | 1111 | 1 |
10 | Right Shift | 1111 | 1111 | 1 |
The final result is Q = 1111 (binary), which is equal to -15 in decimal notation.
Therefore, the result of multiplying +5 and -15 using Booth’s algorithm is -15.