Professional Documents
Culture Documents
State Machines
State Machines
State Machines
1
What Is a State Machine?
2
Figure1: Block Diagram of a Simple State Machine.
Figure2: State Machine, with Separate Output and Next State Decoders.
3
Using input signals for deciding the next state is also known as branching. In
addition to branching, complex sequencers provide the capability of repeating
sequences (looping) and subroutines. The transitions from one state to another
are called control sequencing and the logic required for deciding the next states
is called the transition function (Figure 2). The use of input signals in the
decision-making process for output generation determines the type of a state
machine.
Mealy and Moore. Moore state machine outputs are a function of the present
state only. In the more general Mealy-type state machines, the outputs are
functions of both the state and the input signals. The logic required is known as
the output function. For either type, the control sequencing depends upon both
states and input signals. Most practical state machines are synchronous
sequential circuits that rely on clock signals to trigger the state transitions. A
single clock is connected to all of the state and output edge-triggered flip-flops,
which allows a state change to occur on the rising edge of the clock.
Asynchronous state machines are also possible, which utilize the propagation
delay in combinatorial logic for the memory function of the state machine. Such
machines are highly susceptible to hazards, hard to design, and are seldom used.
In our discussion, we will focus solely on sequential state machines.
1. Moore machines
In automata theory, there are two basic types of finite-state machines (FSM).
One of those is called the Moore machine, named after its inventor Edward
Moore, who introduced the concept in 1956. Moore machines consist of states
4
and transitions. States can produce outputs, and the output is determined solely
by the current state, not by any input.
2. Mealy machines
5
Figure4: Mealy State Machines.
3. Harel statecharts
Although Mealy machines can already reduce the number of required states, for
complex systems such automatons get easily unmanageable.
UML state machines are based on the statechart notation introduced by David
Harel. Furthermore, the UML extends the notation of Harel statecharts by
6
object-oriented principles. Mapping this to our light switch example, in UML
we can model the possible actions of the light switch as a type with
operations turnOn(), turnOff(), setBrightness(value), and so on.
Advantages
Disadvantages
The following table illustrates the differences between the previously described
types at a glance:
7
References
2. Schäfer, Timm, Alexander Knapp, and Stephan Merz. "Model checking UML
state machines and collaborations." Electronic Notes in Theoretical Computer
Science 55.3 (2001): 357-369.