18 FSM
18 FSM
Logistics
HW6 due today
Midterm 2
Wednesday Feb 25
Review session Tuesday Feb 24, 4:30 in this room, EEB 037
Will cover materials up to today’s lecture
Last Lecture
Counter Finite State Machine
Timing
Today
General Finite State Machine (FSM) design
CSE370, Lecture 18 1
One more counter example:
A 5-state counter with D flip flops
Counter repeats 5 states in sequence
Sequence is 000, 010, 011, 101, 110, 000
C+ C B+ C
A+ C
0 0 0 X 1 1 0 X 0 1 0 X
A X 1 X 1 A X 0 X 1 A X 1 X 0
B B B
CSE370, Lecture 18 3
5-state counter (con’t)
A D Q C D Q B D Q A
CLK
A' B
C' C'
B'
111
001
000 110
100
010 101
011
CSE370, Lecture 18 5
5-state counter (con’t)
CSE370, Lecture 18 7
Finite state machines: more than counters
CSE370, Lecture 18 8
FSM design
CSE370, Lecture 18 9
Example: A vending machine
15 cents for a cup of coffee (yeah, it’s subsidized)
FSM-design procedure
1. State diagram
Reset
2. State-transition table
3. State minimization
4. State encoding
5. Next-state logic minimization
6. Implement the design
N
Vending Open
Coin Machine Release
Sensor FSM Mechanism
D
Clock
CSE370, Lecture 18 10
A vending machine:
(conceptual) state diagram
Reset (from all states)
S0
N D
Draw self-loops for
N’ D’ for S0 to S3
S1 S2 Also draw self-loops for
1 for S4 to S8
N D N D
S3 S4 S5 S6
[open] [open] [open]
N D
S7 S8
[open] [open]
CSE370, Lecture 18 11
A vending machine: State transition table
CSE370, Lecture 18 13
A vending machine: State encoding
CSE370, Lecture 18 14
A vending machine: Logic minimization
Q1 Q1 Q1
D1 D0 Open
0 0 1 1 0 1 1 0 0 0 1 0
0 1 1 1 N 1 0 1 1 N N
0 0 1 0
D X X X X D X X X X D X X 1 X
1 1 1 1 0 1 1 1 0 0 1 0
Q0 Q0 Q0
D1 = Q1 + D + Q0 N
D0 = Q0’ N + Q0 N’ + Q1 N + Q1 D
OPEN = Q1 Q0
CSE370, Lecture 18 15
A vending machine: Implementation
CSE370, Lecture 18 16