L29 Adder

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

ESc201 : Introduction to Electronics

Digital Circuits

Vipul Arora
Dept. of Electrical Engineering
IIT Kanpur
April 6, 2022
1
Comparator

A = A3 A2 A1 A0
𝐴𝒊 𝐵𝒊 𝒙 𝒚

B = B3 B2 B1 B0 0
0
0
1
1 0

( A = B ) = x3 x2 x1 x0 1 1

( A  B ) = A3 B3 + x3 A2 B2 + x3 x2 A1 B1 + x3 x2 x1 A0 B0

( A  B ) = A3 B3 + x3 A2 B2 + x3 x2 A1B1 + x3 x2 x1 A0 B0
2
Comparator

A = A3 A2 A1 A0 xi = Ai .Bi + Ai .Bi for i = 0,1,2,3


where xi = 1 only if the pair of bits in position i are
B = B3 B2 B1 B0 equal (i.e., if both are 1 or both are: 0).

( A = B ) = x3 x2 x1 x0 all xi variable must be equal to 1

( A  B ) = A3 B3 + x3 A2 B2 + x3 x2 A1 B1 + x3 x2 x1 A0 B0

( A  B ) = A3 B3 + x3 A2 B2 + x3 x2 A1B1 + x3 x2 x1 A0 B0
3
( A  B ) = A3 B3 + x3 A2 B2
+ x3 x2 A1 B1 + x3 x2 x1 A0 B0

( A  B ) = A3 B3 + x3 A2 B2
+ x3 x2 A1 B1 + x3 x2 x1 A0 B0

( A = B ) = x3 x2 x1 x0 4
Adder
a
S a b S C S
b
0 0 0 0
0 1 1 0
C Half Adder C
1 0 1 0
1 1 0 1
S = a.b + a.b ; C = a.b
a b
a b Cin S Cout
S 0 0 0 0 0
1
0 0 1 1 0
111 0 1 0 1 0
110 Cout Full Adder Cin 0 1 1 0 1
--------- 1 0 0 1 0
1101 1 0 1 0 1
a b 1 1 0 0 1
1 1 1 1 1

S = a.b.cin + a.b.cin + a.b.cin + a.b.cin ;


Cout = a.b.cin + a.b.cin + a.b.cin + a.b.cin 5
S = a.b.cin + a.b.cin + a.b.cin + a.b.cin S = Cin  (a  b)
Cout = a.b.Cin + a.b.Cin + a.b.Cin + a.b.Cin
a b Cin S Cout

Cout = Cin (a.b + a.b) + a.b = Cin .(a  b) + a.b 0 0 0 0 0


0 0 1 1 0
0 1 0 1 0
a ab Cin  (a  b) 0 1 1 0 1

b S 1 0 0 1 0
1 0 1 0 1
Cin .(a  b) 1 1 0 0 1
a.b 1 1 1 1 1

Cout

Cin

6
4-bit Adder
S(0:3) A 3 A 2 A 1 A 0 B 3 B 2 B 1 B 0 S 3 S 2 S 1S 0 Cout C3 C2 C1
0000 0000 0000 0
1 A 3 A 2 A 1A 0
0000 0001 0001 0
0001 0000 0001 0
B 3 B 2 B 1B 0
Cout 4-bit adder

C 4 S 3 S 2 S 1S 0
A(0:3) B(0:3)

S3 S1 S0
S2

C3 C2 C1 0
C4
FA FA FA FA

A3 B3 A2 B2 A1 B1 A0 B0

FA = Full Adder
7
Subtraction
A - B = A + 2’s complement of B
A − B = A + B +1
A - B = A + 1’s complement of B+1

FA FA FA FA 1

B3 B2 B1 B0
A3 A2 A1 A0

B3 B2 B1 B0

B0  1 = B0 .1 + B0 .1 = B0

8
Adder/Subtractor
FA FA FA FA 1

FA FA FA FA 01 A3 A2 A1 A0

A3 B3 A2 B2 A1 B1 A0 B0 1

B3 B2 B1 B0

FA FA FA FA

A3 A2 A1 A0

M=1

B3 B2 B1 B0

B0  0 = B0 .0 + B0 .0 = B0 M = 0 for Adder
B0  1 = B0 .1 + B0 .1 = B0 M=1 for Subtractor
9

You might also like