Skip to content
BetterDL

Unused states

Also called: unused codes, unused state, invalid states, illegal states

Bit patterns that a counter's or state machine's flip-flops can hold but never visit in normal operation, such as 1010 to 1111 in a BCD counter.

n flip-flops can hold 2ⁿ patterns. A machine with N states uses only N of them, so 2ⁿ − N codes are unused.

Unused states matter twice in a design:

  1. They make the logic smaller. In normal operation the machine never sits in an unused code, so its next state doesn't matter. Mark those rows as don't-cares and the K-maps can make bigger groups.
  2. They can still happen. At power-up, or after electrical noise, the flip-flops may land in any pattern. Once the equations are chosen, every don't-care has become a real 0 or 1, so every unused code now goes somewhere. Check where.

If every unused code leads back into the main sequence, the design is self-starting. If some unused code loops among unused codes forever, it has a lock up state.

Worked examples

Example

Designing a mod-5 counter with don't-cares

A mod-5 counter runs 000 → 001 → 010 → 011 → 100 → 000 with D flip-flops. Codes 5, 6 and 7 are unused, so they are don't-cares. The K-map shows D1 = Q1⁺.

Q2\Q1Q000011110
0
0m0
1m1
0m3
1m2
1
0m4
Xm5
Xm7
Xm6
  1. 1.

    D2 is 1 only from 011 (to 100). Group 3 with don't-care 7: D2 = .

  2. 2.

    D1 is 1 from 001 and 010. Pair 1 with 5 and 2 with 6: D1 = = .

  3. 3.

    D0 is 1 from 000 and 010. They pair as ; no don't-care helps further. D0 = .

  4. 4.

    Without the don't-cares, D2 would need : the unused codes saved a literal.

Example

Where do the unused codes go?

Substitute each unused code into the equations from the first example.

  1. 1.

    101: D2 = 0·1 = 0, D1 = 0 ⊕ 1 = 1, D0 = 0·0 = 0 → 010, a real state.

  2. 2.

    110: D2 = 1·0 = 0, D1 = 1 ⊕ 0 = 1, D0 = 0·1 = 0 → 010, a real state.

  3. 3.

    111: D2 = 1·1 = 1, D1 = 1 ⊕ 1 = 0, D0 = 0 → 100, a real state.

  4. 4.

    All three rejoin the count within one edge, so this counter is self-starting.

Common mistakes

  • Thinking unused states can never occur. Power-up and noise can put the flip-flops in any pattern.

  • Forgetting that don't-cares become fixed values once you choose the equations. Check the unused codes against the final equations, not the table.

  • Counting unused states as 2ⁿ − N − 1. With N states and n flip-flops it's exactly 2ⁿ − N.

Practice Unused states

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

Learn it step by step

Unused states is taught in Counters and Finite State Machines.