Mealy and Moore Finite State Machines (FSMs)

Key Differences and Synthesis Implications

The text-book definition ...

The textbook definition is straightforward:

  • A Mealy Machine produces outputs based on both the current state and inputs.
  • A Moore Machine generates outputs solely based on the current state.

So how does this matter?

Let’s begin by examining the synthesis implications of these definitions.

  • A Moore Machine has sequential outputs, as they depend only on the state.
  • A Mealy Machine has combinatorial outputs, since they may rely on asynchronous inputs.

In FPGA design, a fundamental principle is that all inputs and outputs should be registered for stability. This naturally makes Moore Machines a more optimal choice for FPGA-based implementations.

As in every design, there are trade-offs. Let us explore these in more detail.

A Complete Comparison

  1. By definition, the outputs of a Moore Machine depends only on the current state of the the FSM, while the outputs of a Mealy Machine depend on the current state as well as inputs.
  2. Number of States -
    A Mealy Machine can generally be designed with lesser number of states than a Moore Machine.
  3. Mealy Machines generate asynchronous outputs, while Moore Machines always have synchronous outputs.
  4. Mealy Machines are generally faster, since the output is generated in the same clock cycle after a change in the input signals.
  5. Mealy Machines are more prone to glitches on the outputs, since they depend on input transition. Moore Machines, being synchronous, will generate an output transition synchronous with a clock edge.

Final Thoughts

To avoid glitches in a Mealy Machine, the outputs can be registered. Synchronous Mealy Machines are nothing but Moore Machines without the output state decoder.

One important consideration is FSM complexity. As state count increases, the number of required flip-flops grows, making state transition diagrams more intricate and debugging more challenging.

Given that FPGAs are register-rich, one-hot encoding is often preferred for FSM states. While alternative encoding schemes might reduce footprint, they trade resources for speed.

Subscribe to fpgadesign.io

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe