Skip to content
BetterDL

Next-state logic

Also called: next-state function, FSM next-state equations, next-state logic equations

The combinational gates in front of a state machine's flip-flops that compute the next state: one equation per flip-flop, from the present state bits and inputs.

Once each state has a code (state encoding), every state bit Qᵢ needs an equation for its next value Qᵢ⁺. These next-state equations, built from gates, form the next-state logic: the combinational heart of an FSM, sitting in front of the state register.

How to get them:

  1. Write the encoded state table as a truth table: inputs are the present-state bits and the machine inputs; outputs are the next-state bits.
  2. Mark rows for unused codes as don't-cares.
  3. Simplify each output column, for example with a karnaugh map.

With D flip-flops, D is the next value, so Dᵢ = Qᵢ⁺ and you're done. With T or JK flip-flops you'd translate through the excitation table instead.

The outputs get their own output equations the same way.

Counters use exactly the same method. The synchronous up counter's D1 = is a next-state equation.

Z
000000
001010
010000
011100
100001
101100
110001
111100

Worked example

Example

Equations for the Mealy 110 detector

Encode A = 00, B = 01, C = 10 (code 11 unused). Next states: A goes to A on 0, B on 1. B goes to A on 0, C on 1. C goes to A on 0 (output 1), C on 1. The table shows the final equations, with the don't-care rows filled in as they turned out.

  1. 1.

    D1 = 1 when the next state is C: from B with X = 1 (011) and from C with X = 1 (101). With the don't-care at 111: D1 = .

  2. 2.

    D0 = 1 when the next state is B: only from A with X = 1 (001). No don't-care helps: D0 = .

  3. 3.

    Z = 1 only in C with X = 0 (100). With the don't-care at 110: Z = .

  4. 4.

    Check from B (01) with X = 1: D1 = 0 + 1 = 1, D0 = 0 → 10 = C ✓.

  5. 5.

    Safety: from unused 11, X = 0 gives 00 and X = 1 gives 10. Both are real states, so no lock-up.

Common mistakes

  • Mixing up present and next values in the table. Inputs are the present-state bits; outputs are the next-state bits.

  • Forgetting to use unused codes as don't-cares, which makes the equations bigger than they need to be.

  • Using a D-flip-flop equation directly as a T or JK input. Those need the excitation table.

Practice Next-state logic

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Next-state logic is taught in Finite State Machines and Counters.