1.2 Methods for Implementing State Machine

There are multiple ways to implement state machines. State machines can be implemented in firmware, hardware, or a combination of both. Each method of implementation has its pros and cons.

To understand the various methods of implementation, let’s refer back to the General State Machine block diagram. There are four aspects to any state machine that need to be implemented:
  • State of the Machine
  • Next-State Function
  • Output Function
  • State Time
These aspects of a state machine can be implemented using firmware or hardware. The following sections provide a detailed explanation of each implementation method, while Table 1-2 summarizes the differences between them.
Table 1-2. Summary of Firmware and Hardware-based State Machines
State Machine FunctionFirmware ImplementationHardware Implementation
StateVariablesFlip-Flops
Next-State FunctionWritten code for logicDiscrete logic elements (such as gates and look-up tables
Output FunctionWritten code for logicDiscrete logic elements (such as gates and look-up tables
State TimeSoftware or hardware countersHardware timer/counters