Professional Documents
Culture Documents
Prith Banerjee
ECE C03
Advanced Digital Design
Spring 1998
Qualifiers
Registers FSM generating sequences
Combinational Functional of control signals
Units (e.g., ALU) Instructs datapath what to
Busses do next
Control
Qualifiers Control
and Signal
Inputs Outputs
"Puppet" Datapath
Input Output
NS T Q
Input
D Q CLK
PS/Output
CLK Q
R
Q R
\Reset \Reset
D FF Implementation T FF Implementation
Input 1 0 0 1 1 0 1 0 1 1 1 0
Clk
Output 1 1 1 0 1 1 0 0 1 0 1 1
Delayed Outputs:
take effect on next clock edge
Outputs propagation delays must exceed hold times
FSM 1 FSM 2
CLK
Y
FSM 1 A A B
Y=0 X=0
Y=0 X=0 X
A C
[1] [0]
FSM 2 C D D
X=1
Y=1
X=1 Y
B D
Y=0,1 [0] X=0 [1]
no change
Block Diagram N
Coin
Vending Open Gum
Sensor D
Machine Release
Reset FSM Mechanism
Clk
Reset
S0
0 1 1 1 1 0 1 1 0 0 1 0
N N N
X X X X X X X X X X X X
D D D
1 1 1 1 0 1 1 1 0 0 1 0
Q0 Q0 Q0
K-map for D1 K-map for D0 K-map for Open
Q1
D D1 Q1
D Q
CLK \ Q1
Q0
R
Q D1 = Q1 + D + Q0 N
N
\reset
N
\ Q0 OPEN D0 = N Q0 + Q0 N + Q1 N + Q1 D
Q0
\N
D0
D Q
Q0 OPEN = Q1 Q0
Q1 CLK \ Q0
N Q
R
8 Gates
Q1 \reset
D
ECE C03 Lecture 12 14
Alternative State Machine
Representations
Why State Diagrams Are Not Enough
Not flexible enough for describing very complex finite state machines
State Box
A 010 A 010
F F
I0 I1
T T
F F
I1 I0
T T
B C B C
ECE C03 Lecture 12 17
ASM Example: Parity Checker
Input X, Output Z
Even 0
Nothing in output list implies Z not asserted
0 00 10 10
T T
D D
F F
F F
N N
T T
5 01 15 11
H.Open
T F
N Reset
F T
F T
D 0
ECE C03 Lecture 12 19
Moore and Mealy Machine Design
Procedure Moore Machine
Xi Zk
Combinational Outputs
Outputs are function
Inputs
Logic for solely of the current
Outputs and state
Next State
Outputs change
State synchronously with
State Register Feedback
Clock state changes
State
Register
Mealy Machine
Xi Comb.
Combinational
Inputs Logic for
Logic for
Outputs Outputs depend on
Next State state AND inputs
(Flip-flop Zk
Inputs) Outputs
Input change causes
Clock an immediate output
change
state Asynchronous signals
feedback
ECE C03 Lecture 12 20
Equivalence of Moore and Mealy
Machines
Moore (N D + Reset)/0 N D + Reset
Reset/0 Reset
Mealy
Machine 0 0 Machine
[0]
Reset/0 Reset
N/0 N
5 5
N D/0 D/0 ND D
[0]
N/0 N
10 10
D/1 D
N D/0 [0] ND
N+D/1 N+D
15 15
[1] Reset
Reset/1
[0]
Same I/O behavior 0 1 0/0 1/0
0 1
1
Different # of states 1/1
[0]
1
2
[1] 1
S0 00 S0 0
IN IN
S1 01 S1 1
Equivalent
ASM Charts
IN IN
S2 10
H.OUT H.OUT
X J Q A Input X
C Output Z
X
KR Q \A State A, B = Z
\B
FFa
\Reset
Clk
X J Q Z
X C
KR Q \B
\A
FFb
\Reset
Two Techniques for Reverse Engineering:
X
Clk
A
Z
\Reset
Reset X=1 X=0 X=1 X=0 X=1 X=0 X=0
AB = 00 AB = 00 AB = 11 AB = 11 AB = 10 AB = 10 AB = 01 AB = 00
A B X A+ B+ Z
0 0 0 ? ? 0
1 1 1 0
Partially Derived 0 1 0 0 0 1
1 ? ? 1
State Transition 1 0 0 1 0 0
Table 1 0 1 0
1 1 0 1 1 1
1 1 0 1
ECE C03 Lecture 12 24
Formal Reverse Engineering
Derive transition table from next state and output combinational
functions presented to the flipflops!
Ja = X Ka = X B Z=B
Jb = X Kb = X xor A
A+
State 00, Input 0 -> State 00
State 01, Input 1 -> State 01
B+
S0 00 S3 11
H.Z
0 1 0
X X
1
S1 01 S2 10
H.Z
0 1 1 0
X X
\Reset \Reset
A
DA \X
X
B
B Z
\X X
A
X Note glitches
Clk
in Z!
A Outputs valid at
B following falling
clock edge
Z
\Reset
Reset X =1 X =0 X =1 X =0 X =1 X =1
AB=00 AB=00 AB=00 AB=01 AB=11 AB=10 AB=01
Z =0 Z =0 Z =0 Z =0 Z=1 Z =1 Z =0
A B X A+ B+ Z
0 0 0 0 1 0
Partially completed 1 0 0 0
state transition table 0 1 0 ? ? ?
based on the signal 1 1 1 0
trace 1 0 0 ? ? ?
1 0 1 1
1 1 0 1 0 1
ECE C03 Lecture 121 ? ? ? 28
Formal Reverse Engineering
A+ = B (A + X) = A B + B X
B+ = Jb B + Kb B = (A xor X) B + X B
=ABX + ABX + BX
Z =AX + BX
Missing Transitions and Outputs:
State 01, Input 0 -> State 01, Output 1
State 10, Input 0 -> State 00, Output 0
A+ State 11, Input 1 -> State 11, Output 1
B+
Z
ECE C03 Lecture 12 29
ASM Chart of Mealy Machine
S0 = 00, S1 = 01, S2 = 10, S3 = 11
S0 00 S2 10
0
1 X
X
0 1
H. Z
H. Z S1 01 S3 11
H.Z
0 1 1
X X
0
Xi Zk
Inputs Combinational
Outputs
Logic for
Outputs and
Next State
Case Studies:
A finite string recognizer has one input (X) and one output (Z).
The output is asserted whenever the input sequence 010
has been observed, as long as the sequence 100 has never been
seen.
X: 11011010010
Z: 00000001000
Step 2. Draw State Diagrams/ASM Charts for the strings that must be
recognized. I.e., 010 and 100.
Reset
S0
[0] Moore State Diagram
Reset signal places
S1 S4 FSM in S0
[0] [0]
S2 S5
[0] [0]
S3 S6
Outputs 1 Loops in State
[1] [0]
Reset
S0
[0]
S1 S4
[0] [0]
S2 S5
[0] [0]
S3 S6
[1] [0]
Reset
S0
[0]
S1 S4
[0] [0]
S2 S5
[0] [0]
S3 S6
[1] [0]
ECE C03 Lecture 12 36
Finite String Recognizer
S2, S5 with incomplete transitions
S1 S4
[0] [0] Final State Diagram
S2 S5
[0] [0]
S3 S6
[1] [0]
ECE C03 Lecture 12 37
Review of Design Process
Write down sample inputs and outputs to understand specification
Assume you have an interval timer that generates a short time pulse
(TS) and a long time pulse (TL) in response to a set (ST) signal. TS
is to be used for timing yellow lights and TL for green lights.
Farmroad
C
HL
FL
Highway
Highway
FL
HL C
Farmroad
S0 S3
H.HG H.HR
H.FR H.FY
S1 S2
H.HY H.HR
H.FR H.FG
S0 S0
H.HG H.HG
H.FR H.FR
0 0
TL TL C
1 1
0
C H.ST
1
H.ST S1
H.HY
H.FR
S1
H.HY
H.FR
S1 S2
H.HY H.ST H.HR
H.FR H.FG
0 1
TS
S0 S3
H.HG H.HR
H.FR H.ST H.FY
0 1 0
TL C TS
H.ST H.ST
S1 S2
H.HY H.ST H.HR
H.FR H.FG
0 1 0
TS TL + C
1
TS S3: FY
TS/ST
TL + C/ST
S2
TL C