Simuveliq

Finite state machine design

Fill in the state table of a Moore or Mealy machine and get the state diagram, the binary or Gray assignment, the excitation table for D, T, JK or SR flip-flops, the Karnaugh maps and the minimal equations, ready to build the circuit.

What you can do

Frequently asked questions

What is the difference between Moore and Mealy?

In Moore the output depends only on the state; in Mealy it depends on the state and the input.

Guide: designing state machines

A finite state machine describes a sequential circuit: at each clock edge it moves from one state to another depending on its inputs, and its outputs depend on the state. It is the systematic way to design sequence detectors, counters, traffic lights or controllers. This guide walks through the full method, from the state diagram to the flip-flop equations, with an example.

Moore and Mealy

The design method

  1. State diagram: what the machine must "remember", one state per distinct situation, and the transitions for each input value.
  2. State table: the diagram as a table: current state, input, next state and output.
  3. State assignment: a binary code for each state. N states need k = ⌈log₂ N⌉ flip-flops; unused codes are "don't care".
  4. Excitation table: which input each flip-flop needs to go from the current state to the next. With D flip-flops it is direct: D = Q⁺.
  5. Minimal equations: each flip-flop input and each output is simplified with its Karnaugh map.

Example: 101 sequence detector (Mealy, overlapping)

The output Z is 1 when 1, 0, 1 arrive in a row on input X. With overlap, the last 1 can start the next sequence: 10101 is detected twice.

  1. States: S0, nothing useful; S1, "1" received; S2, "10" received.
  2. Transitions:
    • S0: on 0 stays in S0; on 1 goes to S1.
    • S1: on 0 goes to S2; on 1 stays in S1, because that 1 may be a new start.
    • S2: on 0 goes back to S0; on 1 it has detected 101, so Z = 1 and it goes to S1, because that last 1 serves as a start.
  3. Codes: 3 states need 2 flip-flops (Q1 Q0): S0 = 00, S1 = 01, S2 = 10; code 11 is "don't care".
  4. Equations with D flip-flops: the machine goes to S1 (Q0⁺ = 1) whenever X = 1, so D0 = X. It goes to S2 (Q1⁺ = 1) only from S1 with X = 0, so D1 = Q0·X′. The output is 1 in S2 with X = 1: Z = Q1·X.

These are exactly the equations the tool derives for this example. The Moore version needs a fourth state, "101 detected", in which the output is 1.

How to use the tool

  1. Choose Moore or Mealy and the number of inputs, outputs and states.
  2. Fill in the state table: the next state for each input and the outputs (0, 1 or X).
  3. Choose the flip-flop type (D, T, JK or SR) and the state assignment (binary or Gray).
  4. Read the state diagram, the transition and excitation tables and the minimal equations. "Build the circuit in the simulator" assembles it with flip-flops, the minimal logic and a clock, so you can test it.

Common mistakes

Further reading

M. M. Mano and M. D. Ciletti, Digital Design (Pearson); J. F. Wakerly, Digital Design: Principles and Practices (Pearson). Simuveliq is not affiliated with these authors or publishers.

More tools

Versión en español

© 2026 Simuveliq. All rights reserved.