Digital Systems IRM
Digital Systems IRM
Digital Systems IRM
to accompany
DIGITAL SYSTEMS
Principles and Applications
12th Edition
Prepared by
Frank J. Ambrosio
Monroe Community College
Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks. Where
those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been
printed in initial caps or all caps.
10 9 8 7 6 5 4 3 2 1
ISBN-13: 978-0-13-510382-1
ISBN-10: 0-13-510382-7
TABLE OF CONTENTS
SOLUTIONS TO:
1-1 HIGH
1-2 LOW
1-3 S1
1-4 S2
1-6
4.4V
1-8
_____________________________________________________________________________
1
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
1-22 (a) 2N-1 = 15; N = 4; Therefore, 4 lines are required for parallel transmission.
(b) Only 1 line is required for serial transmission.
_____________________________________________________________________________
2
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
3
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
4
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
2-8 17516, 17616, 17716, 17816, 17916, 17A16, 17B16, 17C16, 17D16, 17E16, 17F16, 18016.
2-10 16N 20,000; Therefore, n=4; 164 65,536, this is greater than 40,000, so N=4.
_____________________________________________________________________________
5
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
2-13 (a) 9, (b) D, (c) 8, (d) 0, (e) F, (f) 2, (g) A, (h) 9, (I) B, (j) C, (k) 3, (l) 4, (m) 1, (n) 5, (o) 7, (p) 6
2-14 (a) 0110, (b) 0111, (c) 0101, (d) 0001, (e) 0100, (f) 0011, (g) 1100, (h) 1011, (I) 1001, (j) 1010
(k) 0010, (l) 1111, (m) 0000, (n) 1000, (o) 1101, (p) 1001.
_____________________________________________________________________________
6
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
2-17 28016, 28116, 28216,..... 28816, 28916, 28A16, 28B16, 28C16, 28D16, 28E16, 28F16, 29016,
29116,..... 29816, 29916, 29A16, 29B16, 29C16, 29D16, 29E16, 29F16, 2A016.
2-18 With four hex digits we can represent a decimal number up to: FFFF 16 = (164-1) = 65,53510
With five hex digits we can represent a decimal number up to: FFFFF 16 = (165-1) = 1,048,57510
Therefore, we need five hex digits to represent decimal numbers up to 1 million.
With six hex digits we can represent a decimal number up to: FFFFFF 16 = (166-1) = 16,777,21510
Therefore, we need six hex digits to represent decimal numbers up to 4 million.
2-20 (a) (2N-1)=999. Therefore, N=10. Hence, it requires 10 bits for straight binary.
(b) 99910 requires 12 bits for BCD (4 bits per digit).
2-26 (a) 42=B; 45=E; 4E=N; 20=blank; 53=S; 4D=M; 49=I; 54=T; 48=H. Thus, the name of the
person is BEN SMITH.
(b) 4A=J; 6F=o; 65=e; 20=blank; 47=G; 72=r; 65=e; 65=e; 6E=n. Thus, the name of the
person is Joe Green.
_____________________________________________________________________________
8
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
2-30 (a)101100010012
(b) 111111112
(c) 20910
(d) 59,94310
(e) 9C116
(f) 010100010001BCD
(g) 56510
(h) 10DC16
(i) 196110
(j) 15,90010
(k) 64016
(l) 952B16
(m) 100001100101BCD
(n) 94710
(o) 100011001012
(p) 1011001101002
(q) Convert to decimal, then to binary to obtain 10010102
(r) Convert to decimal, then to BCD to obtain 01011000BCD
_____________________________________________________________________________
9
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
2-37 (a) A 20-bit address will allow 1,048,576 (220) different memory locations to exist.
(b) Since a hex digit requires 4 bits to represent, it will take 5 hex digits to represent the 20-bit
address of a memory location.
(c) 000FF16
(c) 000016 07FF16
2-38 (a) 26=64 different voltage values; 28=256 different voltage values; 210=1,024 different
voltage values.
(b) In 1s there are about 44,000 samples of 10-bits each recorded on the CD surface. Thus,
there are about 440,000 bits recorded on the CD disk during 1s of sampling.
_____________________________________________________________________________
10
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(c) There are about 440,000 bits recorded on the CD disk in 1 second of audio. Therefore, 5
billion bits of audio stored on the CD disk will be equivalent to approximately 11,363.63 seconds
(5x109/440,000).
_____________________________________________________________________________
11
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-1 (a)
(b)
(c) With A=1, X will always be 1 since the OR gate output is 1 whenever any input is a 1.
3-2 If the OR gate should have a LOW on the output, then it should have all LOWs on the inputs.
Therefore, the input that is HIGH is incorrect.
_____________________________________________________________________________
12
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-4 There are 25=32 different input conditions. Only one of these (the 00000 condition) produces a
LOW output.
3-5 If the AND gate should have a HIGH on the output, then it should have all HIGHs on the
inputs. Therefore, the input that is LOW is incorrect.
3-6 (a)
3-8 OUT is always LOW since one or more inputs is always LOW.
3-9 A logic HIGH and a logic LOW applied to the inputs of the unknown 2-input gate would tell us
what type of gate it is. If the resulting output logic level is HIGH, then the gate is an OR gate. If
the resulting output logic level is LOW, then the gate is an AND gate.
3-10 True. The output of any AND gate will be HIGH only when all of its inputs are HIGH.
3-11 (a)
(b)
_____________________________________________________________________________
13
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-12 (a)
(b)
_____________________________________________________________________________
14
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-13
E D C B A (A+B) (A+B)C [(A+B)C] D+[(A+B)C] [D+((A+B)C)]E
0 0 0 0 0 0 0 1 1 0
0 0 0 0 1 1 0 1 1 0
0 0 0 1 0 1 0 1 1 0
0 0 0 1 1 1 0 1 1 0
0 0 1 0 0 0 0 1 1 0
0 0 1 0 1 1 1 0 0 0
0 0 1 1 0 1 1 0 0 0
0 0 1 1 1 1 1 0 0 0
0 1 0 0 0 0 0 1 1 0
0 1 0 0 1 1 0 1 1 0
0 1 0 1 0 1 0 1 1 0
0 1 0 1 1 1 0 1 1 0
0 1 1 0 0 0 0 1 1 0
0 1 1 0 1 1 1 0 1 0
0 1 1 1 0 1 1 0 1 0
0 1 1 1 1 1 1 0 1 0
1 0 0 0 0 0 0 1 1 1
1 0 0 0 1 1 0 1 1 1
1 0 0 1 0 1 0 1 1 1
1 0 0 1 1 1 0 1 1 1
1 0 1 0 0 0 0 1 1 1
1 0 1 0 1 1 1 0 0 0
1 0 1 1 0 1 1 0 0 0
1 0 1 1 1 1 1 0 0 0
1 1 0 0 0 0 0 1 1 1
1 1 0 0 1 1 0 1 1 1
1 1 0 1 0 1 0 1 1 1
1 1 0 1 1 1 0 1 1 1
1 1 1 0 0 0 0 1 1 1
1 1 1 0 1 1 1 0 1 1
1 1 1 1 0 1 1 0 1 1
1 1 1 1 1 1 1 0 1 1
3-14
E D C B A AB (AB)+C [(AB)+C] D[(AB)+C] D[(AB)+C]+E
0 0 0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 1 0 0
0 0 0 1 0 0 0 1 0 0
0 0 0 1 1 1 1 0 0 0
0 0 1 0 0 0 1 0 0 0
0 0 1 0 1 0 1 0 0 0
0 0 1 1 0 0 1 0 0 0
0 0 1 1 1 1 1 0 0 0
0 1 0 0 0 0 0 1 1 1
0 1 0 0 1 0 0 1 1 1
0 1 0 1 0 0 0 1 1 1
0 1 0 1 1 1 1 0 0 0
0 1 1 0 0 0 1 0 0 0
0 1 1 0 1 0 1 0 0 0
0 1 1 1 0 0 1 0 0 0
0 1 1 1 1 1 1 0 0 0
_____________________________________________________________________________
15
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-15
A B C D ABC A+D (A+D) (A+D)(ABC)
0 0 0 0 0 0 1 0
0 0 0 1 0 1 0 0
0 0 1 0 0 0 1 0
0 0 1 1 0 1 0 0
0 1 0 0 0 0 1 0
0 1 0 1 0 1 0 0
0 1 1 0 1 0 1 1
0 1 1 1 1 1 0 0
1 0 0 0 0 1 0 0
1 0 0 1 0 1 0 0
1 0 1 0 0 1 0 0
1 0 1 1 0 1 0 0
1 1 0 0 0 1 0 0
1 1 0 1 0 1 0 0
1 1 1 0 0 1 0 0
1 1 1 1 0 1 0 0
3-16 (a)
_____________________________________________________________________________
16
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
(c)
(d)
(e)
_____________________________________________________________________________
17
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(f)
(g) g AC BC
A
C
(h) h AB CD
A
B
C
D
_____________________________________________________________________________
18
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b) With C = 0
_____________________________________________________________________________
19
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-19
3-20
A B C D X
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
3-21 (a)
_____________________________________________________________________________
20
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
(c)
3-23
(a ) A 1 1 ( b) A A A ( c) B B 0 (d ) C C C ( e) X 0 0 (f ) D 1 D
(g) D 0 D (h ) C C 1 (i) G GF G ( j) Y WY Y
_____________________________________________________________________________
21
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-24
(a)
X (M N)(M P)( N P)
X (M M MP N M NP)( N P)
X (M M N M M P MP N MP P N M N N M P NP N NP P)
X (0 0 MP N 0 0 N M P 0 0)
X MP N N M P
(b)
Z ABC ABC BCD
Z BC(A A D)
Z BC(1 D)
Z BC
3-25 A B AB
A=1 { 1 1 1 1 A=0 { 00 0 1
B=1 { B=0 {
A=0 { 0 1 0 1 0 A=1 { 1 0 1 0 0
B=1 { B=0 {
AB A B
A=1 { 1 1 1 1 0 A=0 { 00 0 1
B=1 { B=0 {
A=0 { 0 1 0 1 1 A=1 { 1 0 1 0 1
B=1 { B=0 {
3-26
(a ) ABC A B C A B C
( b) A BC A(B C) A(B C)
(c) ABCD AB CD A B CD
(d) A B A B AB
( e) A B A B A B
(f ) A C D ACD ACD
_____________________________________________________________________________
22
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-27
X (A B)BC A B BC A B B C A B C
_____________________________________________________________________________
23
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
24
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-29 X=ABC
3-30
_____________________________________________________________________________
25
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-31
3-32 (a) The warning light W will be activated, when temperature (T) is >200F and either the
pressure (P) is >220 p.s.i., or the speed (R) is < 4800 r.p.m. In conclusion, W=1 when T=1
and either P=1 or R=0.
(b)
3-33 (a) The trunk is opened if the key fob trunk button is pressed, assuming the engine is not
running, OR,
The trunk lid button is pressed while the car is not locked and the engine is not running, OR,
The trunk lid button is pressed while the car is not locked, while the engine is running only if
the parking brake is activated.
FOB
MOTOR_ON
TRUNK_UNLOCK
LOCKED
LID
PBRAKE
_____________________________________________________________________________
26
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
I M R L CRANK
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
(e)
CRANK
M
R
L
3-35
(a) NOR gate (b) AND gate (c) NAND gate
_____________________________________________________________________________
27
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-36
3-37 (a)
(b)
A B C X
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
_____________________________________________________________________________
28
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-39
3-40 X will go HIGH when E=1, or D=0, or C=B=0, or when B=1 and A=0.
3-42
E D C B A X
0 0 0 0 0 1
0 0 0 0 1 1
0 0 0 1 0 1
0 0 0 1 1 1
0 0 1 0 0 1
0 0 1 0 1 1
0 0 1 1 0 1
0 0 1 1 1 1
0 1 0 0 0 1
0 1 0 0 1 1
0 1 0 1 0 1
0 1 0 1 1 0
0 1 1 0 0 0
0 1 1 0 1 0
0 1 1 1 0 1
0 1 1 1 1 1
1 0 0 0 0 1
1 0 0 0 1 1
1 0 0 1 0 1
1 0 0 1 1 1
1 0 1 0 0 1
1 0 1 0 1 1
1 0 1 1 0 1
1 0 1 1 1 1
1 1 0 0 0 1
1 1 0 0 1 1
1 1 0 1 0 1
1 1 0 1 1 1
1 1 1 0 0 1
1 1 1 0 1 1
1 1 1 1 0 1
1 1 1 1 1 1
_____________________________________________________________________________
29
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
B A LIGHT
0 0 0
0 1 1
1 0 1
1 1 0
3-44
tw = 100 ns
(a) INPUT
(b) OUTPUT
3-45
(a) FALSE (b) TRUE (c) FALSE (d) TRUE (e) FALSE
(f) FALSE (g) TRUE (h) FALSE (I) TRUE (j) TRUE
3-46
Digital A
B
INPUTS C
D
E
F
G
H
LOGIC
XA
CIRCUITS
XA
XA
x B
xA
x D
x H
x E
_____________________________________________________________________________
30
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-47
AHDL
SUBDESIGN prob3_45
(
a,b,c :INPUT; --define inputs to block
x1,y,z :OUTPUT; --define block output
)
BEGIN
x1 = a # b;
y = !(a & b);
z = a # b # c;
END;
VHDL
ENTITY prob3_45 IS
PORT ( a, b, c :IN bit; --define inputs to block
x, y, z :OUT bit); --define block output
END prob3_45 ;
3-48
(a) AHDL
SUBDESIGN prob3_46
(
rd, rom_a, rom_b, ram :INPUT; --define inputs to block
mem :OUTPUT; --define block output
)
BEGIN
mem = !rd & ((!rom_a # !rom_b) # !ram);
END;
(a) VHDL
ENTITY prob3_46 IS
PORT (rd, rom_a, rom_b, ram :IN bit; --define inputs to block
mem :OUT bit); --define block output
END prob3_46;
_____________________________________________________________________________
31
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b) AHDL
SUBDESIGN prob3_46
(
rd, rom_a, rom_b, ram :INPUT; --define inputs to block
mem :OUTPUT; --define block output
)
VARIABLE
v,w,x1,y :NODE;
BEGIN
x1 = !rd;
w = !rom_a # !rom_b;
v = !ram;
y = w # v;
mem = x1 & y;
END;
(b) VHDL
ENTITY prob3_46 IS
PORT (rd, rom_a, rom_b, ram :IN bit; --define inputs to block
mem :OUT bit); --define block output
END prob3_46;
BEGIN
x <= NOT rd;
w <= (NOT rom_a) OR (NOT rom_b);
v <= NOT ram;
y <= w OR v;
mem = x AND y;
END ckt;
3-49
3-50
_____________________________________________________________________________
32
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
3-51
_____________________________________________________________________________
33
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-1
(a) x ABC AC C(AB A) C(A B)
(b) y (Q R )(Q R ) QQ QR R Q R R QR R Q
(c) w ABC ABC A AC(B B) A AC A A C
(d)
q RST (R S T)
q (R S T)(R ST)
q R R ST SR ST T R ST
q R ST R ST R ST
q R ST
(e)
x A B C ABC ABC A B C ABC
x A B C BC ( A A) AB(C C )
x A B C BC AB
x BC B( A C A) BC B( A C )
One possibility:
(f)
z ( B C )( B C ) A B C
z B B BC B C C C ABC
z BC B C ABC
z BC B (C AC )
z BC B (C A)
z BC B C AB
(g)
y (C D) AC D ABC ABCD AC D
y C D AC D ABC A BCD AC D
y C D C D( A A) AB C A BCD
y C D C D ABC A BCD
y D(C C ) AB C A BCD
y D AB C A BCD
y D AB C A BC
_____________________________________________________________________________
34
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(h)
x AB(C D) ABD B C D
x AB(C D) ABD B C D
x ABC AB D ABD B C D
4-2
4-3
4-5
By adding the term A BC three times and then factoring, the following is obtained:
A - It's 5:00 or later; B - All machines are shut down; C - It's Friday
D - Production run for the day is complete
Output Y assumes all variables that are not mentioned in the conditions of the story problem
must be zero to blow the horn. Output X assumes that all variables that are not mentioned in
the conditions of the story problem can be either 1 or 0 in order to blow the horn.
D C B A X Y
0 0 0 0 0 0
0 0 0 1 0 0
0 0 1 0 0 0
0 0 1 1 1 1
0 1 0 0 0 0
0 1 0 1 0 0
0 1 1 0 0 0
0 1 1 1 1 0
1 0 0 0 0 0
1 0 0 1 0 0
1 0 1 0 0 0
1 0 1 1 1 0
1 1 0 0 0 0
1 1 0 1 0 0
1 1 1 0 1 1
1 1 1 1 1 0
_____________________________________________________________________________
36
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
Y ABC D ABCD
4-7
A3 A2 A1 A0 X
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
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 0
1 1 1 1 0
_____________________________________________________________________________
37
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
The same result can be obtained by writing the S-of-P expression and then simplifying it.
4-9 Change each gate to its NAND equivalent and then cancel double inversions.
4-10 Change each gate to its NAND equivalent and then cancel double inversions.
_____________________________________________________________________________
38
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-11 (a)
(b)
(c)
_____________________________________________________________________________
39
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-12 YA
X BC BC AB Other solution: X BC BC AC
(b) Y C D AC D ABC ABCD AC D
Y D ABC ABC
_____________________________________________________________________________
40
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
41
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-16 (a) X BC AD
(b) X BC AD ABC
_____________________________________________________________________________
42
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-17
4-18 z ABD BC
CD CD CD CD
AB 1 1
AB 1 1
AB
AB 1 1
4-19 In Example 4.3 of your textbook, after the DeMorgan part is completed, we have:
z A BC ACD ABCD A BC
z A BC ACD(B B) ABCD A BC
z A BC ABCD A BCD ABCD A BC
z A BC ABCD A BCD ABCD A BC
z BC(A A A D) ABD(C C)
z BC ABD
_____________________________________________________________________________
43
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-20 (a) Output X will be HIGH only when A and B are at different levels.
4-21 X will be HIGH when AB, B=C, and C=1. Thus, C=1, B=1, A=0 is the only input condition
that produces X=1.
_____________________________________________________________________________
44
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-23
4-24
4-25 One possibility is on the next page. Note the use of the XNOR gates and AND gate 4 to
determine when the two numbers are equal; that is, when X2=Y2, X1=Y1 and X0=Y0
simultaneously. AND gates 1,2,3 and the OR gate are used to sense when Y2 Y1 Y0 > X2
X1 X0. The NOR gate simply uses the fact that if neither M nor P is HIGH then it must be
true that X2 X1 X0 > Y2 Y1 Y0, and therefore N=1.
_____________________________________________________________________________
45
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-26
4-27
_____________________________________________________________________________
46
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-28
4-29
4-30
Since there are only five cases when N/S=1, we will design for N/S.
Obviously, E / W N / S
_____________________________________________________________________________
47
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-31 (a) Parity Generator: To modify the circuit of figure 4-25 (a) to an "Odd Parity Generator" all that
is needed is an inverter at the output.
Odd Parity Checker: To modify the circuit of figure 4-25 (b) to an "Odd Parity Checker" the
2-input exclusive-OR gates should be changed to 2-input exclusive-NOR gates.
_____________________________________________________________________________
48
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-32 (a) When all of the other inputs to the OR gate are in the LOW state the logic signal will pass
through to its output unchanged.
(b) When all of the other inputs to the AND gate are in the HIGH state the logic signal will
pass through to its output unchanged.
(c) When all of the other inputs to the NAND gate are in the HIGH state the logic signal will
pass through to its output INVERTED.
(d) When all of the other inputs to the NOR gate are in the LOW state the logic signal will
pass through to its output INVERTED.
4-33 (a) No. A logic circuit must have two inputs in order to be used as an enable/disable circuit.
(b) No. The control input of an XOR gate can be either HIGH or LOW. If the control input is
LOW the signal at the other input reaches the gate's output unaffected. If the control input is
HIGH the signal at the other input reaches the gate's output INVERTED.
4-34 Use an AND gate that is enabled when B=0, C=1. X=A only if B=0, C=1
4-35 Use an OR gate since output is to be HIGH when inhibited. X=A only if BCD 1. X=1 when BCD = 1
_____________________________________________________________________________
49
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-37
4-38
_____________________________________________________________________________
50
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-40 (a) Since Z1-4 is essentially floating, the Logic Probe will show an indeterminate logic level.
(b) There will be 1.4V-1.8V at the output.
Terminal Z2-9 will be floating (HIGH in TTL) since Z1-4 is opened internally. Thus, the signal
at Z2-8 is the opposite of the signal at Z2-10.
(d)
4-41 IC Z2-2 will be floating and therefore its voltage will fluctuate as it picks up noise. Thus, Z2-3
level will be unpredictable. IC-Z2 may also become overheated and eventually destroy itself.
4-42 1) First isolate Z1-4 from Z2-1 by using one of the following methods:
2) Check to see if Z1-4 is pulsing. If it is, then one can be sure that the inverter Z1 is working
properly. If it's always LOW (internally shorted to ground) then inverter Z1 must be replaced.
3) If step 2 above proves IC Z1 to be working properly then the problem must be with NAND
gate Z2 (internally shorted to ground). By using a logic probe, check the logic level at Z2-1.
Chances are that it will have a permanent logic LOW which kept Z1-4 LOW and Z2-3 HIGH.
Replace Z2.
_____________________________________________________________________________
51
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(a) No. This would've kept point X at a logic LOW permanently and the first case (A=1, B=0)
wouldn't have worked.
(b) No. An open at Z2-13 has the same effect as a logic HIGH (only in TTL). Thus, in the
second case (A=0,B=1,C=1) Z2-11 would've been LOW and Z2-8 HIGH.
(d) No. This would've cause IC Z2 to be unbiased and prevent the circuit from working
properly for the first case.
(g) No. This would've caused Z2-10 to be always LOW and Z2-8 HIGH for all cases.
4-45 1) Make A=0 (Z1-1), B=1 (Z1-2) and C=1 (Z2-12). This is the case that causes the circuit to
malfunction. Note that the other three possible combinations of A and B do not cause a
problem. We know that IC Z1 is working from the results of the first case.
(b) If Z2-11 is LOW and Z2-9 isn't turn off the power to the circuit.
(c) Use a VOM to make a continuity check between Z2-11 and Z2-9. If there is an open, find
it and restore the continuity between these two points.
3) If after performing step two the technician finds that there is a good connection between
Z2-11 and Z2-9, then one could conclude that either output Z2-11 or input Z2-9 is externally
shorted to Vcc. Since the circuit still has the power turned off from the last check, the
technician should make a continuity check to see if the trace between Z2-11 and Z2-9 is
externally shorted to Vcc. If there is a short to Vcc, find it and eliminate it. If no external short
to Vcc is found then either Z2-11 or Z2-9 or both must be internally short to Vcc or have an
internal open. In any case the replacement of IC Z2 should be performed.
4-46 This is a tough one. You have noticed that Z2-6 and Z2-11 will be at the same logic level
except for the two cases that don't work. For those cases, Z2-6 and Z2-11 are supposed to
be different. Since they measure indeterminate for those cases, it is likely that Z2-6 and Z2-
11 are shorted together, probably by a solder bridge. The short will have no effect for all
those cases where these two outputs are at the same level.
4-47 (b) If Z1-2 was internally shorted to ground, whenever the passenger failed to fastened
his/her seat-belt the circuit would've not detected this ALARM condition.
(c) Since this is a TTL logic circuit, if there was an open connection between Z2-6 and Z2-10,
the circuit would've operated as if a logic HIGH was present at Z2-10. This would've caused
the circuit to ALWAYS assume that a passenger was in the seat with the respective seat-belt
fastened.
_____________________________________________________________________________
52
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-48 Since the problem only manifests itself when an occupant is present in the car and the
ignition is turned on, it can be deduced that IC Z2 is working properly. The problem must be
with IC Z1. The following are the possible circuit failures:
Remote possibilities:
Procedure:
1) Make the necessary voltage measurements to confirm proper IC Z1 bias. Check for proper
IC Z1 orientation.
2) Check the logic levels at Z1-2 and Z1-4 with a logic probe. If IC Z1 is working properly then
a TTL logic LOW should be present at these points.
3) If these logic levels are still HIGH, by using an ohmmeter check for any external shorts to
Vcc or open PC traces.
4) Check the logic levels at Z1-1 and Z1-3 with a logic probe. If IC Z1 is to work properly then
a TTL logic HIGH should be present at these points.
5) If these logic levels are LOW, use an ohmmeter to check for any external shorts to
Ground.
6) If the above steps do not reveal a probable cause, Z1 must be internally damaged and it
must be replaced.
4-49 For some reason Z2-13 is always HIGH. The following are the
possible circuit failures:
(f) Connections from Z2-3 to Z2-9 or from Z2-6 to Z2-10 are externally shorted to Ground.
Procedure:
The first troubleshooting step is to make sure that all of the ICs are properly biased (Vcc and
Ground) and oriented.
_____________________________________________________________________________
53
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
I) Isolate Z2-13 from Z2-8 by cutting the trace on the PC board or by clipping the proper pin
on IC Z2 (either pin 8 or pin 13). Check the voltage level at Z2-13 with a VOM. It should be
about 0v since it's floating at this point. If the voltage is Vcc, Z2-13 is either internally or
externally shorted to Vcc and it should be replaced.
II) If a fault is not found after performing step I, then check the logic level at Z2-8 with a logic
probe. If it's HIGH, check the logic levels at Z2-9 and Z2-10. One of them or both should be
LOW. If they are both HIGH, IC Z2-8 is internally or externally shorted to Vcc.
Check the logic levels at Z2-1 and Z2-2. They should be both LOW. If they are LOW, isolate
Z2-3 from Z2-9 by cutting the trace on the PC board or by clipping the appropriate pin (Z2-3
or Z2-9). Check the logic levels at Z2-3 and Z2-9 with a logic probe. If either input is LOW,
one must conclude that IC Z2 pin 3 or pin 9 is externally or internally shorted to ground.
IV) If Z2-10 is LOW, the same test procedure should be used for the connection between Z2-
10 and Z2-6.
4-50 (a) True; (b) True; (c) False; (d) False; (e) True
4-53 A special socket that allows you to drop the chip in and then clamp the contacts onto the
pins.
4-55 JEDEC - Joint Electronic Device Engineering Council; HDL - Hardware Description Language
_____________________________________________________________________________
54
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-58
SUBDESIGN hw
(
inbits[3..0] :INPUT;
outbits[3..0] :OUTPUT;
)
ENTITY hw IS
Port (
inbits :IN BIT_VECTOR (3 downto 0);
outbits :OUT BIT_VECTOR (3 downto 0)
);
END hw;
4-59
TABLE
(a,b,c) => y;
(0,0,0) => 0;
(0,0,1) => 0;
(0,1,0) => 1;
(0,1,1) => 1;
(1,0,0) => 1;
(1,0,1) => 0;
(1,1,0) => 1;
(1,1,1) => 1;
END TABLE;
4-60
BEGIN
IF digital_value[] < 10 THEN
z = VCC; --output a 1
ELSE z = GND; --output a 0
END IF;
END;
_____________________________________________________________________________
55
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-61
4-62
PROCESS (digital_value)
BEGIN
IF (digital_value < 10) THEN z <= '1';
ELSE z <= '0';
END IF;
END PROCESS;
4-63
BEGIN
IF digital_value[] > 5 & digital_value[] < 12 THEN
y = vcc; --output a 1
ELSE y = gnd; --output a 0
END IF;
END;
-- USING PROCESS.
-- Digital Systems 10th ed
-- Tocci Widmer Moss
ENTITY prob4_63 IS
PORT( digital_value :IN INTEGER RANGE 0 TO 15; --declare 4-bit input
z :OUT BIT);
END fig4_55;
_____________________________________________________________________________
56
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
4-64 (a)
SUBDESIGN fig4_60
(
a, b, c :INPUT; --define inputs to block
y :OUTPUT; --define outputs
)
VARIABLE
status[2..0] :NODE; --holds state of cold, moderate, hot
BEGIN
status[]= (a, b, c); --link input bits in order
CASE status[] IS
WHEN b"010" => y = VCC;
WHEN b"011" => y = VCC;
WHEN b"111" => y = VCC;
WHEN OTHERS => y = GND;
END CASE;
END;
4-64 (b)
ENTITY fig4_61 IS
port(
a, b, c :IN bit; --declare 3 bits input
y :OUT BIT);
END fig4_61;
END CASE;
END PROCESS ;
END copy;
4-65 S=!P#(Q&R)
4-66 P = D3$D2$D0$D1
4-67 (a) Two-dimensional form of a truth table used to simplify a sum-of-products expression.
(b) Logic expression consisting of two or more AND terms (products) that are ORed
together.
(c) Logic circuit that produces an even or odd parity bit for a given set of input data bits.
(d) Group of eight 1s that are adjacent to each other within a Karnaugh map.
(e) Logic circuit that controls the passage of an input signal through to the output.
(f) Situation when a circuit's output level for a given set of input conditions can be
assigned as either a 1 or 0.
(h) Whenever a logic voltage level of a particular logic family falls out of the required
range of voltages for either a logic 0 or logic 1.
(i) Signal contention is when two signals are "fighting" each other.
(k) The TTL (Transistor-Transistor-Logic) family is the major family of bipolar digital ICs.
(l) The CMOS (Complementary Metal Oxide Semiconductor) family belongs to the class
of unipolar digital ICs.
4-69
_____________________________________________________________________________
58
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-1
5-3
5-4
_____________________________________________________________________________
59
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-6 The response shown would occur If the NAND latch is not working as a Flip-Flop. A permanent
logic HIGH at IC Z1-4 will prevent the latch from working properly and therefore the switch
bounce will appear at Z1-6. When the 1 KHz squarewave is high, the switch bounce will be
present at Z2-6.
5-7 Control inputs have to be stable for tS=20ns prior to the clock transition.
5-9 Assuming that Q=0 initially (for the positive edge triggered S-C FF).
Assuming that Q=0 initially (for the negative edge triggered S-C FF).
_____________________________________________________________________________
60
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-10 (a)
(b)
(c)
5-11 FF can change state only at points b, d, f, h, j based on values of J and K inputs.
5-12 (a) Connect the J and K inputs permanently HIGH. The Q output will be a squarewave with a
frequency of 5 KHz.
_____________________________________________________________________________
61
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-13
5-14 (a) Since the FF has tH=0, the FF will respond to the value present on the D input just prior
to the NGT of the clock.
(b) Connect Q to the D input of a second FF, and connect the clock signal to the second FF. The
output of the second FF will be delayed by 2 clock periods from the Input Data.
5-15 (a)
_____________________________________________________________________________
62
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
5-17 (a)
(b)
5-18
_____________________________________________________________________________
63
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-19 If Q is connected back to D, the Q and Q outputs will oscillate while CLK is HIGH. This is
because Q =1 will produce S=0, C=1 which will make Q =0. This Q =0 then will make S=1,
C=0 which will make Q =1.
5-20 J=K=1 so FF will toggle on each CLK negative-going edge, unless either PRESET or
CLEAR inputs is LOW.
5-21
CLK
____
PRE
____
CLR
5-22
_____________________________________________________________________________
64
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-25
5-26 (a) Y can go HIGH only when C goes HIGH while X is already HIGH. X can go HIGH only if
B
goes HIGH while A is HIGH. Thus, the correct sequence is A,B,C.
(b) The START pulse initially clears X and Y to 0 before applying the A,B,C signals.
(c)
_____________________________________________________________________________
65
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-27 (a)
(b)
_____________________________________________________________________________
66
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-29 Connect outputs X0 to D input of FF X2 so that the contents of the X register will be
recirculated.
5-30 This is a counter that will recycle every 8 pulses (MOD 8 counter).
(a) Count after 13 clock pulses is 5 (101); Count after 99 clock pulses is 3 (011); Count after
256 clock pulses is 0 (000).
(b) Count after 13 clock pulses is 1 (001); Count after 99 clock pulses is 7 (111); Count after
256 clock pulses is 4 (100).
If the input frequency is 80 MHz the output waveform at X3 will be a squarewave with a frequency of
500 KHz (80 MHz/16).
_____________________________________________________________________________
67
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-31
5-32
(b) With N FFs, the MOD-number is 2N=1024 so that the frequency division at the last FF
will be 1/1024 relative to the input clock. Thus, output frequency = 2MHz/1024 = 1953 Hz.
(c) MOD-number=2N=1024.
(d) Every 1024 pulses the counter recycles through zero. Thus, after 2048 pulses the
counter is back at count zero. Therefore, after 2060 pulses the counter will be at count 12
(i.e. 1024 + 1024 + 12 = 2060).
_____________________________________________________________________________
68
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-36
5-37 Regardless of the logic state of the address line A8, data gets transferred from the MPU to the
X register. Thus, the problem is in the connection between the address line A8 from the MPU
and the 8-input AND gate. The following are some of the circuit faults that could cause this
malfunction:
(a) External open on address line A8 between the MPU and the input of the Inverter.
(b) External short to Vcc on address line A8 between the MPU and the input of the Inverter.
(c) External open on the line connecting the output of the Inverter and the input of the AND
gate.
(d) External short to Vcc on the line connecting the output of the Inverter and the input of the
AND gate.
(e) Internal open or short to Vcc on the input of the Inverter.
(f) Internal open or short to Vcc on the output of the Inverter.
(g) Internal open or short to Vcc on the input of the AND gate.
5-38
_____________________________________________________________________________
69
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-39
_____________________________________________________________________________
70
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
With tp = 1.5ms
5-41
5-42 (a) Closing S1 clears X to 0. Since the OS has tp=1ms, the OS will be triggered before the
end of the tp interval for frequencies greater than 1 KHz. Thus, Q will stay LOW.
(b) If the input frequency drops below 1 KHz, the Q will return HIGH before the OS is
triggered again. This PGT at Q will clock X to the 1 state.
(c) Change tp to 1/50 KHz = 20s.
_____________________________________________________________________________
71
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
0.7 RTCT=5ms
Let CT=1F; 0.7 RT=5ms/1F = 5000
RT = 7143 6.8K (std. value).
If an accurate 5ms is required, an adjustable RT should be used.
5-45
Reduce by half the 1800pF. This will create a T=13.1s or F=76.35 KHz (almost square
wave). Now, take the output of the 555 Timer and connect it to the CLK input of a J-K FF
wired in the toggle mode (J and K inputs connected to +5V). The result at the Q output of the
J-K FF is a perfect 38.17 KHz square wave.
_____________________________________________________________________________
72
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-48
T = 1/f = 1/5 kHz = 200 s Duty cycle = 10%
tH = 0.1 T = 0.1 200 s = 20 s = 0.94 RA C
try C = 0.01 F (standard value)
RA = tH/0.94 C = 20 s/(0.940.01 F) = 2.1 k 2.0 k (5%)
tL = 0.9 T = 0.9 200 s = 180 s = 0.94 RB C
RB = tL/0.94 C = 180 s/(0.940.01 F) = 19.1 k 20 k (5%)
+5v
4 8 555
RA 2k
Reset V
7 CC
Disch 3
RB Out 5kHz
20k
6 Thresh
Control 5
2 Trig
GND
C 0.01F 1 0.01F
5-49 (a)
_____________________________________________________________________________
73
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
5-50 (a) No. An open on the CLR input would be the same as a TTL HIGH and would not cause
FF X2 to clear on the fourth pulse.
(b) Yes. Since X1 provides the CLK input to FF X2, a slow transition on X1 could cause
erratic clocking of X2.
(c) No. This would keep X2 at a permanent LOW.
(d) No. Since X2's J and K inputs are held HIGH.
5-51 (a) Yes. Q2 will stay LOW because the set-up time for FF Q2 has to be equal to 5ns or
longer and it was only 1ns (skew=13ns, tpLH for Q1=12ns)
(b) No. Q2 will go HIGH since the set-up time is 8ns which is greater than 5ns. Thus, when
Q2 is clocked, Q1 has already been HIGH for 8ns and the level at Q1 will be transferred to
Q2 (skew=18ns, tPLH for Q1=10ns).
5-52 Two cascading Inverters between Q1 and D2. This would add 12ns or 14ns to the effective
tpLH of Q1 (using propagation delays for the Inverters of problem 5.45 (a) and (b)). Now the
skew time would be less than the effective propagation delay tpLH of Q1. Thus, by the time
FF Q2 gets clocked, the signal at D2 hasn't yet changed.
5-53 (a) No. If point X was always LOW inputs J and K would've been always HIGH and therefore
FF U2 would've toggled on each NGT of the clock.
(b) No. An internal short to Vcc at U1-1 would make input K always LOW. Under these
conditions FF U2 would be cleared (J=0,K=1) or it wouldn't change states (J=0,K=0) on the
NGT of the clock.
(c) Yes. This condition causes the J input to always be HIGH (floating TTL input). Any time a
NGT on the clock occurs and B is LOW, FF U2 will toggle. If the B input is HIGH FF U2 will
SET. This analysis agrees with the Q waveform.
(d) No. This would cause input K to always be LOW. Under this condition FF U2 could either
SET (J=1,K=0) or it wouldn't change states (J=0,K=0) on the NGT of the clock.
_____________________________________________________________________________
74
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-55 (a) No. Switch bounce would have no effect since the D inputs of the FFs are not sensitive
to transitions.
(b) No. An open on the CLR (HIGH for TTL) input of FF Q2 wouldn't cause Q2 to change
during a PGT on the CLK.
(c) Yes. This fault would cause the switch bounce from the ENTER switch to be present at
the CLK inputs of the D-type FFs. Since the input D of FF Q1 is at a logic LOW during the
second combination, after the first bounce FF Q2 would get SET and after the second switch
bounce it would get CLEAR.
5-57 (a) Asynchronous Inputs - Flip-flop inputs that can affect the operation of the flip-flop
independent of the synchronous and clock inputs.
(b) Edge-Triggered - Manner in which a flip-flop is activated by a signal transition. It may
be either a positive or negative edge-triggered flip-flop.
(c) Shift Register - Digital circuit that accepts binary data from some input source and
then shifts these data through a chain of flip-flops one bit at a time.
(d) Frequency division - Expression normally associated with counters. The frequency
division ratio of a counter is equal to the total number of different states that counter
can go through and is often referred to as the counter's MOD number.
(e) Asynchronous (Jam) Transfer - Data transfer performed without the aid of the clock.
(f) State transition diagram - Way to show pictorially the states of flip-flops change with
each applied clock pulse.
(g) Parallel Data Transfer - Operation by which the entire contents of a register are
transferred simultaneously to another register.
(h) Serial Data Transfer - When data are transferred from one place to another one bit at
a time.
(i) Retriggerable One-Shot - Type of One-Shot that can be triggered while it is in the
quasi-stable state, and it will begin a new tP interval.
(j) Schmitt-trigger inputs - Inputs on certain devices that accept slow-changing signals
and produce oscillation-free transitions at the output.
5-58
This latch design always SETs when both inputs are active (LOW). It remains SET if the
inputs change simultaneously to the no change mode.
_____________________________________________________________________________
75
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-59
5-60
SUBDESIGN prob5_60
(
set, reset :INPUT;
q :OUTPUT;
)
BEGIN
IF reset == 1 THEN q = GND; -- reset or illegal command
ELSIF set == 1 THEN q = VCC; -- set
ELSE q = q; -- hold
END IF;
END;
_____________________________________________________________________________
76
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
q :BUFFER BIT);
END prob5_60;
ARCHITECTURE behavior OF prob5_60 IS
BEGIN
PROCESS (set, reset)
BEGIN
IF reset = '1' THEN q <= '0'; -- reset or illegal
command
ELSIF set = '1' THEN q <= '1'; -- set
ELSE q <= q; -- hold
END IF;
END PROCESS;
END behavior;
5-61
SUBDESIGN prob5_61
(
sbar, rbar :INPUT;
q, qbar :OUTPUT;
)
BEGIN
IF sbar == 0 THEN q = VCC; qbar = GND; -- set or illegal command
ELSIF rbar == 0 THEN q = GND; qbar = VCC; -- reset
ELSE q = q; qbar = qbar; -- hold
END IF;
END;
_____________________________________________________________________________
77
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-62
5-63
(a)
(b)
_____________________________________________________________________________
78
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(c)
SUBDESIGN latch4bit -- AHDL
(enable, din[3..0] :INPUT;
q[3..0] :OUTPUT;)
VARIABLE
q[3..0] :LATCH;
BEGIN
q[].ena = enable;
q[].d = din[];
END;
ARCHITECTURE v OF latch4bit IS
BEGIN
PROCESS (enable, din)
BEGIN
IF enable = '1' THEN q <= din;
END IF;
END PROCESS;
END v;
5-64
-- T flip-flop circuit
SUBDESIGN prob5_64_AHDL
( clk, t :INPUT;
q, qbar :OUTPUT; )
VARIABLE
ff :TFF;
BEGIN
ff.clk = clk;
ff.t = t;
q = ff.q;
qbar = !ff.q;
END;
_____________________________________________________________________________
79
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
-- T flip-flop circuit
ENTITY prob5_64_VHDL IS
PORT ( clk, t :IN BIT;
q, qbar :OUT BIT);
END prob5_64_VHDL;
5-65
(a)
(b)
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY altera;
USE altera.maxplus2.all;
ENTITY shiftreg IS
PORT (data_in, shift_pulses :IN STD_LOGIC;
x0 :OUT STD_LOGIC);
END shiftreg;
ARCHITECTURE v OF shiftreg IS
SIGNAL high :STD_LOGIC;
SIGNAL q :STD_LOGIC_VECTOR (3 DOWNTO 0);
BEGIN
ff3: JKFF PORT MAP (clk => NOT shift_pulses, j => data_in,
k => NOT data_in, prn => high, clrn => high, q => q(3));
ff2: JKFF PORT MAP (clk => NOT shift_pulses, j => q(3),
k => NOT q(3), prn => high, clrn => high, q => q(2));
ff1: JKFF PORT MAP (clk => NOT shift_pulses, j => q(2),
k => NOT q(2), prn => high, clrn => high, q => q(1));
ff0: JKFF PORT MAP (clk => NOT shift_pulses, j => q(1),
k => NOT q(1), prn => high, clrn => high, q => q(0));
high <= '1';
x0 <= q(0);
END v;
5-66
(a)
_____________________________________________________________________________
81
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
SUBDESIGN prob5_66_AHDL
(
clock, data_in :INPUT;
xff[2..0], yff[2..0] :OUTPUT;
)
VARIABLE
xff[2..0], yff[2..0] :DFF; -- defines 2 sets of 3 D FFs
BEGIN
xff[].clk = !clock; -- synchronous (parallel) clocking
yff[].clk = !clock;
xff[2].D = data_in;
xff[1].D = xff[2].Q;
xff[0].D = xff[1].Q;
yff[2].D = xff[0].Q;
yff[1].D = yff[2].Q;
yff[0].D = yff[1].Q;
END;
_____________________________________________________________________________
82
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
LIBRARY altera;
USE altera.maxplus2. ALL;
ENTITY prob5_66_VHDL IS
PORT(
clock, data_in :IN STD_LOGIC;
xff, yff :OUT STD_LOGIC_VECTOR (2 DOWNTO 0));
END prob5_66_VHDL;
ARCHITECTURE a OF prob5_66_VHDL IS
SIGNAL high :STD_LOGIC;
SIGNAL x, y :STD_LOGIC_VECTOR (2 DOWNTO 0);
BEGIN
high <= '1'; -- connection for Vcc
xff2: DFF PORT MAP( d => data_in, -- serial data input
clk => NOT clock, -- NGT clock
clrn => high, -- inactive asynch controls
prn => high,
q => x(2)); -- buried outputs
xff1: DFF PORT MAP(d => x(2), clk => NOT clock, clrn => high,
prn => high, q => x(1));
xff0: DFF PORT MAP(d => x(1), clk => NOT clock, clrn => high,
prn => high, q => x(0));
yff2: DFF PORT MAP(d => x(0), clk => NOT clock, clrn => high,
prn => high, q => y(2));
yff1: DFF PORT MAP(d => y(2), clk => NOT clock, clrn => high,
prn => high, q => y(1));
yff0: DFF PORT MAP(d => y(1), clk => NOT clock, clrn => high,
prn => high, q => y(0));
_____________________________________________________________________________
83
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
SUBDESIGN prob5_67a
(
clock1, xin :INPUT;
q1, q2 :OUTPUT;
)
VARIABLE
q1, q2 :DFF; -- defines two D FFs
clock2, nandout :node;
BEGIN
q1 . clk = !clock1;
q1 . d = VCC;
q2 . d = q[1] . q;
clock2 = !nandout;
nandout = !(xin & clock1);
END;
5-67 (b)
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
LIBRARY altera;
USE altera.maxplus2. ALL;
ENTITY prob5_67b IS
PORT(
clock1, xin :IN std_logic ;
q1, q2 :OUT std_logic);
END prob5_67b;
ARCHITECTURE a OF prob5_67b IS
SIGNAL high, clock2, nandout, clk1not, clk2not :std_logic;
SIGNAL qone, qtwo :std_logic;
BEGIN
high <= '1'; -- connection for Vcc
nandout <= NOT (xin AND clock1);
clock2 <= NOT nandout;
clock2not <= NOT clock2;
clocknot <= NOT clock1;
ff1: DFF
PORT MAP ( d => high,
clk => clk1not,
clrn => high,
prn => high,
q => qone);
ff2: DFF
PORT MAP ( d => qone,
clk => clk2not,
clrn => high,
prn => high,
q => qtwo);
q1 <= qone; -- connect ff out signals to output
pins
q2 <= qtwo;
END a;
_____________________________________________________________________________
84
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
5-68
SUBDESIGN prob5_69a
(
swa, swb, swc, reset, enterNO, enterNC :INPUT;
lock :OUTPUT;
)
VARIABLE
q1, q2 : DFF; -- defines two D FFs
enter, enterbar : node;
BEGIN
q1 . clrn = reset;
q2 . clrn = reset;
q1 . d = swa & !swb & swc;
q2 . d = !swa & swb & !swc & q1 . q;
enter = !enterNO # !enterbar;
enterbar = !enterNC # !enter;
q1 . clk = enter;
q2 . clk = enter;
lock = q2 . q;
END;
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
LIBRARY altera;
USE altera.maxplus2. ALL;
ENTITY prob5_69b IS
PORT(
Swa, swb, swc, reset, enterNO, enterNC :IN std_logic ;
lock :OUT std_logic);
END prob5_69b;
ARCHITECTURE a OF prob5_69b IS
SIGNAL q1, q2, enter, enterbar, :std_logic;
SIGNAL gate2, gate7, high :std_logic;
_____________________________________________________________________________
85
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
BEGIN
high <= '1'; -- connection for Vcc
gate2 <= swa AND (NOT swb) AND swc;
gate7 <= (NOT swa) AND swb AND (NOT swc) AND q1;
lock <= q2;
enter <= NOT enterNO OR NOT enterbar;
enterbar <= NOT enterNC OR NOT enter;
ff1: DFF
PORT MAP ( d => gate2,
clk => enter,
clrn => reset,
prn => high,
q => q1);
ff2: DFF
PORT MAP ( d => gate7, -- toggle mode
clk => enter, -- ripple clock connection
clrn => reset, -- asynch inputs inactive
prn => high,
q => q2);
END a;
_____________________________________________________________________________
86
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(p) 1011000110
1001110100
-________________
0001010010
_____________________________________________________________________________
87
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-4 (a) Eleven magnitude bits can represent decimal numbers from -211 to +(211-1) or -204810
to 204710.
(b) -32,768=-2N---> N=15 (for magnitude). Thus, sixteen bits are required including sign bit.
6-5 Four magnitude bits can represent numbers from -1610 to +1510.
6-7 (a) With 10 bits, we can represent any unsigned number from 0 to 102310. With 10 bits, we can
represent signed numbers from -29 to +(29-1), or -51210 to +51110.
(b) With 8 bits, we can represent any unsigned number from 0 to 25510. With 8 bits, we can
represent signed numbers from -27 to +(27-1), or -12810 to +12710.Using 8-bits
_____________________________________________________________________________
88
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(d) 95 = 01011111
-(-37) = 00100101
+_________
10000100 (Sign bit=1 indicates overflow.)
6-11
_____________________________________________________________________________
89
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
22.8125/1.5=15.1875
_____________________________________________________________________________
90
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
91
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-17 (a) 7716 = 11910 (b) 7716 = +11910 (c) E516 = 22910 ; E516 = -2710
6-18 One possibility is to convert each EX-OR to its NAND equivalents shown below:
Then, convert ANDs and OR gate for COUT to their equivalent NAND representation.
6-19
6-21
6-22 After the PGT of the LOAD pulse, the FFs in the B register require 30ns to produce proper
levels to the FAs. The FAs produce stable outputs in 4x40ns or 160ns (allowing for carry
propagation). These outputs have to be present at the inputs of the A register for 10ns (set-
up time) before the PGT of the TRANSFER pulse. The total time, then, is 200ns.
_____________________________________________________________________________
92
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
93
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-25
Final expression for C3 can be put into S-of-P form by multiplying all terms out. This results in
a circuit with TWO levels of gating. The arrangement of Figure 6.9 requires that A0, B0, and
C0 propagate through as many as 6 levels of gates before producing C3.
6-27 (a) SUM = 0111 (b) SUM = 1010 (-6) (c) SUM = 1100 (-4)
6-28 (a)
C4 C0 (b) C4 C0
1 1 1 1 0 0
1 1 0 1 A 1 1 0 0 A
1 1 0 0 B 0 0 1 0 B
_______________ _______________
1 0 1 0 (-6) 1 1 1 0 (-2)
(c)
C4 C0
1 1 1 1
1 0 1 1 A
1 0 1 1 B
_______________
0 1 1 1 (+7)
6-29 (a)
1 1 (b) 1
0 1 0 1 A 1 1 0 0 A
0 0 0 1 B 1 1 1 0 B
_______________ _______________
0 1 1 1 (+7) 1 0 1 0 (-6)
No Overflow No Overflow
(c)
1 1 0 0 A
0 0 0 0 B
_______________
1 1 0 0 (-4)
No Overflow
_____________________________________________________________________________
94
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-31 Three 74HC00 chips will have a total of twelve 2-input NAND gates.
I. Replace all of the 2-input AND gates (gates 1, 2, 3, 4, 5, 6, 7, and 8) with 2-input NAND
gates.
II. Replace all of the 2-input OR gates (gates 9, 10, 11, and 12) with 2-input NAND gates.
6-32 An EX-OR used as a controlled inverter with X as the control input can be connected as
shown below for each B FF.
6-33 (a) [S]=011 will select the A plus B operation: [A]=0110; [B]=0011; therefore, F=1001,
CN+4=0, OVR=1
(b) [S]=001 will select the B minus A operation: [A]=0110; [B]=0011; therefore, F=1101,
CN+4=0, OVR=0
(c) [S]=010 will select the A minus B operation: [A]=0110; [B]=0011; therefore, F=0011,
CN+4=1, OVR=0
6-34 [S] = 100 will select the Exclusive-OR operation: [A] = XXXX; [B] = 1111.
Therefore, F = [ A] .
6-35 (a) [S] = 110 will select the AND operation: [A] = 10101100; [B] = 00001111; therefore,
=00001100.
(b) [S] = 100 will select the Exclusive-OR operation:[A] = 11101110; [B] = 00110010;
therefore, =11011100.
6-36 [S] = 100 to select the Exclusive-OR operation. Thus, the outputs will be zero when [A] =
[B]. The NORed result of the output sums 0-7 will indicate whether or not the binary
numbers are equal (X=1). The output X of the NOR gate is HIGH when [A]=[B].
_____________________________________________________________________________
95
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-37 (a) After 0010 is transferred into the A register, [A] = 0010.
After [A] is added to 0011 the result should be 0101. However, because bit A2 is stuck
LOW the final results in [A] = 0001.
(b) [A] = 1010
(c) After 0111 is transferred into the A register, [A] = 0011.
After [A] is added to 0011 the result should be 0110. However, because bit A2 is stuck
LOW the final results in [A] = 0010.
(d) [A] = 1011
(e) After 1001 is transferred into the A register, [A] = 1001.
After [A] is added to 0011 the result should be 1100. However, because bit A2 is stuck
LOW the final results in [A] = 1000.
6-38 The technician most likely connected input C0 of the 4-bit parallel adder to the ADD signal
instead of the SUB signal.
6-41
_____________________________________________________________________________
96
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
6-42 AHDL
a [7..0], b[7..0] :INPUT;
z[7..0] :OUTPUT;
VHDL
PORT( a, b :IN BIT_VECTOR (7 DOWNTO 0;
z :OUT BIT_VECTOR (7 DOWNTO 0);
6-43 (a) 000100 (b)10111111 (c) 1000100 (d) 1000000 (e) 0101110
6-46 AHDL
z[6..0] = a[7..1]
z[7] = a[0];
VHDL
z(6..0) <= a(7..1);
z(7) <= a(0);
6-47 AHDL
Z= (B 0000 , b[7..4])
VHDL
Z= B 0000 & b(7 DOWNTO 4);
6-48
-- AHDL adder with overflow detection
SUBDESIGN prob6_48_AHDL
( a[8..1], b[8..1] :INPUT;
s[8..1], overflow :OUTPUT)
BEGIN
s[] = a[] + b[];
IF a[8] == GND & b[8] == GND & s[8] == VCC
THEN overflow = VCC;
ELSIF a[8] == VCC & b[8] == VCC & s[8] == GND
THEN overflow = VCC;
ELSE overflow = GND;
END IF;
END;
_____________________________________________________________________________
97
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
BEGIN
IF a < 0 AND b < 0 AND result >= 0
THEN overflow <= '1';
ELSIF a >= 0 AND b >= 0 AND result < 0
THEN overflow <= '1';
ELSE overflow <= '0';
END IF;
END PROCESS;
END;
6-49
BEGIN
s <= a + b;
END parallel;
6-50
PACKAGE const IS
CONSTANT n :INTEGER := 6;
-- user gives number of input bits
CONSTANT m :INTEGER := 2**n; -- compute combinations
CONSTANT p :INTEGER := n+1; -- add extra bit
CONSTANT q :INTEGER := 2**p; -- compute combinations
END const;
USE work.const.all;
ENTITY prob6_50_VHDL IS
PORT(
a :IN INTEGER RANGE 0 TO m-1; -- augend
b :IN INTEGER RANGE 0 TO m-1; -- addend;
sum :OUT INTEGER RANGE 0 TO q-1 -- answer
);
END prob6_50_VHDL;
ENTITY prob6_51 IS
PORT( cin :IN bit;
s :IN BIT_VECTOR(2 DOWNTO 0);
a :IN BIT_VECTOR(3 DOWNTO 0);
b :IN BIT_VECTOR(3 DOWNTO 0);
f :OUT BIT_VECTOR(3 DOWNTO 0);
cout :OUT bit;
ovr :OUT BIT);
END prob6_51 ;
ARCHITECTURE a OF prob6_51 IS
SIGNAL c :bit_vector (4 DOWNTO 0); -- carries require 5 bit array
BEGIN
PROCESS (a,b,s)
BEGIN
CASE s IS
WHEN "000" =>
f <= "0000";
cout <= '0';
ovr <= '0';
WHEN B"001" =>
c(0) <= cin;
f <= (NOT a) XOR b XOR c(3 DOWNTO 0); -- generate sum
c(4 DOWNTO 1) <= ((NOT a) AND b) OR ((NOT A) AND c(3 DOWNTO 0)) OR
(b AND c(3 DOWNTO 0));
cout <= c(4); -- carry out
_____________________________________________________________________________
99
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
SUBDESIGN prob6_51
(
cin :INPUT; -- Carry in
s[2..0] :INPUT; -- select operation
a[3..0] :INPUT; -- operand A
b[3..0] :INPUT; -- operand B
f[3..0] :OUTPUT; -- result
cout :OUTPUT; -- Carry OUT
ovr :OUTPUT; -- overflow
)
VARIABLE
c[4..0] :node; -- carry array is 5 bits long!
BEGIN
CASE s[] IS
WHEN B"000" =>
f[] = 0;
6-52
(a) Full Adder - Logic circuit with three inputs and two outputs. The inputs are a carry bit
(CIN) from a previous stage, a bit from the Augend, and a bit from the addend,
respectively. The outputs are the sum bit produced by the addition of the bit from the
addend with the bit from the Augend and the resulted carry (C OUT) bit which will be
added to the next stage.
(b) 2's-Complement Form - Result obtained when a 1 is added to the least significant bit
position of a binary number in the 1's-complement form.
(c) Arithmetic/Logic Unit - Digital circuit used in computers to perform various arithmetic
and logic operations.
(d) Sign Bit - Binary bit that is added to the leftmost position of a binary number to indicate
whether that number represents a positive or a negative quantity.
(e) Overflow - When in the process of adding signed binary numbers a 1 is generated from
the MSB position of the number into the sign bit position.
_____________________________________________________________________________
101
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(g) Parallel Adder - Digital circuit made from full adders and used to add all the bits from the
addend and the Augend together and simultaneously.
(h) Look-Ahead Carry - Ability of some parallel adders to predict, without having to wait for
the carry to propagate through the full adders, whether or not a carry bit (C OUT) will be
generated as a result of the addition, thus reducing the overall propagation delays.
(i) Negation (2's complementing)- It's the operation of converting a positive binary number
to its negative equivalent or a negative binary number to its positive equivalent.
(j) B-Register - One of two flip-flop registers used by the ALU (Arithmetic-Logic Unit).
6-53
6-55 The general rule used to convert 8-bit to 16-bit signed binary numbers is as follows:
1. If the signed bit of the 8-bit signed number is positive (0), then 8 more 0s are added in
front of the 8-bit number thereby, making it a 16-bit number with the same sign as the
original 8-bit number.
2. If the signed bit of the 8-bit signed number is negative (1), then 8 more 1s are added in
front of the 8-bit number thereby, making it a 16-bit number with the same sign as the
original 8-bit number.
_____________________________________________________________________________
102
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-1 (a) 250 kHz; 50% (b) same as (a) (c) 1 MHz (d) 32
7-3 100002
A
A
B AB
A
ABCD C
D ABC B B
1
C
E J D J C J B J A J
E K D K C K B K A K
CLR CLR CLR CLR CLR
CLK
7-8 (a) Add one more FF & gate to Problem 7-7(a) schematic. (b) 33 MHz
A
B
C
D
ABCDE E
F J
CLK
F K
CLR
1
CLK
_____________________________________________________________________________
103
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-9
(a)
CLK
7-10
(a)
CLK
7-11 Replace 4-input NAND with a 3-input NAND driving all FF CLRs and whose inputs are Q5, Q4,
and Q1.
7-12
Q5Q4Q3Q2Q1 Q0
Q4Q3Q2Q1 Q0 Q3 Q2 Q1 Q0 Q2 Q1 Q0 Q1 Q0
Q0 1
10 kHz
Q6 J Q5 J Q4 J Q3 J Q2 J Q1 J Q0 J
K K K K K K K
CLR CLR CLR CLR CLR CLR CLR
1 MHz
Q6
Q5
Q2
_____________________________________________________________________________
104
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-13
_
A _
_ _ A
____ B __
_ ___ A AB
ABCD C _ _
_ ABC B
D B
_ 1
C
E J D J C J B J A J
E K D K C K B K A K
CLR CLR CLR CLR CLR
CLK
7-14
C
B B
A A
A
_ _
C B _
_ A
B
A
A
dir
1
C J C J B J A J
CLOCK
7-15 Counter switches states between 000 and 111 on each clock pulse.
7-16
CLK
__
PL
101 010
Q0
Q1
Q2
_____________________________________________________________________________
105
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-17
CLK
___
CLR
_____
LOAD
ENT
ENP
QD
QC
QB
QA
RCO
7-18
CLK
___
CLR
_____
LOAD
ENT
ENP
QD
QC
QB
QA
RCO
_____________________________________________________________________________
106
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-19
CLK
_
D/U
_____
LOAD
_____
CTEN
QD
QC
QB
QA
MAX/MIN
____
RCO
7-20
CLK
_
D/U
_____
LOAD
_____
CTEN
QD
QC
QB
QA
MAX/MIN
____
RCO
7-21
(a) 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, & repeat
(b) MOD-12
(c) frequency at QD (MSB) is 1/12 of CLK frequency
(d) 33.3%
7-22
(a) 0000, 0001, 0010, 0011, 0100, 0101, 0110, 1001, 1010, 1011, 1100, 1101, 1110, 0001,
& repeat
(b) MOD-12
(c) frequency at QD (MSB) is 1/12 of CLK frequency
(d) 50%
_____________________________________________________________________________
107
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-23 (a)
CLK
QA
QB
QC
QD
(b) MOD-10
(c) 10 down to 1
(d) Can produce MOD-10, but not same sequence.
7-25
(a)
(b)
_____________________________________________________________________________
108
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-26
(a)
(b)
(c)
_____________________________________________________________________________
109
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-27
CLK
74HC161 74HC161
CLK CLK
__
EN ENT RCO ENT RCO
1 ENP 1 ENP
___ ___ ___
CLR CLR CLR
_____ _____
LOAD LOAD
0 D QD Q3 0 D QD
0 C QC Q2 0 C QC Q6 (MSB)
0 B QB Q1 0 B QB Q5
0 A QA Q0 0 A QA Q4
Q6
Q5
Q1
Q0
7-28
CLK
74ALS160 or 74ALS160 or
74ALS162 74ALS162
CLK CLK
EN ENT RCO ENT RCO
1 ENP 1 ENP
___ ___
1 CLR 1 CLR
_____ _____
LD LOAD LOAD
D3 D QD Q3 D7 D QD Q7
D2 C QC Q2 D6 C QC Q6 ten's
D1 B QB Q1 D5 B QB Q5 digit
D0 A QA Q0 D4 A QA Q4
7-29
Output: QA QB QC QD RCO
Frequency: 3 MHz 1.5 MHz 750 kHz 375 kHz 375 kHz
Duty Cycle: 50% 50% 50% 50% 6.25%
7-30
Output: QA QC QD RCO
Frequency: 3 MHz 600 kHz 600 kHz 600 kHz
Duty Cycle: 50% 40% 20% 10%
_____________________________________________________________________________
110
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
1.5MHz
1 74HC162
CLK
ENT RCO
ENP
U1
___
CLR
74HC163 _____
LOAD
12MHz CLK
D QD 150kHz
ENT RCO
C QC
ENP
U1 B QB
___
CLR A QA
_____
1 LOAD
74HC163
D QD
C QC CLK
B QB ENT RCO
A QA ENP
U2
___
1 CLR
_____
LOAD
D QD 100kHz
C QC
B QB
1 A QA
_____________________________________________________________________________
111
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-34
12M/12 = 1M 12M/15 = 800k 800k/8 = 100k
74HC161
12MHz CLK
ENT RCO
ENP
___
U2 800kHz
74HC161 1 CLR
_____
CLK LOAD 74HC161
ENT RCO
D QD CLK
ENP
U1 C QC ENT RCO
___
CLR B QB ENP
U1
_____ 1 A QA ___
1 LOAD CLR
_____
D QD 1 LOAD
C QC
D QD
B QB
C QC 100kHz
A QA
B QB
A QA
1MHz
7-35
_ _ _ _
D D D D
C
0 C
1 C
2 C
3
B B B B
A A A A
_ _ _ _
D D D D
C
4 C
5 C
6 C
7
B B B B
A A A A
D D D D
C
8 C
9 C
10 C
11
B B B B
A A A A
D D D D
C
12 C
13 C
14 C
15
B B B B
A A A A
7-36
_ _ _ _ _
D D D D D
C
0 C
1 C
2 C
3 C
4
B B B B B
A A A A A
_ _ _
D D D D D
C
5 C
6 C
7 C
8 C
9
B B B B B
A A A A A
_____________________________________________________________________________
112
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
F=0
0000 0001 0010 0011 0100 0101 0110 0111
DCBA
F=1
1111 1110 1101 1100 1011 1010 1001 1000
_____________________________________________________________________________
113
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
CBA 100
7-43
(a) JA BC, KA 1, JB CA C A, KB 1, JC BA, KC B A
(b) JA BC, KA 1, JB KB 1, JC KC B
7-44
(a) JA C B C B , KA 1, JB C A, KB C A, JC B A, KC 1
(b) JA B C , KA 1, JB C , KB A, JC B A, KC 1 (self-correcting)
7-45
JA KA 1, JB C A DA, KB A, JC DA, KC A B, JD C B A, KD A
7-46
JA C B DC D B , KA 1, JB DA D A, KB C D A DA,
JC A B D D B A , KC AB BD DB A
7-47
DA A, DB BA B A, DC CA CB C B A
7-48
DA A, DB BA BA, DC CA CB D B A, DD DB DA CBA
_____________________________________________________________________________
114
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-49
(a)
(b)
SUBDESIGN mod13_ahdl
( clock :INPUT;
q[3..0] :OUTPUT; )
VARIABLE
q[3..0] :DFF;
BEGIN
q[].clk = clock;
IF q[].q == 12 THEN -- check for terminal state
q[].d = B"0000"; -- recycle
ELSE
q[].d = q[].q + 1; -- increment
END IF;
END;
ENTITY mod13_vhdl IS
PORT ( clock :IN BIT;
q :OUT INTEGER RANGE 0 TO 15 );
END mod13_vhdl;
ARCHITECTURE vhdl OF mod13_vhdl IS
BEGIN
PROCESS (clock)
VARIABLE counter :INTEGER RANGE 0 TO 15;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF (counter = 12) THEN -- terminal state?
counter := 0; -- recycle
ELSE counter := counter + 1; -- increment
END IF;
END IF;
q <= counter;
END PROCESS;
END vhdl;
_____________________________________________________________________________
115
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-50
(a)
(b)
SUBDESIGN mod25_ahdl
( clock :INPUT;
q[4..0] :OUTPUT; )
VARIABLE
q[4..0] :DFF;
BEGIN
q[].clk = clock;
IF q[].q == 0 THEN -- terminal state?
q[].d = B"11000"; -- recycle
ELSE
q[].d = q[].q - 1; -- decrement
END IF;
END;
ENTITY mod25_vhdl IS
PORT ( clock :IN BIT;
q :OUT INTEGER RANGE 31 DOWNTO 0 );
END mod25_vhdl;
ARCHITECTURE vhdl OF mod25_vhdl IS
BEGIN
PROCESS (clock)
VARIABLE counter :INTEGER RANGE 31 DOWNTO 0;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF (counter = 0) THEN -- terminal state?
counter := 24; -- recycle
ELSE counter := counter - 1; -- decrement
END IF;
END IF;
q <= counter;
END PROCESS;
END vhdl;
_____________________________________________________________________________
116
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-51
SUBDESIGN gray_ahdl
( clock, cnt :INPUT;
q[3..0] :OUTPUT; )
VARIABLE
gray: MACHINE OF BITS (q[3..0])
WITH STATES (s0 = B"0000", s1 = B"0001", s2 = B"0011", s3 = B"0010",
s4 = B"0110", s5 = B"0111", s6 = B"0101", s7 = B"0100",
s8 = B"1100", s9 = B"1101", s10 = B"1111", s11 = B"1110",
s12 = B"1010", s13 = B"1011", s14 = B"1001", s15 = B"1000");
BEGIN
gray.clk = clock;
IF cnt THEN
CASE gray IS
WHEN s0 => gray = s1;
WHEN s1 => gray = s2;
WHEN s2 => gray = s3;
WHEN s3 => gray = s4;
WHEN s4 => gray = s5;
WHEN s5 => gray = s6;
WHEN s6 => gray = s7;
WHEN s7 => gray = s8;
WHEN s8 => gray = s9;
WHEN s9 => gray = s10;
WHEN s10 => gray = s11;
WHEN s11 => gray = s12;
WHEN s12 => gray = s13;
WHEN s13 => gray = s14;
WHEN s14 => gray = s15;
WHEN s15 => gray = s0;
END CASE;
ELSE
CASE gray IS
WHEN s0 => gray = s0;
WHEN s1 => gray = s1;
WHEN s2 => gray = s2;
WHEN s3 => gray = s3;
WHEN s4 => gray = s4;
WHEN s5 => gray = s5;
WHEN s6 => gray = s6;
WHEN s7 => gray = s7;
WHEN s8 => gray = s8;
WHEN s9 => gray = s9;
WHEN s10 => gray = s10;
WHEN s11 => gray = s11;
WHEN s12 => gray = s12;
WHEN s13 => gray = s13;
WHEN s14 => gray = s14;
WHEN s15 => gray = s15;
END CASE;
END IF;
END;
_____________________________________________________________________________
117
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY gray_vhdl IS
PORT ( clock, cnt :IN BIT;
q :OUT BIT_VECTOR (3 DOWNTO 0) );
END gray_vhdl;
ARCHITECTURE vhdl OF gray_vhdl IS
BEGIN
PROCESS (clock)
VARIABLE seq :BIT_VECTOR (3 DOWNTO 0);
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF (cnt = '1') THEN
CASE seq IS
WHEN "0000" => seq := "0001";
WHEN "0001" => seq := "0011";
WHEN "0011" => seq := "0010";
WHEN "0010" => seq := "0110";
WHEN "0110" => seq := "0111";
WHEN "0111" => seq := "0101";
WHEN "0101" => seq := "0100";
WHEN "0100" => seq := "1100";
WHEN "1100" => seq := "1101";
WHEN "1101" => seq := "1111";
WHEN "1111" => seq := "1110";
WHEN "1110" => seq := "1010";
WHEN "1010" => seq := "1011";
WHEN "1011" => seq := "1001";
WHEN "1001" => seq := "1000";
WHEN "1000" => seq := "0000";
END CASE;
ELSE
CASE seq IS
WHEN "0000" => seq := "0000";
WHEN "0001" => seq := "0001";
WHEN "0011" => seq := "0011";
WHEN "0010" => seq := "0010";
WHEN "0110" => seq := "0110";
WHEN "0111" => seq := "0111";
WHEN "0101" => seq := "0101";
WHEN "0100" => seq := "0100";
WHEN "1100" => seq := "1100";
WHEN "1101" => seq := "1101";
WHEN "1111" => seq := "1111";
WHEN "1110" => seq := "1110";
WHEN "1010" => seq := "1010";
WHEN "1011" => seq := "1011";
WHEN "1001" => seq := "1001";
WHEN "1000" => seq := "1000";
END CASE;
END IF;
END IF;
q <= seq;
END PROCESS;
END vhdl;
_____________________________________________________________________________
118
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-52
SUBDESIGN stepper_ahdl
(
clock, dir :INPUT;
q[3..0] :OUTPUT;
)
VARIABLE
stepper :MACHINE OF BITS (q[3..0])
WITH STATES (initial = B"0000", s1 = B"0101", s2 = B"0001",
s3 = B"1001", s4 = B"1000", s5 = B"1010", s6 = B"0010",
s7 = B"0110", s8 = B"0100");
BEGIN
stepper.clk = clock;
IF dir == VCC THEN
CASE stepper IS
WHEN initial => stepper = s1;
WHEN s1 => stepper = s2;
WHEN s2 => stepper = s3;
WHEN s3 => stepper = s4;
WHEN s4 => stepper = s5;
WHEN s5 => stepper = s6;
WHEN s6 => stepper = s7;
WHEN s7 => stepper = s8;
WHEN s8 => stepper = s1;
END CASE;
ELSE
CASE stepper IS
WHEN initial => stepper = s1;
WHEN s1 => stepper = s8;
WHEN s2 => stepper = s1;
WHEN s3 => stepper = s2;
WHEN s4 => stepper = s3;
WHEN s5 => stepper = s4;
WHEN s6 => stepper = s5;
WHEN s7 => stepper = s6;
WHEN s8 => stepper = s7;
END CASE;
END IF;
END;
_____________________________________________________________________________
119
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY stepper_vhdl IS
PORT (
clock, dir :IN BIT;
q :OUT BIT_VECTOR (3 DOWNTO 0));
END stepper_vhdl;
ARCHITECTURE vhdl OF stepper_vhdl IS
BEGIN
PROCESS (clock)
VARIABLE stepper :BIT_VECTOR (3 DOWNTO 0);
BEGIN
IF (clock'EVENT AND clock= '1') THEN
IF dir = '0' THEN
CASE stepper IS
WHEN "0101" => stepper := "0100";
WHEN "0100" => stepper := "0110";
WHEN "0110" => stepper := "0010";
WHEN "0010" => stepper := "1010";
WHEN "1010" => stepper := "1000";
WHEN "1000" => stepper := "1001";
WHEN "1001" => stepper := "0001";
WHEN "0001" => stepper := "0101";
WHEN OTHERS => stepper := "0101";
END CASE;
ELSIF dir = '1' THEN
CASE stepper IS
WHEN "0101" => stepper := "0001";
WHEN "0001" => stepper := "1001";
WHEN "1001" => stepper := "1000";
WHEN "1000" => stepper := "1010";
WHEN "1010" => stepper := "0010";
WHEN "0010" => stepper := "0110";
WHEN "0110" => stepper := "0100";
WHEN "0100" => stepper := "0101";
WHEN OTHERS => stepper := "0101";
END CASE;
END IF;
END IF;
q <= stepper;
END PROCESS;
END vhdl;
_____________________________________________________________________________
120
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-53
(a)
(b)
SUBDESIGN divide_by50_ahdl
( freq_in :INPUT;
freq_out :OUTPUT;)
VARIABLE
divide_by[5..0] :DFF;
BEGIN
divide_by[].clk = freq_in;
IF divide_by[] == 1 THEN
divide_by[].d = 50;
freq_out = VCC;
ELSE divide_by[].d = divide_by[].q - 1;
END IF;
END;
ENTITY divide_by50_vhdl IS
PORT (freq_in :IN BIT;
freq_out :OUT BIT);
END divide_by50_vhdl;
ARCHITECTURE vhdl OF divide_by50_vhdl IS
BEGIN
PROCESS (freq_in)
VARIABLE divider :INTEGER RANGE 0 TO 50;
BEGIN
IF (freq_in'EVENT AND freq_in='1') THEN
IF divider = 1 THEN
divider := 50;
ELSE
divider := divider - 1;
END IF;
END IF;
IF divider = 1 THEN
freq_out <= '1';
ELSE
freq_out <= '0';
END IF;
END PROCESS;
END vhdl;
_____________________________________________________________________________
121
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-54
(a)
or
(b)
SUBDESIGN variable_div_ahdl
( freqin, fselect :INPUT;
freqout :OUTPUT; )
VARIABLE
divider[3..0] :DFF;
BEGIN
DEFAULTS
freqout = GND;
END DEFAULTS;
divider[].clk = freqin;
IF fselect == GND THEN
IF divider[].q == 11 THEN divider[].d = 0; freqout = VCC;
ELSE divider[].d = divider[].q + 1;
END IF;
ELSE
IF divider[].q == 4 THEN divider[].d = 0; freqout = VCC;
ELSE divider[].d = divider[].q + 1;
END IF;
END IF;
END;
_____________________________________________________________________________
122
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY variable_div_vhdl IS
PORT ( freqin, fselect :IN BIT;
freqout :OUT BIT);
END variable_div_vhdl;
ARCHITECTURE vhdl OF variable_div_vhdl IS
BEGIN
PROCESS (freqin)
VARIABLE
divider :INTEGER RANGE 0 TO 12;
BEGIN
IF (freqin'EVENT AND freqin = '1') THEN
IF fselect = '0' THEN
IF divider = 11 THEN divider := 0;
ELSE divider := divider + 1;
END IF;
ELSE
IF divider = 4 THEN divider := 0;
ELSE divider := divider + 1;
END IF;
END IF;
END IF;
IF (divider = 11 AND fselect = '0') THEN freqout <= '1';
ELSIF (divider = 4 AND fselect = '1') THEN freqout <= '1';
ELSE freqout <= '0';
END IF;
END PROCESS;
END;
_____________________________________________________________________________
123
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-55
SUBDESIGN mod256_ahdl
(
clock, clear, load, cntenabl, down, din[7..0] :INPUT;
q[7..0], term_ct :OUTPUT;
)
VARIABLE
count[7..0] :DFF;
BEGIN
count[].clk = clock;
count[].clrn = !clear;
IF load THEN count[].d = din[];
ELSIF !cntenabl THEN count[].d = count[].q;
ELSIF !down THEN
count[].d = count[].q + 1;
ELSE
count[].d = count[].q - 1;
END IF;
IF ((count[].q == 0) & down # (count[].q == 255) & !down) & cntenabl
THEN term_ct = VCC;
ELSE term_ct = GND;
END IF;
q[] = count[].q;
END;
ENTITY mod256_vhdl IS
PORT (clock, clear, load, cntenabl, down :IN BIT;
din :IN INTEGER RANGE 0 TO 255;
q :OUT INTEGER RANGE 0 TO 255;
term_ct :OUT BIT);
END mod256_vhdl;
ARCHITECTURE vhdl OF mod256_vhdl IS
BEGIN
PROCESS (clock, clear, down)
VARIABLE count :INTEGER RANGE 0 TO 255;
BEGIN
IF clear = '1' THEN count := 0;
ELSIF (clock = '1' AND clock'EVENT) THEN
IF load = '1' THEN count := din;
ELSIF cntenabl = '1' THEN
IF down = '0' THEN count := count + 1;
ELSE count := count - 1;
END IF;
END IF;
END IF;
IF (((count = 0) AND (down = '1')) OR
((count = 255) AND (down = '0'))) AND cntenabl = '1'
THEN term_ct <= '1';
ELSE term_ct <= '0';
END IF;
q <= count;
END PROCESS;
END vhdl;
_____________________________________________________________________________
124
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-56
SUBDESIGN mod1024_ahdl
(
clock, clear, load, cntenabl, down, din[9..0] :INPUT;
q[9..0], term_ct :OUTPUT;
)
VARIABLE
count[9..0] :DFF;
BEGIN
count[].clk = clock;
count[].clrn = !clear;
IF load THEN count[].d = din[];
ELSIF !cntenabl THEN count[].d = count[].q;
ELSIF !down THEN
count[].d = count[].q + 1;
ELSE
count[].d = count[].q - 1;
END IF;
IF ((count[].q == 0) & down # (count[].q == 1023) & !down) & cntenabl
THEN term_ct = VCC;
ELSE term_ct = GND;
END IF;
q[] = count[].q;
END;
ENTITY mod1024_vhdl IS
PORT (clock, clear, load, cntenabl, down :IN BIT;
din :IN INTEGER RANGE 0 TO 1023;
q :OUT INTEGER RANGE 0 TO 1023;
term_ct :OUT BIT);
END mod1024_vhdl;
ARCHITECTURE vhdl OF mod1024_vhdl IS
BEGIN
PROCESS (clock, clear, down)
VARIABLE count :INTEGER RANGE 0 TO 1023;
BEGIN
IF clear = '1' THEN count := 0;
ELSIF (clock = '1' AND clock'EVENT) THEN
IF load = '1' THEN count := din;
ELSIF cntenabl = '1' THEN
IF down = '0' THEN count := count + 1;
ELSE count := count - 1;
END IF;
END IF;
END IF;
IF (((count = 0) AND (down = '1')) OR
((count = 1023) AND (down = '0'))) AND cntenabl = '1'
THEN term_ct <= '1';
ELSE term_ct <= '0';
END IF;
q <= count;
END PROCESS;
END vhdl;
_____________________________________________________________________________
125
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-57
(a)
(b)
SUBDESIGN mod16_ahdl
( clock, clr, ld, en, din[3..0] :INPUT;
q[3..0], term_ct :OUTPUT; )
VARIABLE
count[3..0] :DFF;
BEGIN
count[].clk = clock;
IF !ld THEN count[].d = din[];
ELSIF clr THEN count[].d = 0;
ELSIF !en THEN count[].d = count[].q - 1;
ELSE count[].d = count[].q ;
END IF;
IF (count[].q == 0 & en == GND) THEN term_ct = VCC;
ELSE term_ct = GND;
END IF;
q[] = count[];
END;
_____________________________________________________________________________
126
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY mod16_vhdl IS
PORT( clock, clr, ld, en :IN BIT;
din :IN INTEGER RANGE 15 DOWNTO 0;
q :OUT INTEGER RANGE 15 DOWNTO 0;
term_ct :OUT BIT);
END mod16_vhdl;
ARCHITECTURE vhdl OF mod16_vhdl IS
BEGIN
PROCESS (clock, en)
VARIABLE count :INTEGER RANGE 15 DOWNTO 0;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF ld = '0' THEN count := din;
ELSIF clr = '1' THEN count := 0;
ELSIF en = '0' THEN count := count - 1;
END IF;
END IF;
IF (count = 0 AND en = '0') THEN term_ct <= '1';
ELSE term_ct <= '0';
END IF;
q <= count;
END PROCESS;
END vhdl;
_____________________________________________________________________________
127
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-58
(a)
(b)
SUBDESIGN mod10_ahdl
(
clock, clear, load, enable, up, din[3..0] :INPUT;
q[3..0], term_ct :OUTPUT;
)
VARIABLE
count[3..0] :DFF;
BEGIN
count[].clk = clock;
count[].clrn = clear;
IF load THEN count[].d = din[];
ELSIF enable THEN
IF up THEN
IF count[].q == 9 THEN
count[].d = 0;
ELSE count[].d = count[].q + 1;
END IF;
ELSE
IF count[].q == 0 THEN
count[].d = 9;
ELSE count[].d = count[].q - 1;
END IF;
END IF;
ELSE count[].d = count[].q;
END IF;
IF ((count[].q == 9 & up) # (count[].q == 0 & !up)) & enable
THEN term_ct = VCC;
ELSE term_ct = GND;
END IF;
q[] = count[];
END;
_____________________________________________________________________________
128
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY mod10_vhdl IS
PORT(clock, clear, load, enable, up :IN BIT;
din :IN INTEGER RANGE 0 TO 9;
q :OUT INTEGER RANGE 0 TO 9;
term_ct :OUT BIT);
END mod10_vhdl;
ARCHITECTURE vhdl OF mod10_vhdl IS
BEGIN
PROCESS (clock, clear, enable, up)
VARIABLE count :INTEGER RANGE 0 TO 9;
BEGIN
IF clear = '0' THEN count := 0;
ELSIF (clock'EVENT AND clock = '1') THEN
IF load = '1' THEN count := din;
ELSIF enable = '1' THEN
IF up = '1' THEN
IF count = 9 THEN count := 0;
ELSE count := count + 1;
END IF;
ELSE
IF count = 0 THEN count := 9;
ELSE count := count - 1;
END IF;
END IF;
END IF;
END IF;
IF ((count = 9 AND up = '1') OR
(count = 0 AND up = '0')) AND enable = '1'
THEN term_ct <= '1';
ELSE term_ct <= '0';
END IF;
q <= count;
END PROCESS;
END vhdl;
_____________________________________________________________________________
129
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-59
INPUT
3 clk VCC
OUTPUT
6 ones[3..0]
mod10 mod10
OUTPUT
clock counter[3..0] clock counter[3..0]
7 tens[3..0]
INPUT enable tc enable tc
4 en VCC
clear clear
1 2
INPUT
5 clr VCC mod10
OUTPUT
clock counter[3..0]
10 hund[3..0]
enable tc
OUTPUT
clear
8 max
9
7-60
fig7_43
INPUT clock
3 clock VCC
clear
q[3..0] q[7..0] OUTPUT
load q[3..0]
9 q[7..0]
INPUT cntenabl term_ct
6 cntenabl VCC
down
INPUT
7 dow n VCC fig7_43
clock
INPUT clear
4 clear VCC
load q[3..0]
q[7..4]
OUTPUT
cntenabl term_ct
10 term_ct
down
din[7..4] din[3..0]
_____________________________________________________________________________
130
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-61
(a)
(b)
INPUT
3 clock VCC
OUTPUT
6 ones[3..0]
mod10_ahdl mod5_ahdl
OUTPUT
clock q[3..0] clock q[2..0]
7 tens[2..0]
INPUT enable tc enable tc
4 enable VCC
clrn clrn
OUTPUT
8 tc
1 2
INPUT
5 clrn VCC
SUBDESIGN mod10_ahdl
(
clock, enable, clrn :INPUT;
q[3..0], tc :OUTPUT;
)
VARIABLE
q[3..0] :DFF;
BEGIN
q[].clk = clock;
IF q[].q == 9 & enable THEN tc = VCC;
ELSE tc = GND;
END IF;
IF !clrn THEN q[].d = 0;
ELSIF enable THEN
IF q[].q == 9 THEN q[].d = 0;
ELSE q[].d = q[].q + 1;
END IF;
ELSE q[].d = q[].q;
END IF;
END;
_____________________________________________________________________________
131
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
SUBDESIGN mod5_ahdl
(
clock, enable, clrn :INPUT;
q[2..0], tc :OUTPUT;
)
VARIABLE
q[2..0] :DFF;
BEGIN
q[].clk = clock;
IF q[].q == 4 & enable THEN tc = VCC;
ELSE tc = GND;
END IF;
IF !clrn THEN q[].d = 0;
ELSIF enable THEN
IF q[].q == 4 THEN q[].d = 0;
ELSE q[].d = q[].q + 1;
END IF;
ELSE q[].d = q[].q;
END IF;
END;
ENTITY mod50_vhdl IS
PORT(clock, enable, clrn :IN BIT;
tc :OUT BIT;
ones :OUT INTEGER RANGE 0 TO 9;
tens :OUT INTEGER RANGE 0 TO 4);
END mod50_vhdl;
ARCHITECTURE vhdl OF mod50_vhdl IS
SIGNAL cascade_node :BIT;
COMPONENT mod10_vhdl
PORT(clock, enable, clrn :IN BIT;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 9);
END COMPONENT;
COMPONENT mod5_vhdl
PORT(clock, enable, clrn :IN BIT;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 4);
END COMPONENT;
BEGIN
digit1: mod10_vhdl PORT MAP (clock => clock, enable => enable,
clrn => clrn, tc => cascade_node, q => ones);
digit2: mod5_vhdl PORT MAP (clock => clock, enable => cascade_node,
clrn => clrn, tc => tc, q => tens);
END vhdl;
--------------------------------------------------------
_____________________________________________________________________________
132
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY mod10_vhdl IS
PORT(clock, enable, clrn :IN BIT;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 9);
END mod10_vhdl;
ARCHITECTURE lsd OF mod10_vhdl IS
BEGIN
PROCESS (clock, enable)
VARIABLE count :INTEGER RANGE 0 TO 9;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF clrn = '0' THEN count := 0;
ELSIF enable = '1' THEN
IF count = 9 THEN count := 0;
ELSE count := count + 1;
END IF;
END IF;
END IF;
IF (count = 9 AND enable = '1') THEN tc <= '1';
ELSE tc <= '0';
END IF;
q <= count;
END PROCESS;
END lsd;
--------------------------------------------------------
ENTITY mod5_vhdl IS
PORT(clock, enable, clrn :IN BIT;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 4);
END mod5_vhdl;
ARCHITECTURE msd OF mod5_vhdl IS
BEGIN
PROCESS (clock, enable)
VARIABLE count :INTEGER RANGE 0 TO 4;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF clrn = '0' THEN count := 0;
ELSIF enable = '1' THEN
IF count = 4 THEN count := 0;
ELSE count := count + 1;
END IF;
END IF;
END IF;
IF (count = 4 AND enable = '1') THEN tc <= '1';
ELSE tc <= '0';
END IF;
q <= count;
END PROCESS;
END msd;
_____________________________________________________________________________
133
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-62
(a)
(b)
INPUT
3 clock VCC
OUTPUT
6 ones[3..0]
mod10dn_ahdl
clock mod10dn_ahdl
INPUT enable q[3..0] clock
4 enable VCC
OUTPUT
load tc enable q[3..0]
7 tens[3..0]
INPUT data[3..0] load tc
11 dones[3..0] VCC
9 data[3..0]
OUTPUT
INPUT 10 8 tc
5 load VCC
INPUT
12 dtens[3..0] VCC
_____________________________________________________________________________
134
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
SUBDESIGN mod10dn_ahdl
(
clock, enable, load :INPUT;
data[3..0] :INPUT;
q[3..0], tc :OUTPUT;
)
VARIABLE
q[3..0] :DFF;
BEGIN
q[].clk = clock;
IF q[].q == 0 & enable THEN tc = VCC;
ELSE tc = GND;
END IF;
IF load THEN q[].d = data[];
ELSIF enable THEN
IF q[].q == 0 THEN q[].d = 9;
ELSE q[].d = q[].q - 1;
END IF;
ELSE q[].d = q[].q;
END IF;
END;
_____________________________________________________________________________
135
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY mod100dn_vhdl IS
PORT(clock, enable, load :IN BIT;
dtens, dones :IN INTEGER RANGE 0 TO 9;
tc :OUT BIT;
ones :OUT INTEGER RANGE 0 TO 9;
tens :OUT INTEGER RANGE 0 TO 9);
END mod100dn_vhdl;
ARCHITECTURE vhdl OF mod100dn_vhdl IS
SIGNAL cascade_node :BIT;
COMPONENT mod10dn_vhdl
PORT(clock, enable, load :IN BIT;
data :IN INTEGER RANGE 0 TO 9;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 9);
END COMPONENT;
BEGIN
digit1: mod10dn_vhdl PORT MAP (clock => clock,
enable => enable, load => load, data => dones,
tc => cascade_node, q => ones);
digit2: mod10dn_vhdl PORT MAP (clock => clock,
enable => cascade_node, load=> load, data => dtens,
tc => tc, q => tens);
END vhdl;
-----------------------------------------------------------------------
ENTITY mod10dn_vhdl IS
PORT(clock, enable, load :IN BIT;
data :IN INTEGER RANGE 0 TO 9;
tc :OUT BIT;
q :OUT INTEGER RANGE 0 TO 9);
END mod10dn_vhdl;
ARCHITECTURE bcd OF mod10dn_vhdl IS
BEGIN
PROCESS (clock, enable)
VARIABLE count :INTEGER RANGE 0 TO 9;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
IF load = '1' THEN count := data;
ELSIF enable = '1' THEN
IF count = 0 THEN count := 9;
ELSE count := count - 1;
END IF;
END IF;
END IF;
IF (count = 0 AND enable = '1') THEN tc <= '1';
ELSE tc <= '0';
END IF;
q <= count;
END PROCESS;
END bcd;
_____________________________________________________________________________
136
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-63
SUBDESIGN wash_mach_delux
( clock, start, full, timesup, dry : INPUT;
hotwater_valve, coldwater_valve, ag_mode, sp_mode : OUTPUT; )
VARIABLE
cycle: MACHINE -- "buried" machine
WITH STATES (idle, wash_fill, wash_agitate, wash_spin,
rinse_fill, rinse_agitate, rinse_spin);
BEGIN
cycle.clk = clock;
CASE cycle IS
WHEN idle =>
IF start THEN cycle = wash_fill;
ELSE cycle = idle;
END IF;
WHEN wash_fill =>
IF full THEN cycle = wash_agitate;
ELSE cycle = wash_fill;
END IF;
WHEN wash_agitate =>
IF timesup THEN cycle = wash_spin;
ELSE cycle = wash_agitate;
END IF;
WHEN wash_spin =>
IF dry THEN cycle = rinse_fill;
ELSE cycle = wash_spin;
END IF;
WHEN rinse_fill =>
IF full THEN cycle = rinse_agitate;
ELSE cycle = rinse_fill;
END IF;
WHEN rinse_agitate =>
IF timesup THEN cycle = rinse_spin;
ELSE cycle = rinse_agitate;
END IF;
WHEN rinse_spin =>
IF dry THEN cycle = idle;
ELSE cycle = rinse_spin;
END IF;
WHEN OTHERS => -- all other states to idle
cycle = idle;
END CASE;
TABLE
cycle => hotwater_valve, coldwater_valve, ag_mode, sp_mode;
idle => GND, GND, GND, GND;
wash_fill => VCC, GND, GND, GND;
wash_agitate => GND, GND, VCC, GND;
wash_spin => GND, GND, GND, VCC;
rinse_fill => GND, VCC, GND, GND;
rinse_agitate => GND, GND, VCC, GND;
rinse_spin => GND, GND, GND, VCC;
END TABLE;
END;
_____________________________________________________________________________
137
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY wash_mach_delux IS
PORT (clock, start, full, timesup, dry :IN BIT;
hotwater_valve, coldwater_valve, ag_mode, sp_mode :OUT BIT);
END wash_mach_delux;
ARCHITECTURE vhdl OF wash_mach_delux IS
TYPE state_machine IS (idle, wash_fill, wash_agitate, wash_spin,
rinse_fill, rinse_agitate, rinse_spin);
BEGIN
PROCESS (clock)
VARIABLE cycle :state_machine;
BEGIN
IF (clock'EVENT AND clock = '1') THEN
CASE cycle IS
WHEN idle =>
IF start = '1' THEN cycle := wash_fill;
ELSE cycle := idle;
END IF;
WHEN wash_fill =>
IF full = '1' THEN cycle := wash_agitate;
ELSE cycle := wash_fill;
END IF;
WHEN wash_agitate =>
IF timesup = '1' THEN cycle := wash_spin;
ELSE cycle := wash_agitate;
END IF;
WHEN wash_spin =>
IF dry = '1' THEN cycle := rinse_fill;
ELSE cycle := wash_spin;
END IF;
WHEN rinse_fill =>
IF full = '1' THEN cycle := rinse_agitate;
ELSE cycle := rinse_fill;
END IF;
WHEN rinse_agitate =>
IF timesup = '1' THEN cycle := rinse_spin;
ELSE cycle := rinse_agitate;
END IF;
WHEN rinse_spin =>
IF dry = '1' THEN cycle := idle;
ELSE cycle := rinse_spin;
END IF;
END CASE;
END IF;
_____________________________________________________________________________
138
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
CASE cycle IS
WHEN idle => hotwater_valve <= '0';
coldwater_valve <= '0';
ag_mode <= '0'; sp_mode <= '0';
WHEN wash_fill => hotwater_valve <= '1';
coldwater_valve <= '0';
ag_mode <= '0'; sp_mode <= '0';
WHEN wash_agitate => hotwater_valve <= '0';
coldwater_valve <= '0';
ag_mode <= '1'; sp_mode <= '0';
WHEN wash_spin => hotwater_valve <= '0';
coldwater_valve <= '0';
ag_mode <= '0'; sp_mode <= '1';
WHEN rinse_fill => hotwater_valve <= '0';
coldwater_valve <= '1';
ag_mode <= '0'; sp_mode <= '0';
WHEN rinse_agitate => hotwater_valve <= '0';
coldwater_valve <= '0';
ag_mode <= '1'; sp_mode <= '0';
WHEN rinse_spin => hotwater_valve <= '0';
coldwater_valve <= '0';
ag_mode <= '0'; sp_mode <= '1';
END CASE;
END PROCESS;
END vhdl;
_____________________________________________________________________________
139
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-64
7-65
_____________________________________________________________________________
140
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
CP
___
MR
Q5
Q4
Q3
Q2
Q1
Q0
7-67 8 clock pulses are needed to serially load a 74166 since there are 8 FFs in the chip.
7-68
CLK
CLR
SER
QH
_____________________________________________________________________________
141
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-69
CP
__
SH/LD
(Q0)
(Q1)
(Q2)
(Q3)
(Q4)
(Q5)
(Q6)
Q7
7-70
CLK
CLK INH
SH/LD
CLR
SER
(QA)
(QB)
(QC)
(QD)
(QE)
(QF)
(QG)
QH
_____________________________________________________________________________
142
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-71
(a) asynch.
(b) True
part Starting at: After 1 CLK: After 2 CLKs: After 3 CLKs: After 4 CLKs:
(c) 1011 0111 1111 1111 1111
(d) 1011 0101 0010 0001 0000
(e) 1011 0110 0110 0110 0110
(f) 1011 1011 1011 1011 1011
(g) 1011 0111 1110 1101 1011
7-72
(a) Loads 00000000.
(b) Loads 11111111.
(c) Shifts in a 1.
(d) Shifts in a 0.
(e) Output will change states if input is switched to the same logic level (in = out).
(f) Input logic level must be maintained for at least 8 clock pulses.
(g) The output will not switch states.
(h) Output will not switch states until input signal is stable; pulsing input condition will not be
recognized.
7-73
+VCC
1 k
74ALS14
0.001
F
1
K Q4 K Q3 K Q2 K Q1 K Q0
CLR CLR CLR CLR CLR
CLK
_____________________________________________________________________________
143
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-74
+VCC
1 k
74ALS14
0.001
F
+VCC
K Q4 K Q3 K Q2 K Q1 K Q0 K Q5
CLR CLR CLR CLR CLR CLR
+VCC
CLK
Q5 Q5 Q5 Q5 Q5
0 1 2 3 4
Q4 Q3 Q2 Q1 Q0
Q5 Q5 Q5 Q5 Q5
5 6 7 8 9
Q4 Q3 Q2 Q1 Q0
7-75
+VCC
1 k CLK CLK
74ALS14
____
CLR
0.001 74HC164
F 1 A
&
B Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
Q0 Q1 Q2 Q3 Q4
Q4 Q1 Q2 Q3 Q4
0 1 2 3 4
Q0 Q0 Q1 Q2 Q3
Q4 Q1 Q2 Q3 Q4
5 6 7 8 9
Q0 Q0 Q1 Q2 Q3
7-77 Output of 3-in AND or J, K inputs to FF D shorted to ground, FF D output shorted to ground,
CLK
input on FF D open, B input to NAND is open.
7-78 Output of 2-input AND or J, K inputs shorted to VCC, output from 2-input AND is open.
_____________________________________________________________________________
144
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-79
(a)
(b)
SUBDESIGN siso8_ahdl
( clk, en, ser :INPUT;
qout :OUTPUT; )
VARIABLE
q[7..0] :DFF;
BEGIN
q[].clk = clk;
qout = q0.q;
IF (en == GND) THEN
q[7..0].d = (ser, q[7..1].q);
ELSE
q[7..0].d = (q[7..0].q);
END IF;
END;
ENTITY siso8_vhdl IS
PORT ( clk, en, ser :IN BIT;
qout :OUT BIT );
END siso8_vhdl;
ARCHITECTURE vhdl OF siso8_vhdl IS
BEGIN
PROCESS (clk)
VARIABLE q :BIT_VECTOR (7 DOWNTO 0);
BEGIN
qout <= q(0);
IF (clk'EVENT AND clk = '1') THEN
IF (en = '0') THEN q := (ser & q(7 DOWNTO 1));
END IF;
END IF;
END PROCESS;
END vhdl;
_____________________________________________________________________________
145
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-80
(a)
(b)
SUBDESIGN pipo8_ahdl
( clk, ld, d[7..0] :INPUT;
q[7..0] :OUTPUT; )
VARIABLE
q[7..0] :DFF;
BEGIN
q[].clk = clk;
IF (ld == VCC) THEN
q[7..0].d = d[7..0];
ELSE
q[7..0].d = (q[7..0].q);
END IF;
END;
ENTITY pipo8_vhdl IS
PORT ( clk, ld :IN BIT;
d :IN BIT_VECTOR (7 DOWNTO 0);
q :OUT BIT_VECTOR (7 DOWNTO 0));
END pipo8_vhdl;
ARCHITECTURE vhdl OF pipo8_vhdl IS
BEGIN
PROCESS (clk)
VARIABLE reg :BIT_VECTOR (7 DOWNTO 0);
BEGIN
IF (clk'EVENT AND clk = '1') THEN
IF (ld = '1') THEN reg := d;
END IF;
END IF;
q <= reg;
END PROCESS;
END vhdl;
_____________________________________________________________________________
146
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-81
(a)
(b)
SUBDESIGN piso8_ahdl
( clk, sh_ld, clrn, d[7..0] :INPUT;
q0 :OUTPUT; )
VARIABLE
q[7..0] :DFF;
ser :NODE;
BEGIN
q[].clk = clk;
q[].clrn = clrn;
ser = GND;
IF (sh_ld == GND) THEN
q[7..0].d = d[7..0];
ELSE
q[7..0].d = (ser, q[7..1].q);
END IF;
END;
ENTITY piso8_vhdl IS
PORT ( clk, sh_ld, clrn :IN BIT;
d :IN BIT_VECTOR (7 DOWNTO 0);
q0 :OUT BIT);
END piso8_vhdl;
ARCHITECTURE vhdl OF piso8_vhdl IS
SIGNAL ser :BIT;
BEGIN
ser <= '0';
PROCESS (clk, clrn)
VARIABLE reg :BIT_VECTOR (7 DOWNTO 0);
BEGIN
IF clrn = '0' THEN reg := "00000000";
ELSIF (clk'EVENT AND clk = '1') THEN
IF (sh_ld = '0') THEN reg := d;
ELSE reg := (ser & reg(7 DOWNTO 1));
END IF;
END IF;
q0 <= reg(0);
END PROCESS;
END vhdl;
_____________________________________________________________________________
147
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7.82
(a)
_____________________________________________________________________________
148
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
SUBDESIGN sipo8_ahdl
( clk, shift, clear, ser_in :INPUT;
q[7..0] :OUTPUT; )
VARIABLE
q[7..0] :DFF;
BEGIN
q[].clk = clk;
IF (clear == VCC) THEN q[] = 0;
ELSIF (shift == VCC) THEN
q[7..0].d = (ser_in, q[7..1]);
ELSE
q[7..0].d = q[7..0].q;
END IF;
END;
ENTITY sipo8_vhdl IS
PORT (clk, shift, clear, ser_in :IN BIT;
q :OUT BIT_VECTOR (7 DOWNTO 0));
END sipo8_vhdl;
ARCHITECTURE vhdl OF sipo8_vhdl IS
BEGIN
PROCESS (clk)
VARIABLE reg :BIT_VECTOR (7 DOWNTO 0);
BEGIN
IF (clk'EVENT AND clk = '1') THEN
IF (clear = '1') THEN reg := "00000000";
ELSIF (shift = '1') THEN
reg := (ser_in & reg(7 DOWNTO 1));
END IF;
END IF;
q <= reg;
END PROCESS;
END vhdl;
_____________________________________________________________________________
149
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-83
7-84
INPUT univ_shift_ahdl
5 clock VCC
clock
INPUT din[3..0]
7 din[7..4] VCC
AND2 1
INPUT
8 ser_in VCC
OR2
14
AND2
19
15
q4
NOT AND2
mode1
sh_rt
11
10
mode0
mode1
AND2
NOT sh_lt
mode0
13
12
q3
AND2
OR2
16 univ_shift_ahdl
AND2
clock
18
q[3..0] OUTPUT
17 mode[1..0] q[3..0]
4 q[3..0]
ser_in
INPUT din[3..0]
9 din[3..0] VCC
2
_____________________________________________________________________________
150
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY univ_8_vhdl IS
PORT (
clock :IN BIT;
din :IN BIT_VECTOR (7 DOWNTO 0); -- parallel data in
ser_in :IN BIT; -- serial data in L or R
mode :IN INTEGER RANGE 0 TO 3; -- 0=hold 1=rt 2=lt 3=load
q :BUFFER BIT_VECTOR (7 DOWNTO 0));
END univ_8_vhdl;
ARCHITECTURE byte OF univ_8_vhdl IS
COMPONENT univ_shift_vhdl
PORT (
clock :IN BIT;
din :IN BIT_VECTOR (3 DOWNTO 0);
ser_in :IN BIT;
mode :IN INTEGER RANGE 0 TO 3;
q :OUT BIT_VECTOR (3 DOWNTO 0));
END COMPONENT;
SIGNAL ser_msn, ser_lsn :BIT;
BEGIN
ser_msn <= ser_in WHEN (mode = 1) ELSE q(3) WHEN (mode = 2) ELSE '0';
ser_lsn <= ser_in WHEN (mode = 2) ELSE q(4) WHEN (mode = 1) ELSE '0';
msn: univ_shift_vhdl PORT MAP (clock => clock, din => din(7 DOWNTO 4),
ser_in => ser_msn, mode => mode, q => q(7 DOWNTO 4));
lsn: univ_shift_vhdl PORT MAP (clock => clock, din => din(3 DOWNTO 0),
ser_in => ser_lsn, mode => mode, q => q(3 DOWNTO 0));
END byte;
-----------------------------------------------------------------------------
ENTITY univ_shift_vhdl IS
PORT (
clock :IN BIT;
din :IN BIT_VECTOR (3 DOWNTO 0);
ser_in :IN BIT;
mode :IN INTEGER RANGE 0 TO 3;
q :OUT BIT_VECTOR (3 DOWNTO 0));
END univ_shift_vhdl;
ARCHITECTURE vhdl OF univ_shift_vhdl IS
BEGIN
PROCESS (clock)
VARIABLE ff :BIT_VECTOR (3 DOWNTO 0);
BEGIN
IF (clock'EVENT AND clock = '1') THEN
CASE mode IS
WHEN 0 => ff := ff; -- hold data
WHEN 1 => ff(2 DOWNTO 0) := ff(3 DOWNTO 1); -- shift right
ff(3) := ser_in;
WHEN 2 => ff(3 DOWNTO 1) := ff(2 DOWNTO 0); -- shift left
ff(0) := ser_in;
WHEN 3 => ff := din; -- parallel load
END CASE;
END IF;
q <= ff; -- update outputs
END PROCESS;
END vhdl;
_____________________________________________________________________________
151
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-85
SUBDESIGN johnson_ahdl
(
clock, reset :INPUT;
q[4..0] :OUTPUT;
)
VARIABLE
q[4..0] :DFF;
ser :NODE;
BEGIN
q[].clk = clock;
q[].clrn = !reset;
-- due to power-on reset, automatically self-starting
-- design is not self-correcting
ser = !q0;
q[4..0].d = (ser, q[4..1].q);
END;
ENTITY johnson_vhdl IS
PORT (
clock, reset :IN BIT;
q :OUT BIT_VECTOR (4 DOWNTO 0)
);
END johnson_vhdl;
_____________________________________________________________________________
152
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-86
SUBDESIGN ring_ahdl
(
clock, hold :INPUT;
q[7..0] :OUTPUT;
)
VARIABLE
q[7..0] :DFF;
ser :NODE;
BEGIN
q[].clk = clock;
-- self-starting by filling with ones
IF q[7..1].q == B"1111111" THEN ser = GND;
ELSE ser = VCC;
END IF;
IF hold THEN q[].d = q[].q;
ELSE q[7..0].d = (ser, q[7..1].q);
END IF;
END;
ENTITY ring_vhdl IS
PORT (
clock, hold :IN BIT;
q :OUT BIT_VECTOR (7 DOWNTO 0)
);
END ring_vhdl;
_____________________________________________________________________________
153
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-87
7-88
% retriggerable, level-sensitive digital one-shot %
SUBDESIGN one_shot_a
(
clock, trigger, reset :INPUT;
delay[3..0] :INPUT;
q :OUTPUT;
)
VARIABLE count[3..0] :DFF;
BEGIN
count[].clk = clock;
count[].clrn = reset;
q = count[].q != B"0000";
END;
_____________________________________________________________________________
154
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
7-89
(a) Parallel
(b) Binary
(c) MOD-8 down
(d) MOD-10, BCD, decade
(e) Asynchronous, ripple
(f) Ring
(g) Johnson
(h) All
(i) Presettable
(j) Up/down
(k) Asynchronous, ripple
(l) MOD-10, BCD, decade
(m) Synchronous, parallel
_____________________________________________________________________________
155
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(Data values used to answer the questions in this chapter were obtained from one of the following sources:
Data tables found throughout chapter 8; www.TI.com)
8-2 Sample calculations (using max. values) for the 7432 IC:
Icc(avg) = (22mA+38mA)/2 = 30mA
PD(avg) for the IC = Icc(avg)xVcc = 30mAx5.25 = 157.5mW
PD(avg) for one gate = 157.5mW/4 = 39.37mW
tpd(avg) = (tPLH+tPHL)/2 = (15ns+22ns)/2 =18.5ns
IC PD(avg.) tpd(avg.)
____________________________________________
(a) 7432 39.37 mW 18.5 ns
(b) 74S32 65.62 mW 7.0 ns
(c) 74LS20 3.93 mW 15.0 ns
(d) 74ALS20 2.61 mW 10.5 ns
(e) 74AS20 14.16 mW 4.75 ns
________________________________________________
(a) A positive noise spike can drive the voltage above 1.0 V level if the amplitude is greater than:
(b) A negative noise spike can drive the voltage below 3.5V level if the amplitude is greater than:
_____________________________________________________________________________
156
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-6 (a) Maximum number of standard logic inputs that the output of a digital circuit can drive
reliably.
(b)NANDs and ANDs.
(c)Any input to a TTL circuit that is left disconnected (open) is said to be floating.
(d)Whenever a totem-pole TTL output goes from a LOW to HIGH, a high-amplitude current
spike is drawn from the Vcc supply. This is because for a short period of time (about 2ns)
both Q3 and Q4 are conducting. It can cause serious malfunctions during switching
transitions unless some type of filtering is used. The most common technique uses small
radio frequency capacitors connected from Vcc to Ground to essentially short out these
high-frequency spikes.
(e) IOL comes from the TTL input that is being driven.
IOH goes into the TTL input that is being driven.
8-8 (a) J and K inputs: 20A in the HIGH state and 0.4mA in the LOW state.
(b) Clock inputs: 80A in the HIGH state and 0.8mA in the LOW state.
Clear inputs: 60A in the HIGH state and 0.8mA in the LOW state.
(c) Fan-Out: 400A in the HIGH state and 8mA in the LOW state.
In the HIGH state: 400A/80A = Five 74LS112s
In the LOW state: 8mA/0.8mA = Ten 74LS112s
8-9 (a) Fan-Out (74LS37) = 30 standard TTL inputs in the HIGH state and 15 standard TTL inputs
in the LOW state.
(b) IOL=15x1.6mA=24mA
8-11 Tied together 74LS20 inputs act like 1LS input load in the LOW state and as separate LS input
loads in the HIGH state. Thus, the 74LS86 output drives only 5LS input loads in the LOW
state and 12LS input loads in the HIGH state. This is okay since the 74LS86 fan-out is 20LS
input loads both in the HIGH and in the LOW state.
The 74AS86 output can sink in the LOW state 20mA and in the HIGH state it can supply 2mA.
The 74AS20 has an input requirement of 0.5mA in the LOW state and 20A in the HIGH state.
Thus, the 74AS86 can drive 100 'AS20 inputs in the HIGH state and 40 'AS20 inputs in the
LOW state.
8-12 If a positive-going transition is applied to the input of a 74LS04, then the output will change in
10ns (tPHL=10ns).
_____________________________________________________________________________
158
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-15 (a) The circuit is used to convert a 60Hz sinewave to a 60 pps signal. The diode and
voltage divider produces a positive half-cycle with reduced amplitude to drive the TTL
inverter. The 74LS14 is a Schmitt Trigger which converts the slow changing input to
fast-changing pulses.
(b) The VX waveform rides on a 1V baseline produced by IIL of the 74LS14 flowing
through the bottom 4.7K resistor to ground. IIL (max)= 0.4mA which could produce a
maximum voltage of1.88V. In practice, however, IIL will be about half that value. VX
apparently is not dropping below VT- (0.6V-1.1V) needed to produce a HIGH at the
74LS14 output.
8-17 Noise is probably caused by totem-pole outputs switching from LOW to HIGH and
producing ICC spikes. The technician probably forgot to connect de-coupling capacitors
from Vcc to ground.
8-20 Since power drain increases with both an increase in frequency and V DD, the best choice is
(b).
8-21 The total power dissipation for the LS04 chip is approximately equal to ICCH x VCC(max) or
2.4mA x 5.25V = 12.6mW. (This approximation neglects 12A (IIH x 2 inputs x 6 AND
gates) supplied by the 74LS04 package.)
8-23 Latch-up can be triggered by high-voltage spikes or ringing at the device inputs and
outputs.
When latch-up occurs, a large current may flow and destroy the IC.
ICC(avg) = 20A
PD(avg) for the IC = ICC(avg) x Vcc = 20Ax6V = 120W
PD(avg) for one gate = 120W/2 = 60W
tpd(avg@6V) =24ns
Therefore, when compared with the values calculated in problem 8.2 for TTL, the 74HC20
draws less power and it is slower.
_____________________________________________________________________________
159
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-25 (a) Term used to describe the logic function created when TTL open-collector outputs are tied
together.
(b) It is a resistor that is used to keep a certain node in a circuit at a specific logic level. It is
used to prevent that particular node from floating to an undetermined logic level as well as
picking up voltage noises.
(c) Open Collector and Tristate outputs.
(d) Bus contention is that situation in which the outputs of two or more active devices are
placed on the same bus line at the same time.
8-26
8-28 (a) Tying the output to +5V: As the output changes from HIGH to LOW the sinking-transistor
(Q4) will be turned ON while the sourcing-transistor (Q3) turns OFF. If the output is tied
to +5V, transistor Q4 will probably be sinking more current than it can handle and
therefore be destroyed.
(b) Tying the output to ground: This would not cause any damage since the output is
switching to a ground potential.
(c) Applying an input of 7V: This would cause the PN junction of one of the emitters in the
multi-emitter-input transistor to be reversed bias. This reverse biasing is the normal
situation when +5V is applied to the input of any TTL gate. Most likely, a slight increase
of the reverse leakage current (IIH) would occur.
(d) Tying the output to another TTL totem-pole output: If both outputs are ALWAYS at the
same level no damage is likely to occur. However, if one output is trying to go to a logic
LOW while the other is trying to go to a logic HIGH, then damage is likely to occur to both
totem-pole outputs. This situation can cause a relatively high current to flow (55 mA) from
Vcc to ground through Q3 of one gate and Q4 of the other.
_____________________________________________________________________________
160
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-32 (a)
X Y EA EB EC Data on Bus
0 0 0 0 1 C
0 1 0 1 0 B
1 0 0 1 0 B
1 1 1 0 0 A
8-34
_____________________________________________________________________________
161
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-37 When C=0, the upper switch is closed so that we have: V x=(10K/(10K + 200)) x Ein.
Vx eIN
When C=1, the lower switch is closed so that: V x= (10K/(10K+10K+200)) x eIN = 0.5
eIN
8-38 With GAIN SELECT=0, the switch is open so the op-amp gain is -(100K/100K) = -1
With GAIN SELECT=1, the switch is closed so that the op-amp gain is -(100K/50K) = -2
8-40 (c)
8-41 (a) IOL(4000B) = 0.4mA ; IIL(74AS) = 2mA. Thus, a 4000B output cannot drive 74AS input
directly.
(b) IOL(74HC) = 4mA ; IIL(74AS) = 2mA. Thus, a 74HC output can drive 2 (4mA/2mA)
74AS
inputs.
_____________________________________________________________________________
162
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
8-44 The 74HC00 NAND gate is connected to 3 TTL input loads. When the output of the high-
speed CMOS gate (74HC00) is LOW, it must be capable of sinking 4.8mA (3x1.6mA).
However, according to table 8-12, the 74HC00 has an IOL(max) = 4mA. Eliminating one of
the 3 TTL input loads could solve the problem. Simply disconnecting pin 2 from pin 3 of the
7402 and tying it permanently to ground can do this. Thus, the 74HC00 will be sinking
3.2mA (2x1.6mA), which is well within its IOL(max) of 4mA. Note that the 7402 gate is still
being used as an inverter.
8-45
8-46 LM35 voltage out at 38C is 0.38V. Therefore, R2=1.5K and R1=18K.
8-47 Use the logic probe to determine if point X can go HIGH when inputs A-F are all LOW. If X can
go HIGH, then place the probe on the output of the NAND gate and inject a pulse on H. If the
output still stays HIGH, probe input H while injecting the pulse at H. If a pulse is detected at H,
the NAND gate is bad. No pulse indication on the probe at H means a hard short (probably on
the circuit board).
If point X will not go HIGH when A-F are LOW, inject a pulse at any output of the 74HC05 IC
while probing X. If X pulses HIGH, then replace the 74HC05 IC. If the problem persists, there
must be an internal short to ground on the NAND gate input. If the probe at X cannot detect a
pulse injected anywhere on that node, look for a hard short to ground on the circuit board.
8-48 Inject a Pulse anywhere along the trace between the NAND and the flip flop while monitoring
the same node with a logic probe. The fact that the probe indicates a constant LOW and does
not detect a pulse indicates a hard wire short to ground.
_____________________________________________________________________________
163
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
s x3 x2 x1 x0 Vout
0 0 0 0 0 0V
10 0 0 1 0 -12V x 0.125V=-1.5V
20 0 1 0 0 -12V x 0.25V=-3.0V
30 0 1 1 1 -12V x (0.25+0.125+0.0625)=-5.25V
40 1 0 1 0 -12V x (0.5+0.125)=-7.50V
50 1 1 1 0 -12V x (0.5+0.25+0.125)=-10.5V
60 1 1 1 1 -12V x (0.5+0.25+0.125+0.0625)=-11.25V
70 1 1 1 1 -12V x (0.5+0.25+0.125+0.0625)=-11.25V
80 1 1 1 0 -12V x (0.5+0.25+0.125)=-10.50V
90 1 1 0 0 -12V x (0.5+0.25)=-9.0V
100 1 0 0 0 -12V x (0.5)=-6V
_____________________________________________________________________________
164
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
_____________________________________________________________________________
165
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-1 (a) All of the outputs are HIGH. (b) O0 = 0, O1- O7 = 1 (c) O0 - O6 = 1 , O7 = 0 . (d) Same
as (a).
9-5 Each 74LS293 is connected as a MOD-8 (Q0 not used). The output O3 will be LOW only
when A2 A1 A0 = 011, E3=1, E2 =0.
This condition is present after the 28th and 29th NGTs of the clock. That is:
_____________________________________________________________________________
166
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-7 (a) When D=0, the C,B and A inputs determine which of the outputs O7 - O0 will be
activated. With D held HIGH, all of these outputs will be inactive (HIGH) because the input
code will be greater than 01112 (710).
(b)
9-8
9-9 For Relay K1 to be energized from t3 to t5, tie outputsO3 and O4 of 7445 together. For
Relay K2 to be energized from t6 to t9 tie outputs O6 , O7 and O8 of 7445 together.
This can be done because the 7445 has open-collector outputs and only one of its outputs
will be active (LOW) at any one time.
_____________________________________________________________________________
167
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-10
9-12 The 'g' segment should be active for the following decimal digits: 2,3,4,5,6,8,9.
9-13 (a) Encoder (b) Encoder (c) Decoder (d) BCD-to-7-segment decoder (e)
Decoder/driver
9-14 The 74147 responds to higher-order A8 . Thus, the encoder output will be the complement
of the code for 8. That is 1 0 0 0 0111 .
_____________________________________________________________________________
168
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-15
_____________________________________________________________________________
169
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-17 If the fourth key were actuated, it would be entered into the MSD. For example, if you
entered 3095, the 5 would replace the 3 in the MSD so you would see 509 on the
displays. The following circuit will prevent the fourth key actuation from having any effect
(until CLEAR is again actuated). The PGT at Z will set W=1. This will hold gate output
HIGH and prevent further key actuation from clocking the ring counter.
9-18 Choice (b) is the only one, which would give the symptoms described. If Q is triggering the
X,Y,Z register, a negative-going transition will occur immediately upon the actuation of a
digit key. This would cause the shift register to shift and produce a positive-transition at
one of the X,Y or Z outputs before the outputs of the encoder have stabilized due to switch
bounce.
Choice (c) could not be the cause of the symptoms described, since it would trigger the
OS more than once for a given key actuation, thereby affecting more than one register.
9-19 Choice (a) could cause this symptom because the open input to the OR gate would
produce a constant HIGH at its output (for TTL), thereby preventing any clocking of the
ring counter. Choice (d) could also cause this symptom. The LOW at Y could pull down
the HIGH at Z so that the ring counter stays at 0002.
9-20 (a) Yes. An open would result in a constant HIGH at the D inputs of the FFs. Since this
is the LSB, the result would always be an odd-numbered entry.
(b) No. OR-gate output would be stuck HIGH, freezing all operation
(c) No. Same as (b).
9-22 Either the output of the INVERTER or input (2) on the NAND gate of Z4 is internally, or
externally shorted to Ground.
9-23 (a) Segment 'g' would be much brighter than the other six segments.
(b) Segment 'g' of display and/or output transistor of 7446/7447 could burn out.
9-24 Inputs D and C to the BCD-to-7-segment decoder/driver have been wired in reversed order.
9-25 Segments 'a' and 'b' of the display are always ON. A short between the cathodes of
segments 'a' and 'b' must exist.
9-26 One possibility: The unused inputs of the remaining XOR gate were left floating (to get 7
XOR gates you need 2 quad 2-input XOR ICs). Most probable cause: Connection 'f' from
the BCD-to-7 segment dec./driver to the XOR gate is open.
_____________________________________________________________________________
170
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-27
9-28
9-29
S1 S0 Output
0 0 I0
0 1 I2
1 0 I1
1 1 I3
_____________________________________________________________________________
171
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-30 (a)
(b)
1_of_8
data7
1_of_4
data6
1_of_2
data3 data5
data1 data2 data4
result result result
data0 data1 data3
inst data0 data2
sel
inst3 data1
sel[1..0]
data0
inst2
sel[2..0]
9-31 (a)
_____________________________________________________________________________
172
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
9-32 (b) The total number of connections in the circuit using the Multiplexers is 63, not including
Vcc and GND. The total number required for the circuit using separate decoder/drivers
and displays for each BCD counter is 66.
9-34 When MSB of counter goes HIGH, it disables the MUX output so that Z=0.
9-35
Therefore, connect I3, I5, I6 and I7 to Vcc. Connect all other MUX inputs to ground.
_____________________________________________________________________________
173
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-36
Connect inputs I1, I5, I8, I11, I14 and I15 to Vcc. Connect all other MUX inputs to ground.
9-37
9-38 (a) Z C B A D C B A D C B A
D=0 D=1
DCBA Z DCBA Z ICBA
_____________________________________________________________________________
174
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
D=0 D=1
DCBA Z DCBA Z ICBA
9-39 (a) Encoder, Multiplexer (b) Multiplexer, Demultiplexer (c) Multiplexer (d) Encoder
(e) Decoder, Demultiplexer (f) Demultiplexer (g) Multiplexer
9-40
When A=B=C=0, output Q 0 will follow the DATA INPUT; all other outputs stay HIGH.
9-41
_____________________________________________________________________________
175
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(c) When the MOD-8 CTR reaches the count of 2 (010), the output of the MUX will be
the complement of I2 (LOW). At this time the DEMUX will be active and O2 will be
LOW allowing LED #2 to be lit for 0.1s. When the counter reaches the count of 6 10
(1102), which will be 0.4s later, LED #6 will lit for 0.1s. This will continue as the
counter sequences through its 8 states.
9-43 As the circuit below shows, five lines will go to the remote monitoring panel.
9-44
_____________________________________________________________________________
176
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-45
_____________________________________________________________________________
177
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-46 (a) Sensor output 3 will not be allowed to go HIGH when Actuator #3 is activated at the count
of 3. This will not allow the counter to be incremented. Thus, the process sequence will be
terminated at this time.
(b) When Actuator #3 is activated sensor #3 and I4 of MUX will be HIGH. Since at this time the
select inputs of the MUX are at the count of 310 (0112) its output will reflect the status of I3,
which is LOW. Thus, the counter won't get incremented and the process sequence will halt.
9-47 Clearly, the MSB (Za) of the 74157 MUX (tens) never goes HIGH. A possible cause could be
that the connection from MUX (tens) to the BCD-to-7 segment decoder/driver is shorted to
ground.
9-48 Connections Q0 and Q1 of the MOD-8 CTR are reversibly connected to the select inputs of the
MUX and DEMUX. This will cause the select inputs to change in the sequence: 0, 2, 1, 3, 4, 6,
5, 7.
I. All of the signals appear to be correct between t0 and t9, with the O0 signal containing the
serial data from register A, and O1 containing the serial data from register B.
II. The O2 and O3 outputs are never activated.
III. Between t10 and t14, the O0 output, rather than O2, contains the serial data from register C.
IV. Between t14 and t18, the O1 output, rather than O3, contains the serial data from register D.
It appears that the select inputs of the receiver's DEMUX are selecting only O 0 and O1.
This would happen if S1 were stuck in the LOW state. This stuck node could be caused by
an internal short to ground at S1, Q1, or an external short to ground.
9-51
_____________________________________________________________________________
178
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-52
9-53 (a) *another solution would be to add a third 74HC85 to the arrangement of figure 9.37(b).
_____________________________________________________________________________
179
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
Prob9_53b
unsigned compare
aeb
dataa[9..0]
agb
datab[9..0]
alb
inst
9-54 D1 C1 B1 A1 D0 C0 B0 A0
BCD input = 0 1 1 0 1 0 0 1
c S3 S2 S1 S0
Sum at the output of the first 75LS83 = 0 1 1 1 0
S3 S2 S1 S0
Sum at the output of the second 75LS83 = 1 0 0 0
b6 b5 b4 b3 b2 b1 b0
Binary output = 1 0 0 0 1 0 1
9-55 By looking at the results at the "Binary output" it can be concluded that a problem exists
for the first two BCD conversions (52 and 95), and that the last conversion for the BCD
number 27 is without fault. Further investigation can bring to conclusion that for the
conversions that exhibit a fault the actual condition of b0 is always the opposite of what it
should be with the exception of the last conversion for the BCD number 27. Now, what
than is the major difference between the two first BCD numbers (52, 95) and the last one
(27)?
The answer is that the last BCD number (27) is the only one with A0=b0. Thus, the most
probable cause for the fault is b0 being connected to B0 instead of A0.
The contents of register [C] will be transferred to registers [A] and [B] when a CLOCK
pulse is applied.
9-58 (a) @ t1 [A] = 1011; [B] = 1000; [C] = 1000{ [B] [C] }
@ t2 [A] = 1011; [B] = 1000; [C] = 1000
@ t3 [A] = 1011; [B] = 1000; [C] = 1000
@ t4 [A] = 1011; [B] = 1011; [C] = 1011{ [A] [B] [C] }
(b) Since the registers' outputs are all in their HI-Z mode, register A would be loaded
with unpredictable data (noise) that would be floating on the Bus.
_____________________________________________________________________________
180
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-59
9-60 (a) Set switches at SW3=1, SW2=0, SW1=SW0=1. Make ESW = 0 and IEA = 0 ; all other
input and output enables are kept HIGH. Apply CLOCK pulse. Set switches at 0001. Make
ESW = 0 and IEB = 0 . Apply CLOCK pulse. Set switches at 1110. Make ESW = 0 and
IEB = 0 . Apply CLOCK pulse.
(b) The 74HC174 register is clocked by the same CLOCK signal as the A, B, C registers.
Thus, each time data is transferred to one of these registers, the 74HC174 will latch the
same data. Since the last operation transferred 1110 to register C, the 74HC174 will also
hold 11102.
9-61 (a) At t1, ESW = 0 and IEA = 0 I because of the levels at OS1, OS0, IS1 and IS0. This will
transfer levels from the switches to register A. Thus, [A] = 1001. The 74HC174 register will
also hold 10012. Other registers have 00002. At t2, OEA = 0 and IEC = 0 . Thus,
[A] [C] so that [C]=10012, as does the 74HC174 register. At t3, OEC = 0 and IEB = 0 .
Thus, [C] [B] so that [B]=1001. All registers are now holding 10012.
(b) In theory, the answer is "no" because only one decoder output can go LOW at one
time, and so only one device's outputs can be enabled. However, in practice there
will be a very short overlap interval where two devices' outputs are enabled as the
output select code changes from one code to another.
9-62 1. Connect Esw from figure 9-67 to the ENABLE input of the 74HC541.
2. Connect SW0-SW3 to the inputs of the first four-tristate buffers of the 74HC541 IC.
Connect the other four unused inputs of the 74HC541 IC to ground.
Thus, any address from 900016 to 97FF16 will activate the second module.
(d) No. In order for the MPU to READ from or WRITE to both modules at the same time
both memory-modules would have to be active at the same time. This is impossible
because only one output from the decoder can be active (LOW) at any one time.
Therefore, both O2 and O4 of the decoder 74LS138 cannot be LOW at the same
time.
_____________________________________________________________________________
182
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
9-65
SUBDESIGN prob9_65
(
a[3..0] :INPUT; --binary inputs
ENTITY prob9_65 IS
PORT (
a :IN BIT_VECTOR (3 DOWNTO 0);
O :OUT BIT_VECTOR (9 DOWNTO 0)
);
END prob9_65 ;
9-66
-- HEX decoder driver for a 7-seg display
SUBDESIGN prob9_66
(
hex[3..0] :INPUT; --4-bit number
lt, bi, rbi :INPUT; --3 independent controls
a,b,c,d,e,f,g,rbo :OUTPUT; --individual outputs
)
BEGIN
IF !bi THEN
(a,b,c,d,e,f,g,rbo) = (1,1,1,1,1,1,1,0); % blank all %
ELSIF !lt THEN
(a,b,c,d,e,f,g,rbo) = (0,0,0,0,0,0,0,1); % test segments %
ELSIF !rbi & hex[] == 0 THEN
(a,b,c,d,e,f,g,rbo) = (1,1,1,1,1,1,1,0); % blank leading 0's %
ELSE
TABLE % display 7 segment Common Anode pattern %
hex[] => a,b,c,d,e,f,g,rbo;
0 => 0,0,0,0,0,0,1,1;
1 => 1,0,0,1,1,1,1,1;
2 => 0,0,1,0,0,1,0,1;
3 => 0,0,0,0,1,1,0,1;
4 => 1,0,0,1,1,0,0,1;
5 => 0,1,0,0,1,0,0,1;
6 => 1,1,0,0,0,0,0,1;
7 => 0,0,0,1,1,1,1,1;
8 => 0,0,0,0,0,0,0,1;
9 => 0,0,0,1,1,0,0,1;
10 => 0,0,0,1,0,0,0,1;
11 => 1,1,0,0,0,0,0,1;
12 => 1,1,1,0,0,1,0,1;
13 => 1,0,0,0,0,1,0,1;
14 => 0,1,1,0,0,0,0,1;
15 => 0,1,1,1,0,0,0,1;
END TABLE;
END IF;
END;
ENTITY prob9_66 IS
PORT (
hex :IN INTEGER RANGE 0 TO 15;
lt, bi, rbi :IN BIT;
a,b,c,d,e,f,g,rbo :OUT BIT;
);
END prob9_66 ;
9-67
% LOW priority encoder. Encodes lowest order input that is activated. %
SUBDESIGN prob9_67
(
sw[9..0], oe :INPUT;
d[3..0] :OUTPUT;
)
VARIABLE
buffers[3..0] :TRI;
BEGIN
IF !sw[0] THEN buffers[].in = 0;
ELSIF !sw[1] THEN buffers[].in = 1;
ELSIF !sw[2] THEN buffers[].in = 2;
ELSIF !sw[3] THEN buffers[].in = 3;
ELSIF !sw[4] THEN buffers[].in = 4;
ELSIF !sw[5] THEN buffers[].in = 5;
ELSIF !sw[6] THEN buffers[].in = 6;
ELSIF !sw[7] THEN buffers[].in = 7;
ELSIF !sw[8] THEN buffers[].in = 8;
_____________________________________________________________________________
185
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
END IF;
buffers[].oe = oe & sw[]!=b"1111111111"; -- enable when OE AND key pressed
d[] = buffers[].out; -- connect to outputs
END;
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY prob9_67 IS
PORT(
sw :IN BIT_VECTOR (9 DOWNTO 0); --standard logic not needed
oe :IN BIT; --standard logic not needed
d :OUT STD_LOGIC_VECTOR (3 DOWNTO 0) --must use std logic for hi-Z
);
END prob9_67;
ARCHITECTURE a OF prob9_67 IS
BEGIN
d <= "ZZZZ" WHEN ((oe = '0') OR (sw = "1111111111")) ELSE
"0000" WHEN sw(0) = '0' ELSE
"0001" WHEN sw(1) = '0' ELSE
"0010" WHEN sw(2) = '0' ELSE
"0011" WHEN sw(3) = '0' ELSE
"0100" WHEN sw(4) = '0' ELSE
"0101" WHEN sw(5) = '0' ELSE
"0110" WHEN sw(6) = '0' ELSE
"0111" WHEN sw(7) = '0' ELSE
"1000" WHEN sw(8) = '0' ELSE
"1001" WHEN sw(9) = '0';
END a;
9-68
-- modified Fig9-66 to make an 8-bit comparator
SUBDESIGN prob9_68
(
a[7..0], b[7..0] :INPUT;
gtin, ltin, eqin :INPUT; % cascade inputs %
agtb, altb, aeqb :OUTPUT;
)
% standard cascade inputs: gtin = ltin = GND eqin = VCC %
BEGIN
IF a[] > b[] THEN
agtb = VCC; altb = GND; aeqb = GND;
ELSIF a[] < b[] THEN
agtb = GND; altb = VCC; aeqb = GND;
ELSE agtb = gtin; altb = ltin; aeqb = eqin;
END IF;
END;
_____________________________________________________________________________
186
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY prob9_68 IS
PORT ( a, b : IN INTEGER RANGE 0 TO 255;
gtin, ltin, eqin : IN BIT; -- cascade inputs
agtb, altb, aeqb : OUT BIT);
END prob9_68;
-- standard cascade inputs: gtin = ltin = '0' eqin = '1'
9-69
-- A 4-bit binary to 2-digit BCD converter
SUBDESIGN prob9_69
( binary[3..0] :INPUT;
ones[3..0], tens[3..0] :OUTPUT;
)
BEGIN
IF binary > 9 THEN
tens[] = B"0001" ;
ones[] = binary[] - 10;
ELSE tens[] = B"0000";
ones = binary[];
END;
ENTITY prob9_69 IS
PORT ( binary :IN INTEGER RANGE 0 TO 15;
ones, tens :buffer INTEGER RANGE 0 TO 9);
END prob9_69;
BEGIN
PROCESS (binary)
BEGIN
IF binary > 9 THEN
tens <= 1;
ones <= binary - 10;
ELSE
tens <= 0;
ones <= binary ;
_____________________________________________________________________________
187
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
END IF;
END PROCESS;
END vhdl;
9-70
-- 3-digit BCD to 8-bit binary code converter handles input values 0 - 255
SUBDESIGN prob9_70
( hundreds[1..0], tens[3..0], ones[3..0] :INPUT;
binary[7..0] :OUTPUT;
)
-- 3-digit BCD to 8-bit binary code converter handles input values 0 - 255
ENTITY prob9_70 IS
PORT ( ones, tens :IN INTEGER RANGE 0 TO 9;
hundreds :IN INTEGER RANGE 0 TO 2;
binary :OUT INTEGER RANGE 0 TO 255);
END prob9_70 ;
_____________________________________________________________________________
188
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
10-1 (a) This project is a security system that monitors the open/closed status of a
number of doors in the building. The status of each door must be monitored in a
remote security shack. When any door is securely closed, the corresponding
LED in the guard's shack should be off. When the door is open, the
corresponding LED should blink. Specifications for this system:
Number of doors: 8
Number of LED indicators: 8
Blink rate: 2.5 Hz
Door sensors: Door open/contacts open, door closed/contacts closed.
(d) 20 Hz
(e) Only one LED will ever be lit at any time.
10-3 24 steps
10-6 Connect a de-bounced push button switch to the step input, a toggle switch to the
dir input, two toggle switches to the mode (m1, m0) inputs, and four LEDs to the
outputs cout.
a. set m1, m0 to [0,0] and dir to 0. Apply pulses to step and compare the LED states to Table
10-1 Full step mode. Repeat with dir=1.
b. set m1, m0 to [0,1] and dir to 0. Apply pulses to step and compare the LED states to Table
10-1 Wave drive mode.
c. set m1, m0 to [1,01] and dir to 0. Apply pulses to step and compare the LED states to Table
10-1 Half step mode.
_____________________________________________________________________________
189
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
Set m1, m0 to [1,1]. Connect toggle switches to each of the inputs Cin[3..0]. Using a logic
probe, monitor each cout line while toggling the input switches on Cin. Each Cout line should
follow the corresponding Cin line. The step and direction lines should have no effect.
ENTITY prob10_7 IS
PORT ( step, dir :IN BIT;
m :IN BIT_VECTOR (1 DOWNTO 0);
cin :IN BIT_VECTOR (3 DOWNTO 0);
q :OUT INTEGER RANGE 0 TO 7;
cout :OUT BIT_VECTOR (3 DOWNTO 0) );
END prob10_7;
10-8
% Complete stepper motor driver
MODES: 00 - Full step; 01 - Wave drive; 02 - Half step; 03 - direct drive %
SUBDESIGN prob10_8
(
step, dir, oe :INPUT;
m[1..0], cin[3..0] :INPUT;
cout[3..0], q[2..0] :OUTPUT;
)
VARIABLE
buffers[3..0] : TRI;
count[2..0] : DFF;
BEGIN
count[].clk = step;
IF dir THEN count[].d = count[].q + 1;
ELSE count[].d = count[].q - 1;
END IF;
q[] = count[].q;
CASE m[] IS
WHEN 0 =>
CASE count[] IS -- FULL STEP
WHEN B"000" => buffers[].in = B"1010";
WHEN B"001" => buffers[].in = B"1001";
WHEN B"010" => buffers[].in = B"0101";
WHEN B"011" => buffers[].in = B"0110";
WHEN B"100" => buffers[].in = B"1010";
WHEN B"101" => buffers[].in = B"1001";
WHEN B"110" => buffers[].in = B"0101";
WHEN B"111" => buffers[].in = B"0110";
END CASE;
WHEN 1 =>
CASE count[] IS -- WAVE DRIVE
WHEN B"000" => buffers[].in = B"1000";
WHEN B"001" => buffers[].in = B"0001";
WHEN B"010" => buffers[].in = B"0100";
WHEN B"011" => buffers[].in = B"0010";
WHEN B"100" => buffers[].in = B"1000";
WHEN B"101" => buffers[].in = B"0001";
WHEN B"110" => buffers[].in = B"0100";
WHEN B"111" => buffers[].in = B"0010";
END CASE;
WHEN 2 =>
CASE count[] IS -- HALF STEP
WHEN B"000" => buffers[].in = B"1010";
WHEN B"001" => buffers[].in = B"1000";
_____________________________________________________________________________
192
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY prob10_8 IS
PORT ( step, dir, oe :IN BIT;
m :IN BIT_VECTOR (1 DOWNTO 0);
cin :IN STD_LOGIC_VECTOR (3 DOWNTO 0);
q :OUT INTEGER RANGE 0 TO 7;
cout :OUT STD_LOGIC_VECTOR (3 DOWNTO 0) );
END prob10_8 ;
10-9
R3 R2 R1 R0
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0
10-10 1111
10-11 Yes
10-12 (a) 1011 (b) 102 (row 2) (c) 012 (row 1) (d) 1001
10-13 No
10-14 DAV
_____________________________________________________________________________
194
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
Keypad
DAV Clk
D3 D3
Q3
D2 D2
Q2
D1 D1
Q1
D0 D0
Q0
+5v MR
10-15 The data goes away (high-Z) before the DAV goes LOW. The high-Z is latched.
10-16 (a) 60 clock cycles (b) 600 clock cycles (c) 3600 clock cycles
10-18 When the set input is active, bypass the prescaler and feed the 60 Hz clock directly
into the units of seconds counter.
10-19
_____________________________________________________________________________
195
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
10-20 (a)
q0 BAND4
q1
q2 OUTPUT zero
q3
mod10
NOT down counter inst3
LoadN sload modulus 10
inst1
data[3..0] q[3..0]
Data OUTPUT ones
q[3..0]
OUTPUT tc
clock cout
Clock
cnt_en
aclr
Enable
inst
NOT
ClearN
inst2
(b)
SUBDESIGN MOD10
( data[3..0], loadn, clrn, clk, en :INPUT;
ones[3..0], tc, zero :OUTPUT; )
VARIABLE
count[3..0] :DFF;
BEGIN
count[].clk = clk;
count[].clrn = clrn; -- clear the counter asynch
IF loadn == 0 THEN count[].d = data[]; -- load the counter
ELSIF en THEN
IF count[].q == 0 THEN count[].d = 9; -- reset to 9
--tc = VCC;
ELSE count[].d = count[].q - 1; -- increment
END IF;
ELSE count[].d = count[].q; -- hold
END IF;
IF count[] == 0 THEN zero = VCC;
END IF;
tc = en & count[].q == 0;
ones[] = count[].q;
END;
_____________________________________________________________________________
196
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(c)
ENTITY mod10 IS
PORT
( data :IN INTEGER RANGE 0 TO 9;
loadn, clrn, clk, en :IN BIT;
ones :OUT INTEGER RANGE 0 TO 9;
tc, zero :OUT BIT);
END mod10;
ARCHITECTURE digit of MOD10 IS
BEGIN
PROCESS (clk, clrn)
VARIABLE count :INTEGER RANGE 0 TO 9;
BEGIN
IF clrn = '0' THEN count := 0; -- asynch clear
ELSIF (clk'EVENT AND clk = '1') THEN -- look for PGT
IF loadn = '0' THEN count := data; -- load data
ELSIF en = '1' THEN
IF count = 0 THEN count:= 9; -- start over at 9
ELSE count := count - 1; -- count down
END IF;
END IF;
END IF;
IF count = 0 THEN zero <= '1'; -- mimimum limit of 0
ELSE zero <= '0';
END IF;
IF en = '1' AND count = 0 THEN tc <= '1'; -- mimimum AND enabled
ELSE tc <= '0';
END IF;
ones <= count;
END PROCESS;
END digit;
10-21 (a)
SUBDESIGN ENCODER
(
key[9..0], clk, enablen :INPUT; -- Individual inputs to encode, clock 10Hz
D[3..0] :OUTPUT; -- Encoded data out
pgt_1Hz, loadn :OUTPUT; -- Data available strobe
)
VARIABLE debounce[2..0] :DFF; -- make a non recycling counter 0-7
div10[6..0] :DFF; -- divide by 100
BEGIN
--------MOD 100 to produce 1 Hz out -------------
div10[].clk = clk;
IF div10[].Q < 99 THEN div10[].D = div10[].Q + 1; -- count up mod 10
_____________________________________________________________________________
197
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b)
ENTITY encoder IS
PORT (
clk, enablen :IN BIT; --clock 100Hz
key :IN BIT_VECTOR (9 DOWNTO 0); -- Individual inputs to encode,
D :OUT INTEGER RANGE 0 TO 9; -- Encoded data out
pgt_1Hz :OUT BIT;
loadn :BUFFER BIT); -- Data available strobe
END encoder;
_____________________________________________________________________________
198
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
10-22 (a)
NOT S-R LATCH
startn INPUT
VCC AND3
inst5 NOR2
INPUT
SET
door_closed
VCC
NOT
timer_done INPUT inst2
VCC inst1
inst4
NOT
NOR2
OR3 Q
inst9 OUTPUT magnetron
NOT inst
INPUT inst12 RESET
stopn
VCC
inst8
(b)
SUBDESIGN control
(
startn, stopn, clearn, door_closed, timer_done :INPUT;
magnetron :OUTPUT; -- HIGH = ON
)
VARIABLE
cook :DFF; -- use DFF for asynchronous preset and clear features
BEGIN
cook.clk = GND; -- just using asynch inputs. Not using clock or D
cook.d = GND;
cook.prn = !(!startn & door_closed & !timer_done);
-- start only if door closed w/time on clock
cook.clrn = !(!stopn # !clearn # !door_closed # timer_done);
-- turn off mag under these circumstances
magnetron = cook.q; -- connect DFF output to block output port
END;
(c)
ENTITY control IS
PORT
(startn, stopn, clearn, door_closed, timer_done :IN BIT; -- n suffix designates active
LOW.
magnetron :BUFFER BIT); -- HIGH = ON
END control;
_____________________________________________________________________________
200
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
10-23 (a)
(b)
SUBDESIGN decode
(
sec_ones[3..0] :INPUT; -- lower digit = seconds
sec_tens[3..0] :INPUT; -- middle digit = 10s of seconds
min[3..0] :INPUT; -- upper digit = minutes
sec_ones_segs[0..6] :OUTPUT; -- active LOW LED drive for 7
segment
sec_tens_segs[0..6] :OUTPUT; -- note order [0..6] <-> [a..g]
min_segs[0..6] :OUTPUT; --
)
BEGIN
% NOTE LOW digit always displays zero %
TABLE
sec_ones[] => sec_ones_segs[];
0 => 1; -- Display a zero
1 => H"4f";
2 => H"12";
3 => H"06";
4 => H"4C";
5 => H"24";
6 => H"20";
7 => H"0F";
8 => H"00";
9 => H"04";
END TABLE;
_____________________________________________________________________________
201
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(c)
ENTITY decode IS
PORT
( lo, mid, hi :IN INTEGER RANGE 0 TO 9;
-- lo = seconds, mid= 10s of seconds, hi = minutes
ha, hb, hc, hd, he, hf, hg :OUT BIT;
-- active LOW LED drive: minutes
ma, mb, mc, md, me, mf, mg :OUT BIT;
-- tens of seconds
la, lb, lc, ld, le, lf, lg :OUT BIT);
-- ones of seconds
END decode;
_____________________________________________________________________________
202
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
WITH lo SELECT
losegs <= "0000001" WHEN 0,
"1001111" WHEN 1,
"0010010" WHEN 2,
"0000110" WHEN 3,
"1001100" WHEN 4,
"0100100" WHEN 5,
"0100000" WHEN 6,
"0001111" WHEN 7,
"0000000" WHEN 8,
"0000100" WHEN 9,
"1111111" WHEN OTHERS;
-- This section drives the middle digit and requires zero blanking logic
PROCESS(mid, hi)
BEGIN
IF hi = 0 AND mid = 0 THEN -- detect leading zeros
midsegs <= "1111111"; --blank the display
ELSE
CASE mid IS
WHEN 0 => midsegs <="0000001";
-- Display a zero
WHEN 1 => midsegs <="1001111";
-- Display 1
WHEN 2 => midsegs <="0010010";
WHEN 3 => midsegs <="0000110";
WHEN 4 => midsegs <="1001100";
WHEN 5 => midsegs <="0100100";
WHEN 6 => midsegs <="0100000";
WHEN 7 => midsegs <="0001111";
WHEN 8 => midsegs <="0000000";
WHEN 9 => midsegs <="0000100";
-- Display 9
END CASE;
END IF;
END PROCESS;
-- This section drives the most significant digit
WITH hi SELECT
hisegs <= "1111111" WHEN 0, -- always blank when zero
"1001111" WHEN 1,
_____________________________________________________________________________
203
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
"0010010" WHEN 2,
"0000110" WHEN 3,
"1001100" WHEN 4,
"0100100" WHEN 5,
"0100000" WHEN 6,
"0001111" WHEN 7,
"0000000" WHEN 8,
"0000100" WHEN 9,
"1111111" WHEN OTHERS;
(la, lb, lc, ld, le, lf, lg) <= losegs; -- connect internal signals to outputs
(ma, mb, mc, md, me, mf, mg) <= midsegs;
(ha, hb, hc, hd, he, hf, hg) <= hisegs;
END display;
10-24
Frequency Counter
SUBDESIGN PROB10_25
(
clock :INPUT; -- synch clock
q[2..0] :OUTPUT; -- 3-bit counter
clear, enable, store:OUTPUT; -- timing signals
)
VARIABLE
count[2..0] :DFF; -- declare a register of D flip flops.
BEGIN
count[].clk = clock; -- connect all clocks to synchronous source
IF count[].q < 5 THEN
count[].d = count[].q + 1; -- increment current value by one
ELSE count[].d = 0; -- force unused states to 0
END IF;
q[] = count[].q; -- connect register to outputs
CASE count[] IS
WHEN 0 => clear = VCC; enable = GND; store = GND;
WHEN 2 => clear = GND; enable = VCC; store = GND;
_____________________________________________________________________________
204
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY prob10_25 IS
PORT( clock :IN BIT ;
q :OUT INTEGER RANGE 0 TO 5;
clear, enable, store :OUT BIT );
END prob10_25;
ARCHITECTURE a OF prob10_25 IS
BEGIN
PROCESS ( clock) -- respond to clock
VARIABLE count :INTEGER RANGE 0 TO 5;
BEGIN
IF (clock = '1' AND clock'event) THEN
IF count < 5 THEN -- maximum (terminal) count
count := count + 1;
ELSE
count := 0;
END IF;
END IF;
10-26
SUBDESIGN prob10_26
(
1Hz, 10Hz, 100Hz, 1KHz, 10KHz, 100KHz :INPUT;
s[2..0] :INPUT; -- select inputs
freqout :OUTPUT;
)
BEGIN
CASE s[] IS
WHEN 0 => freqout = 1Hz;
WHEN 1 => freqout = 10Hz;
WHEN 2 => freqout = 100Hz;
_____________________________________________________________________________
205
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
ENTITY prob10_26 IS
PORT(
Hz1, Hz10, Hz100, KHz1, KHz10, KHz100 :IN BIT;
s :IN INTEGER RANGE 0 TO 5;
freqout :OUT BIT );
END prob10_26;
10-27
10-28
SUBDESIGN prescaler (
clk : INPUT;
freqs[5..0] : OUTPUT;
)
_____________________________________________________________________________
206
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
VARIABLE
KHZ10 : fig10_26; -- mod-10
KHZ1 : fig10_26;
HZ100 : fig10_26;
HZ10 : fig10_26;
HZ1 : fig10_26;
BEGIN
KHZ10.clock = clk; -- synchronous clocking
KHZ10.enable = VCC;
KHZ1.clock = clk;
KHZ1.enable = KHZ10.tc;
Hz100.clock = clk;
HZ100.enable = KHZ1.tc;
Hz10.clock = clk;
HZ10.enable = HZ100.tc;
Hz1.clock = clk;
HZ1.enable = HZ10.tc;
freqs[] = (clk, KHZ10.tc, KHZ1.tc, HZ100.tc, HZ10.tc, HZ1.tc);
END;
include "prescaler.inc";
include "prob10_26.inc";
include "prob10_25.inc";
SUBDESIGN T_and_C (
clk, freq_range[2..0] : INPUT;
clear, enable, store : OUTPUT;
)
VARIABLE
presc : prescaler; -- frequency prescaler
fmux : prob10_26; -- multiplexer selects freq
control : prob10_25; -- control signal generator
BEGIN
presc.clk = clk;
(fmux.KHZ100, fmux.KHZ10, fmux.KHZ1, fmux.HZ100, fmux.HZ10, fmux.HZ1) =
presc.freqs[];
control.clock = fmux.freqout;
clear = control.clear;
enable = control.enable;
store = control.store;
fmux.s[] = freq_range[];
END;
_____________________________________________________________________________
207
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b) Smallest change that can occur in the analog output as a result of a change in the digital input.
(e) Ratio of the step size to the full-scale value of a DAC. Percentage resolution can also
be defined as the reciprocal of the maximum number of steps of a DAC.
(f) False.
11-6 Assume resolution = 40A. The number of steps required to produce 10mA F.S. =
10mA/40A = 250. Therefore, it requires 8 bits.
11-8 The glitches are caused by the temporary states of the counter as FFs change in response to clock.
11-9 12-bit DAC gives us 212-1 steps = 4095. Step-Size = F.S/# of steps = 2mA/4095 = 488.4nA
To have exactly 250 RPM the output of the DAC must be 500A. ((250 x 2mA)/1000RPM)
In order to have 500A at the output of the DAC, the computer must increment the input
of the DAC to the count of 1023.75. (500A/488.4nA)
Thus, the motor will rotate at 250.061 RPM when the computer's output has incremented
1024 steps.
_____________________________________________________________________________
208
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-15 With the current IC fabrication technology, it is very difficult to produce resistance
values over a wide resistance range. Thus, this would be the disadvantage of the
circuit of figure 11.7, especially if it was to have a large number of inputs.
(b) Step-Size = (F.S./# of steps) = 10mA/255 = 39.2A. Ideal output for 00000001 2
is 39.2A. The possible range is 39.2A 20A = 19.2A-59.2A. Thus, 50A is
within this range.
11-17 (a) 0.1 inches out of a total of 10 inches is a percentage resolution of 1%.
Thus, (1/2n-1) x 100% 1%. The smallest integer value of n which satisfies this
criteria is n=7.
(b) The potentiometer will not give a smoothly changing value of VP but will change in small
jumps due to the granularity of the material used as the resistance.
11-18 (a) Resistor network used in simple DAC using a an op-amp summing amplifier. Starting with
the MSB resistor, the resistor values increase by a factor of 2.
(b) Type of DAC where its internal resistance values only span a range of 2 to 1.
(c) Amount of time that it takes the output of a DAC to go from zero to within 1/2 step
size of its full-scale value as the input is changed from all 0s to all 1s.
(d) Term used by some DAC manufacturers to specify the accuracy of a DAC. It's
defined as the maximum deviation of a DAC's output from its expected ideal
value.
(e) Under ideal conditions the output of a DAC should be zero volts when the input is
all 0s. In reality, there is a very small output voltage for this situation. This
deviation from the ideal zero volts is called the offset error.
_____________________________________________________________________________
209
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-20 The actual offset voltage is greater than 2mV. In fact, it appears to be around 8mV.
11-21 The DAC's binary input next to the LSB (00000000) is always HIGH. It is probably open.
11-22 The graph of Figure 11.32 would've resulted, if the two least significant inputs of the DAC were
reversed (000000002). Thus, the staircase would've incremented in the following sequence:
0,2,1,3,4,6,5,7,8,10,9,11,12,14,13,15.
11-23 A START pulse is applied to reset the counter and to keep pulses from passing through
the AND gate into the counter. At this point, the DAC output, VAX, is zero and EOC is
high.
When START returns low, the AND gate is enabled, and the counter is allowed to count.
The VAX signal is increased one step at a time until it exceeds VA. At that point, EOC
goes LOW to prevent further pulses from being counted. This signals the end of
conversion, and the digital equivalent of VA is present at the counter output.
11-24 (a) (Digital value) x (resolution) VA+VT; (Digital value) x (40mV) 6.001V = 6001mV.
Therefore, Digital value 150.025. This indicates a digital value of 151 or
written in binary 100101112.
(b) Using same method as in (a) the digital value is again 100101112.
(c) Maximum conversion time =(max. # of steps)x(T CLOCK); TCLOCK = (28-1) x (0.4s) = 102s.
Average conversion time = 102s/2 = 51s.
11-25 Because the difference in the two values of VA was smaller than the resolution of the converter.
11-26 The A/D converter has a full-scale value of (28-1) x 40mV=10.2V. Thus, a VA of 10.853V
would mean that the comparator output would never switch LOW. The counter would
keep counting indefinitely producing the waveform below at the D/A output.
_____________________________________________________________________________
210
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-28 (a) With VA = 5.022V, the value of VAY must equal or exceed 5.023V to switch
COMP. Thus, VAX must equal or exceed 5.018V. This requires 5.018V/10mV =
501.8 = 502 steps.
This gives VAX = 5.02V and digital value 01111101102.
(b) VAY 5.029V, VAX 5.024V; # of steps = 5.024V/10mV = 502.4 = 503 steps (V AX =
5.03V). This gives digital value 01111101112.
(c) In (a) quantization error is VAX - VA = 5.02V - 5.022V = -2mV. In (b) VAX - VA =
5.03V - 5.028V = +2mV
11-29 01000111002 = 28410; At count of 28410, VAY = 2.84V + 5mV = 2.845V; At count
of 28310, VAY = 2.83V + 5mV = 2.835V. Thus, the range of VA = 2.8341V --->
2.844V
11-30
_____________________________________________________________________________
211
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
For a more accurate reproduction of the signal, we must have an A/D converter with
much shorter conversion times. An increase in the number of bits of the converter will
also help, especially during those times when the original waveform changes rapidly.
11-31
(a) Since the Flash ADC samples at intervals of 75s, the sample frequency is 1/75s =13.33
kHz.
(b) The sine wave has a period of 100 s or a F=10 kHz. Therefore, the difference
between the sample frequency and the input sine wave frequency is 3.3 kHz.
(c) The frequency of the reconstructed waveform is approximately 1/300 s or 3.33 kHz.
11-32 (a) Input signal = 5 kHz; (b) Input signal = 9.9 kHz; (c) Input signal = 9.8 kHz
(d) Input signal = 5 kHz; (e) Input signal = 900 Hz; (f) Input signal = 800 Hz
11-33 (a) digital-ramp ADC; (b) successive approximation ADC; (c) successive approximation ADC
(d) both; (e) both; (f) digital-ramp ADC; (g) successive approximation ADC; (h) both
11-34
_____________________________________________________________________________
212
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-35
11-37 t0: Set MSB (bit 5); t1: Set bit 4; clear bit 4; t2: Set bit 3; clear bit 3; t3: Set bit 2
t4: Set bit 1; clear bit 1; t5: Set LSB; Digital result = 1001012
11-38 The range is 3.0V ; The offset is 0.5V.; The Resolution = 3V/255 = 11.76mV : 10010111 2=15110
Thus, the value of the analog input is approximately (15110 x 11.76mV) + 0.5V = 2.276V
11-40 (a) Since we must measure accurately from 50F to 101F, the digital value for 50F for
the best resolution should be 000000002.
(b) The voltage applied to the input VIN(-) should be 500mV. With VIN(-) = 500mV, when
the temperature is 50F the ADC output will be 000000002.
(c) The full range of voltage that will come in is: (101F x 0.01V) - (50F x 0.01V) = 510mV.
(e) An input temperature of 72F causes the LM34 sensor to output a voltage of (72F x
0.01V) = 720mV. However, since there is an offset voltage of 500mV, the ADC will
convert (720mV-500mV) = 220mV. The resolution will be 510mV/256 = 1.99mV, so
220mV/1.99mV = 11010 = 011011102.
(f) The sensor will change by 10mV for every 1F change. Therefore, an output change
of one step of the ADC (1.99mV) corresponds to a temperature change of 0.199F.
Thus, the resolution is 0.199F/step.
_____________________________________________________________________________
213
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-41 Since a conversion would take place every 1s rather than the 1V/25s rate of
conversion, the result would've been a much closer reproduction of the analog signal.
11-42
11-43 (a) flash. (b) digital-ramp and SAC; (c) flash. (d) flash; (e) digital-ramp. (f) digital-
ramp, SAC, and flash; (g) SAC and flash.
_____________________________________________________________________________
214
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
11-45 If the switch is stuck closed, the output will follow VA. If the switch is stuck open, or if
Ch is shorted, the output will be 0V.
11-46
A MOD-16 counter is used between the 50KHz clock and the clock input of the MOD-
4 counter because a 320s time delay is needed for the proper operation of the
circuit. The 320s was determined according to the following requirements:
(b) The outputs must remain stable for 100s after the conversion is complete.
(c) A 10s delay (OS1) is needed in order to allow the analog signal VA to stabilize
before the ADC is given a Start pulse
11-47 (a) The CS signal is LOW only when ALE=0 and the following address is on the address bus:
A15 A14 A13 A12 A11 A10 A9 A8 A7-->A0
1 1 1 0 1 0 1 0 x--->x = EAXX16
_____________________________________________________________________________
215
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
(b) Add an inverter between address line A9 and input A1 of the 74LS138.
(c) 1. Remove the inverter between address line A12 and the NAND gate.
2. Change CS from output 2 of the 74LS138 to output 7.
11-48 Yes. Connect the two least significant bits (b0 and b1) to ground. Attach b2 through
b9 from the ADC to the port.
11-49
Sample 1 2 3 4 5 6 7 8 9 10
IN[n] (v) 0 0 0 0 10 10 10 10 10 10
OUT[n] (v) 0 0 0 0 2.5 5 7.5 10 10 10
11-50
Sample 1 2 3 4 5 6 7 8 9 10
IN[n] (v) 0 0 0 0 10 10 10 10 10 10
OUT[n] (v) 0 0 0 0 4 7 9 10 10 10
_____________________________________________________________________________
216
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-4 Data input lines = 16; Data output lines = 16; Address lines = 13 (2 N = 8192)
Capacity in bytes = 16,384 ((8192x16)/8)
12-5 (a) Random Access Memory (RAM) - Memory in which the access time is the same for any location.
(b) Read/Write Memory (RWM) - Any memory that can be read from and written into with equal ease.
(c) Read-Only Memory (ROM) - Memory devices that are designed for applications where the ratio of
read operations to write operations is very high.
(d) Internal Memory - This is also referred to as the computer's main memory. It stores the
instructions and data that the CPU is currently working on.
(e) Auxiliary Memory - This type of memory is also referred to as mass storage. It stores large
amounts of data without the need for electrical power.
(f) Capacity - A way of specifying how many bits can be stored in a particular memory device or
complete memory system.
(g) Volatile - Any type of memory that requires the application of electrical power in order to store
information.
(h) Density - Another term for Capacity.
(i) Read - The operation whereby the binary word stored in a specific memory location is sensed
and then transferred to another device.
(j) Write - The operation whereby a new word is placed into a particular memory location.
12-6 (a) Address bus, Data bus, and Control bus; (b) Address bus; (c) Data bus. (d) CPU.
12-7 (a) CS 1 produces Hi-Z state outputs; (b) Data out = 11101101
12-8 (a) Only register 11 will have both enable inputs activated; (b) Input address code 0100
will activate both enable inputs of register 4.
12-9 (a) 16K = 16,384. (b) There are 4 bits per register; (c) 16,384 = 214 = 27x27 = 128x128.
Thus, two 1-of-128 decoders are required.
12-10 (a) True; (b)Process of entering data into the ROM; (c) The delay between the
application of a ROM's inputs and the appearance of the data outputs during a READ
operation.
(d) Data Inputs = 4; Data Outputs = 4; Address Inputs = 10; (e) Its function is to activate
one row-select line and one column-select line.
12-11 Since the address inputs to the ROM are stable 500ns prior to the TRANSFER pulse,
then our only concern is to accommodate the tOE delay of 120ns. Thus, the PGT of
TRANSFER should not occur for at least 120ns after its NGT. This neglects the set-up
time requirement of the 74ALS273.
12-12 Since the address inputs will have changed only 70ns prior to the NGT of the
TRANSFER pulse, we have to accommodate the access time requirement of 250ns.
Thus, the PGT of the TRANSFER PULSE should occur for at least 180ns after the NGT.
_____________________________________________________________________________
217
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-13 (a) PROM; (b) MROM; (c) All of these memories are nonvolatile; (d) EPROM, EEPROM, FLASH.
(e) EEPROM; (f) EPROM; (g) EEPROM, FLASH; (h) PROM; (i) FLASH; (j) EEPROM, FLASH.
(k) PROM, EPROM, EEPROM, FLASH. (l) EPROM
12-14 Row 3 will be active (HIGH). Thus, transistors Q13, Q14 and Q15 will be conducting.
12-15
Row 0: Connections to the bases of transistors Q3 and Q1 will be made. Connections to the bases
of transistors Q0 and Q2 will be unconnected.
Row 1: Connection to the base of transistor Q4 will be made. Connections to the bases of
transistors Q5, Q6 and Q7 will be unconnected.
Row 2: Connections to the bases of transistors Q8, Q10 and Q11 will be made. Connection to the
base of transistor Q9 will be unconnected.
Row 3: Connections to the bases of transistors Q12, Q13 and Q14 will be made. Connection to the
base of transistor Q15 will be unconnected.
12-16 (a) Counter is initially RESET so that address inputs to EPROM are 000000000000. Switches
are set for desired data. The PROGRAM push-button is depressed and released. This
triggers OS to apply an inverted 50ms PROGRAM PULSE to the EPROM. The NGT of the
PROGRAM PULSE increments the counter to the next address. Likewise, the inverted
PROGRAM PULSE programs the 2732 EPROM with data from the switches. This process
is repeated until each EPROM address has been programmed with desired data.
(b)
(c) Switch bounce should have no effect because the bounce duration will not exceed 50ms.
_____________________________________________________________________________
218
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-17 (a) Invert A15 and drive CD; Connect RD to OE; Connect WR to WE.
12-18 Each data output waveform will change according to the truth table as the counter
sequences through the various addresses. The D0 waveform is shown below.
12-19
Change D7 in truth-table of figure 12.6 (b) so that it has the levels shown above at the various
addresses. Therefore, the hex data will be 5E, BA, 05, 2F, 99, FB, 00, ED, 3C, FF, B8, C7, 27, EA,
52, 5B.
12-21
(a) Multiplexer
(b) Demultiplexer
(d)
Wave A9 A8 Number
Triangle 1 1 3
Sine 0 0 0
+ Ramp 0 1 1
-Ramp 1 0 2
_____________________________________________________________________________
219
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-22 (a)
(b)
B 120
. Thus, B = 8510 = 55H
FFH 360
C 240
. Thus, C = 17010 = AAH
FFH 360
(c) 1-Cycle = 256 points 60 cycles/sec = 60 x 256 points/sec = 15,360 Hz
(d) Sequencer outputs A, B, and C must remain active long enough to allow for tpd
of the counter, tacc of the ROM, and tpd of the octal latch.
TCK(min) = 10+20+5 = 35ns
FCK(max) = 1/TCK(min) = 1/35ns = 28.6 MHz
(e) It takes 4 cycles of CK for each DAC-OUT pulse and 256 DAC-OUT pulses per cycle.
TSINE = TCK x 4 x 256 = 35.84 s
FSINE = 1/TSINE = 1/35.84 s = 27.9 kHz
(f) It supplies the Most-significant address bits to ROM to select the type of waveform.
_____________________________________________________________________________
220
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-23
(a) tACC=100ns: (b) tOD=30ns: (c) tRC=100ns; 1/100ns=10 million: (d) tAS=20ns:
(b) (e) tDS+tDH=30ns: (f) tAH=tWC-(tAS+tW )=40ns: (g) tWC=100ns; 1/100ns=10 million
12-25
We save 9 address pins by using address multiplexing, but we need RAS and CAS
signals instead of a single CS. Thus, we save a Net Total of 8 pins.
_____________________________________________________________________________
221
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-26
12-27
12-30 The cycles of CAS -before- CAS must be applied at least every 7.8s (4ms/512) in
order for the data to be retained.
_____________________________________________________________________________
222
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-32
12.33
12-34 1)Add four more PROMs (PROM-4 through PROM-7) to the circuit of fig.12.37.
2) Connect AB13 to C input of the 3-line-to-8-line decoder.
3) Connect outputs 4 through 7 of the decoder to the CS inputs of PROMS 4 through 7
respectively.
_____________________________________________________________________________
223
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
12-35 (1) Connect AB13, AB14, and AB15 to the inputs of a 3-input OR gate.
(2) Replace the existing LOW at input C of the decoder with the output of the OR gate.
12-37
* Each 64Kx8 module consists of two 64Kx4 RAM chips with their address inputs, chip select
inputs and R/W inputs tied in parallel.
_____________________________________________________________________________
224
Instructor's Resource Manual Digital Systems Principles and Applications - 12th edition
__________________________________________________________________________________________
13-1 (a) Standard logic refers to SSI and MSI chips that provide basic digital functions.
(b) ASICs are ICs that are designed to implement a specific application.
(c) Microprocessor/DSP devices control components in a system and manipulate data
by executing a program of instructions,
13-2 The necessary speed of operation for the circuit, cost of manufacturing, system power
consumption, system size, amount of time available to design the product, etc.
13-3 Because its functionality is determined by the program of instructions, the "software."
13-5 (a) PLDs use programmable electronic switches to create the desired functionality using
the logic hardware available on the IC.
(b) Gate arrays use customized interconnections, created during IC fabrication, between
the prefabricated gates on a silicon wafer to create the desired functionality.
(b) Standard cells use predefined logic function building blocks to create the desired
functionality in an IC.
(c) Full custom employs layout of components and interconnections to design an IC for
the desired application.
13-12 An LUT is a Look Up Table, used to define logic functions using SRAM memory.
13-13 MAX7000S uses AND/OR array and the MX II uses a look-up table (LUT).
13-14 SRAM
13-15 By configuring itself automatically at power-up from the on-chip configuration flash
memory (CFM).
_____________________________________________________________________________
225