Professional Documents
Culture Documents
ESc201:IntroductiontoElectronics
Digital Circuits 1
DigitalCircuits1
Dr. K
D
K. V
V. S
Srivastava
i
t
Dept. of Electrical Engineering
IIT Kanpur
1
Numbers
Every number system is associated with a base or radix
Ap
positional notation is commonly
y used to express
p
numbers
(2009)10 = 2 10 + 0 10 + 0 10 + 9 10
3
(
(123.24)
)10 = 1 10 + 2 10 + 3 10 + 2 10 + 4 10
2
Numbers
An octal number system has a base 8 and uses symbols
(0,1,2,3,4,5,6,7)
(2007)8 = 2 8 + 0 8 + 0 8 + 7 8
3
(2007)8 = (1033)10
3
Number
Symbol
10
11
12
13
14
15
Numbers
A hexadecimal
h
d i l system
t
h a base
has
b
off 16
+ 9 160 = 11209
(1101) 2 = 1 23 + 1 22 + 0 21 + 1 20
21
22
23
24
16
25
32
26
64
27
128
28
256
29
512
210
1024(K)
220
1048576(M)
(1101) 2 = 1 8 + 1 4 + 0 2 + 1 2 = 13
1
1101.1001
23
22
21
20
3
-2
2 2-3
2
2-1
2-4
13. 5625
2-1
2-2
2-3
2-4
2-5
2-6
0.5
0.25
0.125
0.0625
0.03125 0.015625
11001 = ?
25
1100001 = ?
64+32+1=97
64
32 1 97
0.101 = ?
0.5+0.125=0.625
11.001 = ?
3+0.125=3.125
6
45 = bn 2 + bn 1 2 ....... + b1 2 + b0
n
45
n 1
n2
0
= 22.5 = bn 2 + bn 1 2 ....... + b1 2 + b0 0.5
2
22 + 0.5 = bn 2
n 1
n2
+ bn 1 2 ....... + b1 2 + b0 0.5
b0 = 1
22 + 0.5 = bn 2
22 = bn 2
n 1
+ bn 1 2 ....... + b1 2 + b0 0.5 b0 = 1
n 1
n2
n2
+ bn 1 2 ....... + b2 2 + b1 2
1
22
n2
n 3
0
= 11 = bn 2 + bn 1 2 ....... + b2 2 + b1 0.5
2
11 = bn 2
n2
n 3
+ bn 1 2 ...... + b3 2 + b2 2
1
b1 = 0
5 = bn 2
n 3
n4
+ bn 1 2 ...... + b4 2 + b3 2
1
0
8
5 = bn 2
n 3
+ bn 1 2 ...... + b4 2 + b3 2
n4
+ bn 1 2 ...... + b4 2 + 0.5b3 b3 = 1
2.5 = bn 2
2 = bn 2
n4
1 = bn 2
n 5
n4
n 5
n 5
+ bn 1 2 ...... + b5 2 + b4 2
n6
+ bn 1 2 ...... + b5 2 + 0.5b4 b4 = 0
0
b5 = 1
45
remainder
22
11
45
44
101101
101100
10
(153)10 = bn 8 + bn 1 8 .......b1 8 + b0
n
b0
b
153
= 19.125 = bn 8n 1 + bn 1 8n 2.......b1 80 + 0 8 = 0.125
8
8
153
19
remainder
1
b0 = 1
153
(231)8
11
0.35 = 0 + b1 2 + b2 2 + .......b n 2
0 7 = b1 + b2 2 + .......b n 2
0.7
1
n +1
0.7 = b2 2 + b3 2 + .......b n 2
b1 = 0
n +1
12
0.7 = b2 2 + b3 2 + .......b n 2
n +1
1 4 = b2 + b3 2 + .......b n 2
1.4
b2 = 1
n+2
N t that
Note
th t
+1/4+1/8+1
1/4 1/8
1
1
0 4 = b3 2 + b4 2 .......b n 2
0.4
1
0.8 = b3 + b4 2 .......b n 2
n+2
n +3
b3 = 0
13
0 125
0.125
0 .
((.001)
001)2
0.
25
0.
1.
5
0
0 .
0.8125 = ?
1.
0 8125
0.8125
((.1101)
1101)2
125
1.
0
0.
1.
x2
x2
x2
8125
x2
625
x2
25
x2
5
x2
0
14
decimal
2bit 3bit
4bit
5bit
00
000
0000
00000
01
001
0001
00001
10
010
0010
00010
Least significant
g
bit or LSB 3
11
011
0011
00011
100
0100
00100
101
0101
00101
110
0110
00110
111
0111
00111
1000
01000
1001
01001
10
1010
01010
11
1011
01011
12
1100
01100
13
1101
01101
14
1110
01110
15
1111
15
01111
Binary numbers
Most significant bit or MSB
1011000111
= h1161 + h0
0(0000)
1(0001)
2(0010)
3(0011)
4(0100)
5(0101)
h1
h0
Symbol
7(0111)
8(1000)
9(1001)
10(1010)
11(1011)
12(1100)
13(1101)
14(1110)
15(1111)
16
Binary Addition/Subtraction
0
1 0
101
1101
110
+ 1110
1011
11011
1
1
1
1 1
17
Complement of a number
9s complement
p
Decimal system:
10s complement
9s complement of n-digit number x is 10n -1 -x
10s complement of n-digit number x is 10n -x
9s complement of 85 ?
10 1 85
2
99 85 = 14
9' complement
9's
l
t off 123 = 999 123 = 876
10'ss complement of 123 = 99'ss complement of 123+1 = 877
10
18
1s complement
p
is simply
p y obtained by
y flipping
pp g a bit
(changing 1 to 0 and 0 to 1)
1's complement
p
of 1001101 = ?
0110010
19
001110
1011 0101
101101100 010010100
20
10 6 = ?
Adder
1010 (1010 )2
CY
610 ( 0110 )2
1010
+1010
10100
( 0100 )2 410
Answer is +4
21
6 10 = ?
Adder
610 ( 0110 )2
S
CY
1010 (1010 )2
2' complement
2's
l
off 1010
1010=0110
0110
If Carry is 0; then number you get is negative
0110
+0110
01100
( 0100 )2 410
Answer is -4
22
Example
10
0100
S
x1=1010
0100
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
Adder
x2=0110
2's Complement
CY
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
1010
1010
+1010
10100
23
Example
1100
6
S
x1=0110
0100
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
Adder
x2=1010
2's Complement
10
CY
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
0110
0110
+0110
1100
Signed
Magnitude
decimal
Signed1s
complement
decimal
Signed2s
complement
0000
1110
1111
0001
1101
1110
0010
1100
1101
0011
1011
1100
0100
1010
1011
0101
1001
1010
0110
1000
1001
0111
1000
1001
2
2
1010
1011
1100
5
5
1101
1110
1111
25
Example
+5
+2
+7
-5
+2
-3
0101
+0010
0111
1011
+0010
1101
2 complement
2s
l
t iis 011 = 3
+5
-2
+3
-5
-2
-7
0101
+1110
0011
1011
+1110
1001
2 complement
2s
l
t iis 111 = 7
26
Example
2s complement
p
is 11111001:
00000111= 7
27
Boolean Algebra
Algebra on Binary numbers
A variable x can take two values {0,1} 0
False
No
Low voltage
Basic operations:
AND: y = x1. x 2
True
Yes
High voltage
y is 1 if and only if both x1 and x2 are 1, otherwise zero
x1 x2 y
Truth Table
0
0
1
1
0
1
0
1
0
0
0
1
28
Basic operations:
OR: y = x1 + x 2
y is 1 if either x1 or x2 is 1. y= 0 if and only if both variables are
zero
x1 x2 y
0
0
1
1
NOT: y = x
0
1
0
1
0
1
1
1
x
0 1
1 0
29
Boolean Algebra
Basic Postulates
P1
P1.a:
x+0=x
P1.b:
P1
b x.1=x
P2.b: x . y = y . x
Identity element
P2.a: x + y = y + x
Commutative
P3.a: x.(y+z) = x.y+x.z P3.b: x+y.z = (x+y).(x+z)Distributive
P4.b: x . x = 0
P4.a: x + x = 1
Complement
Basic Theorems
T1.a: x + x = x
T2.a: x + 1 = 1
T3.a: ( x ) = x
T4.a: x + (y+z) = (x+y)+z
T1.b: x . x = x
T2.b: x . 0 = 0
T4.b: x . (y.z) = (x.y).z
T5 b
T5.b:
((x.y)) = x + y (D
(DeMorgan
M
30
P1.b: x . 1 = x
P2.a: x + y = y + x P2.b:
P3
P3.a:
x.(y+z)
( + ) = x.y+x.z
+
P3 b
P3.b:
P4.a: x + x = 1
Prove T1.a: x + x = x
x + x = (x+x).
(
) 1 (P1
(P1.b)
b)
= ((x+x).
) (x+x)
(
)
= x + x.x
=x+0
=x
((P4.a))
(P3.b)
(P4.b)
((P1.a))
x .y = y.x
x+y.z = ((x+y).(x+z)
)(
)
P4.b: x . x = 0
Prove T1.b: x . x = x
x . x = xx.x+
x+ 0 (P1.a)
(P1 a)
= x.x + x.x
((P4.b))
= x . (x+x ) (P3.a)
=x.1
=x
(P4.a)
((P1.b))
31
P1.b: x . 1 = x
P2.a: x + y = y + x
P2.b:
P3
P3.a:
x.(y+z)
( + ) = x.y+x.z
+
P3 b
P3.b:
P4.a: x + x = 1
Prove : x + 1 = 1
x + 1 = xx+(x+
(x x)
= (x+x)+ x
=x+x
x .y = y.x
x+y.z = ((x+y).(x+z)
)(
)
P4.b: x . x = 0
x + x .y = x
x + x .y = x+y
= x . 1 + x. y
= x. (1+ y)
=x.1
= (x
( + x ).
) (x+
( + y))
= 1. (x+ y)
=x
=x+y
=1
DeMorgans Theorem
(x1 + x 2 + x 3 + ....) = x1 . x 2 .x 3 .
(x1. x 2 . x 3 .....) = ( x1 + x 2 + x 3 +.....)
32
((x1 + x 2 + x 3 + ....)) = x1 . x 2 .x 3 .
(x1. x 2 . x 3 .....) = ( x1 + x 2 + x 3 +.....)
(x1.x 2 + x 2 .x 3 ) = ?
= (x1. x 2 ) . (x 2 . x 3 )
= (x1 +x 2 ) . (x 2 + x 3 )
= (x1 + x 2 ) . (x 2 + x 3 )
= x1. x 2 + x 2 .x 2 +x1 . x 3 + x 2 . x 3
= x1 . x 2 + x1 . x 3 + x 2 . x 3
33
x1 x2 y
0
0
1
1
0
1
0
1
0
1
0
0
y = 1 when x1 is 0 and x2 is 1
y = x1 . x2
Boolean expression
34
0
1
0
1
x1 x2 y
y = x1 . x2
1
0
0
0
x1 x2 y
0
0
1
1
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
0
0
1
0
y = x1 . x2
x1 . x2
y = x1 . x2 + x1. x2
x1 . x2
35
0
1
0
1
0
1
1
0
y = x1 . x2 + x1. x2
x1 x2 y
0
0
1
1
0
1
0
1
1
1
1
0
y = x1 . x2 + x1 . x2 + x1. x2
y =x1 + x2
36
x1 x2 y
x1 x2 y
0
0
1
1
0
0
1
1
0
1
0
1
1
0
1
1
y =x1 + x2
0
1
0
1
0
1
1
1
y =x1 + x2
x1 + x2
x1 x2 y
0
0
1
1
0
1
0
1
0
1
1
0
y = (x1 + x2 ).( x1 + x2 )
x1 + x2
37
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
S
Sum
off Products (SOP)
(SO ) form
f
38
AND: y = x1. x 2
x1
AND
x2
AND
y=0
G t is
Gate
i closed
l
d
x1
AND
OR y = x1 + x 2
OR:
x1
NOT: y = x
x2
y = x1
G t is
Gate
i open
OR
y
39
NAND: y = x1. x 2
x1x2
x1
x2
x1
x2
x1
NOR: y = x1 + x 2
x1x2
AND
x2
x1
x2
NAND
x1+x2
x1+x2
OR
NOR
y
40
XOR: y = x1 x 2 =xx1. x2 + x1 . x2
x1 x2 y
0
0
1
1
0
1
0
1
0
1
1
0
x1x2
x1
x2
y
x1
x2
x2
XOR
x1x2
41
x1
x2
x3
OR y = x1 + x 2 + x3 + ....
OR:
x1
x2
x3
AND
42
y
C
z
x
y
C = x. y + x.z + y.z
x
x y z
y
z
z
S
x
y
x y z
y
z
x y z
x
z
x
y
z
x y z
43
y f1
y min
i tterm
0
0
1
1
0
1
0
1
0
0
1
1
0
1
0
1
0
1
1
0
f1 = x . y + x. y
f1 = m1 + m2
f 2 = (0,
(0 2,3)
2 3) = ?
x.y
x.y
x.y
x.y
m0
m1
m2
m3
f1 = ((1,, 2))
f 2 = x . y + x. y + x . y
y z min terms
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
f 2 = (1,
(1 4,
4 7) = ?
x.y.z
x.y.z
x.y.z
x.y.z
x.y.z
x.y.z
x.y.z
x.y.z
m0
m1
1
m2
m3
m4
m5
m6
m7
f 2 = x . y. z + x. y. z + x . y . z
45
y f1
0
0
1
1
0
1
0
1
0
0
1
1
0
1
1
0
y Max term
0
1
0
1
x+y
x+y
x+y
x+y
M0
M1
M2
M3
f1 = ( x + y ) ( x + y )
f1 = M 0 M 3
f1 = (M 0 , M 3 )
46
x
0
0
0
0
1
1
1
1
y z Max. terms
0
0
1
1
0
0
1
1
0 x + y + z M0
1 x + y + z M1
0 x + y + z M2
1 x + y + z M3
0 x + y + z M4
1 x + y + z M5
0 x + y + z M6
1 x + y + z M7
f1 = (1,5,
(1 5 7) = ?
f 2 = (x
( + y + z ).(
) ( x + y + z ).(
) ( x + y + z)
47
Simplification
x1 x2 x3 y
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
y= (1,3,5,
(1 3 5 7)
y = x1 . x2 . x3 + x1. x2 . x3 + x1. x2 . x3 + x1. x2 . x3
x1
x2
x3
x1
x2
x3
x1
x2
x3
x1
x2
x3
Goal of Simplification
x2
x3
x1
x2
x3
y = x1 . x3 + x1. x2 . x3 + x1. x2 . x3
x2
x3
x1
x1
y
x3
x2
x3
x1
x2
x3
x1
x2
x3
x1
x2
x3