Chapter 4
4.1. SOP form: f = x1 x2 + x2 x3
POS form: f = (x1 + x2 )(x2 + x3 )
4.2. SOP form: f = x1 x2 + x1 x3 + x2 x3
POS form: f = (x1 + x3 )(x1 + x2 )(x2 + x3 )
4.3. SOP form: f = x1 x2 x3 x4 + x1 x2 x3 x4 + x2 x3 x4
POS form: f = (x1 + x4 )(x2 + x3 )(x2 + x3 + x4 )(x2 + x4 )(x1 + x3 )
4.4. SOP form: f = x2 x3 + x2 x4 + x2 x3 x4
POS form: f = (x2 + x3 )(x2 + x3 + x4 )(x2 + x4 )
4.5. SOP form: f = x3 x5 + x3 x4 + x2 x4 x5 + x1 x3 x4 x5 + x1 x2 x4 x5
POS form: f = (x3 + x4 + x5 )(x3 + x4 + x5 )(x2 + x3 + x4 )(x1 + x3 + x4 + x5 )(x1 + x2 + x4 + x5 )
4.6. SOP form: f = x2 x3 + x1 x5 + x1 x3 + x3 x4 + x2 x5
POS form: f = (x1 + x2 + x3 )(x1 + x2 + x4 )(x3 + x4 + x5 )
4.7. SOP form: f = x3 x4 x5 + x3 x4 x5 + x1 x4 x5 + x1 x2 x4 + x3 x4 x5 + x2 x3 x4 + x2 x3 x4 x5
POS form: f = (x3 + x4 + x5 )(x3 + x4 + x5 )(x1 + x2 + x3 + x4 + x5 )
P
4.8. f = P m(0, 7)
f = P m(1, 6)
f = P m(2, 5)
f = P m(0, 1, 6)
f = m(0, 2, 5)
etc.
4.9. f = x1 x2 x3 + x1 x2 x4 + x1 x3 x4 + x2 x3 x4
4.10. SOP form: f = x1 x2 x3 + x1 x2 x4 + x1 x3 x4 + x1 x2 x3 + x1 x3 x4 + x2 x3 x4
POS form: f = (x1 + x2 + x3 )(x1 + x2 + x4 )(x1 + x3 + x4 )(x2 + x3 + x4 )(x1 + x2 + x3 + x4 )
The POS form has lower cost.
P
4.11. The statement is false. As a counter example consider f (x 1 , x2 , x3 ) = m(0, 5, 7).
Then, the minimum-cost SOP form f = x1 x3 + x1 x2 x3 is unique.
But, there are two minimum-cost POS forms:
f = (x1 + x3 )(x1 + x3 )(x1 + x2 ) and
f = (x1 + x3 )(x1 + x3 )(x2 + x3 )
4-1
4.12. If each circuit is implemented separately:
f = x 1 x 4 + x 1 x2 x3 + x 1 x2 x4 Cost= 15
g = x 1 x 3 x4 + x 2 x3 x4 + x 1 x 3 x4 + x 1 x2 x4 Cost = 21
In a combined circuit:
f = x 2 x3 x4 + x 1 x3 x4 + x 1 x 2 x 3 x4 + x 1 x2 x3
g = x 2 x3 x4 + x 1 x3 x4 + x 1 x 2 x 3 x4 + x 1 x2 x4
The first 3 product terms are shared, hence the total cost is 31.
4.13. If each circuit is implemented separately:
f = x 1 x2 x4 + x 2 x4 x5 + x 3 x 4 x 5 + x 1 x2 x4 x5 Cost = 22
g = x 3 x 5 + x 4 x 5 + x 1 x2 x4 + x 1 x2 x4 + x 2 x4 x5 Cost = 24
In a combined circuit:
f = x 1 x2 x4 + x 2 x4 x5 + x 3 x 4 x 5 + x 1 x2 x4 x5
g = x 1 x2 x4 + x 2 x4 x5 + x 3 x 4 x 5 + x 1 x2 x4 x5 + x 3 x 5
The first 4 product terms are shared, hence the total cost is 31. Note that in this implementation f ⊆ g, thus
g can be realized as g = f + x3 x5 , in which case the total cost is lowered to 28.
4.14. f = (x3 ↑ g) ↑ ((g ↑ g) ↑ x4 ) where g = (x1 ↑ (x2 ↑ x2 )) ↑ ((x1 ↑ x1 ) ↑ x2 )
4.15. f = (((x3 ↓ x3 ) ↓ g) ↓ ((g ↓ g) ↓ (x4 ↓ x4 )), where
g = ((x1 ↓ x1 ) ↓ x2 ) ↓ (x1 ↓ (x2 ↓ x2 )). Then, f = f ↓ f .
4.16. f = (g ↑ k) ↑ ((g ↑ g) ↑ (k ↑ k)), where g = (x1 ↑ x1 ) ↑ (x2 ↑ x2 ) ↑ (x5 ↑ x5 )
and k = (x3 ↑ (x4 ↑ x4 )) ↑ ((x3 ↑ x3 ) ↑ x4 )
4.17. f = (g ↓ k) ↓ ((g ↓ g) ↓ (k ↓ k)), where g = x1 ↓ x2 ↓ x5
and k = ((x3 ↓ x3 ) ↓ x4 ) ↓ (x3 ↓ (x4 ↓ x4 )). Then, f = f ↓ f .
4.18. f = x1 (x2 + x3 )(x4 + x5 ) + x1 (x2 + x3 )(x4 + x5 )
4.19. f = x1 x3 x4 + x2 x3 x4 + x1 x3 x4 + x2 x3 x4 = (x1 + x2 )x3 x4 + (x1 + x2 )x3 x4
This requires 2 OR and 2 AND gates.
4.20. f = x1 · g + x1 · g, where g = x3 x4 + x3 x4
4.21 f = g · h + g · h, where g = x1 x2 and h = x3 + x4
4.22. Let D(0, 20) be 0 and D(15, 26) be 1. Then decomposition yields:
g = x5 (x1 + x2 )
f = (x3 x4 + x3 x4 )g + x3 x4 g = x3 x4 g + x3 x4 g + x3 x4 g
Cost = 9 + 18 = 27
4-2
The optimal SOP form is:
f = x 3 x4 x5 + x 1 x3 x4 x5 + x 1 x 2 x3 x4 + x 1 x 3 x4 x5 + x 2 x3 x 4 x5 + x 2 x3 x4 x5
Cost = 7 + 29 = 36
4.23. The prime implicants are generated as follows:
List 1 List 2
0 0 0 0 0 0,2 0 0 x 0
0,4 0 x 0 0
2 0 0 1 0 0,8 x 0 0 0
4 0 1 0 0
8 1 0 0 0 4,5 0 1 0 x
8,9 1 0 0 x
5 0 1 0 1
9 1 0 0 1 5,7 0 1 x 1
7 0 1 1 1 7,15 x 1 1 1
15 1 1 1 1
The initial prime implicant table is
Prime Minterm
implicant 0 2 4 5 7 8 9 15
p1 0 0 x 0
p2 0 x 0 0
p3 x 0 0 0
p4 0 1 0 x
p5 1 0 0 x
p6 0 1 x 1
p7 x 1 1 1
The prime implicants p1 , p5 and p7 are essential. Removing these prime implicants gives
Prime Minterm
implicant 4 5
p2
p3
p4
p6
Since p4 covers both minterms, the final cover is
C = {p1 , p4 , p5 , p7 }
= {00x0, 010x, 100x, x111}
4-3
and the function is implemented as
f = x 1 x 2 x4 + x 1 x2 x 3 + x 1 x 2 x3 + x 2 x3 x4
4.24. The prime implicants are generated as follows:
List 1 List 2 List 3
0 0 0 0 0 0,4 0 x 0 0 3,7,11,15 x x 1 1
0,8 x 0 0 0 9,11,13,15 1 x x 1
4 0 1 0 0
8 1 0 0 0 4,6 0 1 x 0
8,9 1 0 0 x
3 0 0 1 1
6 0 1 1 0 3,7 0 x 1 1
9 1 0 0 1 3,11 x 0 1 1
6,7 0 1 1 x
7 0 1 1 1
11 1 0 1 1 9,11 1 0 x 1
13 1 1 0 1 9,13 1 x 0 1
15 1 1 1 1 7,15 x 1 1 1
11,15 1 x 1 1
13,15 1 1 x 1
The initial prime implicant table is
Prime Minterm
implicant 0 4 6 8 9 15
p1 0 x 0 0
p2 x 0 0 0
p3 0 1 x 0
p4 1 0 0 x
p5 0 1 1 x
p6 x x 1 1
p7 1 x x 1
There are no essential prime implicants. Prime implicant p3 dominates p5 and their costs are the same, so
remove p5 . Similarly, p7 dominates p6 , so remove p6 . This gives
Prime Minterm
implicant 0 4 6 8 9 15
p1
p2
p3
p4
p7
4-4
Now, p3 and p7 are essential, which leaves
Prime Minterm
implicant 0 8
p1
p2
p4
Choosing p2 results in the minimum cost cover
C = {p2 , p3 , p7 }
= {x000, 01x0, 1xx1}
and the function is implemented as
f = x 2 x 3 x4 + x 1 x2 x 4 + x 1 x4
4.25. The prime implicants are generated as follows:
List 1 List 2 List 3
0 0 0 0 0 0,4 0 x 0 0 0,4,8,12 x x 0 0
0,8 x 0 0 0
4 0 1 0 0 4,5,12,13 x 1 0 x
8 1 0 0 0 4,5 0 1 0 x 8,9,12,13 1 x 0 x
4,12 x 1 0 0
3 0 0 1 1
8,9 1 0 0 x
5 0 1 0 1
8,12 1 x 0 0
9 1 0 0 1
12 1 1 0 0 3,7 0 x 1 1
3,11 x 0 1 1
7 0 1 1 1
5,7 0 1 x 1
11 1 0 1 1
5,13 x 1 0 1
13 1 1 0 1
9,11 1 0 x 1
14 1 1 1 0
9,13 1 x 0 1
12,13 1 1 0 x
12,14 1 1 x 0
4-5
The initial prime implicant table is
Prime Minterm
implicant 0 3 4 5 7 9 11
p1 0 x 1 1
p2 x 0 1 1
p3 0 1 x 1
p4 1 0 x 1
p5 x x 0 0
p6 x 1 0 x
p7 1 x 0 x
p8 1 1 x 0
Prime implicant p5 is essential, so remove columns 0 and 4 to get
Prime Minterm
implicant 3 5 7 9 11
p1
p2
p3
p4
p6
p7
Here, p3 dominates p6 , and p4 dominates p7 ; but costs of p3 and p4 are greater than the costs of p6 and p7 ,
respectively. So, use branching. First choose p3 to be in the final cover, which leads to
Prime Minterm
implicant 3 9 11
p1
p2
p4
p6
p7
Now, choose p2 and p7 (lower cost than p4 ) to cover the remaining minterms. The resulting cover is
C = {p2 , p3 , p5 , p7 }
= {x011, 01x1, xx00, 1x0x}
4-6
Next, assume that p3 is not included in the final cover, which leads to
Prime Minterm
implicant 3 5 7 9 11
p1
p2
p4
p6
p7
Then p6 is essential. Also, column 3 dominates 7, hence remove 3 giving
Prime Minterm
implicant 7 9 11
p1
p2
p4
p7
Choose p1 and p4 , which results in the cover
C = {p1 , p4 , p5 , p6 }
= {0x11, 10x1, xx00, x10x}
Both covers have the same cost, so choosing the first cover the function can be implemented as
f = x 2 x3 x4 + x 1 x2 x4 + x 3 x4 + x 1 x3
Observe that if we had not taken the cost of prime implicants (rows) into account and pursued the dominance
of p3 over p6 and p4 over p7 , then we would have removed p6 and p7 giving the following table
Prime Minterm
implicant 3 5 7 9 11
p1
p2
p3
p4
Now p3 and p4 are essential. Also choose p1 , so that
C = {p1 , p3 , p4 , p5 }
= {0x11, 01x1, 10x1, xx00}
The cost of this cover is greater by one literal compared to both covers derived above.
4-7
4.26. Note that X # Y = X · Y . Therefore,
(A · B)#C = A·B·c
(A#C) · (B#C) = A·C ·B·C
= A·B·C
Similarly,
(A + B)#C = (A + B) · C
= A·C +B·C
(A#C) + (B#C) = A·C +B·C
4.27. The initial cover is C 0 = {0000, 0011, 0100, 0101, 0111, 1000, 1001, 1111}.
Using the ∗-product get the prime implicants
P = {00x0, 0x00, x000, 010x, 01x1, 100x, x111}.
The minimum cover is Cminimum = {00x0, 010x, 100x, x111}, which corresponds to f = x 1 x2 x4 +
x 1 x2 x3 + x 1 x2 x 3 + x 2 x3 x4 .
4.28. The initial cover is C 0 = {0x0x0, 110xx, x1101, 1001x, 11110, 01x10, 0x011}.
Using the ∗-product get the prime implicants
P = {0x0x0, xx01x, x1x10, 110xx, x10x0, 11x01, x1101}.
The minimum cover is Cmimimum = {0x0x0, xx01x, x1x10, 110xx, x1101}, which corresponds to f =
x 1 x3 x5 + x 3 x4 + x 2 x4 x 5 + x 1 x2 x3 + x 2 x3 x 4 x5 .
4.29. The initial cover is C 0 = {00x0, 100x, x010, 1111, 00x1, 011x}.
Using the ∗-product get the prime implicants P = {00xx, 0x1x, x00x, x0x0, x111}.
The minimum-cost cover is Cminimum = {x00x, x0x0, x111}, which corresponds to f = x 2 x3 + x2 x4 +
x2 x3 x4 .
4.30. Expansion of x1 x2 x3 gives x1 .
Expansion of x1 x2 x3 gives x1 .
Expansion of x1 x2 x3 gives x1 .
Expansion of x1 x2 x3 gives x2 x3 .
The set of prime implicants comprises x1 and x2 x3 .
4.31. Expansion of x1 x2 x3 x4 gives x2 x3 x4 and x1 x2 x4 .
Expansion of x1 x2 x3 x4 gives x2 x3 x4 .
Expansion of x1 x2 x3 x4 gives x3 x4 .
Expansion of x1 x2 x3 gives x1 x3 .
Expansion of x2 x3 gives x2 x3 .
The set of prime implicants comprises x2 x3 x4 , x1 x2 x4 , x3 x4 , x1 x3 , and x2 x3 .
4.32. Representing both functions in the form of Karnaugh map, it is easy to show that f = g. The minimum cost
SOP expression is
f = g = x 2 x3 x 5 + x 2 x3 x4 + x 1 x3 x4 + x 1 x2 x4 x5 .
4-8
4.33. The cost of the circuit in Figure P4.2 is 11 gates and 30 inputs, for a total of 41. The functions implemented
by the circuit can also be realized as
f = x 1 x2 x4 + x 2 x3 x 4 + x 1 x3 x4 + x 1 x4
g = x 1 x2 x4 + x 2 x3 x 4 + x 1 x3 x4 + x 2 x4 + x 3 x4
The first three product terms in f and g are the same; therefore, they can be shared. Then, the cost of
implementing f and g is 8 gates and 24 inputs, for a total of 32.
4.34. The cost of the circuit in Figure P4.3 is 11 gates and 26 inputs, for a total of 37. The functions implemented
by the circuit can also be realized as
f = (x2 ↑ x4 ) ↑ (x1 ↑ x2 ↑ x3 ) ↑ (x1 ↑ x2 ↑ x3 ) ↑ (x2 ↑ x3 )
g = (x2 ↑ x4 ) ↑ (x1 ↑ x2 ↑ x3 ) ↑ (x1 ↑ x2 ↑ x3 ) ↑ (x1 ↑ x1 )
The first three NAND terms in f and g are the same; therefore, they can be shared. Then, the cost of imple-
menting f and g is 7 gates and 20 inputs, for a total of 27.
4.35. Using gate level primitives, the circuit in Figure 4.25b can be implemented using the code
module prob4 35 (x1, x2, x3, x4, x5, f);
input x1, x2, x3, x4, x5;
output f;
or (g, x1, x2, x5);
not (notx3, x3);
not (notx4, x4);
and (a, x3, notx4);
and (b, notx3, x4);
or (k, a, b);
and (c, g, k);
not (notg, g);
not (notk, k);
and (d, notg, notk);
or (f, c, d);
endmodule
4-9
4.36. Using continuous assignment, the circuit in Figure 4.25b can be implemented using the code
module prob4 36 (x1, x2, x3, x4, x5, f);
input x1, x2, x3, x4, x5;
output f;
wire g, k;
assign g = (x1 | x2 | x5);
assign k = (x3 & ∼x4) | (∼x3 & x4);
assign f = (g & k) | (∼g & ∼k);
endmodule
4.37. Using gate level primitives, the circuit in Figure 4.27c can be implemented using the code
module prob4 37 (x1, x2, x3, x4, x5, x6, x7, f);
input x1, x2, x3, x4, x5, x6, x7;
output f;
nand (a, x1, x1);
nand (b, x2, x3);
nand (c, a, b);
nand (d, x5, x5);
nand (e, x6, x6);
nand (g, d, e);
nand (h, x4, g);
nand (j, x7, x7);
nand (k, h, j);
nand (m, c, k);
nand (f, m, m);
endmodule
4.38. Using continuous assignment, the circuit in Figure 4.27c can be implemented using the code
module prob4 38 (x1, x2, x3, x4, x5, x6, x7, f);
input x1, x2, x3, x4, x5, x6, x7;
output f;
wire a, b;
assign a = ∼(∼x1 & ∼(x2 & x3));
assign b = ∼(∼(x4 & ∼(∼x5 & ∼x6)) & ∼x7);
assign f = ∼(∼(a & b));
endmodule
4-10
4.39. Using gate level primitives, the circuit in Figure 4.28b can be implemented using the code
module prob4 39 (x1, x2, x3, x4, x5, x6, x7, f);
input x1, x2, x3, x4, x5, x6, x7;
output f;
nor (a, x2, x2);
nor (b, x3, x3);
nor (c, a, b);
nor (d, x1, c);
nor (e, x4, x4);
nor (g, x5, x6);
nor (h, e, g);
nor (k, h, x7);
nor (f, d, k);
endmodule
4.40. Using continuous assignment, the circuit in Figure 4.27c can be implemented using the code
module prob4 40 (x1, x2, x3, x4, x5, x6, x7, f);
input x1, x2, x3, x4, x5, x6, x7;
output f;
wire a, b;
assign a = ∼(x1 | ∼(∼x2 | ∼x3));
assign b = ∼(∼(∼x4 | ∼(x5 | x6)) | x7);
assign f = ∼(a | b);
endmodule
4.41. Using the POS expression
f = (x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )
the function can be implemented using the code
4-11
module prob4 41 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
not (notx1, x1);
not (notx2, x2);
not (notx3, x3);
not (notx4, x4);
or (a, x1, x2, notx3, notx4);
or (b, x1, notx2, notx3, x4);
or (c, notx1, x2, notx3, x4);
or (d, notx1, notx2, x3, notx4);
and (f, a, b, c, d);
endmodule
4.42. Using the POS expression
f = (x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )(x1 + x2 + x3 + x4 )
the function can be implemented using the code
module prob4 42 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
assign f = (x1 | x2 | ∼x3 | ∼x4) & (x1 | ∼x2 | ∼x3 | x4) &
(∼x1 | x2 | ∼x3 | x4) & (∼x1 | ∼x2 | x3 | ∼x4);
endmodule
4.43. The simplest expression is
f = x1 x3 + x2 x3 (x1 + x4 )
which can be implemented using the code
module prob4 43 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
not (notx1, x1);
not (notx3, x3);
and (a, notx1, notx3);
or (b, x1, x4);
and (c, x2, x3, b);
or (f, a, c);
endmodule
4-12
4.44. The simplest expression is
f = x1 x3 + x2 x3 (x1 + x4 )
which can be implemented using the code
module prob4 44 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
assign f = (∼x1 & ∼x3) | (x2 & x3 & (x1 | x4));
endmodule
4.45. The simplest expression is
f = (x1 + x3 )(x1 + x2 + x3 + x4 )
which can be implemented using the code
module prob4 45 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
not (notx1, x1);
not (notx2, x2);
not (notx3, x3);
or (a, notx1, x3);
or (b, x1, notx2, notx3, x4);
and (f, a, b);
endmodule
4.46. The simplest expression is
f = (x1 + x3 )(x1 + x2 + x3 + x4 )
which can be implemented using the code
module prob4 46 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
assign f = (∼x1 | x3) & (x1 | ∼x2 | ∼x3 | x4);
endmodule
4-13
4.47. The simplest expression is
f = (x2 + x3 )(x1 + x3 + x4 )
which can be implemented using the code
module prob4 47 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
not (notx1, x1);
not (notx3, x3);
or (a, x2, notx3);
or (b, notx1, notx3, x4);
and (f, a, b);
endmodule
4.48. The simplest expression is
f = (x2 + x3 )(x1 + x3 + x4 )
which can be implemented using the code
module prob4 48 (x1, x2, x3, x4, f);
input x1, x2, x3, x4;
output f;
assign f = (x2 | ∼x3) & (∼x1 | ∼x3 | x4);
endmodule
4-14