What is a state machine?
We’ve seen how we can use FFs to store values. Up until now, we’ve only used a counter to keep track of pushbutton events or counters to cycle through a seven-segment display to our counter value. What can we use if we have something more complex such as a calculator that needs to track the accumulator or a traffic light controller that cycles through a set series of events? The answer is a state machine. In general, a state machine takes in events and, based on the events, moves through a set of states that can produce one or more outputs.
A state machine can be quite simple or extremely complex. In the previous chapter, we designed a simple circuit to control our seven-segment display. The seven-segment controller contained two counters that cycled a zero through the cathodes and presented the anode data for each digit. We could have written a state machine to handle this; however, it was easier to write it the way we did.
Before we...