4.
1 Find the minimum-cost SOP and POS forms for the function f (x1, x2, x3) = ∑m(1, 2, 3, 5).
Solution:
f (x1, x2 , x3 ) = ∑m(1,2,3,5)
x1x2
x3 00 01 11 10
0
0 1 0 0
0 2 6 4
1
1 1 0 1
1 3 7 5
f ( x1, x2 , x3 ) = x1x2 + x2 x3
Mapping the 1’s from the K-map as follows
f ( x1 , x2 , x3 ) = x1 x2 + x2 x3 - This is the minimum-cost SOP form.
f (x1, x2 , x3 ) = ∑m(1,2,3,5)
x1x2
x3 00 01 11 10
0
0 1 0 0
0 2 6 4
1
1 1 0 1
1 3 7 5
f (x1, x2 , x3 ) = ( x1 + x2 )(x2 + x3 )
Mapping the 0’s from the K-map as follows
f ( x1 , x2 , x3 ) = ( x1 + x2 )( x2 + x3 ) - This is the minimum-cost POS form.
4.2 Repeat problem 4.1 for the function f (x1, x2, x3) = ∑m(1, 4, 7) + D(2, 5).
Solution:
f ( x1, x2 , x3 ) = ∑m(1,4,7) + D(2,5)
x1x2
x3 00 01 11 10
0
0 d 0 1
0 2 6 4
1
1 0 1 d
1 3 7 5
f ( x1, x2 , x3 ) = x2 x3 + x1x3 + x1 x2
Mapping the 1’s from the K-map as follows
f ( x1 , x 2 , x3 ) = x 2 x3 + x1 x3 + x1 x 2 -This is the minimum-cost SOP form.
f ( x1, x2 , x3 ) = ∑m(1,4,7) + D(2,5)
x1x2
x3 00 01 11 10
0
0 d 0 1
0 2 6 4
1
1 0 1 d
1 3 7 5
f (x1, x2 , x3 ) = (x1 + x3 )(x1 + x2 )(x2 + x3 )
Mapping the 0’s from the K-map as follows
f ( x1 , x 2 , x3 ) = ( x 2 + x3 )( x1 + x3 )( x1 + x 2 ) This is the minimum-cost POS form.
4.5 Repeat problem 4.1 for the function f (x1, . . . , x5) = ∏M(1, 4, 6, 7, 9, 12,15, 17, 20, 21,
22, 23, 28, 31).
Solution:
f ( x1, x2 , x3 , x4 , x5 ) = ∏ M (1, 4, 6, 7, 9, 12,15,17, 20, 21,22,23, 28, 31)
x1x2 . x1x2
00 01 11 10 00 01 11 10
x3x4 x3x4
00 1 1 1 1 00 0 0 1 0
0 8 24 16 1 9 25 17
01 1 1 1 1 01 1 1 1 1
2 10 26 18 3 11 27 19
11 0 1 1 0 11 0 0 0 0 x1x2 x4 x5
6 14 30 22 7 15 31 23
10 0 0 0 0 10 1 1 1 0
4 12 28 20 5 13 29 21
x5 = 0 x5 = 1
x2 x4 x5 x3 x4
x5 .x3 x1x3 x4 x5
or
f ( x1 , x2 , x3 , x4 , x5 ) = ∏ M (1, 4, 6, 7, 9,12,15,17, 20, 21,22,23, 28, 31)
.
x2x3 00 01 11 10 x2x3 00 01 11 10
x4x5 x4x5
00 1 0 0 1 00 1 0 0 1
0 4 12 8 16 20 28 24
01 0 1 1 0 01 0 0 1 1
1 5 13 9 17 21 29 25
11 1 0 0 1 11 1 0 0 1
3 7 15 11 19 23 31 27
10 1 0 1 1 10 1 0 1 1
2 6 14 10 18 22 30 26
x1 = 0 x1 = 1
x2 x4 x5
x5 .x3 x1 x2 x4 x5
x1 x3 x4 x5
x3 x4
Mapping the 1’s from the K-map as follows
f ( x1 , x2 , x3 , x4 , x5 ) = x3 .x5 + x2 x4 x5 + x3 x4 + x1 x3 x4 x5 + x1 x2 x4 x5 This is the minimum-cost
SOP form.
f ( x1 , x2 , x3 , x4 , x5 ) = ∏ M (1, 4, 6, 7, 9, 12,15,17, 20, 21,22,23, 28, 31)
x1x2 . x1x2
00 01 11 10 00 01 11 10
x3x4 x3x4
00 1 1 1 1 00 0 0 1 0
0 8 24 16 1 9 25 17
01 1 1 1 1 01 1 1 1 1
2 10 26 18 3 11 27 19
11 0 1 1 0 11 0 0 0 0
6 14 30 22 7 15 31 23
10 0 0 0 0 10 1 1 1 0
4 12 28 20 5 13 29 21
x5 = 0 x5 = 1
(x + x + x + x )
(x + x + x )
3 4 5 (x + x + x )
2 3 4
(x + x + x )
1 3 4 5
3 4 5
(x + x + x + x )
1 2 4 5
or
(x + x + x )
3 4 5
x2x3 00 01 11 10 x2x3 00 01 11 10
x4x5 x4x5
00 1 0 0 1 00 1 0 0 1
0 4 12 8 16 20 28 24
01 0 1 1 0 01 0 0 1 1
1 5 13 9 17 21 29 25
11 1 0 0 1 11 1 0 0 1
3 7 15 11 19 23 31 27
10 1 0 1 1 10 1 0 1 1
2 6 14 10 18 22 30 26
x1 = 0 x1 = 1
(x + x + x ) 3 4 5
(x + x + x ) 2 3 4
(x + x + x + x )
1 3 4 5 (x + x + x + x ) 1 2 4 5
Mapping the 0’s from the K-map as follows
f ( x1 , x2 , x3 , x4 , x5 ) = ( x3 + x4 + x5 )( x2 + x3 + x4 )( x3 + x4 + x5 )( x1 + x3 + x4 + x5 )( x1 + x2 + x4 + x5 )
This is the minimum-cost POS form
4.9 A four-variable logic function that is equal to 1 if any three or all four of its variables are
equal to 1 is called a majority function. Design a minimum-cost SOPcircuit that implements
this majority function.
Solution:
Truth table: f ( x1 , x 2 , x3 , x 4 ) = ∑ m(7,11,13,14,15)
f ( x1, x2 , x3 , x4 ) = ∑m(7,11,13,14,15)
x1 x2 x3 x4 f
0 0 0 0 0 x1x2 00 01 11 10
0 0 0 1 0 x3x4
0 0 1 0 0
0 0 1 1 0 00
0 1 0 0 0 0 0 0 0
0 1 0 1 0 0 4 12 8
0 1 1 0 0
01 0 0 1 0
0 1 1 1 1
1
x1 x2 x4
1 0 0 0 0 5 13 9
1 0 0 1 0
1 0 1 0 0 11 0 1 1 1 x1 x3 x4
1 0 1 1 1 3 7 15 11
1 1 0 0 0
1 1 0 1 1 10 0 0 1 0
1 1 1 0 1 2 6 14 10
1 1 1 1 1
f (x1, x2 , x3 ) = (x1 + x3 )(x1 + x2 )(x2 + xx31)x2 x3
x2 x3 x4
Mapping the 1’s from the K-map as follows
f ( x1 , x 2 , x3 ) = x1 x 2 x3 + x1 x 2 x 4 + x 2 x3 x 4 + x1 x3 x 4 -This is the minimum-cost SOP form.
4.12 A circuit with two outputs has to implement the following functions
f (x1, . . . , x4) =∑m(0, 2, 4, 6, 7, 9) + D(10, 11)
g(x1, . . . , x4) =∑m(2, 4, 9, 10, 15) + D(0, 13, 14)
Design the minimum-cost circuit and compare its cost with combined costs of two circuits
that implement f and g separately. Assume that the input variables are available in both
uncomplemented and complemented forms.
Solution:
The Karnaugh Map for getting the minimum cost SOP form for the function f is:
f (x1, x2 , x3 , x4 ) = ∑m(0,2,4,6,7,9) + D(10,11)
x1x2 00 01 11 10
x3x4
00
1 1 0 0
0 4 12 8
01 0 0 0 1 x1 x2 x4
1 5 13 9
x1.x4 11 0 1 0 d
3 7 15 11
10 1 1 0 d
2 6 14 10
f (x1, x2 , x3 ) = (x1 + x3 )(x1 + x2 )(x2 + x3 )
x1 x2 x3
From the Karnaugh map the minimum cost SOP expression is
f ( x1 , x2 , x3 , x4 ) = x1.x4 + x1 x2 x3 + x1 x2 x4
The realization of function requires,
Two 3-input AND gate.
One 2-input AND gate.
One 3-input OR gate.
The number of gates needed to implementation the function is:
The cost of f=total no. of gates+ total no of inputs=(2+1+1)+{(2)(3)+(2)(1)+(3)(1)}=15
g(x1, x2 , x3 , x4 ) = ∑m(2,4,9,10,15) + D(0,13,14)
x1x2 00 01 11 10
x3x4
00
d 1 0 0
0 4 12 8
01 0 0 d 1
1 5 13 9
11 0 0 1 0 x1 x2 x3
3 7 15 11
10 1 0 d 1
2 6 14 10
f (x1, x2 , x3 ) = (x1 + x3 )(x1 + x2 )(x2 + x3 )
x1.x3.x4 x1 x3 x4
x2 x3 x4
From the Karnaugh map the minimum cost SOP expression is
g ( x1 , x2 , x3 , x4 ) = x1.x3 .x4 + x2 x3 x4 + x1 x3 x4 + x1 x2 x3
The realization of this function requires,
Four 3-input AND gate.
One 4-input OR gate.
The number of gates needed to implementation the function is:
The cost of g=total no. of gates+ total no of inputs=(4+1)+{(3)(4)+(4)(1)}=21
The total cost of realization of function f and g is=15+21=36
In order to find the combined cost of implementing both the function f and g, we draw the
Karnaugh map of f and g and groped the elements such that both the function have as
many common groping as they possibly can have. Hence the resultant modified
Karnaugh maps
f (x1, x2 , x3 , x4 ) = ∑m(0,2,4,6,7,9) + D(10,11) g(x1, x2 , x3 , x4 ) = ∑m(2,4,9,10,15) + D(0,13,14)
x1x2 00 01 11 10
x1x2 00 01 11 10
x3x4 x3x4
00 00
1 1 0 0 d 1 0 0
0 4 12 8 0 4 12 8
01 0 0 0 1 01 0 0 d 1
1 5 13 9 1 5 13 9
11 0 1 0 d 11 0 0 1 0
3 7 15 11 3 7 15 11
10 1 1 0 d 10 1 0 d 1
2 6 14 10 2 6 14 10
f (x1, x2 , x3 ) = (x1 + x3x)(xx1 x+ x2 )(x2 + x3 ) f (x1, x2 , x3 ) = (x1 + x3 )(x1 + x2 )(x2 + x3 )
x1.x3.x4 1 2 3 x1.x3.x4 x1 x2 x3
x2 x3 x4 x1.x2 .x3 x4
x2 x3 x4
x1.x2 .x3 x4
Modified minimum cost SOP forms are
f (x1, x2 , x3 , x4 ) = x1.x3.x4 + x2 x3 x4 + x1 x2.x3 x4 + x1x2 x3
g(x1, x2 , x3 , x4 ) = x1.x3.x4 + x2 x3 x4 + x1 x2.x3 x4 + x1x2 x3
Hence the first three terms are shared between the two functions.
The implementation of both the functions require:
Four 3-input AND gate
One 4-input AND gate
Two 4-input OR gate
Now the combine cost of the system is
The cost of system=total no. of gates+ total no of
inputs=(4+1+2)+{(3)(4)+(4)(1)+(4)(2)}=31
4.14 Implement the logic circuit in Figure 4.23 using NAND gates only.
Solution: the followings are the logic functions for g and f:
g ( x1 , x2 ) = x1.x2 + x1 x2
f ( x3 , x4 , g ) = x3 g + g x4
Now implementing the logic using only NAND gate can be done by considering the
following relationships
A = ( A. A) = (A ↑ A)
A + B = A.B = (A ↑ A) ↑ (B ↑ B )
AB = AB = (A ↑ B ) ↑ (A ↑ B )
Implementation of given logic function using only NAND gate is:
( )( )
g ( x1 , x2 ) = x1.x2 + x1 x2 = x1.x2 + x1 x2 = x1.x2 x1 x2
x1.x2 = x1.x2 .x2 = x1 ↑ (x2 ↑ x2 )
x1 x2 = x1.x1.x2 = (x1 ↑ x1 ) ↑ x2
[ ] [
g = (x1 ↑ (x2 ↑ x2 )) ↑ (x1 ↑ x1 ) ↑ x2 ]
( ) ( )
f ( x3 , x4 , g ) = x3 g + g x4 = x3 g + g x4 = ( x3 g ). g x4
(x3 g ) = x3 ↑ g
(g x ) = g ↑ x = (g ↑ g ) ↑ x
4 4 4
f = [x ↑ g ] ↑ [(g ↑ g ) ↑ x ]
3 4
x1
x2
g
x2
x1
g
x3
f
x4
g