15
BOOTH'S MULTIPLICATION ALGORITHM

Booths Multiplication Algorithm

Embed Size (px)

DESCRIPTION

Booth's multiplication algorithm

Citation preview

Page 1: Booths Multiplication Algorithm

BOOTH'S MULTIPLICATION ALGORITHM

Page 2: Booths Multiplication Algorithm

INTRODUCTION

History Procedure Example

Page 3: Booths Multiplication Algorithm

HISTORY

在 1951 年時, Andrew D. Booth 在倫敦的Bloomsbury 區的 Birkbeck 學院研究結晶學的時候發明的。

Booth 創造了這個運算法增加計算機運算加法位移的速度。

這個算法對電腦運算結構有很大的幫助。

Page 4: Booths Multiplication Algorithm

PROCEDURE

If x 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).

Page 5: Booths Multiplication Algorithm

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.

Page 6: Booths Multiplication Algorithm

x y 1

A multiplicand

zeroes 0

S negative of the

multiplicand

zeroes 0

P zeroes multiplier 0Find 3 × -4, with x = 4 and y = 4:A = 0011 0000 0 S = 1101 0000 0 P = 0000 1100 0

Page 7: Booths Multiplication Algorithm

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.

Page 8: Booths Multiplication Algorithm

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

Page 9: Booths Multiplication Algorithm

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.

Page 10: Booths Multiplication Algorithm

③ 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.

Page 11: Booths Multiplication Algorithm

EXAMPLE 2

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.

we demonstrate the improved technique by multiplying -8 by 2 using 4 bits for the multiplicand and the multiplier:

Page 12: Booths Multiplication Algorithm

② 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.

Page 13: Booths Multiplication Algorithm

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.

Page 14: Booths Multiplication Algorithm

③ 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.

Page 15: Booths Multiplication Algorithm

ORIGINAL INFORMATION

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