Home / Learn Verilog / Finite State Machines: The Big Idea

Finite State Machines: The Big Idea

A circuit that moves between a fixed set of states.

Bottom lineA circuit that moves between a fixed set of states.

Breaking it down

Door controllerbuttondonetimeoutCLOSEDOPENINGOPEN
Door controller

The basic idea

An FSM has a state register, next-state logic and output logic. On each clock it moves to a new state based on inputs.

Why this comes up

Every controller, protocol and sequencer is an FSM.

The mechanics

Draw the state diagram first, then code: state register, next-state case, outputs.

Where it is used

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

Smallest FSM: a two-state toggleVerilog: edit and run

The state register changes only at clock edges.

Quick check

1. An FSM has...