0% found this document useful (0 votes)
19 views19 pages

COA Lec-Multiplication, Division and Comparator

Uploaded by

dominic cobb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views19 pages

COA Lec-Multiplication, Division and Comparator

Uploaded by

dominic cobb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

CSE 233: COMPUTER ORGANIZATION

& ARCHITECTURE
Tamanna Haque Nipa
Assistant Professor
Dept. of CSE
Stamford University Bangladesh
MULTIPLICATION –EXAMPLE (UNSIGNED)
1011 Multiplicand (11 dec)
x 1101 Multiplier (13 dec)
1011
0000 Partial products ( Note: if multiplier
bit is 1 copy multiplicand (place
1011 value) otherwise zero )
1011
10001111 Product (143 dec)
Note: need double length result
FLOWCHART FOR UNSIGNED BINARY
MULTIPLICATION
EXECUTION OF EXAMPLE
11 x 13 = 1011 x 1101
C A Q M n
0 0000 1101 1011 4
0 1011 1101 1011 4
0 0101 1110 1011 3
0 0010 1111 1011 2
0 1101 1111 1011 2
0 0110 1111 1011 1
1 0001 1111 1011 1
0 1000 1111 1011 0
Right
1011 1011 Shift
0010 0110
0 1101 1 0001
RESULT
o n is
i pt i
c r
Des quired
Re

10001111 = 143(10)
UNSIGNED BINARY MULTIPLICATION
BOOTH’S ALGORITHM- SIGNED MULTIPLICATION
EXECUTION OF EXAMPLE
7 x -3 = 0111 x 1101 (0011, 1100 +1 = 1101)

A Q Q-1 M n
0000 1101 0 0111 4
1001 1101 0 0111 4
1100 1110 1 0111 3

A= A - M ASR (A, Q, Q-1)


0000 1001 1101 0
0111
1100 1110 1
1 1001
EXECUTION OF EXAMPLE
7 x -3 = 0111 x 1101 (0011, 1100 +1 = 1101)

A Q Q-1 M n
0000 1101 0 0111 4
1001 1101 0 0111 4
1100 1110 1 0111 3
0011 1110 1 0111 3
0001 1111 0 0111 2
1010 1111 0 0111 2
1101 0111 1 0111 1
1110 1011 1 0111 0
A= A + M A= A - M
1100 0001
0111 0111
1 0011 1 1010
RESULT
7 x -3 = 0111 x 1101 (0011, 1100 +1 = 1101) = - 21

A Q Q-1 M n Description
0000 1101 0 0111 4 Initialization
1001 1101 0 0111 4 A=A-M
1100 1110 1 0111 3 ASR(A, Q, Q-1) and n=n-1

0011 1110 1 0111 2 A=A+M


0001 1111 0 0111 2 ASR(A, Q, Q-1) and n=n-1
1010 1111 0 0111 2 A=A-M
1101 0111 1 0111 1 ASR(A, Q, Q-1) and n=n-1
1110 1011 1 0111 0 ASR(A, Q, Q-1) and n=n-1

-128 64 32 16 8 4 2 1
11101011 = -21(10)
1 1 1 0 1 0 1 1
-128+64+32+8+2+1= -21
SIGNED DIVISION ALGORITHM
SIGNED DIVISION EXAMPLE
SIGNED DIVISION EXAMPLE
SIGNED DIVISION EXAMPLE
Let n= 4 bit
MAGNITUDE COMPARATOR X= 7 and Y=5 (0101)
X>Y is true
Possible 3 conditions
Y= { (2n-1) - Y0 }
⚫ X>Y
⚫ Y>X (2n-1) = 16-1=15
⚫ X=Y Y0= 1010 =10
S0, { (2n-1) - Y0 }
Equations:
⚫ X>Y = X –Y > 0 = 15 -10 =5
= X – { (2n-1) - Y0 } > 0
= X - (2n-1) + Y0 > 0
X + Y0 > (2n-1)
= X + Y0 > (2n-1) …. (1)
7+10 > 15……….
true
MAGNITUDE COMPARATOR
Equations:
⚫ X>Y = X + Y0 > (2n-1) …….(1)
⚫ For Y>X , similarly we can write
Y> X = Y + X0 > (2n-1)…….(2)
⚫ X=Y
= (X(n-1) ⊙ Y(n-1)). (X(n-2) ⊙ Y(n-2))……… (X0 ⊙ Y0)….(3)

A B F=A⊙B
0 1 1 1 = 7 0 1 1 1 = 7
0 0 1
0 1 1 1 =7 0 1 0 1 =5
0 1 0
1 . 1 . 1 . 1 =1 1 .1. 0. 1 =0
1 0 0
1 1 1
MAGNITUDE COMPARATOR
X>Y = X + Y0 > (2n-1) …….(1)
Y> X = Y + X0 > (2n-1)…….(2)
X=Y = (X(n-1) ⊙ Y(n-1)). (X(n-2) ⊙ Y(n-2))……… (X0 ⊙ Y0)….(3)

X Y

4 4

Cin = 0
4 bit Full Adder
Cout

Discard
MAGNITUDE COMPARATOR
X>Y = X + Y0 > (2n-1) …….(1)
Y>X = Y + X0 > (2n-1)…….(2)
X=Y = (X(n-1) ⊙ Y(n-1)). (X(n-2) ⊙ Y(n-2))……… (X0 ⊙ Y0)….(3)
X X Y
Y

4
4
4 4 4 4
Cin = 0

Cin = 0
4 bit Full Adder
Cout

4 bit Full Adder


Cout

X>Y Discard Y>X Discard


X=Y
MAGNITUDE COMPARATOR - EXAMPLE
X>Y = X + Y0 > (2n-1) …….(1)
Y>X = Y + X0 > (2n-1)…….(2)
X=Y = (X(n-1) ⊙ Y(n-1)). (X(n-2) ⊙ Y(n-2))……… (X0 ⊙ Y0)….(3)

Let X= 6 (0110), Y = 10(1010), n= 4 bit


Equation 1: Equation 2:

Y= { (2n-1) - Y0 } X= { (2n-1) - X0 }

(2n-1) = 16-1=15 X0= 1001 = 9

Y0= 0101 = 5 S0, Y>X = Y + X0 > (2n-1)

S0, X>Y = X + Y0 > (2n-1) = 10 + 9 > 15 = 19 >15 = True


= 6 + 5 > 15 Equation 3:
0 1 1 0 = 6
= 11 >15 = False 1 0 1 0 = 10
0 .0. 1. 1 = 0

You might also like