3. Numbers Every number system is associated with a base or radix
The decimal system has a base of 10 and uses symbols
(0,1,2,3,4,5,6,7,8,9) to represent numbers
5 4 3 2 1 0
5 4 3 2 1 0 5 4 3 2 1 0
( )r
a a a a a a a r a r a r a r a r a r
= + + + + +
A positional notation is commonly used to express numbers
3 2 1 0
10
(2009) 2 10 0 10 0 10 9 10
= + + +
An octal number system has a base 8 and uses symbols (0,1,2,3,4,5,6,7)
3 2 1 0
8
(2007) 2 8 0 8 0 8 7 8
= + + +
2 1 0 1 2
10
(123.24) 1 10 2 10 3 10 2 10 4 10
− −
= + + + +
What decimal number does it represent?
1 0
8
(2007) 2 512 0 64 0 8 7 8 1033
= + + + =
Internshala Trainings
4. A hexadecimal system has a base of 16
3 2 1 0
10
(2 9) 2 16 16 16 9 16
BC B C
= + + +
Number Symbol
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
How do we convert it into decimal number?
1 0
10
(2 9) 2 4096 11 256 12 16 9 16 11209
BC = + + + =
Internshala Trainings
5. A Binary system has a base 2 and uses only two symbols
0, 1 to represent all the numbers
3 2 1 0
2
(1101) 1 2 1 2 0 2 1 2
= + + +
Which decimal number does this correspond to ?
1 0
2
(1101) 1 8 1 4 0 2 1 2 13
= + + + =
1 1 0 1 . 1 0 0 1
23
22
21 20
2-1 2-3
2-2
2-4
20
1
21 2
22 4
23 8
24 16
25 32
26 64
27 128
28 256
29 512
210 1024(K)
220 1048576(M)
2-1 2-2 2-3 2-4 2-5 2-6
0.5 0.25 0.125 0.0625 0.03125 0.015625
Internshala Trainings
7. Converting decimal to binary number
Convert 45 to binary number
10 1 0
(45) .......
n n
b b b
−
=
1 1
1 1 0
45 2 2 ....... 2
n n
n n
b b b b
−
−
= + +
Divide both sides by 2
1 2 0
1 1 0
45
22.5 2 2 ....... 2 0.5
2
n n
n n
b b b b
− −
−
= = + +
1 2 0
1 1 0
22 0.5 2 2 ....... 2 0.5
n n
n n
b b b b
− −
−
+ = + + +
0 1
b
=
Internshala Trainings
8. 1 2 0
1 1 0
22 0.5 2 2 ....... 2 0.5
n n
n n
b b b b
− −
−
+ = + + + 0 1
b
=
1 2 1 0
1 2 1
22 2 2 ....... 2 2
n n
n n
b b b b
− −
−
= + +
Divide both sides by 2
2 3 0
1 2 1
22
11 2 2 ....... 2 0.5
2
n n
n n
b b b b
− −
−
= = + + 1 0
b
=
2 3 1 0
1 3 2
11 2 2 ...... 2 2
n n
n n
b b b b
− −
−
= + + +
3 4 0
1 3 2
5.5 2 2 ...... 2 0.5
n n
n n
b b b b
− −
−
= + + + 2 1
b
=
3 4 1 0
1 4 3
5 2 2 ...... 2 2
n n
n n
b b b b
− −
−
= + +
Internshala Trainings
9. 3 4 1 0
1 4 3
5 2 2 ...... 2 2
n n
n n
b b b b
− −
−
= + +
4 5 0
1 4 3
2.5 2 2 ...... 2 0.5
n n
n n
b b b b
− −
−
= + + 3 1
b
=
4 5 1 0
1 5 4
2 2 2 ...... 2 2
n n
n n
b b b b
− −
−
= + +
5 6 0
1 5 4
1 2 2 ...... 2 0.5
n n
n n
b b b b
− −
−
= + + 4 0
b
=
5 1
b
=
10 5 4 3 2 1 0
(45) 101101
b b b b bb
= =
Internshala Trainings
10. Converting decimal to binary number
Method of successive division by 2
45
22 1
remainder
11 0
5 1
2 1
1 0
0 1
45 = 1 0 1 1 0 1
Internshala Trainings
11. Convert (153)10 to octal number system
10 1 0 8
(153) ( ....... )
n n
b b b
−
=
1 1
10 1 1 0
(153) 8 8 ....... 8
n n
n n
b b b b
−
−
= + +
Divide both sides by 8
1 2 0 0
1 1
153
19.125 8 8 ....... 8
8 8
n n
n n
b
b b b
− −
−
= = + + 0
0.125
8
b
= 0 1
b
=
153
19 1
remainder
2 3
0 2
153 = (231)8
Internshala Trainings
12. Converting decimal to binary number
Convert (0.35)10 to binary number
10 1 2 3
(0.35) 0. ....... n
b b b b
− − − −
=
1 2
1 2
0.35 0 2 2 ....... 2 n
n
b b b
− − −
− − −
= + + +
How do we find the b-1 b-2 …coefficients?
Multiply both sides by 2
1 1
1 2
0.7 2 ....... 2 n
n
b b b
− − +
− − −
= + + 1 0
b−
=
1 2 1
2 3
0.7 2 2 ....... 2 n
n
b b b
− − − +
− − −
= + +
Internshala Trainings
13. 1 2 1
2 3
0.7 2 2 ....... 2 n
n
b b b
− − − +
− − −
= + +
Multiply both sides by 2
1 2
2 3
1.4 2 ....... 2 n
n
b b b
− − +
− − −
= + +
2 1
b−
=
Note that ½+1/4+1/8+……1
1 2 2
3 4
0.4 2 2 ....... 2 n
n
b b b
− − − +
− − −
= +
1 3
3 4
0.8 2 ....... 2 n
n
b b b
− − +
− − −
= + 3 0
b−
=
Internshala Trainings
15. Binary numbers
1011000111
Binary digit = bit
Least significant
bit or LSB
Most significant bit or MSB
This is a 10 bit number
decimal 2bit 3bit 4bit 5bit
0 00 000 0000 00000
1 01 001 0001 00001
2 10 010 0010 00010
3 11 011 0011 00011
4 100 0100 00100
5 101 0101 00101
6 110 0110 00110
7 111 0111 00111
8 1000 01000
9 1001 01001
10 1010 01010
11 1011 01011
12 1100 01100
13 1101 01101
14 1110 01110
15 1111 01111
N-bit binary number can
represent numbers from 0 to 2N
-1
Internshala Trainings
16. Converting Binary to Hex and Hex to Binary
Number Symb
ol
0(0000) 0
1(0001) 1
2(0010) 2
3(0011) 3
4(0100) 4
5(0101) 5
6(0110) 6
7(0111) 7
8(1000) 8
9(1001) 9
10(1010) A
11(1011) B
12(1100) C
13(1101) D
14(1110) E
15(1111) F
7 6 5 4 3 2 1 0 1 0
( ) ( , )
b Hex
b b b b b b bb h h
=
7 6 5 4 3 2 1 1
7 6 5 4 3 2 1 0 1 0
2 2 2 2 2 2 2 16
b b b b b b b b h h
+ + + + + + = +
3 2 1 4 3 2 1 1
7 6 5 4 3 2 1 0 1 0
( 2 2 2 )2 ( 2 2 2 ) 16
b b b b b b b b h h
+ + + + + + = +
h1 h0
(10110011) (1011)(0011) ( 3)
b Hex
B
= =
(110011) (11)(0011) (33)
b Hex
= =
( ) (1110)(1100) (11101100)
Hex b
EC = =
Internshala Trainings
18. Complement of a number
Decimal system:
9’s complement
10’s complement
9’s complement of n-digit number x is 10n -1 -x
10’s complement of n-digit number x is 10n -x
9’s complement of 85 ? 2
10 1 85
− − 99 85 14
− =
9's complement of 123 = 999 123 876
− =
10's complement of 123 = 9's complement of 123+1 877
=
Internshala Trainings
19. Complement of a binary number
Binary system:
1’s complement
2’s complement
1’s complement of n-bit number x is 2n -1 -x
2’s complement of n-bit number x is 2n -x
1’s complement of 1011 ? 4
2 1 1011
− − 1111 1011 0100
− =
1's complement of 1001101 = ?
0110010
1’s complement is simply obtained by flipping a bit (changing 1 to 0 and 0 to 1)
Internshala Trainings
20. 2's complement of 1010 = 1's complement of 1010+1 0110
=
2's complement of 110010 =
001110
Leave all least significant 0’s as they are, leave first 1 unchanged and then flip
all subsequent bits
1011 0101
→
101101100 010010100
→
Internshala Trainings
21. Advantages of using 2’s complement
Adder
x1
x2
S
CY
Can we carry out Y = X1 – X2 using such an adder?
x2
Adder
2's Complement
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
S
Y
x1
x1,x2: N bit numbers
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
2
2N
x
− 1 2
( , ) 2N
CY S x x
= + −
Note that carry will be there only if x1 – x2 is positive as 2N is N+1 bits (1
followed by N zeros) Internshala Trainings
22. Advantages of using 2’s complement
x2
Adder
2's Complement
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
S
Y
x1
x1,x2: N bit numbers
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
2
2N
x
− 1 2
( , ) 2N
CY S x x
= + −
Note that carry will be there only if x1 – x2 is positive as 2N is N+1 bits (1
followed by N zeros)
A zero carry implies a negative number whose magnitude (x2 – x1) can be found
as follows:
1 2
2N
S x x
= + −
1 2 2 1
2'scomplement of 2 ( 2 )
N N
S x x x x
= − + − = −
Internshala Trainings
23. Adder
2's Complement
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
S
Y
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
x1=1010
x2=0110
Example
10
6
1010
1 0 1 0
+ 1 0 1 0
1 0 1 0 0
0100
1 0
0100
Internshala Trainings
24. Adder
2's Complement
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
S
Y
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
x1=0110
x2=1010
Example
6
10
0110
0 1 1 0
+ 0 1 1 0
1 1 0 0
1100
0 1
0100
It makes sense to use adder as a subtractor as well provided additional circuit
required for carrying out 2’s complement is simple
Internshala Trainings
25. Subtraction using 10’s complement
x2
Adder
S
Y
x1
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
x1,x2: N digit numbers
10's Complement
Y = S if Sign = 0
Y = 10's Complement of S if Sign = 1
8
3
10-3=7
1
5
5
0
This way of subtraction would make sense only if subtracting a number x2
from 10N is much simpler than directly subtracting it directly from x1
Internshala Trainings
26. Representing positive and negative binary numbers
One extra bit is required to carry sign information. Sign bit = 0
Represents positive number and Sign bit = 1 represents negative number
decimal Signed
Magnitude
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
-0 1000
-1 1001
-2 1010
-3 1011
-4 1100
-5 1101
-6 1110
-7 1111
decimal Signed 1’s
complement
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
-0 1111
-1 1110
-2 1101
-3 1100
-4 1011
-5 1010
-6 1001
-7 1000
decimal Signed 2’s
complemen
t
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
-1 1111
-2 1110
-3 1101
-4 1100
-5 1011
-6 1010
-7 1001
Internshala Trainings
27. If we represent numbers in 2’s complement
form carrying out subtraction is same as addition
x2
Adder
2's Complement
Y = S if Sign = 0
Y = 2's Complement of S if Sign = 1
S
Y
x1
x1,x2: N bit numbers
Sign
Sign = 0 for psotive numbers
= 1 for negative numbers
CY
Adder
S
x1
x2
x1,x2: N bit numbers in 2's complement
CY
Answer is in 2’s
complement form
Internshala Trainings
30. Boolean Algebra
Algebra on Binary numbers
A variable x can take two values {0,1} 0
False
No
Low voltage
1
True
Yes
High voltage
Basic operations:
1 2
AND: y = x . x
Y is 1 if and only if both x1 and x2 are 1, otherwise zero
x1 x2 y
0 0 0
0 1 0
1 0 0
1 1 1
Truth Table
Internshala Trainings
31. Basic operations:
1 2
OR: y = x + x
Y is 1 if either x1 and x2 is 1. Or y= 0 if and only if both variables are zero
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 1
NOT: y = x
y
x
1
1
0
0
Internshala Trainings
32. Boolean Algebra
Basic Postulates
P1: x + 0 = x
P2: x + y = y + x
P3: x.(y+z) = x.y+x.z
P4: x + x = 1
P1: x . 1 = x
P2: x . y = y . x
P3: x+y.z = (x+y).(x+z)
P4: x . x = 0
Basic Theorems
T1: x + x = x
T2: x + 1 = 1
T3: ( x ) = x
T4: x + (y+z) = (x+y)+z
T5 (x+y) = x . y (DeMorgan's theorem)
T6: x+ x.y = x
T1: x . x = x
T2: x . 0 = 0
T4: x . (y.z) = (x.y).z
T5 (x.y) = x + y (DeMorgan's theorem)
T6: x.( x+y) = x
Internshala Trainings
33. P1: x + 0 = x
P2: x + y = y + x
P3: x.(y+z) = x.y+x.z
P4: x + x = 1
P1: x . 1 = x
P2: x . y = y . x
P3: x+y.z = (x+y).(x+z)
P4: x . x = 0
Proving theorems
Prove T1: x + x = x
x + x = (x+x). 1 (P1)
= (x+x). (x+x) (P4)
= x + x.x (P3)
= x + 0 (P4)
= x (P1)
Prove T1: x . x = x
x . x = x.x+ 0 (P1)
= x.x + x.x (P4)
= x . (x+x ) (P3)
= x . 1 (P4)
= x (P1)
Internshala Trainings
34. Prove : x + 1 = 1
Proving theorems
x + 1 = x+(x+ x)
= (x+x)+ x
= x + x
= 1
P1: x + 0 = x
P2: x + y = y + x
P3: x.(y+z) = x.y+x.z
P4: x + x = 1
P1: x . 1 = x
P2: x . y = y . x
P3: x+y.z = (x+y).(x+z)
P4: x . x = 0
x + x .y = x
= x . 1 + x. y
= x. (1+ y)
= x . 1
=x
DeMorgan’s theorem
1 2 3 1 2 3
(x x x ....) x . x .x .
+ + + =
1 2 3 1 2 3
(x . x . x .....) ( x + x x +.....)
= +
x + x .y = x+y
= (x + x ). (x+ y)
= 1. (x+ y)
= x + y
Internshala Trainings
35. Simplification of Boolean expressions
1 2 2 3
(x .x x .x ) ?
+ =
1 2 3 1 2 3
(x x x ....) x . x .x .
+ + + =
1 2 3 1 2 3
(x . x . x .....) ( x + x x +.....)
= +
1 2 2 3
(x x ) . (x + x )
= +
1 2 1 3 2 3
x . x x . x x . x
= + +
Internshala Trainings
36. Function of Boolean variables
x1
x2
y
y
x
x1 x2 y
0 0 0
0 1 1
1 0 0
1 1 0
2
y= x
Y = 1 when x1 is 0 and x2 is 1
1 2
y= .
x x
Boolean expression
Internshala Trainings
37. Obtaining Boolean expressions from truth Table
x1 x2 y
0 0 1
0 1 0
1 0 0
1 1 0
1 2
y= .
x x
x1 x2 y
0 0 0
0 1 0
1 0 1
1 1 0
1 2
y= .
x x
x1 x2 y
0 0 1
0 1 0
1 0 0
1 1 1
1 2
.
x x
1 2
.
x x
1 2 1 2
y= . .
x x x x
+
Internshala Trainings
38. Obtaining Boolean expressions from truth Table
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 0
1 2 1 2
y= . .
x x x x
+
Instead of writing expressions as sum of terms that make y equal to 1, we
can also write expressions using terms that make y equal to 0
x1 x2 y
0 0 1
0 1 1
1 0 1
1 1 0
1 2 1 2 1 2
y= . . .
x x x x x x
+ +
1 2
y=x x
+
Internshala Trainings
39. x1 x2 y
0 0 1
0 1 0
1 0 1
1 1 1
1 2
y=x x
+
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 1
1 2
y=x x
+
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 0
1 2
x x
+
1 2
x x
+
1 2 1 2
y=(x ).( )
x x x
+ +
Internshala Trainings
40. 1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
Obtaining Boolean expressions from truth Table
y
x1 x2 x3
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
1 2 3 1 2 3 1 2 3 1 2 3
y=( ).( ).( ).( )
x x x x x x x x x x x x
+ + + + + + + +
Sum of Products (SOP) form
Product of Sum (POS) form
Internshala Trainings
42. Implementing Boolean expressions
Elementary Gates
1 2
AND: y = x . x
x1
x2
y
AND
Why call it a gate?
x1
AND y = 0
0
Gate is closed
x1
AND
1
y = x1
Gate is open
1 2
OR: y = x + x
x1
x2
y
OR
NOT: y = x y
x
Internshala Trainings
43. 1 2
NAND: y = x . x
x1
x2
y
NAND
x1
x2
AND
x1x2
x1x2
1 2
NOR: y = x + x
x1
x2
OR
x1+x2
x1+x2
x1
x2
y
NOR
Internshala Trainings
44. 1 2 1 2 1 2
XOR: y = x x =x . .
x x x
+
x1 x2 y
0 0 0
0 1 1
1 0 1
1 1 0
Y is 1 if only one variable is 1 and the other is zero
x2
x1
x1 x1x2
x1x2
x2
y x1
x2
y
XOR
1 2 1 2 1 2
XNOR: y =x x = x . .
x x x
+
Y is 1 if only both variables are either 0 or 1
x1
x2
y
XNOR
1 2 1 2
y =x x =x x
Internshala Trainings
45. Gates with more than 2 inputs
1 2 3
AND: y = x . x . ...
x y
AND
x1
x2
x3
1 2 3
OR: y = x + x ....
x
+ +
x1
x2
x3
y
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
XOR: y =x x x = x . . . . . . .
x x x x x x x x x x x
+ + +
Y = 1 only if odd number of inputs is 1
Internshala Trainings
46. Implementing Boolean expressions using gates
. . . . . . . .
S x y z x y z x y z x y z
= + + +
. . .
C x y x z y z
= + +
x
y
z
S
C
y
y
z
y
z
x
x
x
y
y
z
z
z
S
x
x y z
x y z
x y z
x y z
x
y
y
z
z
x
C
Internshala Trainings
47. Implementing gates using Switches
x
SN
Voltage controlled Switch
SN:
Switch is closed if voltage x is HIGH
Switch is open if voltage x is LOW
x
SP
Voltage controlled Switch
SP:
Switch is closed if voltage x is LOW
Switch is open if voltage x is HIGH
We have seen earlier (in class 12) that transistors act as switches !
Internshala Trainings
48. SN
SP
VDD = 5V
x y
x
SN
Switch is closed if voltage x is HIGH
Switch is open if voltage x is LOW
Switch is closed if voltage x is LOW
Switch is open if voltage x is HIGH
x
SP
LOW
closed
open
HIGH
0
1
y
x
NOT gate
Internshala Trainings
50. NOR Gate
1 2
NOR: y = x + x
SP
x1
SN
SP
x2
SN
y
x1 x2
VDD = 5V
y
x2
x1
LOW HIGH
HIGH
HIGH
LOW
LOW
HIGH HIGH
LOW
LOW
LOW
LOW
Internshala Trainings
51. x
y
y
z
z
x
C
Design Overview a b c S CY
0 0
0 0
0 0
1
0 1 1
0 0
1
0 1
1
0
1
1
1
1 1
0 0
0
1 1
0
0
1
1
0
1 0
0
0
1
1
1
1
Full Adder
b
c
S
CY
a
. . . . . . . .
S x y z x y z x y z x y z
= + + +
. . .
C x y x z y z
= + +
y
y
z
y
z
x
x
x
y
y
z
z
z
S
x
x y z
x y z
x y z
x y z
SN
SP
x1
SN
x1
x2
SP
x2
VDD = 5V
SP
SN
y
Internshala Trainings
53. Representation of Boolean Expressions
x y min term
0 0 x . y m0
0 1 x . y m1
1 0 x . y m2
1 1 x . y m3
0 0 0
0 1 1
1 0 1
1 1 0
x y f1
1
f = . .
x y x y
+ 1 1 2
f = m m
+ 1
f = (1,2)
2
f = (0,2,3) ?
=
2
f = . . .
x y x y x y
+ +
A minterm is a product that contains all the variables used in a function
Internshala Trainings
54. Three variable functions
y z min terms
0 0 0 x . y . z
0 0 1 x . y . z
0 1 0 x . y . z
0 1 1 x . y . z
1 0 0 x . y . z
1 0 1 x . y . z
1 1 0 x . y . z
1 1 1 x . y . z
x
m0
m1
m2
m3
m4
m5
m6
m7
2
f = (1,4,7) ?
=
2
f = . . . . . .
x y z x y z x y z
+ +
Internshala Trainings
55. Product of Sum Terms Representation
0 0 0
0 1 1
1 0 1
1 1 0
x y f1 x y
0 0 x + y M0
0 1 x + y M1
1 0 x + y M2
1 1 x + y M3
Max term
F1 = (x+y)(x’ + y’) = M0.M3 = ∏M0M3
Internshala Trainings
56. y z
x Max. terms
M0
M1
M2
M3
M4
M5
M6
M7
0 0 0 x + y + z
0 0 1 x + y + z
0 1 0 x + y + z
0 1 1 x + y + z
1 0 0 x + y + z
1 0 1 x + y + z
1 1 0 x + y + z
1 1 1 x + y + z
1
f = (1,5,7) ?
=
2
f =(x ).( ).( )
y z x y z x y z
+ + + + + +
Internshala Trainings
57. Simplification of Boolean Expressions
y
x1 x2 x3
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
y= (1,3,5,7)
y
x1
x2
x3
x1
x2
x3
x2
x3
x1
x2
x3
x1
Simplification of Boolean expression yields : y = x3 !! which does not
require any gates at all !
Internshala Trainings
58. Goal of Simplification
1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
y
x1
x2
x3
x1
x2
x3
x2
x3
x1
x2
x3
x1
Goal of simplification is to reduce the complexity of gate circuit. This requires
that we minimize the number of gates. Since number of gates depends on
number of minterms, one of the goals of simplification is to minimize the
number of minterms in SOP expression
Internshala Trainings
59. 1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
y
x1
x2
x3
x1
x2
x3
x2
x3
x1
x2
x3
x1
1 3 1 2 3 1 2 3
y= . . . . .
x x x x x x x x
+ +
y
x1
x2
x3
x2
x3
x1
x1
x3
This circuit is simpler not just because it uses 4 gates instead of 5 but also
because circuit-2 uses one 2-input and three 3-input gates as compared to five
3-input gates used in circuit-1
Internshala Trainings
60. Goal of Simplification
1. Minimize number of product terms
2. Minimize number of literals in each term
In the SOP expression:
Simplification Minimization
Internshala Trainings
61. Minimization
1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
1 3 2 2 1 3 2 2
y= . .( ) . .( )
x x x x x x x x
+ + +
1 3 1 3
y= . .
x x x x
+
1 1 3
y=( ).
x x x
+
3
y= x
Principle used: x + x = 1
Internshala Trainings
62. f = . . .
x y x y x y
+ +
Apply the Principle: x + x = 1 to simplify
f = .( ) .
x y y x y
+ +
f = .
x x y
+
How do we simplify further?
f = . . . . . . .
x y x y x y x y x y x y x y
+ + = + + +
Principle used : x + x = x
f = . . . .
. ( ) ( ).
x y x y x y x y
x y y x x y x y
+ + +
= + + + = +
Internshala Trainings
63. Simplify
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
1 2 3 4 1 2 3 4
. . . . . . . . . . . .
. . . . . .
f x x x x x x x x x x x x x x x x
x x x x x x x x
= + + + +
+
Principle: x + x = 1 and x + x = x
Need a systematic and simpler method for applying these two principles
Karnaugh Map (K map) is a popular technique for carrying out simplification
It represents the information in problem in such a way that the two
principles become easy to apply
Internshala Trainings
65. K-map representation of truth table
x y min term
0 0 x . y m0
0 1 x . y m1
1 0 x . y m2
1 1 x . y m3
0
1
1
0
m0
m3
x
y
m2
m1
0 0 0
0 1 1
1 0 1
1 1 0
x y f1
0
1
1
0
x
y
0 1
1 0
Internshala Trainings
67. 3-variable K-map representation
y z min terms
0 0 0 x . y . z
0 0 1 x . y . z
0 1 0 x . y . z
0 1 1 x . y . z
1 0 0 x . y . z
1 0 1 x . y . z
1 1 0 x . y . z
1 1 1 x . y . z
x
m0
m1
m2
m3
m4
m5
m6
m7
yz
x 00 01 11
0
1
10
m0 m1 m3 m2
m4 m5 m6
m7
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
x y z f
yz
x 00 01 11
0
1
10
0 1 1 0
0 1 1 0
Internshala Trainings
68. yz
x 00 01 11
0
1
10
1 0
0 1 1 0
0
1
f = . . . . . . . .
x y z x y z x y z x y z
+ + +
Internshala Trainings
69. w x y z
0 0 0
0 0 0 1
0
min terms
m0
m1
0 0 1 0 m2
0 0 1
1 m3
1 1 1 0 m14
1 1 1 1 m15
4-variable K-map representation
yz
wx 01 11
11
01
00
00 10
10
0 1 3 2
4 5 7 6
12 13 15 14
8 9 10
11
yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
f =w. . . w. . . . . . . . .
. . . . . . . . .
x y z x y z w x y z w x y z
w x y z w x y z w x y z
+ + +
+ + +
Internshala Trainings
70. Minimization using Kmap
2
f = (2,3)
0
1
1
0
x
y
0
1 1
0
f = . .
x y x y
+
f = .( )
x y y
+
f = x
Combine terms which differ in only one bit position. As a result,
whatever is common remains.
Internshala Trainings
71. 0
1
1
0
x
y
1
0
0 1
f = . .
x y x y
+
f =( . ).
x x y
+ f = y
0
1
1
0
x
y
1 0
1 0
f = y
0
1
1
0
x
y
1
0
0
1
f = x
Internshala Trainings
72. 0
1
1
0
x
y
0 1
1 1
f = . . .
x y x y x y
+ +
f = .( ) .
.
x y y x y
x x y
+ +
= +
f = . .
( ).
x x y x y
x x x y
x y
+ +
= + +
= +
The idea is to cover all the 1’s with as few and as simple terms as possible
Internshala Trainings
73. yz
x 00 01 11
0
1
10
1 0
0 1 1 0
0
1
3-variable minimization
f = . . . . . . . .
x y z x y z x y z x y z
+ + +
.
x z
.
y z
f = . . . .
x y z y z x z
+ +
Internshala Trainings
74. yz
x 00 01 11
0
1
10
0 1 1 0
1 0
0 1
3-variable minimization
f = . . . . . . . .
x y z x y z x y z x y z
+ + +
.
x z
.
x z
f = . .
x z x z
+
Internshala Trainings
75. yz
x 00 01 11
0
1
10
1 1
0
0
1 1
0 0
3-variable minimization
f = . . . . . . . .
x y z x y z x y z x y z
+ + +
.
x y
.
x y
f = . .
x y x y
+
f = .( )
x y y x
+ =
yz
x 00 01 11
0
1
10
1 1
0
0
1 1
0 0
x
Internshala Trainings
76. yz
x 00 01 11
0
1
10
1 1 1 1
0 0 0 0 x
yz
x 00 01 11
0
1
10
1 1
0 0
1 1
0 0
z
yz
x 00 01 11
0
1
10
1
1
0 0
0 0
1
1
z
yz
x 00 01 11
0
1
10
1
1
0 0
1
1 1 1
z
x
f =x z
+
Internshala Trainings
77. yz
x 00 01 11
0
1
10
0 0
1 1 1
0
0
0
Can we do this ?
Note that each encirclement should represent a single product term. In this
case it does not.
f = . . . . . .
. .
x y z x y z x y z
x y x z
+ +
= +
We do not get a single product term.
In general we cannot make groups of 3 terms.
Internshala Trainings
78. yz
x 00 01
0
1
0 0
1 1
0
0
0
10 11
0
Can we use kmap with the following ordering of variables?
Can we combine these two terms into a single term ?
f = . . . .
.( . . )
x y z x y z
x y z y z
+
= +
Note that no simplification is possible.
Kmap requires information to be represented
Internshala Trainings
79. yz
x 00 01
0
1
0
0
0
10 11
0
1 1
0 0
These two terms can be combined into a single term but it is not easy to
show that on the diagram.
f = . . . .
.( ). .
x y z x y z
x y y z x z
+
= + =
Kmap requires information to be represented in such a way that it is easy
to apply the principle 1
x x
+ =
Internshala Trainings
80. yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
. .
w x z
4-variable minimization
. .
w y z
. .
w y z
f = . . . . . . . . . . . .
w y z w x z w y z w x y z w x y z
+ + + +
But is this the simplest expression ?
Internshala Trainings
81. yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
. . . . . . . .
w x y z w x y z w x z
+ =
yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
. . . . . . . .
w x y z w x y z x y z
+ =
Internshala Trainings
82. yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
. .
w x z
4-variable minimization
. .
w y z
. .
w y z
f = . . . . . . . . . .
w y z w x z w y z w x z x y z
+ + + +
. .
w x z
. .
x y z
Is this the best that we can do ?
Internshala Trainings
83. yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
f = . . . .
. . . . . .
w y z w x z
w y z w x z x y z
+ +
+ +
yz
1 0
1
wx 01 11
11
01
00 0
00 10
0 1 1 0
1 0 1
0
1 0 0
0
10
Cover the 1’s with minimum number of terms
f = . . . .
. . . .
w y z w x z
w x z x y z
+ +
+
Internshala Trainings
84. yz
0
1
wx 01 11
11
01
00 0
00 10
1 0
0 0
1 0 0
10
1
0
0
0 0
1
4-variable minimization
yz
0
1
wx 01 11
11
01
00 0
00 10
1 0
0 0
1 0 0
10
1
0
0
0 0
1
f = . . . . . .
w x y w x z w y z
+ + f = . . . . . .
w x y w x z x y z
+ +
Internshala Trainings
85. Groups of 4
yz
0
wx 01 11
11
01
00
00 10
1
0
0
10
1
0
0 0
0
1 1
0 0
1
1
1
.
w x
.
y z
yz
0
wx 01 11
11
01
00
00 10
1
10
0
0 0
0
1
0 0
1
1
0 0
1
1
0
.
x z
.
w z
Internshala Trainings
89. Don’t care terms
0 0 0
0 0 0 1
0
0 0 1 0
0 0 1
1
a b c d
1 1
0
0 1
0 1
1 0 0
1 0
1 0
1
0
1 0 0 0
0 0 1
0 1 0
0 1
1
1 1
1
1
1 0 0
1 0
1 0
1
1
1
1
1
1
1
1
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0
y0y1y2y3y4y5y6y7y8y9
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 0
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
a
b
c
d
y0
y1
y2
y3
y9
Decimal
Decoder
01 11
11
01
00
00 10
10 0
ab
cd
0 0
0 0 0 0
x x x x
x x
1
0
0
Y3
3 . . .
y a b c d
=
Internshala Trainings
90. 01 11
11
01
00
00 10
10 0
ab
cd
0 0
0 0 0 0
x x x x
x x
1
0
0
Y3
Don’t care terms can be chosen as 0 or 1.
Depending on the problem, we can choose the don’t care term
as 1 and use it to obtain a simpler Boolean expression
3 . .
y b c d
=
Don’t care terms should only be included in encirclements if it helps in
obtaining a larger grouping or smaller number of groups.
Internshala Trainings
91. Minimization of Product of Sum Terms using Kmap
0
1
1
0
x
y
0 1
1 1
f = . .
( ).
x x y x y
x x x y
x y
+ +
= + +
= +
0
1
1
0
x
y
0 1
1 1
f = x y
+
0
1
1
0
x
y
1
0
0 1
f = y
Internshala Trainings
92. 0
1
1
0
x
y
1 0
1 0
f = y
0
1
1
0
x
y
1
0
0
1
f = x
yz
x 00 01 11
0
1
10
0 1 1 0
1 0
0 1
.
x z
+
x z
+
f =( . ).( )
x z x z
+ + f = . .
x z x z
+
Internshala Trainings
93. yz
wx 01 11
11
01
00
00 10
1
10
0
1
0
1
1 1
1 1
0 0
1 1
0
0
0
x y z
+ + x y z
+ +
w y z
+ +
w x
+
f =( ).( ).( ).( )
x y z x y z w y z w x
+ + + + + + +
Internshala Trainings
94. yz
wx 01 11
11
01
00
00 10
10
1
1
1 1
1
1
0
0 x
x
0
x
x
1
1
1
Example
Obtain the minimized PoS by suitably using don’t care terms
f =( ).( ).( )
x w z x w y y z
+ + + + +
Internshala Trainings
95. Design Flow
System Description
Truth Table
Boolean Expression
Minimized
Boolean Expression
Gate Netlist
x
y
z
f
system
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
x y z f
f = . . . . . . . .
x y z x y z x y z x y z
+ + +
f = . .
x z x z
+
x
y
y
z
z
x
C
Internshala Trainings
96. Library of available Gates Cost
Inverter 1
Two input NAND 2
Three input NAND 3
AND-OR-Invert 3
C
AB
Y +
=
y
x1
x2
x3
x1
x2
x3
x2
x3
x1
x2
x3
x1
Mapping of Boolean expression to a Network of
gates available in the library
1 2 3 1 2 3 1 2 3 1 2 3
y= . . . . . . . .
x x x x x x x x x x x x
+ + +
Internshala Trainings
98. Implementation using only NAND gates
.
x x x
= .
x y
.
x y
x
y f = .
x y x y
= +
A SoP expression is easily implemented with NAND gates. f = . . .
a b c d g h
+ +
a
b
c
d
g
h
f
a
b
c
d
g
h
f
Internshala Trainings
100. Often there is lot of further optimization that can be done
Consider implementation of XOR gate . .
f A B A B
= +
. . . .
( ) ( )
f A B B B A B A A
B A B A A B
= + + +
= + + +
Internshala Trainings
101. Implementation using only NOR gates
x x x
+ =
x y
+
x y
+
x
y f = .
x y x y
+ =
To implement using NOR gates, it is easiest to start with minimized Boolean
expression in POS form
f =( ).( ).( )
a b c d g h
+ + +
Internshala Trainings
102. f =( ).( ).( )
a b c d g h
+ + +
a
b
c
d
g
h
f
a
b
c
d
g
h
f
a
b
c
d
g
h
f
There is a one-to-one mapping between OR-AND network and NOR network
Internshala Trainings
103. To implement SoP expression using NOR gates, determine first the
corresponding PoS expression and then follow the procedure
outlined earlier
Implement f(x,y,z)= . . using NOR gates
x z x z
+
yz
x 00 01 11
0
1
10
0 1 1 0
1 0
0 1 f =( . ).( )
x z x z
+ +
x
x
z
z
f
x
z
f
z
x
Similarly PoS expression can be implemented as NAND network by first
converting it to SoP expression and then following the procedure outlined
earlier
Internshala Trainings
105. Digital Circuits
Combinational Circuits Sequential Circuits
CC
X
Y
W
Output is determined by current
values of inputs only.
X
Z
CC
Storage
elements
Output is determined in general
by current values of inputs and
past values of inputs/outputs as
well.
Internshala Trainings
106. Design of Complex Combinational circuits
8-bit adder
B(0:7)
A(0:7) S(0:7)
C
C
00...0
A7A6...A0 B7B6...B0 S7S6...S0
00...0 00...0 0
00...1 00...0 00...1 0
00...1 0
00...1
00...0 Truth table has 216 entries
System
Description
Truth
Table
Boolean
expression
Minimized Boolean
expression
Gate
Netlist
This design approach becomes difficult to use
Internshala Trainings
107. B(0:7)
A(0:7) S(0:7)
8-bit adder
C
1-bit adder
1-bit adder
1-bit adder
A1
A7 B1
B7 A0
B0
S0
C0
S1
C1
S7
C7
Design system as a network of sub-systems that are of
manageable size and can be implemented using the
earlier approach of truth table, minimization etc.
a b c S CY
0 0
0 0
0 0
1
0 1 1
0 0
1
0 1
1
0
1
1
1
1 1
0 0
0
1 1
0
0
1
1
0
1 0
0
0
1
1
1
1
1 1 0 1
1 1 0 1 1
+ 1 1 1 0
Internshala Trainings
109. Decoders
2-to-4 line
decoder
B
A
y3
y0
y1
y2
Maps a smaller number of inputs to a larger set of outputs in general
Active Low
0 0
0
0
1
1 1
1
Y0 Y1 Y2 Y3
0 0
0
1
0 1 0 0
0 0 1 0
0 0 1
0
B A
2-to-4 line
decoder
A
B
y0
y2
y1
y3
0 0
0
0
1
1 1
1
b a Y0 Y1 Y2 Y3
0 1 1
1 1
0
1
0
1
1
1
1
0
1
1 1
Internshala Trainings
111. B
A
y2
y3
y1
y0
E
2/4
Decoder with Enable Input
Y0 Y1 Y2 Y3
A
B
E
0
0
0
1
1 0 1 0 0
0 0 1 0
0 1
0
1
1
1
1
0
1
1
0
0
x x
1 0 0 0
0 0 0
0
B
A
y2
y3
y1
y0
E
2/4 Y0 Y1 Y2 Y3
A
B
E
0
0
0
1
1 0 1 0 0
0 0 1 0
0 1
0
1
0
1
0
x x
1 0 0 0
0 0 0
0
1
0
0
0
0
Internshala Trainings
112. B
A
y2
y3
y1
y0
E
2/4
Y0 Y1 Y2 Y3
A
B
E
0
0
0
1
1 0 1 0 0
0 0 1 0
0 1
0
1
1
1
1
0
1
1
0
0
x x
1 0 0 0
0 0 0
0
Decoder: gate Implementation
0 1 2 3
Y =E.B.A ;Y =E.B.A;Y =E.B.A ;Y =E.B.A
B
A
E
Y0
Y1
Y2
Y3
E.B.A
E.B.A
E.B.A
E.B.A
Internshala Trainings
113. A n to 2n decoder is a minterm generator
x y min term
0 0 x . y m0
0 1 x . y m1
1 0 x . y m2
1 1 x . y m3
B
A
E
Y0
Y1
Y2
Y3
E.B.A
E.B.A
E.B.A
E.B.A
It can be used to implement any combinational circuit
0 0 0
0 1 1
1 0 1
1 1 0
f1
B A
B
A
y2
y1
y0
y3
f
1 E
2/4
1
0
0
1
0
0
1
Internshala Trainings
114. Implementation of a 3-variable function with a 3-to-8 decoder
A
B
C f
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 0
B
A
C
y1
y2
y3
y4
y5
y6
y7
y0
E
3/8
f
0
0
0
0
0
1
1
1
1
1
1
1
1
Although it is easy to implement any combinational circuit with this method ,
it is often very inefficient in terms of gate utilization. Note that this method
does not require any minimization.
Internshala Trainings
115. Implementing larger decoders using simpler ones.
3/8 decoder using 2/4 decoders
B
A
y2
y3
y1
y0
E
2/4
B
A
C
y1
y2
y3
y4
y5
y6
y7
y0
E
3/8
B
A
E
2/4
y4
y5
y6
y7
2/4
E
C
0
How many 2/4 decoders are required to implement a 4/16 decoder ?
Internshala Trainings
116. A
B
C
E y0 y1 y2 y3 y4 y5 y6 y7
0 x x x 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0 0 0
1 0 0 1 0 1 0 0 0 0 0 0
1 0 1 0 0 0 1 0 0 0 0 0
1 0 1 1 0 0 0 1 0 0 0 0
1 1 0 0 0 0 0 0 1 0 0 0
1 1 0 1 0 0 0 0 0 1 0 0
1 1 1 0 0 0 0 0 0 0 1 0
1 1 1 1 0 0 0 0 0 0 0 1
B
A
y2
y3
y1
y0
2/4
E y4
y6
y7
E
A
B
2/4
y5
E
C
0
2/4
Y0 Y1 Y2 Y3
A
B
E
0
0
0
1
1 0 1 0 0
0 0 1 0
0 1
0
1
1
1
1
0
1
1
0
0
x x
1 0 0 0
0 0 0
0
1
0
1
0
0
0
0
0
1
0
0
0
1
0
Internshala Trainings
122. Priority Encoders
Resource
4:1 MUX
x y
printer
D0
D1
D2
D3
Priority is 3,2,1,0 with user 3
having the highest priority
X, Y have to be determined
based on this priority order and
the requests to use the resource.
0 0
0
0
1 0
0
0
x y
R0 R1 R2
x x
0
R3
0
1
0
0
x 0 1
x x 1 0 1 0
x x 1
x 1 1
01 11
11
01
00
00
10
R3R2
R1R0
0 0 0
1
1 1
1
1
1
1 1
1
1 1
1
1
10
X
R0
R1
R2
R3
priority
Encoder
2 3
x R R
= +
01 11
11
01
00
00
10
R3R2
R1R0
10
Y
0 1 1
0 0 0 0
1 1 1
1 1 1
1
1
1 2 3
y R R R
= +
Internshala Trainings
123. Gray Codes
decimal Natural
Binary
Gray
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
1-bit change as one goes from
one code word to the next.
0111-1111-1000 0111-0000-1000
In the case of natural binary code:
In the case of Gray code, no such
problem occurs.
Internshala Trainings
128. Mux is often used when resources have to be shared
8-bit ader
S1
a(0:7) b(0:7) c(0:7) d(0:7)
0 0 1
1
S2
Y
S1 S0
0 0
1
0
0
1
1 1
a+c
a+d
b+c
b+d
y =
0 0
a c
= a+c
Internshala Trainings
129. Implementing Boolean expressions using Multiplexers
y
0
1
1 2 1 2
y x x x x
= +
1
x
?
?
x1 x2 y
0 0 0
0 1 1
y = x2 when x1 = 0
x2
1 0 1
1 1 0
y = x2 when x1 = 1
x2
Internshala Trainings
130. ( , , ) (1,2,6,7)
F x y z =
A 3 variable function can be implemented with a 4:1 mux with 2 select lines
00
01
10
11
F
y z
F
x y z
0 0
0 0
0 0
1 0
F = 0 when yz = 00
0
0 1
0 1
0 1
1 0
F = x when yz =01
x
1 0
1 0
0 1
1 1
F = 1 when yz = 10
1
1 1
1 1
0 0
1 1
F = x when yz = 11
x
Mux is more efficient way of implementing combinational circuits as
compared to decoders. Internshala Trainings
137. Adder/Subtractor
a b S
0 0
0 0
0 0
1
0 1 1
0 0
1
0 1
1
0
1
1
1
1 1
0 0
0
1 1
0
0
1
1
0
1 0
0
0
1
1
1
1
Cin Cout
Half Adder
a b
S
C
a b S
0
0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
C
. . ; .
S a b a b C a b
= + =
a
b
C
S
a b
S
Full Adder
Cout Cin
1 1 0
1 1 1
1
1 1 1 1
. . . . . . . . ; . . .
in in in in out in in
S a b c a b c a b c a b c C a b a c b c
= + + + = + +
Internshala Trainings
138. . . . . . . . .
in in in in
S a b c a b c a b c a b c
= + + +
. . .
out in in
C a b a C b C
= + +
( )
in
S C a b
=
( . . ) . .( ) .
out in in
C C a b a b a b C a b a b
= + + = +
a
b S
Cin
Cout
a b
( )
in
C a b
.
a b
.( )
in
C a b
Internshala Trainings
140. Subtraction
A - B = A + 2’s complement of B
A - B = A + 1’s complement of B+1
FA
FA
FA
FA
A3 A2 A1 A0
1
B0
B1
B2
1
B3
A - B = A + B+1
0
B
1
B
2
B
3
B
One needs add a circuit for predicting errors resulting from overflow
Internshala Trainings
141. Adder/Subtractor
FA
FA
FA
FA
A3 A2 A1 A0
B1 B0
B2
B3
0 FA
FA
FA
FA
A3 A2 A1 A0
1
B0
B1
B2
1
B3
FA
FA
FA
FA
A3 A2 A1 A0
B0
B1
B2
B3
M = 1
Internshala Trainings
144. Digital Circuits
Combinational Circuits Sequential Circuits
CC
X
Y
W
Output is determined by current
values of inputs only.
CC
Storage
elements
X Z
Output is determined in general
by current values of inputs and
past values of inputs/outputs as
well.
Internshala Trainings
145. NOR SR Latch
Q
Q
R
S
1; 0 Set State
Q Q
= =
0; 1 Re et State
Q Q s
= =
1
0
0
0
1
1 0 1 0
S R Q Q State
SET
Internshala Trainings
146. NOR SR Latch
Q
Q
R
S
1; 0 Set State
Q Q
= =
0; 1 Re et State
Q Q s
= =
1
0
0
0 1
1 0 1 0
S R Q Q State
SET
0 1 0 1 RESET
Reset
Set
Internshala Trainings
147. Q
Q
R
S
HOLD State
0
0
S R Q Q State
1 0 1 0 SET
0 1 0 1 RESET
0 0 HOLD
1
1
0
Q Q
1 1 0 0 INVALID
Internshala Trainings
148. Q
Q
R
S
1
1
0
0
Both the outputs are well defined and
0. the first problem is that we do not
get complementary output.
A more serious problem occurs when we switch the latch to the hold state by
changing RS from 11 → 00 . Suppose the inputs do not change
simultaneously and we get the situation 11 → 01* → 00
Q
Q
R
S
Q
Q
R
S
Q
Q
R
S
1
1
0
0
0
1
1
0
0
0
1
0
Q = 1
Internshala Trainings
149. Q
Q
R
S
Q
Q
R
S Q
Q
R
S
1
1
0
0
0
1
1
0
0
0
1
0
Q = 1
Q
Q
R
S
Q
Q
R
S
Q
Q
R
S
1
1
0
0
1
0
0
1
0
0
0
1
Q = 0
Suppose the inputs change as RS = 11 → 10* → 00
So although output is well defined when we apply RS = 11, it becomes
unpredictable once we switch the latch to hold state by applying RS = 00. That
is why RS = 11 is not used as an input combination.
Internshala Trainings
150. The error can occur also due to unequal gate delays.
Q
Q
R
S
1
2
1
1
0
0
Q
Q
R
S
1
2
0
0
0
0
Suppose gate-1 is faster
Q
Q
R
S
1
2
0
0
1
0
0
Q = 1
On the other hand suppose that gate-2 is faster.
Q
Q
R
S
1
2
1
1
0
0
Q
Q
R
S
1
2
0
0
0
0 Q
Q
R
S
1
2
0
0
1
0
0
Q = 0
Again the output is unpredictable in general
Internshala Trainings
151. NAND Latch
Q
Q
R
S
S R Q Q State
0 1 1 0 SET
1 0 0 1 RESET
1 1 HOLD
Q Q
0 0 1 1 INVALID
Internshala Trainings
152. RS NAND Latch with Enable
Q
Q
R
S
EN
0
1
1
Hold State
Q
Q
R
S
EN
1
S
R
Enable State
S R Q Q
0
1
1
1
1
Hold
Set
Reset
Hold
Invalid
x x
1 0 1 0
0 1 0 1
Q Q
Q Q
1 1
0 0
0 0
Internshala Trainings
153. D latch
Q
Q
S
R
Q
S
R Q
D
EN
EN
Enable State
S R Q Q
0
1
1
1
1
Hold
Set
Reset
Hold
Invalid
x x
1 0 1 0
0 1 0 1
Q Q
Q Q
1 1
0 0
0 0
1 1
0
0
1
If EN = 1 then Q = D otherwise the latch is in Hold state
1
Q
Q
D
EN
Internshala Trainings
164. Characteristic table
Q
D
clk
Q(t+1)
Inputs (D)
0 0
1 1
Q
clk
J
K
Q(t+1)
Inputs
JK Flip-flop
J K
0 0 Q(t)
0
0 1
1 0 1
1 1 Q(t)
Given a input and the present state of the flip-flop,
what is the next state of the flip-flop
( 1)
Q t D
+ =
( 1) ( ). ( ).
Q t Q t J Q t K
+ = + →Characteristic equation
Internshala Trainings
165. Q
clk
T Q(t+1)
Inputs (T)
0 Q(t)
1
Toggle or T Flip-flop
Q(t)
Excitation Table
Inputs
0 0
0 1
1 0
1 1
Q(t+1)
Q(t) T
What inputs are required to effect a particular state change
0
0
1
1
( 1) ( ). ( ).
Q t Q t T Q t T
+ = +
Internshala Trainings
166. Excitation Table
Q
clk
J
K
J K Q(t+1)
Q(t)
0 0
0 1
1 0
1 1 Q(t)
0
1
Inputs
0 0
0 1
1 0
1 1
Q(t+1)
Q(t)
X 0
J K
0 X
1 X
X 1
Q
D
clk
Q(t+1)
D
0 0
1 1
Inputs
0 0
0 1
1 0
1 1
Q(t+1)
Q(t) D
0
1
0
1
Internshala Trainings
167. Convert a D FF to JK FF
clk
Q
D
K
CC
J
J K Q(t+1)
0 0
0 1
1 0
1 1 Q(t)
0
1
Q(t)
D
Q(t)
0
1
Q(t)
00 01 11
0
1
10
0 0
1
Q
JK
1
0
1
1
0
. .
D Q J Q K
= +
clk
D
K
J
Q
Q
Internshala Trainings