shift registers
counters
state diagrams
state transition table
next state functions
potential optimizations
Spring 2010
In 0
=1
In =001
1
100
Spring 2010
010
In = X
111
1
In = 0 010
In = X
In = 1
110
5 states
8 other transitions between states
6 conditioned by input
001
0
reset
Spring 2010
010
100
111
0
110
State diagrams
Like a program
Start in some state
For each state:
Spring 2010
Counters
3-bit up-counter: 000, 001, 010, 011, 100, 101, 110, 111, 000, ...
3-bit down-counter: 111, 110, 101, 100, 011, 010, 001, 000, 111, ...
010
001
000
011
100
3-bit up-counter
110
111
Spring 2010
101
Counter
OUT1
OUT2
D Q
OUT3
D Q
CLK
001
010
011
000
100
111
Spring 2010
110
101
"1"
CSE370 - XIV - Finite State Machines I
Shift register
OUT1
IN
1
0
0
001
Spring 2010
D Q
110
101
0
1
010
000
D Q
OUT3
CLK
100
1
D Q
OUT2
111
0
1
0
011
The next state function where the FSM should transition next
The output function
Spring 2010
Spring 2010
000
011
100
3-bit up-counter
111
Spring 2010
010
110
101
current state
0
000
1
001
2
010
3
011
4
100
5
101
6
110
7
111
next state
001
1
010
2
011
3
100
4
101
5
110
6
111
7
000
0
10
C2
0
0
1
1
0
0
1
1
C1
0
1
0
1
0
1
0
1
N3
C1
N3
0
0
0
1
1
1
1
0
N1
1
0
1
0
1
0
1
0
N1 <=
<=
N2 <=
<=
N3 <=
<=
<=
<=
N2
C3
0
N2
0
1
1
0
0
1
1
0
C1
C1
C1 xor 1
C1C2 + C1C2
C1 xor C2
C1C2C3 + C1C3 + C2C3
(C1C2)C3 + (C1 + C2)C3
(C1C2)C3 + (C1C2)C3
(C1C2) xor C3
N1
C3
0
C2
C3
C1
C2
C2
Spring 2010
11
100
0
1
0
101
0
0
001
0
011
D Q
111
OUT1
IN
1
010
000
110
D Q
OUT2
In
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
OUT3
D Q
C1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
C2
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
C3
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
N1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
N2
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
N3
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
N1 <= In
N2 <= C1
N3 <= C2
CLK
Spring 2010
12
Complex counter
Step 2: derive the state transition table from the state transition
diagram
000
0
1
0
0
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1
1
0
1
1
0
0
0
0
1
1
1
110
010
101
011
note the don't care conditions that arise from the unused state codes
Spring 2010
13
B+
C
0
A+
C
1
C
0
C+ <= A
B+ <= B + AC
A+ <= BC
Spring 2010
14
C+
B+
A+
C
1
C
0
B
Present State Next State
C
B
A
C+ B+ A+
0
0
0
0
1
0
0
0
1
1
1
0
0
1
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
1
0
1
1
1
0
1
1
0
0
0
0
1
1
1
1
0
0
001
111
000
110
100
010
101
011
Spring 2010
15
Self-starting counters
Start-up states
Self-starting solution
111
111
001
000
000
110
101
010
101
011
011
Spring 2010
110
100
100
010
001
on previous slide
16
Activity
State Assignment
(Arbitrary different
encoding yields
different circuits)
Spring 2010
18
Activity
State Table
S1
0
0
0
0
0
0
0
0
1
1
Spring 2010
S0
0
0
0
0
1
1
1
1
0
1
A
0
0
1
1
0
0
1
1
-
B
0
1
0
1
0
1
0
1
-
N1
0
1
0
1
0
1
0
1
1
1
N0
0
1
1
1
1
0
1
0
0
1
Out
0
0
0
0
0
0
0
0
1
0
19
Activity
S0
0
0
0
0
1
1
1
1
0
1
A
0
0
1
1
0
0
1
1
-
B
0
1
0
1
0
1
0
1
-
N1
0
1
0
1
0
1
0
1
1
1
Spring 2010
N0
0
1
1
1
1
0
1
0
0
1
Out
0
0
0
0
0
0
0
0
1
0
N1 <= S1 + B
N0 <= S1S0 + S1S0B + S1S0A
Out = S1S0
20
Edge Detector
Sample an input
Output a 1 when either the transition 0 -> 1, or 1 -> 0 is detected
0
1
B/0
D/1
0
reset
0
1
A/0
1
C/0
E/1
1
Spring 2010
22
Edge Detector
B/0
D/1
0
0
reset
A/0
1
C/0
E/1
1
Spring 2010
reset
1
0
0
0
0
0
0
0
0
0
0
input
0
1
0
1
0
1
0
1
0
1
current
state
A
A
B
B
C
C
D
D
E
E
next
state
A
B
C
B
D
E
C
E
C
B
D
output
0
0
0
0
0
0
1
1
1
1
23
Edge Detector
B/0
D/1
0
reset
0
1
A/0
1
1
C/0
1
Spring 2010
E/1
reset
1
0
0
0
0
0
0
0
0
0
0
input
0
1
0
1
0
1
0
1
0
1
state
A
A
B
B
C
C
D
D
E
E
state
A
B
C
B
D
E
C
E
C
B
D
output
0
0
0
0
0
0
1
1
1
1
24
Edge Detector
Spring 2010
reset
1
0
0
0
0
0
0
0
0
0
0
input
0
1
0
1
0
1
0
1
0
1
current
state
000
000
001
001
010
010
100
100
101
101
next
state
000
001
010
001
100
101
010
101
010
001
100
output
0
0
0
0
0
0
1
1
1
1
25
26
Mealy machine
0/0
reset
1
0
0
0
0
0
0
B
0/0
reset/0
0/1
1/1
1/0
input
0
1
0
1
0
1
current
state
A
A
B
B
C
C
next
state
A
B
C
B
C
B
C
output
0
0
0
0
1
1
0
C
1/0
Spring 2010
27
Mealy machine
State assignment:
reset
1
0
0
0
0
0
0
input
0
1
0
1
0
1
current
state
00
00
01
01
10
10
next
state
00
01
10
01
10
01
10
output
0
0
0
0
1
1
0
N0 = in
Spring 2010
28
29
next state
outputs
Inputs
output
logic
next state
logic
Outputs
Next State
Current State
Spring 2010
30
output
logic
Inputs
Outputs
next state
logic
Next State
Current State
Next State
State
Clock 0
Spring 2010
5
31
Moore
inputs
combinational
logic for
next state
reg
logic for
outputs
outputs
state feedback
Mealy
inputs
logic for
outputs
combinational
logic for
next state
outputs
reg
state feedback
Spring 2010
state feedback
32
Spring 2010
33