Moore machines can be converted to Mealy machines with a few simple steps. We know that Mealy machines are faster, so we may want to convert our Moore machine to a Mealy machine.
Note: You can learn more about Moore machines and Mealy machines.
There are two techniques to convert these machines:
By transition diagram
By transition table
Let's take examples of both of these techniques.
The steps involved in this method are:
To redraw the original states without the output. The starting state remains the same.
Draw the transitions as they are on the original machine.
Add output to the transitions based on their destination's output symbol in the original machine.
Let's take a simple Moore machine:
We redraw the states without the output:
Draw transitions:
Now we add output to the transitions based on the transition's destination:
For example, the output of the transition
The transformed machine above is our final Mealy machine.
The steps involved in this method are:
To rewrite the table, excluding the output column.
To add the output to the destination columns adjacent to the destination state. The output will be according to the output of the destination state in the Moore machine transition table.
Let's take the transition table of the previous example is:
Current State | Destination State for 0 | Destination State for 1 | Output |
q0 | q0 | q1 | a |
q1 | q2 | q0 | b |
q2 | q0 | q1 | a |
We will rewrite the table above without the output table:
Current State | Destination State for 0 | Destination State for 1 |
q0 | q0 | q1 |
q1 | q2 | q0 |
q2 | q0 | q1 |
Now, we'll add the output symbols to the destination symbols by looking at the original table:
Current State | Destination State and output for 0 | Destination State and output for 1 |
q0 | q0, a | q1, b |
q1 | q2, a | q0, a |
q2 | q0, a | q1, b |
For example, for
This is the final transition table of the Mealy machine.
While transforming a Moore machine having
Free Resources