Comparison

Mealy vs Moore State Machine

A vending machine controller that releases a can the instant it detects correct payment is a Mealy machine — output changes with input, not just with the clock. Change that to releasing the can one clock cycle after detecting payment and you have a Moore machine. Both implement the same behaviour, but the Mealy version typically needs fewer states, while the Moore version produces glitch-free, synchronous outputs — a distinction that shows up in nearly every FSM question in GATE and university papers.

EEE, ECE, EI

Side-by-side comparison

ParameterMealyMoore State Machine
Output Depends OnCurrent state AND current inputCurrent state only
Output TimingCombinational — can glitch with inputRegistered — changes only on clock edge
Number of StatesFewer states for same behaviourMore states (one state per output combination)
State DiagramOutput labelled on transition arcsOutput labelled inside state circles
Response SpeedFaster — responds in same clock cycleSlower — one clock cycle latency
Glitch RiskHigher — output can glitch on input noiseLower — output stable between clock edges
Hardware ComplexitySlightly simpler — fewer flip-flopsSlightly more complex — extra states
Implementation in HDLTwo always blocks (state, output)Three always blocks or Moore-explicit coding
GATE/Exam FrequencyHigh — minimum state questionsHigh — output timing and Moore diagram
Real ExampleSerial bit pattern detector (overlapping)Traffic light controller

Key differences

The key distinction: Mealy outputs fire immediately when inputs change, even between clock edges, so a noisy input line can generate spurious outputs — a real problem in 3.3 V FPGA I/O without input synchronisers. Moore outputs change only at the clock edge, adding one cycle of latency but eliminating glitches. For the same sequence detector, a Mealy machine typically needs n states where Moore needs n+1. In Verilog, a Moore machine uses three always blocks; Mealy can be done in two.

When to use Mealy

Use a Mealy machine when response speed within the same clock cycle is critical, such as a serial 1-of-N pattern detector on a fast data link where overlapping sequences must be detected without losing a cycle.

When to use Moore State Machine

Use a Moore machine when output stability is paramount, such as a traffic light controller where the light must hold its colour for a full clock period without any combinational glitches affecting pedestrian signals.

Recommendation

For GATE and university exams, choose the Moore machine when the question asks for glitch-free outputs. Choose Mealy when minimising state count — the question usually specifies which to use, but when it does not, state your assumption explicitly.

Exam tip: GATE regularly tests minimum state reduction for sequence detectors — draw the Mealy diagram first, minimise states using implication chart, then convert to Moore by splitting states if required.

Interview tip: Interviewers at VLSI and FPGA companies expect you to code both machines in Verilog; be ready to write the two-always-block Mealy template from memory and explain why Moore avoids output glitches.

More Digital Electronics comparisons