chapter 3
chapter 3
A
B UDP_02467 E
C
F
D
FIGURE 3.37
Schematic for Circuit with_UDP_02467
Note that the variables listed on top of the table are part of a comment and are shown
only for clarity. The system recognizes the variables by the order in which they are listed
in the input declaration. A user-defined primitive can be instantiated in the construction
of other modules (digital circuits), just as the system primitives are used. For example,
the declaration
Circuit _with _UDP_ 02467 (E, F, A, B, C, D);
will produce a circuit that implements the hardware shown in Figure 3.37.
Although Verilog HDL uses this kind of description for UDPs only, other HDLs and
computer-aided design (CAD) systems use other procedures to specify digital circuits
in tabular form. The tables can be processed by CAD software to derive an efficient gate
structure of the design. None of Verilog’s predefined primitives describes sequential
logic. The model of a sequential UDP requires that its output be declared as a reg data
type, and that a column be added to the truth table to describe the next state. So the
columns are organized as inputs : state : next state.
In this section, we introduced the Verilog HDL and presented simple examples to
illustrate alternatives for modeling combinational logic. A more detailed presentation
of Verilog HDL can be found in the next chapter. The reader familiar with combina-
tional circuits can go directly to Section 4.12 to continue with this subject.
PROBLEMS
3.15 Simplify the following Boolean function F, together with the don’t-care conditions d, and
then express the simplified function in sum-of-minterms form:
(a) F 1x, y, z2 = ⌺10, 1, 4, 5, 62 (b)* F (A, B, C, D) = ⌺(0, 6, 8, 13, 14)
d1x, y, z2 = ⌺12, 3, 72 d (A, B, C, D) = ⌺(2, 4, 10)
(c) F 1A, B, C, D2 = ⌺15, 6, 7, 12, 14, 15,2 (d) F 1A, B, C, D2 = ⌺14, 12, 7, 2, 10,2
d1A, B, C, D2 = ⌺13, 9, 11, 152 d1A, B, C, D2 = ⌺10, 6, 82
3.16 Simplify the following functions, and implement them with two-level NAND gate circuits:
(a) F 1A, B, C, D2 = AC⬘D⬘ + A⬘C + ABC + AB⬘C + A⬘C⬘D⬘
(b) F 1A, B, C, D2 = A⬘B⬘C⬘D + CD + AC⬘D
(c) F 1A, B, C2 = 1A⬘ + C⬘ + D⬘2 1A⬘ + C⬘2 1C⬘ + D⬘2
(d) F 1A, B, C, D2 = A⬘ + B + D⬘ + B⬘C
3.17* Draw a NAND logic diagram that implements the complement of the following function:
F 1A, B, C, D2 = ⌺ 10, 1, 2, 3, 6, 10, 11, 142
3.18 Draw a logic diagram using only two-input NOR gates to implement the following function:
F 1A, B, C, D2 = (A { B)'(C { D)
3.19 Simplify the following functions, and implement them with two-level NOR gate circuits:
(a)* F = wx⬘ + y⬘ z⬘ + w⬘ yz⬘
(b) F 1w, x, y, z2 = ⌺ 10, 3, 12, 152
(c) F (x, y, z) = [(x + y)(x = z)]⬘
3.20 Draw the multiple-level NOR circuit for the following expression:
CD1B + C2A + 1BC⬘ + DE⬘2
3.21 Draw the multiple-level NAND circuit for the following expression:
w 1x + y + z2 + xyz
3.22 Convert the logic diagram of the circuit shown in Fig. 4.4 into a multiple-level NAND circuit.
3.23 Implement the following Boolean function F, together with the don’t-care conditions d,
using no more than two NOR gates:
F 1A, B, C, D2 = ⌺ 12, 4, 10, 12, 14,2
d1A, B, C, D2 = ⌺ 10, 1, 5, 82
Assume that both the normal and complement inputs are available.
Problems 121
3.24 Implement the following Boolean function F, using the two-level forms of logic (a) NAND-
AND, (b) AND-NOR, (c) OR-NAND, and (d) NOR-OR:
F 1A, B, C, D2 = ⌺ 10, 4, 8, 9, 10, 11, 12, 142
3.25 List the eight degenerate two-level forms and show that they reduce to a single operation.
Explain how the degenerate two-level forms can be used to extend the number of inputs
to a gate.
3.26 With the use of maps, find the simplest sum-of-products form of the function F = fg, where
f = abc⬘ + c⬘d + a⬘cd⬘ + b⬘cz⬘
and
g = 1a + b + c⬘ + d⬘2 1b⬘ + c⬘ + d2 1a⬘ + c + d⬘2
3.27 Show that the dual of the exclusive-OR is also its complement.
3.28 Derive the circuits for a three-bit parity generator and four-bit parity checker using an odd
parity bit.
3.29 Implement the following four Boolean expressions with three half adders:
D = A{B{C
E = A⬘ BC + AB⬘ C
F = ABC⬘ + (A⬘ + B⬘) C
G = ABC
3.30* Implement the following Boolean expression with exclusive-OR and AND gates:
F = AB⬘ CD⬘ + A⬘ BC D⬘ + AB⬘ C⬘ D + A⬘ BC⬘ D
3.31 Write a Verilog gate-level description of the circuit shown in
(a) Fig. 3.20(a) (b) Fig. 3.20(b) (c) Fig. 3.21(a)
(d) Fig. 3.21(b) (e) Fig. 3.24 (f) Fig. 3.25
3.32 Using continuous assignment statements, write a Verilog description of the circuit
shown in
(a) Fig. 3.20(a) (b) Fig. 3.20(b) (c) Fig. 3.21(a)
(d) Fig. 3.21(b) (e) Fig. 3.24 (f) Fig. 3.25
3.33 The exclusive-OR circuit of Fig. 3.30(a) has gates with a delay of 3 ns for an inverter, a 6 ns
delay for an AND gate, and a 8 ns delay for an OR gate. The input of the circuit goes from
xy = 00 to xy = 01.
(a) Determine the signals at the output of each gate from t = 0 to t = 50 ns.
(b) Write a Verilog gate-level description of the circuit, including the delays.
(c) Write a stimulus module (i.e., a test bench similar to HDL Example 3.3), and simulate
the circuit to verify the answer in part (a).
3.34 Using continuous assignments, write a Verilog description of the circuit specified by the
following Boolean functions:
Out_1 = 1A + B⬘2C⬘ 1C + D2
Out_2 = 1C⬘D + BCD + CD⬘2 1A⬘ + B2
Out_3 = 1AB + C2D + B⬘C
3.35* Find the syntax errors in the following declarations (note that names for primitive gates
are optional):
3.36 Draw the logic diagram of the digital circuit specified by the following Verilog description:
(b) module Circuit_B (F1, F2, F3, A0, A1, B0, B1);
output F1, F2, F3;
input A0, A1, B0, B1;
nor (F1, F2, F3);
or (F2, w1, w2, w3);
and (F3, w4, w5);
and (w1, w6, B1);
or (w2, w6, w7, B0);
and (w3, w7, B0, B1);
not (w6, A1);
not (w7, A0);
xor (w4, A1, B1);
xnor (w5, A0, B0);
endmodule
assign y1 = a || b;
and (y2, a, b);
assign y3 = a && b;
endmodule
References 123
3.37 A majority logic function is a Boolean function that is equal to 1 if the majority of the
variables are equal to 1, equal to 0 otherwise.
(a) Write a truth table for a four-bit majority function.
(b) Write a Verilog user-defined primitive for a four-bit majority function.
3.38 Simulate the behavior of Circuit_with_UDP_02467, using the stimulus waveforms shown
in Fig. P3.38.
t, ns
10 20 30 40 50 60 70 80
B
t, ns
10 20 30 40 50 60 70 80
C
t, ns
10 20 30 40 50 60 70 80
D
t, ns
10 20 30 40 50 60 70 80
FIGURE P3.38
Stimulus waveforms for Problem 3.38
3.39 Using primitive gates, write a Verilog model of a circuit that will produce two outputs,
s and c, equal to the sum and carry produced by adding two binary input bits a and b (e.g.,
s = 1 and c = 0 if a = 0 and b = 1). (Hint: Begin by developing a truth table for s and c.)
REFERENCES
1. Bhasker, J. 1997. A Verilog HDL Primer. Allentown, PA: Star Galaxy Press.
2. Ciletti, M. D. 1999. Modeling, Synthesis and Rapid Prototyping with the Verilog HDL.
Upper Saddle River, NJ: Prentice Hall.
3. Hill, F. J., and G. R. Peterson. 1981. Introduction to Switching Theory and Logical Design,
3rd ed. New York: John Wiley.
4. IEEE Standard Hardware Description Language Based on the Verilog Hardware Descrip-
tion Language (IEEE Std. 1364-1995). 1995. New York: The Institute of Electrical and
Electronics Engineers.
5. Karnaugh, M. A Map Method for Synthesis of Combinational Logic Circuits. Transactions
of AIEE, Communication and Electronics. 72, part I (Nov. 1953): 593–99.
6. Kohavi, Z. 1978. Switching and Automata Theory, 2nd ed. New York: McGraw-Hill.
27
Chapter 3
3.1
yz y yz y
x 00 01 11 10 x 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 0 1 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1 1 1
z z
F = xy' + x'z' F = z' + xy'
yz y yz y
x 00 01 11 10 x 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 1 1 0 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 x 1 1
z z
F = x' + y'z F = x'z + yz + x'y
3.2
yz y yz y
x 00 01 11 10 x 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 0 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1 1
z z
(a) F = x'y' + xz (b) F = y + x'z
y yz y
yz
x x
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 0 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1 1 1
z z
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
28
y yz y
yz
x x
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 0 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1 1 1 1
z z
F = z' F=x+yz
(e) (f)
3.3
yz y yz y
x x
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 0 1 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1
z z
(a) F =xy + x'y'z' + x'yz' (b) F = x'y' + yz + x'yz'
F = xy + x' z' F = x' + yz
yz y yz
x x
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
0 1 1 1 0 1
m4 m5 m7 m6 m4 m5 m7 m6
x 1 1 1 x 1 1 1
z z
F = x'y + yz' + y'z' F = x'yz + xy'z' + xy'z
F = = x' y + z' F = x'yz + xy'
(c) (d)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
29
3.4
CD C
AB
00 01 11 10
m0 m1 m3 m2
00
m4 m5 m7 m6
yz y
x 01 1 1 1
00 01 11 10 B
m0 m1 m3 m2 m12 m13 m15 m14
0 1 1 11 1
m4 m5 m7 m6 A m8 m9 m11 m10
x 1 1 1 10
z D
(a) F=y (b) F = BCD + A' BD'
CD C yz y
AB 00 01 11 10 wx 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 01
m12 m13 m15 m14 B m12 m13 m15 m14 x
11 1 1 1 11 1 1 1 1
A m8 m9 m11 m10 w m8 m9 m11 m10
10 1 10
D z
(c) F =CD + ABD + ABC (d) F = w'x'y +wx
yz y yz y
wx wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 00
m4 m5 m7 m6 m4 m5 m7 m6
01 01
m12 m13 m15 m14 x m12 m13 m15 m14 x
11 1 1 1 11 1 1 1
w m8 m9 m11 m10 w m8 m9 m11 m10
10 1 10 1 1
z z
F = wx + wyz F = wz' + xy'w
(e)
(f)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
30
3.5
yz y CD C
wx AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 1 01 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 B
11 1 1 1 11 1 1 1
w m8 m9 m11 m10 A m8 m9 m11 m10
10 10
z D
(a) F =xz' + w'y'z+ wxy (b) F = AC' + ABC' + ABD'
yz y CD C
wx AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 1 1 01 1 1 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 B
11 1 1 11 1 1
w m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 10 1
z D
(c) F = z + xw' (d) F =BD + A'B + B' D'
or = BD + B'D' + A'D'
3.6
CD C yz y
AB wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1
m12 m13 m15 m14 B m12 m13 m15 m14 x
11 1 1 11 1 1
A m8 m9 m11 m10 w m8 m9 m11 m10
10 1 1 10 1 1 1
D z
(a) F = B' D' +A'BD + ABC' (b) F = xy' +x'z + wx'y
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
31
CD C CD C
AB AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1
m12 m13 m15 m14 B m12 m13 m15 m14 B
11 1 11 1
A m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 1 10 1
D D
(d) F = C'D + A'BD + A'B'C'
(c) F = A'BC' + B'C'D + ACD + AB'C
3.7
yz y CD C
wx AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 1 00 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 B
11 1 1 11 1 1 1
w m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 1 10 1 1 1
z D
(a) F = z + x'y (b) F = AD' + C'D + BCD'
CD C yz y
AB 00 01 11 10 wx 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 1 00
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1 1 1
m12 m13 m15 m14 B m12 m13 m15 m14 x
11 1 1 11 1 1 1
A m8 m9 m11 m10 w m8 m9 m11 m10
10 1 1 1 10
D z
(c) F = B'D' + AC + A'BD + CD (or B'C) (d) F = xw' + xz + xy
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
32
3.8
(a) F(x, y, z) = Σ(3, 5, 6, 7)
yz y
x 00 01 11 10
m0 m1 m3 m2
0 1
m4 m5 m7 m6
x 1 1 1 1
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1 1
m4 m5 m7 m6
01 1
m12 m13 m15 m14 B
11 1 1 1
A m8 m9 m11 m10
10 1
D
(c) F = Σ(0, 1, 2, 3, 11, 12, 14, 15)
y
wx 00 01 11 10
m0 m1 m3 m2
00 1 1 1 1
m4 m5 m7 m6
01
m12 m13 m15 m14 x
11 1 1 1
w m8 m9 m11 m10
10 1
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
33
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1
m4 m5 m7 m6
01 1 1 1
m12 m13 m15 m14 B
11 1
A m8 m9 m11 m10
10 1
D
3.9
yz y CD C
wx AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 1 1 01 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 B
11 1 1 11 1 1
w m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 10 1 1 1
z D
(a) (b)
CD C yz y
AB wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 1 1 01 1 1
m12 m13 m15 m14 B m12 m13 m15 m14 x
11 1 1 11 1 1 1 1
A m8 m9 m11 m10 w m8 m9 m11 m10
10 1 1 10 1 1
D z
(c) (d)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
34
CD C yz y
AB wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 1 00 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1
m12 m13 m15 m14 B m12 m13 m15 m14 x
11 1 1 11 1
A m8 m9 m11 m10 w m8 m9 m11 m10
10 1 1 1 10 1 1
D z
yz y CD C
wx AB
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 B
11 1 1 1 1 11 1 1
w m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 10 1 1 1
z D
F = Σ(0, 2, 5, 7, 8, 10, 12, 13, 14, 15) F = Σ(0, 2, 3, 5, 7, 8, 10, 11, 14, 15)
Essential: xz, wx, x'z' Essential: AC, B'D', CD, A'BD
F = xz + wx + x'z' F = AC + B'D' + CD + A'BD
(a)
(b)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
35
CD C yz y
AB wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1 1 1
B m12 m13 m15 m14 x
m12 m13 m15 m14
11 1 1 1 1 11 1 1
A w m8 m9 m11 m10
m8 m9 m11 m10
10 1 1 10 1 1
z
D
F = Σ(1, 3, 4, 5, 10, 11, 12, 13, 14, 15) F = Σ(0, 1, 4, 5, 6, 7, 9, 11, 14, 15)
Essential: AC, BC', A'B'D Essential: w'y', xy, wx'z
Non-essential: AB, Aʹ′Bʹ′D, Bʹ′CD, Aʹ′Cʹ′D Non-essential: wx, x'y'z, w'wz, w'x'z
F = AC + BCʹ′ + Aʹ′Bʹ′D F = w'y' + xy + wx'z
(c)
(d)
CD C yz y
AB wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 1 00 1 1 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 01 1 1 1 1
B m12 m13 m15 m14 x
m12 m13 m15 m14
11 1 1 11 1
A w m8 m9 m11 m10
m8 m9 m11 m10
10 1 1 1 10 1
z
D
F(A, B, C, D) = S(0, 1, 3, 7 8, 9, 10,13,15) F = S(0, 1, 2, 4, 5, 6, 7, 10, 15)
Essential: B'C', AB'D' Essential: w'y', w'z', xyz, x'yz'
Non-essential: ABD, A'CD, BCD Non-Essential: w'x
F = B'C' + AB'D' +A'CD +ABD F = w'y' + w'z' + xyz + x'yz'
(e) (f)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
36
3.11
(a)
F(w,
x,
y,
z)
=
∑
(0,
1,
2,
5,
8,
10,
13)
yz y yz y
wx wx
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 1 00 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 01 1 1 1
m12 m13 m15 m14 x m12 m13 m15 m14 x
11 1 11 1 1 1
w m8 m9 m11 m10 w m8 m9 m11 m10
10 1 1 10 1 1
z z
F
=
x'z'
+
w'x'y'
+
xy'z
F'
=
yz
+
xy
+
xz'
+
wx'z
F
=
(y'
+
z')(x'
+
y')(x'
+
z)(w'
+x
+
z')
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
37
3.12 (a)
F = Π(1, 3, 5, 7, 13, 15)
F' = A'D + B'D
F = (A + Dʹ′)(Bʹ′ + Dʹ′)
F = C'D' + AB' + CD'
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 0 0
m4 m5 m7 m6
01 0 0
m12 m13 m15 m14 B
11 0 0
A m8 m9 m11 m10
10
D
(b)
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 0 0
m4 m5 m7 m6
01 0
m12 m13 m15 m14 B
11 0 0
A m8 m9 m11 m10
10 0 0
D
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
38
yz y
x 00 01 11 10
m0 m1 m3 m2
0 1 1
m4 m5 m7 m6
x 1 1 1 1
z
F' = x'z + y'z
F = (x + z')(y + z')
(b) F = ACD' + C'D + AB' + ABCD
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1
m4 m5 m7 m6
01 1
m12 m13 m15 m14 B
11 1 1 1
A m8 m9 m11 m10
10 1 1 1 1
D
F = AC + AB' + C'D
F' = A'C + A'D' + BC'D'
F = (A + C')(A + D)(B'+C + D)
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
39
(c)
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 0 0
m4 m5 m7 m6
01 0
m12 m13 m15 m14 B
11 0 0 0 0
A m8 m9 m11 m10
10
F' = AB + BC'D
F = (A' + B')(B' + C + D')
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1 0 0 1
m4 m5 m7 m6
01 1 0 1 1
m12 m13 m15 m14 B
11 0 0 0 0
A m8 m9 m11 m10
10 1 1 1 1
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
40
(d)
CD C CD C
AB 00 01 11 10 AB 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 00 0 0 0 0
m4 m5 m7 m6 m4 m5 m7 m6
01 1 01 0 0 0
m12 m13 m15 m14 B m12 m13 m15 m14 B
11 1 1 1 11 0
A m8 m9 m11 m10 A m8 m9 m11 m10
10 1 10 0 0 0
D D
3.14
CD C CD C
AB 00 01 11 10 AB 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 0 0
m4 m5 m7 m6 m4 m5 m7 m6
01 1 01 0 0 0
m12 m13 m15 m14 B m12 m13 m15 m14 B
11 1 11 0 0 0
A m8 m9 m11 m10 A m8 m9 m11 m10
10 1 1 10 0 0
D D
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
41
3.15
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1 x
m4 m5 m7 m6
yz y
01 x 1
x 00 01 11 10
m0 m1 m3 m2 m12 m13 m15 m14 B
0 1 1 x x 11 1 1
m4 m5 m7 m6
A m8 m9 m11 m10
x 1 1 1 x 1 10 1 x
z
D
F=1 F = A'D' + B'D' + BCD' + ABC'D
F = Σ(0,1, 2, 3, 4, 5, 6, 7) F = Σ(0, 2, 4, 6, 8, 10, 13, 14)
CD C CD C
AB 00 01 11 10 AB 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 x 00 x 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 1 01 1 1 x
m12 m13 m15 m14 B m12 m13 m15 m14 B
11 1 1 1 11 1
A m8 m9 m11 m10 A m8 m9 m11 m10
10 x x 10 x 1
D D
F = BC + CD + ABD' + A'BD F = B'D' + C'D' + A'BC
F = Σ(3, 5, 6, 7, 11, 12, 14, 15) F = F = Σ(0, 2, 4, 6, 7, 8, 10, 12)
3.16 (a)
CD C
AB 00 01 11 10
m0 m1 m3 m2 F = C + D'
00 1 1 1 F = (C'D)'
m4 m5 m7 m6
01 1 1 1
m12 m13 m15 m14 B D'
F
11 1 1 1 C
A m8 m9 m11 m10
10 1 1 1
D
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
42
(b)
CD C
AB 00 01 11 10
m0 m1 m3 m2 F = AD + B'D + CD
00 1 1 F = ((AD)' (B'D)' (CD)')'
m4 m5 m7 m6 A
01 1 D
m12 m13 m15 m14 B B'
11 1 1 F
D
A m8 m9 m11 m10
C
10 1 1 D
CD C
AB 00 01 11 10 F = C' + A'D'
m0 m1 m3 m2 F = (C(A + D))'
00 1 1 0 1 F = (C(A'D')')'
m4 m5 m7 m6
01 1 1 0 1 C
D
(d)
CD C
AB F = A' + B + D'
00 01 11 10
m0 m1 m3 m2 F = (A(B')D)'
00 1 1 1 1
m4 m5 m7 m6
A
01 1 1 1 1
m12 m13 m15 m14 B B' F
11 1 1 1 1
A m8 m9 m11 m10
D
10 1 1
D
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
43
3.17
CD C
AB 00 01 11 10
m0 m1 m3 m2
A'
00 1 1 1 1
B'
m4 m5 m7 m6
01 1 B'
B C F'
m12 m13 m15 m14
11 1
A m8 m9 m11 m10
C
10 1 1 D'
CD C
AB
00 01 11 10
m0 m1 m3 m2 A'
00 1 1 B'
m4 m5 m7 m6 A
01 B
F'
m12 m13 m15 m14 B
C'
11 1 1 D
A m8 m9 m11 m10
C
10 D'
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
44
z
F = y'z' + wx' + w'z'
F =[(y + z)' + (w' + x)' + (w + z)']
F' =[(y + z)' + (w' + x)' + (w + z)']'
(b)
yz y
wx 00 01 11 10
m0 m1 m3 m2 y
00 1 1 z'
m4 m5 m7 m6 y'
01 z
x F'
m12 m13 m15 m14
w
11 1 1 x'
w m8 m9 m11 m10
w'
10 x
z
F = Σ(0, 3, 12, 15)
F' =y'z+yz' + w'x + wx' = [(y + z')(w + x')(w + x')(w' + x)]'
F = (y + z')' + (y' + z)' + (w + x')' + (w' + x)'
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
45
A'
C'
D'
B
C
B' F'
C
D'
E
Multi-level NAND:
C'
A
C
D F
B
C'
D
E'
x
y
z
x'
y' F
z'
w
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
46
3.22
D
C y
B
x
z
D
C y
B
x
A
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
47
3.23
CD C
AB
00 01 11 10
m0 m1 m3 m2
00 x x 1
m4 m5 m7 m6 A
01 1 x B'
m12 m13 m15 m14 B
C' F
11 1 1
D
A m8 m9 m11 m10
10 x 1
D
F = B'D' + AD' + C'D'
F' = D + A'BC
F = [D + A'BC]' = [D + (A + B' + C')']'
3.24 F(A, B, C, D) = S(0, 4, 8, 9, 10, 11, 12, 14)
CD C
AB 00 01 11 10
m0 m1 m3 m2
00 1
m4 m5 m7 m6
01 1
m12 m13 m15 m14 B
11 1 1
A m8 m9 m11 m10
10 1 1 1 1
D
(a) F = C'D' + AB' + AD'
F' = (C'D')'(AB')'(AD')'
AND-NAND:
C'
D'
A F
B'
A
D'
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
48
C'
D'
A F’
B'
A
D'
A'
D
A'
D
3.25
A
B A
B
ABCD A+B+C+D
C
C
D D
AND-AND AND OR-OR OR
A
B A
B
(AB CD)' (A + B + C + D)'
C
C
D D
AND-NAND NAND OR-NOR NOR
A
B A
B
(A'B'C'D')' [(AB)' + (C' D')]'
C
C
D A+B+C+D D ABCD
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
49
A'B'
A
A
B B
A'B'C'D'
C A' + B' + C' + D'
C
D C'D' (A + B + C + D)' D (A + B + C + D)'
3.26
g = (a + b +c' + d')(b' + c' + d)(a'+ c + d')
f = abc' + c'd + a'cd'+ b'cd' g' = a'b'cd + bcd' + ac'd
cd c cd c
ab ab
00 01 11 10 00 01 11 10
m0 m1 m3 m2 m0 m1 m3 m2
00 1 1 00 1 1 0 1
m4 m5 m7 m6 m4 m5 m7 m6
01 1 1 01 1 1 1 0
m12 m13 m15 m14 b m12 m13 m15 m14 b
11 1 1 11 1 0 1 0
a m8 m9 m11 m10 a m8 m9 m11 m10
10 1 1 10 1 0 1 1
d d
fg = ac'd + abc'd + b'cd'
3.28
x
y
x
y P C
z
z
P
(a) 3-bit odd parity generator (b) 4-bit odd parity generator
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
50
S F = (AB) C
Half-Adder
C G = ABC
AB
A
B
F
C
D
3.31 Note: It is assumed that a complemented input is generated by another circuit that
is not part of the circuit that is to be described.
(a) module Fig_3_20a_gates (F, A, B, C, C_bar, D);
output F;
input A, B, C, C_bar, D;
wire w1, w2, w3, w4;
and (w1, C, D);
or (w2, w1, B);
and (w3, w2, A);
and (w4, B, C_bar);
or (F, w3, w4);
endmodule
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
51
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
52
3.32 Note: It is assumed that a complemented input is generated by another circuit that
is not part of the circuit that is to be described.
Note:
Because
the
signals
here
are
all
scalar–valued,
the
logical
operators
(!,
&&,
and
||)
are
equivalent
to
the
bitwise
operators
(~,
&,
|).
If
the
operands
are
vectors
the
bitwise
operators
produce
a
vector
result;
the
logical
operators
would
produce
a
sclara
result
(true
or
false).
(a) module Fig_3_20a_CA (F, A, B, C, C_bar, D);
output F;
input A, B, C, C_bar, D;
wire w1, w2, w3, w4;
assign w1 = C && D;
assign w2 = w1 || B;
assign w3 = !(w2 && A);
assign w4 = !w3;
assign w5 = !(B && C_bar);
assign w5_bar = !w5;
assign F = w4 || w5_bar);
endmodule
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
53
3.33 (a)
Initially, with xy = 00, w1 = w2 = 1, w3 = w4 = 0 and F = 0. w1 should change to 0 3ns after xy
changes to 01. w4 should change to 1 6ns after xy changes to 01. F should change from 0 to 1 8ns
after w4 changes from 0 to 1, i.e., 14 ns after xy changes from 00 to 01.
x w3
w1 6
F=x y
3
8
3 w2
y w4
6
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
54
(b)
`timescale 1ns/1ps
endmodule
x
w1
y
w2
w3
w4
F
t = 10 ns
t = 24 ns
Note: input change occurs at t = 10 ns.
t = 16 ns
Δ = 14 ns
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
55
Line 1: Dash not allowed character in identifier; use underscore: Exmpl_3. Terminate line with semicolon
(;).
Line 2: inputs should be input (no s at the end). Change last comma (,) to semicolon (;). Output is
declared but does not appear in the port list, and should be followed by a comma if it is intended to
be in the list of inputs. If Output is a mispelling of output and is to declare output ports, C should
Line 3: B cannot be declared both as an input (Line 2) and output (Line 3). Terminate the line with a
semicolon (;).
Line 5: Too many entries for the not gate (may have only a single input, and a single output). Termiante
Line 6: OR must be in lowercase: change to “or”. Replace semicolon by a comma (B,) in the list of ports.
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
56
3.36 (a)
B
C x
D d
z F
w
a
A y
(b)
A1 A0 B1 B0
w1
w6
F1
w2
w7 w3 F2
w4
F3
w5
(c)
a b
y1
y2
y3
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
57
3.37
UDP_Majority_4 (y, a, b, c, d);
output y;
input a, b, c, d;
table
// a b c d : y
0 0 0 0 : 0;
0 0 0 1 : 0;
0 0 1 0 : 0;
0 0 1 1 : 0;
0 1 0 0 : 0;
0 1 0 1 : 0;
0 1 1 0 : 0;
0 1 1 1 : 1;
1 0 0 0 : 0;
1 0 0 1 : 0;
1 0 1 0 : 0;
1 0 1 1 : 0;
1 1 0 0 : 0;
1 1 0 1 : 0;
1 1 1 0 : 1;
1 1 1 1 : 1;
endtable
endprimitive
3.38
module t_Circuit_with_UDP_02467;
wire E, F;
reg A, B, C, D;
Circuit_with_UDP_02467 m0 (E, F, A, B, C, D);
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
58
t, ns
10 20 30 40 50 60 70 80
B
t, ns
10 20 30 40 50 60 70 80
C
t, ns
10 20 30 40 50 60 70 80
D
t, ns
10 20 30 40 50 60 70 80
E
t, ns
10 20 30 40 50 60 70 80
F
t, ns
10 20 30 40 50 60 70 80
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.
59
3.39
a b s c
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
s = a'b + ab' = a ^ b
c = ab = a && b
Digital
Design
With
An
Introduction
to
the
Verilog
HDL
–
Solution
Manual.
M.
Mano.
M.D.
Ciletti,
Copyright
2012,
All
rights
reserved.