Anda di halaman 1dari 20

Booth’s Algorithm

Dr.K.R.Jothi
Associate Professor
SCOPE
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 -M = 1 0 1 0 q0 <- 0
A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
10 01
q1 q0 ?

A=A-M 00 A=A+M
11
Arithmetic Shift Right A Q q0

n = n -1

No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?

A=A-M 00 A=A+M
11
Arithmetic Shift Right A Q q0

n = n -1

No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
3 n=n-1 A=A-M 00 A=A+M
11
Arithmetic Shift Right A Q q0

n = n -1

No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000
+1010 (-M) Arithmetic Shift Right A Q q0
1010

n = n -1

No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010
2 n=n-1
n = n -1

No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010

2 n = n -1
n = n -1
0 0 1 1 0 0 0 0 1 A=A+M 1101
+0110 (M)
0011 No
Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010

2 n = n -1
n = n -1
0 0 1 1 0 0 0 0 1 A=A+M 1101
+0110 (M)
0 0 0 1 1 0 0 0 0 Arithmetic Right Shift 0011 No
1 n=n-1 Is n = 0 ?
Yes
Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010

2 n = n -1
n = n -1
0 0 1 1 0 0 0 0 1 A=A+M 1101
+0110 (M)
0 0 0 1 1 0 0 0 0 Arithmetic Right Shift 0011 No
Is n = 0 ?
1 n=n-1
0 0 0 0 1 1 0 0 0 Arithmetic Right Shift
Yes
0 n=n-1 Result in AQ

Stop
Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010

2 n = n -1
n = n -1
0 0 1 1 0 0 0 0 1 A=A+M 1101
+0110 (M)
0 0 0 1 1 0 0 0 0 Arithmetic Right Shift 0011 No
Is n = 0 ?
1 n=n-1
0 0 0 0 1 1 0 0 0 Arithmetic Right Shift
Yes
0 n=n-1
Result in AQ

AQ is 0 0 0 0 1 1 0 0 (binary value of 12) Stop


Booth’s Algorithm Start

Example: (6) x (2) = (12) M <- Multiplicand


M Q Product Q <- Multiplier
0110 0010 1 1 0 0 q0 <- 0
-M = 1 0 1 0 A <- 0
Tracing Table n <- no. of bits
n A Q q0 Action / Comment
qn…q1
4 0 0 0 0 0 0 1 0 0 Initialization
10 01
q1 q0 ?
0 0 0 0 0 0 0 1 0 Arithmetic Right Shift
n = n -1
3
A=A-M 00 A=A+M
1 0 1 0 0 0 0 1 0 A=A-M 11
0000

1 1 0 1 0 0 0 0 1 Arithmetic Right Shift


+1010 (-M) Arithmetic Shift Right A Q q0
1010

2 n = n -1
n = n -1
0 0 1 1 0 0 0 0 1 A=A+M 1101
+0110 (M)
0 0 0 1 1 0 0 0 0 Arithmetic Right Shift 0011 No
Is n = 0 ?
1 n=n-1
0 0 0 0 1 1 0 0 0 Arithmetic Right Shift
Yes
0 n=n-1
Result in AQ

AQ is 0 0 0 0 1 1 0 0 (binary value of 12) Stop


Start

Booth’s Algorithm M <- Multiplicand


Q <- Multiplier
q0 <- 0
Example: (-7) x (+3) = ( - 21) A <- 0
M Q Product n <- no. of bits
1 0 0 1 0 0 1 1 -M = 0 1 1 1

10 01
Tracing Table q1 q0 ?
n A Q q0 Action / Comment
qn…q1 A=A-M 00 A=A+M
4 0000 0011 0 Initialization 11
0111 0011 0 A=A-M Arithmetic Shift Right A Q q0
3 0011 1001 1 Arithmetic Right Shift
n = n -1
2 0001 1100 1 Arithmetic Right Shift
1010 1100 1 A=A+M No
Is n = 0 ?
1 1101 0110 0 Arithmetic Right Shift
Yes
0 1110 1011 0 Arithmetic Right Shift Result in AQ

AQ is 1 1 1 0 1 0 1 1 (binary value of -21 ) Stop


Examples
• Multiply the following using Booth’s algorithm
-7 x -3
11 x 13
-11 x 13
11 x -13
-11 x -13
Booth Algorithm

Multiplier
V ersion of multiplicand
selected by bit i
Bit i Bit i -1

0 0 0 X M
0 1 + 1 X M
1 0  1 X M
1 1 0 X M

Booth multiplier recoding table.


Booth Algorithm
In general, in the Booth scheme, -1 times the shifted multiplicand is selected
when moving from 0 to 1, and +1 times the shifted multiplicand is selected when
moving from 1 to 0, as the multiplier is scanned from right to left.
Implied bit

0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0

0 + 1 - 1 + 1 0 - 1 0 + 1 0 0 - 1 + 1 - 1 + 1 0 - 1 0 0

Booth recoding of a multiplier.


Booth Algorithm
Considering the product (+13)(+11) then use the 2’s-complement of the multiplier

0 1 1 0 1 (+13) 0 1 1 0 1
0 1 0 1 1 x (+11) +1 -1 +1 0 -1
1 1 1 1 1 1 0 0 1 1
2’s-complement of +13 0 0 0 0 0 0 0 0 0
1 0 0 1 1 0 0 0 0 1 1 0 1
1 1 1 0 0 1 1
0 0 1 1 0 1
1 0 0 0 1 0 0 0 1 1 1 1 (+ 143)
Booth Algorithm
Considering the product (-13)(+11) then use the 2’s-complement of the multiplier

1 0 0 1 1 (-13 ) 1 0 0 1 1
0 1 0 1 1 x (+11) +1 -1 +1 0 -1
0 0 0 0 0 0 1 1 0 1
2’s-complement of -13 0 0 0 0 0 0 0 0 0
0 1 1 0 1 1 1 1 1 0 0 1 1
0 0 0 1 1 0 1
1 1 0 0 1 1
1 1 1 0 1 1 1 0 0 0 1 (- 143)
Booth Algorithm
Considering the product (+13)(-11) then use the 2’s-complement of the
multiplier

0 1 1 0 1 (+13 ) 0 1 1 0 1
1 0 1 0 1 x (-11) -1 +1 -1 +1 -1
1 1 1 1 1 1 0 0 1 1
2’s-complement of +13 0 0 0 0 0 1 1 0 1
1 0 0 1 1 1 1 1 1 0 0 1 1
0 0 0 1 1 0 1
1 1 0 0 1 1
1 0 1 1 0 1 1 1 0 0 0 1 (- 143)
Booth Algorithm
Considering the product (-13)(-11) then use the 2’s-complement of the multiplier

1 0 0 1 1 (-13 ) 1 0 0 1 1
1 0 1 0 1 x (-11) -1 +1 -1 +1 -1
0 0 0 0 0 0 1 1 0 1
2’s-complement of -13 1 1 1 1 1 0 0 1 1
0 1 1 0 1 0 0 0 0 1 1 0 1
1 1 1 0 0 1 1
0 0 1 1 0 1
1 0 0 0 1 0 0 0 1 1 1 1 ( 143)

Anda mungkin juga menyukai