Finite State Machines: by Mike Chen
Finite State Machines: by Mike Chen
Finite State Machines: by Mike Chen
By Mike Chen
Finite State Machines
vs.
Combinational Logic Units
• Combinational logic units are a type of logic
circuit whose output is a pure function of the
present input only.
• Finite State Machines, used in sequential logic,
have outputs that depend on both the present
input as well as the history of the input.
A Finite State Machine
Curren
t State
State0 Next State / Output …. Next State / Output
State1 …. …. ….
…. …. …. ….
Staten …. …. ….
Representing a Finite State Machine
State0 State1
Input / Output
Example 1:
A Modulo-4 Synchronous Counter
Input / Output2Output1Output0
Present State = sn
Input = xn
Output = zn
Truth Table for the s1 s 2 x 1 x 0 s1 s 0 z 2 z 1 z 0
Vending Machine 0 0
1 0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
2 0 0 1 0 0 0 1 1 0
3 0 0 1 1 d d d d d
4 0 1 0 0 1 0 0 0 0
5 0 1 0 1 1 1 0 0 0
For the FSM circuit, we will need:
6 0 1 1 0 0 0 1 0 1
• Two D flip-flops to represent the two 7 0 1 1 1 d d d d d
state bits. 8 1 0 0 0 1 1 0 0 0
9 1 0 0 1 0 0 1 0 0
• PLA that takes four inputs (two for the
10 1 0 1 0 0 0 1 0 0
present state bits and two for the coin
bits) and has five outputs (two for the 11 1 0 1 1 0 0 1 1 1
next state bits and three for the dispense 12 1 1 0 0 d d d d d
and return bits). 13 1 1 0 1 0 0 1 1 0
14 1 1 1 0 1 1 1 1 1
15 1 1 1 1 d d d d d
Logic Design for the Vending Machine
x1 z2
x0 z1
5x5 z0
PLA
Assumes the clock input is asserted only
on an event such as the user inserting a
Q D coin into the machine.
s0
CLK
Q D
s1