Lecture32 FSM
Lecture32 FSM
18B11EC215
Lecture 32
Introduction to State Machines
1
Outline
Introduction to FSM
Finite State Machine
Types of FSMs
State Diagram
State Table
State Reduction
State Assignment
Transition and Output Table
2
References
Introduction[1-3]
State machine is an important area of digital system design.
3
Finite State Machine[2]
A FSM is an abstract model describing the synchronous sequential
machine.
5
Types of FSMs
FSMs are generally of two types:
1.MEALY Machine: MEALY circuits are named after G. H,
Mealy, one of the leading scientists in designing digital systems.
The basic property of Mealy circuits is that the output is a
function of the present input conditions and the present state (PS)
of the circuit.
6
Block Diagram of Mealy
Machine
CLOCK
In case of a Mealy model, the next state is a function of the present/current
state and the present inputs.
Its output is also a function of the present/current state and the present
inputs.
7
Block Diagram of Moore
Machine [1]
Inputs Next Excitation State
Output
State Memory
Current Logic Outputs
Logic (F/F)
State
CLOCK
In case of a Moore model, the next state is a function of the present/current
state and the present inputs.
Its output is a function of the present state and are independent of the inputs.
8
Comparison between
Moore and Mealy
Mealy Machine Machine
Moore Machine
Output depends on present input Output depends only on the
and present state of the circuit. present state of the circuit.
Require more number of states
Require less number of states.
than Mealy machine.
Asynchronous output generation,
Both output and state change
though the state change is
synchronous to the clock edge.
synchronous to the clock.
Faster, the output is generated on The output is generally produced
the same clock cycle. in the next clock cycle.
Glitches can be generated as
Safer to use, because they change
output change depends on input
states on the clock edge.
transition.
9
State Diagram[2]
The state diagram or state graph is a pictorial representation of
the relationships between the present state, the input, the next
state, and the output of the sequential circuit.
10
The figure on next slide shows the state diagram of a Mealy
Circuit.
The state is represented by a circle also called the node or
vertex and the transition between states is indicated by
directed lines connecting the circles.
A directed line connecting a circle with itself indicates that the
next state is same as the present state.
The binary number inside each circle identifies the state
represented by the circle.
The directed lines are labelled with two binary numbers
separated by a symbol /.
The input value that causes state transition is labelled first and
the output value that occurs when this input is applied during
the present state is labelled after the symbol /. 11
State Diagram using
Mealy Machine[2]
12
In the case of a Moore circuit , the directed lines are labelled
with only one binary number representing the input that causes
the state transition.
The output is indicated within the circle below the present
state, because the output depends only on the present state and
not on the input.
The figure on next slide shows the state diagram of a Moore
Circuit.
13
State Diagram using
Moore Machine[2]
14
State Table[2]
Even though the behavior of a sequential circuit can be
conveniently described using a state diagram, for its
implementation the information contained in the state diagram
is to be translated into a state table.
The state table is a tabular representation of the state diagram.
In the next slide, state table(b) is shown for the corresponding
state diagram(a).
The present state designates the state of the flip-flops before
the application of the clock pulse.
The next state is the state of the flip-flops after the application
of the clock pulse and the output section gives the value of
output variables during the present state.
15
State Table and State
Diagram of Mealy
Circuit[2]
16
State Table and State
Diagram
Both the state diagram and the state table contain the same
information and the choice between the two representations is
a matter of convenience.
17
State Table and State
Diagram of Moore
Circuit[2]
18
State Table and State
Diagram
In the previous slide, the state diagram and the state table of a
Moore circuit is shown.
The next state of the machine indicates the next outputs of the
flip-flops that will be obtained when the present inputs are
applied to the machine in the present state.
19
State Reduction[2]
The state reduction technique avoids the introduction of
redundant states.
21
As evident from the state diagram, the states are represented
by letter symbols instead of their binary values because in
state reduction technique, the binary designation of states is
not important, but the input-output sequence is important.
STEP 1: Determine the state table for the given state diagram.
22
STEP 1 : State Table
23
As we know, in equivalent states, every possible set of inputs
generate exactly the same output and the same next state.
From the state table, we have observed that there are two
input combinations i.e. X=0 and X=1.
From the table, we can observe that states a and c are
equivalent, as both go to states b and d and have outputs 0 and
1 for X=0 and X=1 respectively.
Also, states b and e are equivalent as both go to states e and f
and have outputs 0 and 1 for X=0 and X=1 respectively.
State c can be removed as replaced by a. Similarly, state e can
be removed and replaced by b.
Final reduced state table and state diagram(only four states) is
shown in the next slide 24
Reduced State Table and
State Diagram [2]
25
State Assignment[2]
The process of assigning binary values to the states of the sequential
machine is known as state assignment.
The binary values are to be assigned to the states in such a way that
it is possible to implement flip-flop input functions using minimum
logic gates.
The output values of the physical devices are referred to as state
variables.
Rules for state assignment:
Rule 1: States having the same NEXT STATE for a given input
condition should have assignments which can be grouped into
logically adjacent cells in a K-map.
Rule 2: States that are the next states of a single state should have
assignments which can be grouped into logically adjacent cells in a
K-map.
26
Transition and Output
Table[2]
The transition and output table can be obtained from the state
table by modifying the entries of the state table to correspond to
the states of the machine in accordance with the selected state
assignment.
In this table, the next state and output entries are separated into
two sections.
The entries of the next state part of this table defines the
necessary state transitions of the machine and thus, specify the
next values of the outputs of the flip-flops used.
The next part of the state table is called the transition table.
The output part of the table indicates the output of the sequential
machine for various input combinations applied to the machine,
which is in the present state.
27
Example[2]
Obtain a reduced state table and reduced state diagram for the
sequential machine whose state diagram is :
28
From the state diagram , state table can be formed, which is as
shown below:
29
It can be observed from the state table that states c and d are
equivalent.
So, state d can be removed and d is replaced by c at other
places also.
Reduced state table and state diagram are shown in the next
slide.
30
Reduced State Table and
State Diagram[2]
31
References
[1] R. P. Jain, “Modern Digital Electronics,” 4th Edition, Tata
McGraw-Hill Education, 2009.
32