How to convert the Moore machine to the Mealy machine

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.

Conversion techniques

There are two techniques to convert these machines:

  • By transition diagram

  • By transition table

Let's take examples of both of these techniques.

By transition diagram

The steps involved in this method are:

  1. To redraw the original states without the output. The starting state remains the same.

  2. Draw the transitions as they are on the original machine.

  3. Add output to the transitions based on their destination's output symbol in the original machine.

Example

Let's take a simple Moore machine:

g ENTRY q0/a q0/a ENTRY->q0/a q0/a->q0/a 0 q1/b q1/b q0/a->q1/b 1 q1/b->q0/a 1 q2/a q2/a q1/b->q2/a 0 q2/a->q0/a 0 q2/a->q1/b 1
An example Moore machine
  1. We redraw the states without the output:

g q0 q0 q1 q1 q2 q2
Step 1: Redraw the states
  1. Draw transitions:

g ENTRY q0 q0 ENTRY->q0 q0->q0 0 q1 q1 q0->q1 1 q1->q0 1 q2 q2 q1->q2 0 q2->q0 0 q2->q1 1
Step 2: Add transitions
  1. Now we add output to the transitions based on the transition's destination:

g ENTRY q0 q0 ENTRY->q0 q0->q0 0 / a q1 q1 q0->q1 1 / b q1->q0 1 / a q2 q2 q1->q2 0 / a q2->q0 0 / a q2->q1 1 / b
Step 3 : Add output to transitions. This is the final Mealy machine.

For example, the output of the transition q0q1q_0 \to q_1 is bb, because the transition lands on q1q_1 which had an output bb in the original Moore machine.

The transformed machine above is our final Mealy machine.

By transition table

The steps involved in this method are:

  1. To rewrite the table, excluding the output column.

  2. 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.

Example

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

  1. 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

  1. 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 q0q_0, the destination state for 11 is q1q_1. As a result, we see that the output against q1q_1 in the original table is bb, so the output here will also become bb.

This is the final transition table of the Mealy machine.

Conclusion

While transforming a Moore machine having nn states and mm outputs, there can be at most nn states in the Mealy machine.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved