Professional Documents
Culture Documents
FSM Optimization
Randy H. Katz
University of California, Berkeley
July 1993
State Reduction
State Assignment
0
S0
[0]
S0
1
[0] 0
S1
1 1 [1]
S1 1 1
[1]
S2
[0]
0
0
Odd Parity Checker: two alternative state diagrams
Algorithmic Approach
• Start with state transition table
• If such states transition to the same next state, they are equivalent
Fifteen states (1 + 2 + 4 + 8)
Reset
0/0 1/0
0/0 1/0 0/0 0/0 0/1 0/0 1/0 0/0 1/0 1/0
1/0 1/0 1/0 0/1 1/0 0/0
Reset
S0
0/0 1/0
S1 S2
1/0
0/0 1/0 0/0
Corresponding
CorrespondingState
State
Diagram S3' S4'
Diagram
0,1/0 0/0 1/0
S7' S10'
0/1 1/0
0,1/0
• Problem: does not allows yield the most reduced state table!
Next State
Present State X =0 X =1 Output
S0 S0 S1 0
S1 S1 S2 1
S2 S2 S1 0
No
Noway
wayto
tocombine
combinestates
statesS0
S0and
andS2S2
based on Next State Criterion!
based on Next State Criterion!
S0
S1 S1
Next States
Under all S2 S2
Input
Combinations S3 S3
S4 S4
S5 S5
S6 S6
S0 S1 S2 S3 S4 S5 S6 S0 S1 S2 S3 S4 S5
Example:
S0 transitions to S1 on 0, S2 on 1;
S1 transitions to S3 on 0, S4 on 1;
S0 S1-S3
S2-S4
S1 © R.H. Katz Transparency No. 9-19
Contemporary Logic Design
State Reduction FSM Optimization
Implication Chart Method
S1-S3 S2 and S4
S1 S2-S4 have different
S1-S5 S3-S5 I/O behavior
S2 S2-S6 S4-S6
S1-S0 S3-S0 S5-S0 This implies that
S3 S2-S0 S4-S0 S6-S0 S1 and S0 cannot
be combined
S4
S1-S0 S3-S0 S5-S0 S0-S0
S5 S2-S0 S4-S0 S6-S0 S0-S0
S0-S0
S6 S0-S0
S0 S1 S2 S3 S4 S5
Starting Implication Chart
S1
00 10
S0 00 S1 Next State
11
Present Output
[1] 01 [0] State 00 01 10 11
11 S0 S0 S1 S2 S3 1
10
01
S1 S0 S3 S1 S5 0
S2 S1 S3 S2 S4 1
00
01
00 S3 S1 S0 S4 S5 0
S2 01 S3 S4 S0 S1 S2 S5 1
[1] [0] S5 S1 S4 S0 S5 0
10 10
11 11
S4 11 S5
00
[1] [0]
01 11
State Diagram
S1
S0 S1 S2 S3 S4
Implication Chart
S1
Implication
ImplicationChart
Chart
S2 S0 -S2
S1 -S1
S0 S1
S0 is equivalent to S2
since nothing contradicts this assertion!
2. Square labeled Si, Sj, if outputs differ than square gets "X".
Otherwise write down implied state pairs for all input
combinations
5. For each remaining unmarked square Si, Sj, then Si and Sj are
equivalent.
When FSM implemented with gate logic, number of gates will depend on
mapping between symbolic state names and binary encodings
4 states = 4 choices for first state, 3 for second, 2 for third, 1 for last
= 24 different encodings (4!)
24 state assignments
for the traffic light
controller Symbolic State Names: HG, HY, FG, FY
S0 Assignment Assignment
State Name Q2 Q 1 Q0 State Name Q2 Q1 Q0
S0 0 0 0 S0 0 0 0
0 1 S1 1 0 1 S1 0 0 1
S2 1 1 1 S2 0 1 0
S1 S2 S3 0 1 0 S3 0 1 1
S4 0 1 1 S4 1 1 1
S3 Assignment Assignment
Q1 Q 0 Q1 Q 0
S4
Q 00 01
2
11 10 Q2 00 01 11 10
0 S0 S4 S3 0 S0 S1 S3 S2
1 S1 S2 1 S4
Medium Priority
α β
i/j i/j states that have common output behavior
(group 1's in output map)
Lowest Priority
© R.H. Katz Transparency No. 9-29
Contemporary Logic Design
State Assignment FSM Optimization
Pencil and Paper Methods
Example: 3-bit Sequence Detector
Reset
Lowest Priority:
0,1/0 S1' 0/1, 0/0: (S0, S1', S3')
1/0 0/0 1/0 1/0: (S0, S1', S3', S4')
S3' S4'
Reset State = 00
Not
Notmuch
muchdifference
differencein
inthese
thesetwo
two
assignments
assignments
S7' S10'
0/1 1/0
0,1/0
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 S0 S3' 0 S0
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 S0 S3' S7' 0 S0 S3'
Q1 Q0 Q1 Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 S0 S1 S3' S7' 0 S0 S1 S3'
(a) (b)
Q2 Q1 Q2 Q 1 Q2 Q1
Current Next State 00 01 11 10 00 01 11 10 00 01 11 10
State X =0 X=1 Q0 X Q0 X Q0 X
(S0 ) 000 001 101 00 0 0 0 X 00 0 0 0 X 00 1 0 0 X
(S1 ) 001 011 111
(S2 ) 101 01 1 0 0 X 01 0 0 0 X 01 1 0 0 X
111 011
( S'3 ) 011 010 010 11 1 1 11 1 1 11
(S4' ) 111 0 0 1 1 1 0 0 1
010 110
( S7' ) 010 000 000 10 0 0 0 1 10 1 1 10
1 1 1 0 0 1
(S'10) 110 000 000
P2 P1 P0
Q2 Q1 Q2 Q1 Q2 Q1
Current Next State
State Q0 X 00 01 11 10 Q0 X 00 01 11 10 Q0 X 00 01 11 10
X =0 X=1
( S0) 000 001 010 00 0 1 0 1 00 0 0 0 0 00 1 0 0 1
( S1) 001 011 100
( S2) 010 100 011 01 0 0 0 1 01 1 1 0 1 01 0 1 0 0
( S3' ) 011 101 101
( S'4 ) 100 101 110 11 1 1 X 0 11 0 0 X 0 11 0 1 X 0
( S7' ) 101 000 000 10 0 10 10
0 1 X 1 0 X 0 1 1 X 0
(S'10) 110 000 000
P2 P1 P0
First encoding exhibits a better clustering of 1's in the next state map