Cs316-Lec3 5
Cs316-Lec3 5
Prof. Sirer
CS 316
Cornell University
Finite State Machines
An electronic machine which has
external inputs
externally visible outputs
internal state
Output and next state depend on
inputs
current state
Designing an FSM
Draw a state diagram
Write down state transition table
Assign numbers to states
Determine logic equations for all flip-flops and
outputs
A Simple Example
S0 S1 S2 S3 S4
flip-flops
HELLObox: State Assignment 2
Assign bit
patterns to states Current Next Output
that would make State
the resulting State
device simple 0011101 0111110 00111
Here, we use far 0 0 01
more bits than
necessary 0111110 0010110 01111
to simplify the 0 0 10
combinatorial 0010110 0010110 00101
circuit
0 1 10
0010110 1110111 00101
HELLObox #2
o1o
o2 0
o
o4 3o6 15 bits of information
o5
(7 outputs + 8 bits of
combinational next state) are computed
circuit by the combinatorial
circuit
8 bits have non-trivial
logic equations
all 7 outputs are simple
pass-throughs
flip-flops
FSM: Serial Adder
Add two input bit streams
streams are sent with least-significant-bit (lsb) first
…10110
…00101
…01111
FSM: State Diagram
00/1
00/0 S0 S1 11/1
11/0
s s’
Q D
clk