Booths Multiplication Algorithm

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 15

BOOTH'S

MULTIPLICATION
ALGORITHM
INTRODUCTION
 History
 Procedure

 Example
HISTORY

在 1951 年時, Andrew D. Booth 在倫敦的


Bloomsbury 區的 Birkbeck 學院研究結晶學的時
候發明的。
 Booth 創造了這個運算法增加計算機運算加法位
移的速度。
 這個算法對電腦運算結構有很大的幫助。
PROCEDURE

 Ifx is the count of bits of the multiplicand, and y is


the count of bits of the multiplier :

 Draw a grid of three rows, each with columns for x


+ y + 1 bits. Label the lines respectively A (add), S
(subtract), and P (product).
 In two’s complement notation, fill the first x bits of
each line with :
 A: the multiplicand
 S: the negative of the multiplicand

(in 2's complement format)


 P: zeroes

 Fill the next y bits of each line with :


 A: zeroes
 S: zeroes
 P: the multiplier

 Fill the last bit of each line with a zero.


x y 1
A multiplicand zeroes 0

S negative of the zeroes 0


multiplicand

P zeroes multiplier 0

Find 3 × -4, with x = 4 and y = 4:


A = 0011 0000 0
S = 1101 0000 0
P = 0000 1100 0
 Do both of these steps y times :
 1.If the last two bits in the product are...
 00 or 11: do nothing.

 01: P = P + A. Ignore any overflow.

 10: P = P + S. Ignore any overflow.

 2.Arithmetically shift the product right one


position.

 Drop the first (we count from right to left when


dealing with bits) bit from the product for the final
result.
The last two bits do
00 do nothing
01 P = P + A. Ignore any
overflow
10 P = P + S. Ignore any
overflow.
11 do nothing
EXAMPLE 1

 Find 3 × -4, with x = 4 and y = 4:


 A = 0011 0000 0

 S = 1101 0000 0

 P = 0000 1100 0

 Perform the loop four times :


① P = 0000 1100 0. The last two bits are 00.
P = 0000 0110 0. A right shift.
② P = 0000 0110 0. The last two bits are 00.
P = 0000 0011 0. A right shift.
③ P = 0000 0011 0. The last two bits are 10.
P = 1101 0011 0. P = P + S.
P = 1110 1001 1. A right shift.
④ P = 1110 1001 1. The last two bits are 11.
P = 1111 0100 1. A right shift.

 The product is 1111 0100, which is -12.


EXAMPLE 2

we demonstrate the improved technique by


multiplying -8 by 2 using 4 bits for the multiplicand
and the multiplier:

 A = 1 1000 0000 0
 S = 0 1000 0000 0

 P = 0 0000 0010 0

 Perform the loop four times :


① P = 0 0000 0010 0. The last two bits are 00.
P = 0 0000 0001 0. Right shift.
② P = 0 0000 0001 0. The last two bits are 10.
P = 0 1000 0001 0. P = P + S.
P = 0 0100 0000 1. Right shift.

③ P = 0 0100 0000 1. The last two bits are 01.


P = 1 1100 0000 1. P = P + A.
P = 1 1110 0000 0. Right shift.

④ P = 1 1110 0000 0. The last two bits are 00.


P = 1 1111 0000 0. Right shift.

 The product is 11110000 (after discarding the first and


the last bit) which is -16.
EXAMPLE 3

Find -11 × -4, with x = 4 and y = 4:


 A = 1 0101 0000 0

 S = 0 1011 0000 0

 P = 0 0000 1100 0

 Perform the loop four times :


① P = 0 0000 1100 0 The last two bits are 00.
P = 0 0000 0110 0 Right shift.

② P = 0 0000 0110 0. The last two bits are 00.


P = 0 0000 0011 0 Right shift.
③ P = 0 0000 0011 0 The last two bits are 10.
P=P+S
0 0000 0011 0 (P)
+ 0 1011 0000 0 (S)
= 0 1011 0011 0 (P+S)
P = 0 0101 1001 1. Right shift.

④ P = 0 0101 1001 1 The last two bits are 11.


P = 0 0010 1100 1 Right shift.

 The product is 0010 1100 (after discarding the first and


the last bit) which is 44.
ORIGINAL INFORMATION

 http://en.wikipedia.org/wiki/Booth
%27s_multiplication_algorithm

You might also like