Designing a finite state machine from a word problem follows the same path every time:
- States in words. Write down what each state must remember. Decide Moore or Mealy.
- Transitions. For every state and every input value, choose the next state (and Mealy output). For detectors, use the suffix rule.
- State table. One row per state, so no arrow is missed. Merge any equivalent states.
- Encode. Give each state a bit pattern; note the unused codes.
- Equations. Derive one next state logic per flip-flop and an output equation per output, using unused codes as don't-cares.
- Build and check. Wire D flip-flops and gates, check that unused codes can't lock up, and trace a test input you've worked out by hand.
Each step needs the result of the one before, so the order matters. Skipping step 1 is the usual cause of tangled designs.
| Z | |||||
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |