Professional Documents
Culture Documents
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-2 Appendix A: Digital Logic
Chapter Contents
A.1 Introduction
A.2 Combinational Logic
A.3 Truth Tables
A.4 Logic Gates
A.5 Properties of Boolean Algebra
A.6 The Sum-of-Products Form, and Logic Diagrams
A.7 The Product-of-Sums Form
A.8 Positive vs. Negative Logic
A.9 The Data Sheet
A.10 Digital Components
A.11 Sequential Logic
A.12 Design of Finite State Machines
A.13 Mealy vs. Moore Machines
A.14 Registers
A.15 Counters
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-3 Appendix A: Digital Logic
Some Definitions
• Combinational logic: a digital logic circuit in which logical deci-
sions are made based only on combinations of the inputs. e.g. an
adder.
• Sequential logic: a circuit in which decisions are made based on
combinations of the current inputs as well as the past history of
inputs. e.g. a memory unit.
• Finite state machine: a circuit which has an internal state, and
whose outputs are functions of both current inputs and its inter-
nal state. e.g. a vending machine controller.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-4 Appendix A: Digital Logic
i0 f0 (i0, i1)
i1 Combinational f1 (i1, i3, i4)
...
A Truth Table
• Developed in 1854 by George Boole.
• Further developed by Claude Shannon (Bell Labs).
• Outputs are computed for all possible input combinations (how
many input combinations are there?)
• Consider a room with two light switches. How must they work?
Inputs Output
GND
Light Z A B Z
“Hot”
0 0 0
0 1 1
1 0 1
1 1 0
Switch A Switch B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-6 Appendix A: Digital Logic
A B Z
0 0 1
0 1 0
1 0 0
1 1 1
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-7 Appendix A: Digital Logic
0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-8 Appendix A: Digital Logic
A F=A A F= A
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-9 Appendix A: Digital Logic
A A
F= A B F= A + B
B B
NAND NOR
A B F A B F
0 0 0 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
A A
F=A⊕B F = A ⊕. B
B B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-10 Appendix A: Digital Logic
A A
B F = ABC F = A+ B
C B
(a) (b)
A A+ B
B A+ B
(c)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-11 Appendix A: Digital Logic
3.5 V CC = 5 V
VCC
R L = 400 Ω
V O –Output Voltage–V
3.0
2.5
VCC = +5 V RL
VCC 2.0
Vout
A 1.5
A A Vin
Collector 1.0
Base Emitter A
0.5
GND = 0 V 0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
V I–Input Voltage–V
(a) Inverter showing power terminals; (b) transistor symbol; (c) tran-
sistor configured as an inverter; (d) inverter transfer function.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-12 Appendix A: Digital Logic
+5 V +5 V
Logical 1 Logical 1
2.4 V
2.0 V
Forbidden Range Forbidden Range
0.8 V
0.4 V Logical 0
0V Logical 0 0V
(a) (b)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-13 Appendix A: Digital Logic
VCC
Vout
AB
V1
A Vout
A+B
V2 V1 V2
B A B
(a) (b)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-14 Appendix A: Digital Logic
Tri-State Buffers
• Outputs can be 0, 1, or “electrically disconnected.”
C A F C A F
0 0 ø 0 0 0
0 1 ø 0 1 1
1 0 0 1 0 ø
1 1 1 1 1 ø
A F=AC A F = AC
or or
C C
F=ø F=ø
Tri-state buffer Tri-state buffer, inverted control
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-15 Appendix A: Digital Logic
A = A Involution
AND, 1s with
AB= A+ B A+ B = A B DeMorgan’s Theorem
0s, and 0s
with 1s. AB + AC + BC ( A + B )( A + C )( B +C) Consensus Theorem
= AB + AC = ( A + B)(A + C )
A (A + B) = A A+AB = A Absorption Theorem
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-16 Appendix A: Digital Logic
DeMorgan’s Theorem
A B AB = A + B A + B = AB
0 0 1 1 1 1
0 1 1 1 0 0
1 0 1 1 0 0
1 1 0 0 0 0
A A
F=A+B F=AB
B B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-17 Appendix A: Digital Logic
All-NAND Implementation of OR
• NAND alone implements all other Boolean logic gates.
A
A
A+B A+ B
B
B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-18 Appendix A: Digital Logic
Minterm A B C F
Index 1
0 0 0 0 0
1 0 0 1 0 0 0
2 0 1 0 0 0-side 1-side
3 0 1 1 1
4 1 0 0 0
5 1 0 1 1
6 1 1 0 1 A balance tips to the left or
right depending on whether
7 1 1 1 1 there are more 0’s or 1’s.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-19 Appendix A: Digital Logic
• Gate count is
8, gate input
count is 19.
ABC
ABC
AB C
ABC
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-20 Appendix A: Digital Logic
Connection No connection
Connection No connection
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-21 Appendix A: Digital Logic
A+ B+ C
A+ B+C
A+ B+ C
A+ B+ C
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-22 Appendix A: Digital Logic
A B F A B F A B F
low low low 0 0 0 1 1 1
low high low 0 1 0 1 0 1
high low low 1 0 0 0 1 1
high high high 1 1 1 0 0 0
Dual Operations
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-23 Appendix A: Digital Logic
A Physical A A
F F=AB F=A+B
B AND gate B B
A Physical
F A A
B NAND gate F= A B F = A + B
B B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-24 Appendix A: Digital Logic
Bubble Matching
(a) (b)
x0 Bubble match
Negative logic
Negative logic x0 Negative Negative
Negative logic x1 Logic Logic
Negative logic
Bubble mismatch x1 Bubble match
(c) (d)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-25 Appendix A: Digital Logic
SN7400 QUADRUPLE 2-INPUT POSITIVE-NAND GATES
description
These devices contain four independent schematic (each gate)
2-input NAND gates. V CC
1A
1B
1
2
14
13
VCC
4B
4 kΩ 1.6 kΩ 130 Ω
Data Sheet
1Y 3 12 4A
H H L 4 11 A
2A 4Y
L X H 2B 5 10 3B B
2Y 6 9 3A
X L H GND 7 8 3Y
Y
NAND gate, 2A
2B
3A
2Y
V IH
V IL
High-level input voltage
Low-level input voltage
2
0.8
V
V
3Y
16
mA
mA
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-26 Appendix A: Digital Logic
Digital Components
• High level digital circuit designs are normally created using col-
lections of logic gates referred to as components, rather than us-
ing individual logic gates.
• Levels of integration (numbers of gates) in an integrated circuit
(IC) can roughly be considered as:
• Small scale integration (SSI): 10-100 gates.
• Medium scale integration (MSI): 100 to 1000 gates.
• Large scale integration (LSI): 1000-10,000 logic gates.
• Very large scale integration (VLSI): 10,000-upward logic
gates.
• These levels are approximate, but the distinctions are useful
in comparing the relative complexity of circuits.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-27 Appendix A: Digital Logic
Multiplexer
D0 00
Data Inputs
A B F
D1 01
F
D2 10 0 0 D0
D3 11 0 1 D1
1 0 D2
1 1 D3
A B
Control Inputs
F = A B D0 + A B D1 + A B D2 + A B D3
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-28 Appendix A: Digital Logic
D1
F
D2
D3
A B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-29 Appendix A: Digital Logic
0 000
A B C M 0 001
0 0 0 0 0 010
0 0 1 0 1 011
F
0 1 0 0 0 100
0 1 1 1 1 101
1 0 0 0 1 110
1 0 1 1 1 111
1 1 0 1
1 1 1 1
A B C
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-30 Appendix A: Digital Logic
A B C F
0 0 0 0 0 00
0 0 1 0 0
1 01
F
0 1 0 1 C 10
1
0 1 1 1 C 11
1 0 0 0
C
1 0 1 1
1 1 0 1 A B
C
1 1 1 0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-31 Appendix A: Digital Logic
Demultiplexer
00 F0 D A B F0 F1 F2 F3
01 F1
D 0 0 0 0 0 0 0
10 F2
0 0 1 0 0 0 0
11 F3
0 1 0 0 0 0 0
0 1 1 0 0 0 0
A B 1 0 0 1 0 0 0
1 0 1 0 1 0 0
F0 = D A B F2 = D A B 1 1 0 0 0 1 0
1 1 1 0 0 0 1
F1 = D A B F3 = D A B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-32 Appendix A: Digital Logic
F1
D
F2
F3
A B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-33 Appendix A: Digital Logic
Decoder
Enable = 1 Enable = 0
A B D 0 D1 D2 D3 A B D0 D 1 D 2 D 3
00 D0
A 01 D1 0 0 1 0 0 0 0 0 0 0 0 0
B 10 D2 0 1 0 1 0 0 0 1 0 0 0 0
1 0 0 0 1 0 1 0 0 0 0 0
Enable 11 D3
1 1 0 0 0 1 1 1 0 0 0 0
D0 = A B D1 = A B D2 = A B D3 = A B
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-34 Appendix A: Digital Logic
D0
D1
A
D2
B
D3
Enable
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-35 Appendix A: Digital Logic
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-36 Appendix A: Digital Logic
Priority Encoder
• An encoder translates a set of inputs into a binary encoding.
• Can be thought of as the converse of a decoder.
• A priority encoder imposes an order on the inputs.
• Ai has a higher priority than Ai+1
A0 A1 A2 A3 F0 F1
0 0 0 0 0 0
0 0 0 1 1 1
A0 00 0 0 1 0 1 0
A1 01 F0 0 0 1 1 1 0
0 1 0 0 0 1
A2 10 F1
0 1 0 1 0 1
A3 11 0 1 1 0 0 1
0 1 1 1 0 1
1 0 0 0 0 0
1 0 0 1 0 0
F0 = A0 A1 A3 + A0 A1 A2 1 0 1 0 0 0
F1 = A0 A2 A3 + A0 A1 1 0 1 1 0 0
1 1 0 0 0 0
1 1 0 1 0 0
1 1 1 0 0 0
1 1 1 1 0 0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-37 Appendix A: Digital Logic
F0
A1
A2
F1
A3
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-38 A B C Appendix A: Digital Logic
Programmable OR matrix
Logic Array
• A PLA is a
customizable AND
matrix followed by
a customizable
OR matrix.
• Black box view of
PLA:
A F0 Fuses
B PLA
C F1
AND matrix
F0 F1
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-39 A B C Appendix A: Digital Logic
Simplified ABC
Representation AB C
of PLA ABC
Implementation ABC
of Majority
Function
F0 F1
(Majority) (Unused)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-40 Appendix A: Digital Logic
Carry In 0 0 0 0 1 1 1 1
Operand A 0 0 1 1 0 0 1 1
Operand B + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 1
0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-41 Appendix A: Digital Logic
Full Adder
Ai Bi Ci Si Ci+1
Bi Ai
0 0 0 0 0 Ci
0 0 1 1 0
0 1 0 1 0 Full
0 1 1 0 1 adder
1 0 0 1 0
1 0 1 0 1 Ci+1
1 1 0 0 1 Si
1 1 1 1 1
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-42 Appendix A: Digital Logic
b3 a3 b2 a2 b1 a1 b0 a0
c3 c2 c1 c0
0
c4
s3 s2 s1 s0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-43 Appendix A: Digital Logic
A B Cin
PLA Realization
of Full Adder
Sum Cout
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-44 Appendix A: Digital Logic
Sequential Logic
• The combinational logic circuits we have been studying so far
have no memory. The outputs always follow the inputs.
• There is a need for circuits with memory, which behave differ-
ently depending upon their previous state.
• An example is a vending machine, which must remember how
many and what kinds of coins have been inserted. The machine
should behave according to not only the current coin inserted,
but also upon how many and what kinds of coins have been in-
serted previously.
• These are referred to as finite state machines, because they can
have at most a finite number of states.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-45 Appendix A: Digital Logic
...
...
Inputs Outputs
binational logic ik Combinational fm
unit and delay logic unit
...
...
elements (called
flip-flops) in a
feedback path, State bits
which maintains Q0 D0
state informa- s0
tion.
...
Qn Dn
sn
Synchronization
signal
Delay elements (one per state bit)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-46 Appendix A: Digital Logic
1
A B
∆τ A+ B 0
B
1
A+ B 0
∆τ
Timing Behavior
• The delay between input and output (which is lumped at the out-
put for the purpose of analysis) is at the basis of the functioning
of an important memory element, the flip-flop.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-47 Appendix A: Digital Logic
S-R Flip-Flop
• The S-R flip-flop is an active high (positive logic) device.
Qt St Rt Qi+1 S
S 0 0 0 0 R
Q 0 0 1 0
0 1 0 1
Q
0 1 1 (disallowed)
1 0 0 1
R Q Q
1 0 1 0
1 1 0 1 ∆τ ∆τ
1 1 1 (disallowed) 2∆τ 2∆τ
Timing Behavior
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-48 Appendix A: Digital Logic
S S S R
Q Q Q Q
R Q R Q R Q S Q
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-49 Appendix A: Digital Logic
A Hazard
A
AB
Glitch caused by
C S a hazard
S
Q
B ∆τ
A AB R
R Q Q
Q
∆τ
2∆τ
Timing Behavior
Time
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-51 Appendix A: Digital Logic
Scientific Prefixes
• For computer memory, 1K = 210 = 1024. For everything else, like
clock speeds, 1K = 1000, and likewise for 1M, 1G, etc.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-52 Appendix A: Digital Logic
S R
Q
CLK
CLK
Q Q
R
Q
∆τ
2∆τ
Timing Behavior
• The clock signal, CLK, enables the S and R inputs to the flip-flop.
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-53 Appendix A: Digital Logic
Clocked D Flip-Flop
• The clocked D flip-flop, sometimes called a latch, has a potential
problem: If D changes while the clock is high, the output will also
change. The Master-Slave flip-flop (next slide) addresses this prob-
lem.
D D
Q
CLK
CLK
Circuit
Q Q
Q
∆τ ∆τ
D Q
2∆τ 2∆τ
Symbol
C Q Timing Behavior
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-54 Appendix A: Digital Logic
Master-Slave Flip-Flop
• The rising edge of the clock loads new data into the master,
while the slave continues to hold previous data. The falling
edge of the clock loads the new master data into the slave.
Master Slave D
D D QM D QS
CLK
Circuit
CLK C C QS QM
QS
QS
D Q
∆τ ∆τ
Symbol
Q 3∆τ 2∆τ 2∆τ 2∆τ
Timing Behavior
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-55 Appendix A: Digital Logic
J
Q
J Q
CLK
K Q
Q
K
Symbol
Circuit
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-56 Appendix A: Digital Logic
J
Q
J Q
CLK
K Q
Q
K
Symbol
Circuit
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-57 Appendix A: Digital Logic
Clocked T Flip-Flop
• The presence of a constant 1 at J and K means that the flip-flop
will change its state from 0 to 1 or 1 to 0 each time it is clocked
by the T (Toggle) input.
1 J Q Q
T T
K Q Q
Circuit Symbol
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-58 Appendix A: Digital Logic
changes in D. Q
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-59 Appendix A: Digital Logic
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-60 Appendix A: Digital Logic
Output 00 Output 01
state state
RESET 0/01
State
1/00 A B
Transition q1 q0
1/00
Diagram for
Mod-4 1/00
0/10
Counter 0/00
1/00
C D
0/11
Output 10 Output 11
state state
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-61 Appendix A: Digital Logic
Input RESET
Present state 0 1
A B/01 A/00
B C/10 A/00
C D/11 A/00
D A/00 A/00
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-62 Appendix A: Digital Logic
Input RESET
Present
state (St) 0 1
A:00 01/01 00/00
B:01 10/10 00/00
C:10 11/11 00/00
D:11 00/00 00/00
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-63 Appendix A: Digital Logic
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-64 Appendix A: Digital Logic
RESET
DQ
s1 q1
CLK Q
DQ
s0 q0
Q
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-65 Appendix A: Digital Logic
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-66 Appendix A: Digital Logic
A 1/1 0/0
0/0
F 1/1
1/0
C 0/1
G
1/0
1/0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-67 Appendix A: Digital Logic
Input X
Present state 0 1
A B/0 C/0
B D/0 E/0
C F/0 G/0
D D/0 E/0
E F/0 G/1
F D/0 E/1
G F/1 G/0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-68 Appendix A: Digital Logic
(b)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-69 Appendix A: Digital Logic
CLK
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-70 Appendix A: Digital Logic
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-71 Appendix A: Digital Logic
Input N D Q Input N D Q
x1 x0 x1 x0 x1 x0
P.S. 00 01 10 P.S. 00 01 10
A B/000 C/000 A/110 s 1 s0 s 1 s0 / z 2 z 1 z 0
B C/000 D/000 A/101 A:00 01/000 10/000 00/110
C D/000 A/100 A/111 B:01 10/000 11/000 00/101
D A/100 A/110 B/111 C:10 11/000 00/100 00/111
D:11 00/100 00/110 01/111
(a)
(b)
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-73 Appendix A: Digital Logic
Q D
s0 0
(a) CLK
1
Q D
s1 2
P resent N ext
D ispense 5
R eturn nickel
state C oin state R eturn dim e
B ase 10
6
equivalent
s1 s0 x1 x0 s1 s 0 z 2 z 1 z 0
8
0 0 0 0 0 0 1 0 0 0
1 0 0 0 1 1 0 0 0 0
2 0 0 1 0 0 0 1 1 0 9
3 0 0 1 1 d d d d d
4 0 1 0 0 1 0 0 0 0 10
5 0 1 0 1 1 1 0 0 0
6 0 1 1 0 0 0 1 0 1 12
7 0 1 1 1 d d d d d
8 1 0 0 0 1 1 0 0 0
13
9 1 0 0 1 0 0 1 0 0
10 1 0 1 0 0 0 1 1 1
11 1 0 1 1 d d d d d 14
12 1 1 0 0 0 0 1 0 0
13 1 1 0 1 0 0 1 1 0
14 1 1 1 0 0 1 1 1 1
15 1 1 1 1 d d d d d
(b) (c)
s1 s0 z2 z1 z0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-74 Appendix A: Digital Logic
Moore Counter
• Mealy Model: Outputs are functions of Inputs and Present State.
• Previous FSM designs were Mealy Machines, in which next state
was computed from present state and inputs.
• Moore Model: Outputs are functions of Present State only.
0 00
0 z0 z1 0 x 01 4-to-1
D Q z0
1 1 10 MUX S0
00 01 11 Q
1 1
00
01 4-to-1 z1
D Q
11 10 MUX
10 S1
1 11 Q
0 0
CLK
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-75 Appendix A: Digital Logic
Four-Bit Register
• Makes use of tri-state buffers so that multiple registers can gang
their outputs to common output lines.
D3 D2 D1 D0
D Q D Q D Q D Q
Write (WR)
CLK
Enable (EN)
Q3 Q2 Q1 Q0
WR D3 D2 D1 D0
EN Q3 Q2 Q1 Q0
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-76 Appendix A: Digital Logic
Left-Right
Shift c1
c0
with
Shift right input
Parallel
Read and c0
D Q D Q D Q D Q
Shift right
output
Write c1 CLK
Enable (EN)
Q3 Q2 Q1 Q0
Control Function
c1 c0
Shift right input D3 D2 D1 D0
0 0 No change Shift left output Shift right output
0 1 Shift left c Shift right input
1 0 Shift right c01 Q 3 Q2 Q1 Q 0
1 1 Parallel load
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring
A-77 Appendix A: Digital Logic
Modulo-8 Counter
• Note the use of the T flip-flops, implemented as J-K’s. They are
used to toggle the input of the next flip-flop when its output is 1.
1 J Q 1 J Q 1 J Q
K K K
CLK
Enable (EN)
RESET
Q2 Q1 Q0
CLK
ENABLE Q0
MOD(8) COUNTER
RESET Q2 Q1 Q0 Q1
Q2
Timing Behavior
Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring