Skip to main content
  • Pricing
Tutorials

Verilog State Machines: State and Transitions

By Oakgen TeamPublished 1 min read

Share
Verilog State Machines: State and Transitions

A clocked finite-state machine has a register for its current state and logic for the next state. Decide what should happen for each combination of state and relevant inputs. Then decide which outputs depend on the current state and which depend on the inputs too.

Draw a small transition table

In a classroom example, reset puts a controller in Idle. In Idle, a start input makes the next state Active. When Active, a done input makes the next state Idle. For either state, leave it unchanged if its transition condition is absent.

Write a row for each of those four cases. Make reset behavior explicit and think about unexpected state encodings. In HDL, assign a default next state before conditional assignments so that every path of the combinational block gives a value.

Check the design at clock edges

In simulation, follow reset with an idle cycle. Assert start for an edge, remove it, then wait a cycle before asserting done. Compare the state after each edge against the transition table. That checks both staying Active and returning to Idle.

Keep the state names meaningful. Named states make the simulation trace readable and give the synthesis tool the chance to recognize the design as a state machine.

Continue with Oakgen Agent

Open in Oakgen Agent

Review the prefilled prompt before sending.

Open in Oakgen Agent

Sources

  1. Intel, Quartus Prime State Machine HDL Guidelines
Share