What is a Mealy machine?
Overview
A Mealy machine is a finite state machine that has an output value rather than a final state. For a given input, the machine generates a corresponding output. The output of the Mealy machine depends on the present state of the FA as well as the current input symbol.
Unlike other finite automata that determine the acceptance of a particular string in a given language, Mealy machines determine the output against the given input.
Formal theorem
The Mealy machine is a 6 tuple machine
Note: The output function means that for every transition at a particular state, there is a corresponding output associated with it.
Formation of the machine
The Mealy machine forms an FA of the type:
In the machine above, the transition on input
Note: If the input string is of length
, the output produced by a Mealy machine will also be of length .
Example
Suppose we have the following Mealy machine:
Now, we take an input string in
Transitions Explanation
- The first input character is
. Hence, we move to and output a . Our output string is .
- For the next
, we move to , which outputs an . The output string becomes .
- The next
gives another . The output string becomes .
- The last
takes us to and produces a . The final output string is .
Transition table
The transition table for the above machine will be:
Current State | Destination State for 0 | Output at 0 | Destination State for 1 | Output at 1 |
q0 | q1 | b | q0 | a |
q1 | q0 | a | q1 | b |
The Mealy machine is faster than the Moore machine as it is asynchronous to the fluctuations of a clock pulse.
Note: If you want to know about the Moore machine, click here.
Free Resources