Finite State Machines (FSMs)

Finite State Machines are the heart of control logic in digital systems. In VHDL, FSMs are typically implemented using a combination of an enumeration type and one or more processes.

Types of FSMs

  1. Moore Machine: The outputs depend only on the current state.

  2. Mealy Machine: The outputs depend on both the current state and the current inputs.

One-Process Style

Alternatively, you can implement the entire FSM in a single sequential process. This can be more compact but sometimes makes output timing (e.g., registered outputs) harder to visualize.

FSM Encoding

Synthesis tools can automatically choose the best encoding (Binary, One-hot, Gray) for your FSM. You can often provide hints to the compiler using attributes like fsm_encoding.

Best Practices

  • Use enumeration types for state names rather than constants/integers for better readability and debugging.

  • Always handle the `when others` case in a case statement, even if you think you’ve covered all states.

  • Keep output logic simple to avoid long combinational paths.

Next, we will cover Testbenches and Simulation.

Credits

Maintained and authored by Agus L. Setiawan. For more FPGA guides, visit Technolati.com.