Professional Documents
Culture Documents
MULTIPLICATION:
We have a multiplicand and a multiplier and we are
supposed to find the product of the two. WE firstly convert the
decimal values into their binary equivalent. If a negative
number is involved, we use its signed 2’s complemented value.
Also, we define an “n” as the maximum number of bits of the
multiplier and multiplicand and the product would also use
these many amount of bits.
Here,
A: Accumulator contents
M: Multiplicand
Q: Multiplier
n: Number of bits
q1: Least bit of Q
q0: Bit whose initial value is 0
Time complexity:
The time complexity of multiplication using Booth’s
Algorithm is O(n^2), where n is the number of bits used.
This is because after we perform a single operation, we reduce
n by 1 and keep doing that unless n becomes 0. So, the code
runs n times. Also, each time the code runs, we perform a
right shift or a two’s complement which also works on n bits
as in a right shift we shift all the n bits. So, the total time
complexity is O(n^2).
DIVISION:
We divide the dividend by the divisor and get the
quotient and remainder. We again first convert the decimal
values to their binary notation.
One of the registers(M) stores the divisor and another
one(Q) holds the dividend. An accumulator with initial value
as 0 is also used.