Short notes

State Machine Short Notes

Designing a sequence detector that recognises the bit pattern 1011 in a serial data stream is the standard state machine problem in every university exam — the circuit watches one bit per clock cycle, holds its current state in D flip-flops, and asserts an output HIGH when the fourth matching bit arrives. That detector is a 4-state Mealy or 5-state Moore machine, and drawing its state diagram correctly before writing a single Boolean equation is what separates students who get full marks from those who don't.

EEE, ECE, EI

How it works

A Moore machine's output depends only on the present state, so it changes only on clock edges — output glitches are absent. A Mealy machine's output depends on both present state and current input, so it can respond one clock cycle faster but may produce short glitches when inputs change asynchronously. The design procedure goes: state diagram → state table → state assignment → next-state equations using K-maps → flip-flop excitation equations → logic diagram. For a 3-state machine, two D flip-flops are needed (since 2² = 4 ≥ 3), and unused states must be handled by forcing them into valid states via the excitation logic.

Key points to remember

Mealy machines generally need fewer states than equivalent Moore machines for the same sequence detection task. State minimisation using the implication table (or Paull-Unger method) reduces the number of flip-flops required. For the 1011 sequence detector, the Mealy version needs 4 states while Moore needs 5. One-hot encoding uses one flip-flop per state, simplifying next-state logic at the cost of more flip-flops. State assignment affects the complexity of combinational logic: adjacent Gray-code assignment minimises K-map groupings. Hazards in the combinational output logic of Mealy machines are eliminated by adding a D flip-flop at the output (effectively making it Moore).

Exam tip

The examiner always asks you to design a sequence detector for 1011 or 1010 as a complete problem — if you lose marks, it's usually in the K-map simplification step or the Mealy/Moore output column in the state table.

More Digital Electronics notes