Difference Between Mealy and Moore Machine

Both Mealy and Moore Machines accept the regular languages and provide the output. Before proceeding to the key difference between Mealy and Moore machines, let’s look at the basic definition of the Mealy and Moore machines which helps us to understand all the key differences in the Mealy and Moore machines

  • Moore Machine: The output depends only on the current state; the input changes the current state to the next state, and then the output is produced.
  • Mealy Machine: The output depends on both the current state and the input, so the output is produced immediately during the transition to the next state.

The following Diagram Shows the key difference between Mealy and Moore machine which will be discussed later in the lecture

Difference Between Mealy and Moore Machine - Key Points

Key Differences Between Mealy and Moore Machines

Let’s explain all the major key differences between Mealy and Moore’s machine. A detailed description is given below

1. Transition Labels

Moving from one state to another state using an arrow is called a transition, and the value attached to the arrow is called a transition label.

  • In a Mealy Machine, the transition label contains the input with the output represented as input/output (i.e., 1/a) or input, output (i.e., 1, a).
  • In Moore Machine, the transition label contains only the input.  Output remains inside the states instead of over the transition.

The descriptive diagram of transition labels in the Moore and Mealy machines is given below

Difference Between Mealy and Moore Machine - Transition Labels

  • Transition Labels in Mealy: 0/a, 1/b
  • Transition Labels in Moore: 0, 1

2. Input to Output Behaviour of any State

When input is given to any state in Moore and Mealy, then the output behaviour may different. Let’s explain

Case 01: When various inputs produce the Same output

In the following diagram, when inputs 0 and 1 produce the same output a,
• In Mealy, output a is written on both transitions
• In Moore, output a is written once on the state

Difference Between Mealy and Moore Machine - Case 01- Various Inputs Produce Same Output

Case 02: When various inputs produce different outputs

In the following diagram, when inputs 0 and 1 produce different outputs “a” and “b” respectively

Difference Between Mealy and Moore Machine - Case 02- Various Inputs Produce Different Output

Note: both the Mealy and Moore machines are equivalent in functionality

3. Output Function

In Mealy Machine Output Function (λ ) is

λ : Q × Σ → O

Where,

  • Qis current state
  • Σ is current input symbol
  • O isresulting output symbol

So, in a Mealy machine, the output is calculated during transitions, based on the current state and input.

In Moore Machine Output Function (λ) is

λ : Q → O

where,

  • Q is current state
  • O isresulting output symbol

 So, in a Moore machine, the output is tied to each state and remains constant while in that state, regardless of the input.

4. Output Dependency  

In a Mealy machine,

  • Output depends on both the current state and the current input.
  • Output can change immediately when the input changes, even without a state change.

In a Moore machine,

The output depends only on the current state, regardless of the input. It changes only when the machine moves to a new state.

5. Output Length 

The output length of a Mealy Machine equals the input length.

Mealy Machine Output length = input length

Look at the following diagram, when the input length is four, which is “1101”, and the output length is also four, which is “CBAC”.

Difference Between Mealy and Moore Machine - Mealy Machine- Input and Output Length is Same

The output length of a Moore Machine is equal to the input length plus one.

Moore Machine Output length = input length + 1

Reason: In a Moore machine, each state holds an output, and the machine enters the start state before any input is read. Since the output is based only on the state (not on the input), the machine produces the first output immediately, without consuming any input.

Look at the following diagram, when the input length is four, which is “1101”, and the output length is five, which is “CCBAC”.

Difference Between Mealy and Moore Machine - Moore Machine- Input and Output Length is Different

Important: In many cases, application designers align the output length of a Moore machine with its input length by ignoring or discarding the first output in practical applications.

6. Number of States After Conversions

When converting between Mealy and Moore machines, the number of states may change, which depends on the direction of conversion.

Case 01: Mealy to Moore Conversion

After converting Mealy to a Moore machine the number of states is according to the following formula

Minimum number of Moore states ≥ number of Mealy states

Example: Consider the following Mealy Machine

Difference Between Mealy and Moore Machine - Mealy Machine

After Mealy to Moore conversion, the result is given in following diagram

Difference Between Mealy and Moore Machine - Mealy to Moore Conversion - States may Increased

Moore to Mealy Conversion

In a Moore machine, each state has a fixed output. When converting Moore to Mealy machine, we can merge multiple Moore states into one if their transitions lead to the same output behavior.

Example: Moore Machine

Difference Between Mealy and Moore Machine - Moore Machine

After the Moore to Mealy conversion, the result is given in the following diagram

Difference Between Mealy and Moore Machine - Moore to Mealy Conversion- No chance to Increase States

7. Number of States for Equivalent Functionality

To implement the same functionality, a Moore machine usually requires more states than a Mealy machine.

  • Mealy Machine can change output on transitions, so it can handle multiple output behaviors within a single state.

  • Moore Machine produces output only on states, so for every unique output, a separate state is needed. Therefore, a Moore machine may need to split a single Mealy state into multiple states, each with different outputs.

The following figure explains how the number of states can be changed in Moore and Mealy for equivalent functionality.

Example 01: First complement in Moore and Mealy Machine

Difference Between Mealy and Moore Machine - Example

Example 02:

Difference Between Mealy and Moore Machine - Number of States for Equivalent Functionality

8. Output Synchronization

Synchronization makes sure outputs and transitions follow the clock cycle, avoiding mid-cycle changes or instability.

One clock cycle completes when

  • The system reads the current input,
  • Processes the transition (based on current state and input),
  • Moves to the next state
  • And produces the output

Moore Machine  (One Clock Cycle Working)

I) At the start of the clock cycle:

  • The machine is in a current state.

  • It outputs the value associated with that state.

II) During the clock cycle:

  • It reads the input, decides the next state.

 III) At the rising edge of the clock:

  • The machine transitions to the next state.

  • New output appears in the next cycle (from the new state).

Output is updated only at the end of the cycle, after the state change.

Mealy Machine (One Clock Cycle Working)

I). At the start of the clock cycle:

  • The machine is in its current state.

  • It reads the input immediately.

II). During the same cycle:

  • It calculates the next state.

  • It generates the output based on the current input and state.

III). At the clock edge:

  • The machine moves to the next state, ready for the next input.

Output is generated instantly within the cycle, not delayed to the next.

Result:

  • In a Moore machine, output changes only on state transitions at clock edges, making the output naturally synchronized with the clock.

  • In a Mealy machine, output can change anytime the input changes, causing outputs to be asynchronous and potentially unsynchronized with the clock.

9. Responsiveness

A machine that provides output immediately is considered more responsive. A Mealy machine is more responsive than a Moore machine

Reason:

In Mealy, as the machine reads the input, it immediately provides the output because the transition label shows the relation of input to output.

Difference Between Mealy and Moore Machine - Mealy Machine Example

In Moore, as the machine reads the input at current state, it first goes to the next state and then provides the output. So output appeared with a step delay as compared to the Mealy Machine.

Difference Between Mealy and Moore Machine - Moore Machine Example

Note: State to state may be same or different states

10. Machine Design Complexity

When comparing Mealy and Moore machines, the design complexity primarily depends on how outputs are generated from states and inputs.

  • Mealy machines are generally less complex to design because they require fewer states—outputs depend on both state and input, so multiple output behaviors can be handled within a single state.

  • Moore machines tend to be more complex with more states, since each state must represent a unique output regardless of input, increasing the number of states needed.

The following figure explains the complexity of designing Moore and Mealy machines

Difference Between Mealy and Moore Machine - Machine Design Complexity

11. Clock Cycle in Circuit

In Mealy Machine, During the clock cycle if input changes the output is also changes

Difference Between Mealy and Moore Machine - Mealy Machine Clock Cycle

In Moore Machine, during the clock cycle if input changes then output changes at the active edge of the next clock cycle

Difference Between Mealy and Moore Machine - Moore Machine Clock Cycle

12. Hardware Requirement

  • Mealy machine needs fewer number of states, So Less hardware is required.
  • Moore machine requires more states, so more hardware is required.

Summary Table: Difference Between Mealy and Moore Machine

Key Point Mealy Machine Moore Machine
State Diagram Labels Transitions are labeled with both input and output. Transitions are labeled with input only and output is associated with states.
Input and Output String Length  If the length of the input string is “N”, then the length of the output string is also “N” If the length of the input string is “N”, then the length of the output string is “N+1”.
Output Function  ‘λ’ is the output function which maps Q×∑→ O. Where Q is state, and O is output. λ is the output function which maps Q → O. Where Q is state, and O is output.
Output Dependency   Output in Mealy Machine is placed in each transition. That’s why it depends on the present state as well as the present input. So, If input changes, output also changes because output depends on State and input.  Output in Moore Machine is placed within each state. That’s why it depends only on the current state. So, If input changes, output does not change because output depends on only State. 
Output States after conversions    The number of states can increase after conversion from Mealy to Moore machine. After conversion from Moore to Mealy machine, state numbers always decrease.
Output synchronization   Output is not synchronized with the clock. Mealy Machines react faster to inputs. Output is synchronized with the clock. Moore Machines react slower to inputs (1 clock cycle later). 
Responsiveness: More responsive to inputs since the output can change as soon as the input does. Less immediate response; outputs change only when the state changes.
Number of States for Equivalent Functionality: Often requires fewer states than Moore to achieve the same function. May require more states to represent different outputs for the same set of inputs.
Machine Designing It is more complex to design due to the direct input-output relationship. It is less complex in design because outputs are fixed per state.

"Your Support, Our Priority"

"We Make It Easy"