Professional Documents
Culture Documents
General Finite State Machine (FSM) Design Moore/Mealy Machines
General Finite State Machine (FSM) Design Moore/Mealy Machines
General finite state machine (FSM) FSM: A system that visits a finite
design number of logically distinct states
Moore/Mealy machines
Counters are simple FSMs
Outputs and states are identical
Visit states in a fixed sequence without
inputs
1 2
FSMs are typically more complex than Counter design FSM design procedure
procedure 1. State diagram
counters 1. State diagram 2. State-transition table
Outputs can depend on current state and 2. State-transition table 3. State minimization
on inputs 3. Next-state logic 4. State encoding
minimization 5. Next-state logic
State sequencing depends on current 4. Implement the design minimization
state and on inputs 6. Implement the design
3 4
S3 S4 S5 S6
N [open] [open] [open]
Vending Open
Coin Machine Release N D
Sensor FSM Mechanism
D
S7 S8
[open] [open]
5 6
Clock
2. State transition table 3. State minimization
present inputs next output
state D N state open
Reset present inputs next output
S0 0 0 S0 0 N’D’ state D N state open
0 1 S1 0 0¢ 0 0 0¢ 0
1 0 S2 0 0 1 5¢ 0
1 1 X X 0¢ 1 0 10¢ 0
S1 0 0 S1 0 1 1 – –
0 1 S3 0 N’D’ N
1 0 S4 0
5¢ 0 0 5¢ 0
1 1 X X 0 1 10¢ 0
D 1 0 15¢ 0
S2 0 0 S2 0 5¢
0 1 S5 0 1 1 – –
1 0 S6 0 N 10¢ 0 0 10¢
1 1 X X 0 1 15¢ 0
S3 0 0 S3 0 D 10¢ 1 0 15¢ 0
0 1 S7 0 1 1 – –
1 0 S8 0 15¢ – – 15¢ 1
1 1 X X N+D
S4 X X S4 1
S5 X X S5 1 15¢ symbolic state table
S6 X X S6 1 [open] Reset
S7 X X S7 1
S8 X X S8 1
7 8
9 10
11 12
Current State
Moore vs. Mealy machines State diagrams
Moore machine
inputs Outputs are a function
combinational
logic for of current state Moore machine
next state logic for
reg outputs
outputs Outputs change Each state is labeled by a state-
synchronously with
state changes
name/output pair.
state feedback
inputs
logic for
outputs outputs Mealy machine Mealy machine
Outputs depend on state
combinational
reg
and on inputs Each transition arc is labeled by a input-
logic for
next state
Input changes can cause condition/output pair.
immediate output changes
state feedback (asynchronous)
13 14
Circuits recognize AB=10 followed by AB=01 Moore: Output is a function of state only
What kinds of machines are they? Specify output in the state bubble
current next current
out 0 reset input state state output
A DQ DQ 1 – – A 0
1
Q Q B/0 D/1 0 0 A B 0
B DQ DQ 0 0 1 A C 0
Q Q 0 0 0 B B 0
reset
clock out A/0 1 0 0 1 B D 0
A 0 0 C E 0
Moore D Q 1
1 0 1 C C 0
Q
E/1 0 0 D E 1
B C/0
D Q 0 0 1 D C 1
Q 0 0 E B 1
clock 1
Mealy 15 0 1 E D 116
combinational
logic for reg
next state
state feedback
19 20
Recognize AB = 01
Mealy or Moore?
A
out
D Q
B
clock
Q
Synchronous Mealy
(Moore) A
D Q out
B
D Q
clock
Q
Moore
21