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
State Machine Function | Firmware Implementation | Hardware Implementation |
---|---|---|
State | Variables | Flip-Flops |
Next-State Function | Written code for logic | Discrete logic elements (such as gates and look-up tables |
Output Function | Written code for logic | Discrete logic elements (such as gates and look-up tables |
State Time | Software or hardware counters | Hardware timer/counters |