Sie sind auf Seite 1von 14

Finite State Machines

Finite state machine - block diagram


PREVIOUS STATE

STATE MEMORY
SET
D Q
OUTPUTS
NEXT CLR Q
NEXT STATE STATE OUTPUT LOGIC

...
INPUTS LOGIC
SET
D Q

CLR Q

CLK

• State memory: Set of n flip-flops that hold the state of the machine (up to 2^n
distinct states)
• Next state logic: Combinational circuit that determines the next state as a function
of the current state and the input
• Output logic: Combinational circuit that determines the output as a function of the
current state and the input
Finite State Machine - Types
PREVIOUS STATE

• Mealy machine: The output STATE MEMORY


D
SET
Q
OUTPUTS
depends on the current state and COMBINATIONAL
NEXT
STATE
CLR Q
OUTPUT LOGIC

...
INPUTS LOGIC

input D
SET

CLR
Q

CLK

• Moore machine: The output PREVIOUS STATE

depends only on the current state STATE MEMORY


D
SET
Q
OUTPUTS
NEXT CLR Q
COMBINATIONAL STATE OUTPUT LOGIC

...
INPUTS LOGIC
SET
D Q

CLR Q

CLK
State diagram
A state diagram represents the states as circles and the transitions between them as arrows annotated
with inputs and outputs

1/0
0/0
0/1
00 10

0/1
1/0 0/1 1/0

1/0
01 11
Sequential Circuit Design using FSM
• Understand specifications
• Draw state graph (to describe state machine behavior)
• Construct state table (from state graph)
• Perform state minimization (if necessary)
• Encode states (i.e., state assignment)
• Create state-assigned table
• Select type of Flip-Flop to use
• Determine Flip-Flop input equations and FSM output equation(s)
• Draw logic diagram

5
Example: A sequence detector (Mealy)
To illustrate the design of a clocked Mealy sequential circuit, we will design
a sequence detector.
The circuit is of the form:

serial bit stream (input)


output (serial bit stream)

6
Example: A sequence detector (Mealy)

Suppose we want to design the sequence detector so that any input


sequence ending in 101 will produce an output of Z = 1 coincident with the
last 1. The circuit does not reset when a 1 output occurs.

A typical input sequence and the corresponding output sequence are:

X= 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0
Z= 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0
(time: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)

7
Example: A sequence detector (Mealy)
Initially, we do not know how many flip-flops will be required, so we will
designate the circuit states as S0, S1, etc.

We will start with a reset state designated S0.

If a 0 input is received, the circuit can stay in S0 because the input sequence we
are looking for does not start with a 0.

8
Example: A sequence detector (Mealy)

State Graph for the Mealy Machine

9
Example: A sequence detector (Mealy)
We can then convert our state graph to a state table:

Since there are 3 states, we only need 2 flip-flops


for the circuit.

10
Example: A sequence detector (Mealy)
And then convert our state table to a transition table:

From the transition table, we can plot the


next-state maps for the flip-flops and the
map for the output function Z with respect to
the present state and the input X.

11
Example: A sequence detector (Mealy)
Using the derived equations, we can then draw the corresponding circuit diagram

12
Example: A sequence detector (Moore)
The procedure for finding the state graph for a Moore machine is similar to that used for a Mealy
machine, except that the output is written with the state.

We will rework the previous example as a Moore machine: the circuit should produce an output of 1
only if an input sequence ending in 101 has occurred.

State Graph for the Moore Machine


13
Example: A sequence detector (Moore)
As with the Mealy machine, the state and transition tables can be derived from the state
graph:

Das könnte Ihnen auch gefallen