Dl14_sequential Ckt-3_state Assign Prob
Dl14_sequential Ckt-3_state Assign Prob
Overview
Qualifiers
Registers FSM generating sequences
Combinational Functional of control signals Instructs
Units (e.g., ALU) Busses datapath what to do next
Control
Control
State
Qualifiers Control
and Signal
Inputs Outputs
Datapath
Designing Finite State Machines
0
State S0 : zero 1s detected
State S1 : one 1 detected
State S2 : two 1s detected
State S3 : three 1s detected
° S0 = 00 ° S2 = 10
° S1 = 01 ° S3 = 11
Finding Expressions for Next State and Output Value
NS
Input
D Q
CLK PS/Output
Q
R
\Reset
D 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
No change
N
Coin Vending
D Open Gum
Sensor Machine Release
Reset FSM Mechanism
Clk
Vending Machine FSM
State Diagram
Q1 Q1 Q1
Q1 Q0 Q1 Q0 Q1 Q0
DN DN DN
N N N
D D D
Q0 Q0 Q0
K-map for D1 K-map for D0 K-map for Open
Minimized Implementation
Q1
D D1 Q1
D Q
Q0 CLK Q̄ 1
R Q
N Reset OPEN
N
Q̄ 0
Q0
D0
N̄ Q0
D Q
Q1 CLK
R Q Q̄ 0
N
Reset
Q1
D
A: 0 1 0 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0
B: 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0
Z: 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0
• State definitions:
– INIT: initial state
– A0: A had 10 but not 00 on
the previous clock ticks.
– A1: A had 01 but not 11 on
the previous clock ticks.
– OK0: A had 00, or when OK B=1 and
last A=0
– OK1: A had 11, or when OK B=1 and
last A=1
How to choose the best state
assignment?
• Formal way: try all assignments!
– To much work, not practical.
State Q1Q2Q3
• Easy to force reset state
INIT 000 • When Q1=1
• Q2 indicates an OK state
A0 100 • Q3 indicates the previous
value of A
A1 101
OK0 110
OK1 111
Ex: One-hot State Assignment
• Minimal Risk:
– Consider getting one of the unused (or illegal) states (can
be hardware failure, design error, etc).
– Identify unused states, create next-state transitions to
initial, idle or a safe state.
• Minimal Cost:
– Assumes the machine never enters to the unused states.
– In the next-state table unused states can be marked as
don’t cares.
– Simplifies excitation logic, but may create problems.
State Minimization
NS output
PS x=0 x=1 x=0 x=1
Reduced State Transition Diagram
a a b 0 0
b c d 0 0
c a d 0 0
d e f 0 1
e a f 0 1
f e f 0 1
NS output
PS x=0 x=1 x=0 x=1
a a b 0 0
b c d 0 0
c a d 0 0
d e d 0 1
e a d 0 1
Summary