Skip to content
BetterDL

Mealy-to-Moore conversion

Also called: converting Mealy to Moore, Mealy to Moore

Turning a Mealy machine into a Moore machine with the same behavior, by splitting each state according to the outputs on the arrows that enter it.

Any mealy machine can be rebuilt as a moore machine that produces the same output sequence, apart from timing. The problem to solve: a Mealy state can be entered by arrows with different outputs (some x/0, some x/1), but a Moore state needs one fixed output.

The method:

  1. For each state, look at the outputs on the arrows entering it.
  2. If they all carry the same output, keep the state and give it that output.
  3. If they carry different outputs, split the state into one copy per output value. Each copy gets its own fixed output.
  4. Point each incoming arrow at the copy that matches its output. Give every copy the same outgoing arrows as the original.

The Moore machine usually has more states, and its output appears one clock cycle later, because it now has to move into a state before showing the result. Going the other way, Moore to Mealy, is easier: move each state's output onto the arrows that enter it.

start01010101A00B0C0A11

Worked example

Example

Converting the Mealy 110 detector

Mealy: A: 0/0 → A, 1/0 → B. B: 0/0 → A, 1/0 → C. C: 0/1 → A, 1/0 → C.

  1. 1.

    Arrows into A carry 0 (from A and B) and 1 (from C). Split A into A0 (output 0) and A1 (output 1).

  2. 2.

    Arrows into B and C all carry 0, so they stay as single states with output 0.

  3. 3.

    Redirect: A on 0 and B on 0 go to A0; C on 0 goes to A1.

  4. 4.

    A0 and A1 both copy A's outgoing arrows: 0 → A0, 1 → B.

  5. 5.

    Result (the diagram): 4 Moore states. A1 means "just saw 110", the extra match state a Moore detector always needs.

Common mistakes

  • Splitting by the outputs on the arrows leaving a state. It's the incoming arrows that decide the split.

  • Forgetting to copy the outgoing arrows to every copy of a split state.

  • Expecting the converted machine's output at the same moment. It shows up one cycle later.

Practice Mealy-to-Moore conversion

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Mealy-to-Moore conversion is taught in Finite State Machines.