Computing Library › Digital Logic & Circuits
Digital Logic & Circuits

Mealy Machine

In a Mealy machine the outputs depend on both the current state and the current inputs, reacting faster but risking glitches.

What it is

A Mealy machine is a finite state machine whose outputs depend on the current state and the current inputs together. Outputs are labeled on the transition arrows, not the states, because they can change as soon as the input changes.

Faster reaction

Kronos motion — lego machine

Because an input can affect the output within the same clock cycle, a Mealy machine responds one cycle sooner than an equivalent Moore machine. This lower latency is its main advantage.

Fewer states

Mealy machines usually need fewer states, since a single state can produce different outputs for different inputs. This can make the state register smaller and the diagram more compact.

The glitch risk

Because outputs follow inputs directly through combinational logic, they can change at any time during a clock cycle and may glitch if inputs are not clean. Outputs that feed other synchronous logic often need to be registered to remove this hazard, which reintroduces a cycle of delay.

When to choose it

Prefer Mealy when reaction speed or state count matters and when the outputs will be sampled at clean moments or registered. Many real designs mix both styles, using whichever suits each output.