Beruflich Dokumente
Kultur Dokumente
Lecture Notes # 5
Sequential Circuit (Finite-State Machine) Design
SHANTANU DUTT
Department of Electrical Engineering and Computer Science
University of Illinois, Chicago
Phone: (312) 355-1314: e-mail: dutt@eecs.uic.edu
URL: http://www.eecs.uic.edu/~dutt
x
# of
1s
even
(0)
odd
(1)
even
(2)
odd
(3)
odd
(3)
Solution 2: (Moore)
0
0/0
Reset
Even
Transition
Arc
Input
1/1
1/0
Odd
Reset
Output
Even
Output
[0]
O/P is dependent
on current state and
input in Mealy
0/1
Mealy Machine: Output is associated
with the state transition, and appears
before the state transition is completed
(by the next clock pulse).
1
Odd
[1]
Input
Output is
dependent only
on current state
External I/Ps
External O/Ps
m1
Comb.
Logic
m2
FFs
Output
Logic
m2
CLK
t+
FFs
CLK
External Outputs
Next State
Comb.
Logic
n even
odd
External
I/Ps
m1
Even
Odd O/P=1
O/P=1
x=1
(Moore)
(Mealy)
O/P=0
Odd State: 1;
Next
State
Input
State Variable A
Mealy
O/P
Moore
O/P
A+
y1
D-FF
Excit.
y2
DA
Input
variables
1
1
to comb. logic
DA= Ax ; TA= x
y1 = A for Moore
y2 = Ax for Mealy
Output functions
0
y2
x
N.S. & O/P
Logic
Q
A FF
T-FF
Excit.
TA
N.S.
Logic
Or
DA
CLK
A
O/P
Logic
FFs
DA
y1
Reset
State=0
Even
0/0
Reset
State=0
Even
[0]
1/1
1/0
State=1
Odd
N.S.
Logic
State=1
Odd
[1]
0/1
Mealy
D-
FF D
Moore
CLK
S.T. is complete.
CLK
S.T. is complete.
x
D
even
Q
(state)
y2
(Mealy O/P)
y1
Moore
O/P)
odd
even
even
odd
odd
a) D-FF
0
x=1
Q
R
CLK
y2
b) T-FF
x
T
CLK
Q
R
y2
Reset
Reset
x=1
CLK
Q
R
CLK
Reset
a) D-FF
y1
Reset
b) T-FF
(3)
(4)
Moore
O/Ps depend only on the
present state
Since the O/Ps change
when the state changes,
and the state change is
synchronous with the
enabling clock edge, O/Ps
change synchronously
with this clock edge
A counter is a Moore
machine
Reset
Vending
Machine
FSM
Open
Gum
Release
Mechanism
CLK
States:
0C
5C
10C
15C
9
The figure below show the Moore and Mealy machine state transition diagrams.
Reset / 0
Reset
( N D Reset )/0
0 cent
[0]
Reset
ND
( N D Reset )/0
0 cent
Reset / 0
N D /0
5 cent
[0]
10 cent
[0]
N+D
15 cent
[1]
Moore machine
N/0
5 cent
D/0
D/1
N/0
ND
10 cent
N D /0
N+D/1
15 cent
Mealy machine
Moore and Mealy machine state diagrams for the vending machine FSM
10
State transition table for Moore and Mealy M/C.(Next state also gives D-FF
excitation).
Present State
Inputs
Next State
Q1 Q 2
0 0
D N
Q 1+ Q2+
Open
Open
0 0
0
0
0
0
0 1
0
1
0
0
1 0
1
0
0
0
1 1
x
x
x
x
0 1
0 0
0
1
0
0
0 1
1
0
0
0
1 0
1
1
0
1
1 1
x
x
x
x
1 0
0 0
1
0
0
0
0 1
1
1
0
1
1 0
1
1
0
1
1 1
x
x
x
x
1 1
0 0
1
1
1
1
0 1
1
1
1
1
1 0
1
1
1
1
1 1
x
x
x
x
Encoded vending machine state transition table.
Q+ = D
Q Q+ D
0 0
0
0 1
1
1 0
0
1 1
1
11
00
01
11
10
00
01
11
10
DN
Q1Q0
00
01
11
10
00
01
11
10
K-map for D1
DN
Q1Q0
00
01
11
10
00
01
11
10
DN
K-map for D0
Q1Q0
D1 = Q1 + D + Q0N
D0 N Q0 Q0 N Q1 N Q1 D
OPEN = Q1Q0
Moore OPEN = Q1Q0 + DQ0 + DQ1 + NQ1
Mealy
00
01
11
10
00
01
DN
11
10
12
Q1
D1
D
Q0
N
CLK
Q
R
Q1
Q1
OPEN
Reset
Q0
Q0
D0
N
Q1
N
D
CLK
Q
R
Similarly,
a Mealy
implementation;
only the OPEN
function changes.
Q0
Q0
Reset
Q1
D
13
J-K Excitation
D N
Q 1+ Q2+
J1 K1
J0 K0
Q Q+
0 0
0
0
0 x
0 x
0 0
0 1
0
1
0 x
1 x
1 0
1
0
1 x
0 x
0 1
1 1
x
x
x x
x x
1 0
0 1
0 0
0
1
0 x
x 0
1 1
0 1
1
0
1 x
x 1
1 0
1
1
1 x
x 0
1 1
x
x
x x
x x
1 0
0 0
1
0
x 0
0 x
0 1
1
1
x 0
1 x
1 0
1
1
x 0
1 x
1 1
x
x
x x
x x
1 1
0 0
1
1
x 0
x 0
0 1
1
1
x 0
x 0
1 0
1
1
x 0
x 0
1 1
x
x
x
x
x x
Remapped next-state functions for the vending machine example.
J
0
1
x
x
14
K
x
x
1
0
Q1Q0
00
01
11
10
00
01
11
10
DN
Q1Q0
00
01
11
10
00
01
11
10
DN
K-map for J1
Q1Q0
DN
00
01
K-map for K1
00
01
11
10
Q1Q0
00
01
11
10
00
01
DN
11
11
10
10
K-map for J0
K-map for K0
J1 = D + Q0N
J 0 Q0 N Q1 D
K1 = 0
K 0 Q1 N
15
N
Q0
CLK
D
Q0
K R
Q1
Q1
OPEN
N
Q1
CLK
Q1
J
K R
Q
Q
Q0
Q0
Reset
16
1 received
1 received
Reset
0/1
i=0
Output
Input
Reset
i=0
[1]
0/0
1/0
1/1
10
01
i=1
1/0
i=2
0/0
Mealy Machine
0
i=1
[0]
i=2
[0]
Moore Machine
19
21
(0,00)
(0,0>0)
(1,00)
(0,1)
(2,00)
(1,1)
(2,1)
(1,0>0)
(2,0>0)
22
Reset
(0,00)
1/0
0/0
1/0
(0,0>0)
(1,00)
1/0
0/0
0/0
0/1
1/0
(0,1)
(2,00)
0/0
1/0
(1,1)
0/0
1/0
0/0
(2,1)
(1,0>0)
0/0
1/1
1/0
0/0
(2,0>0)
1/0
23