SCLA076 December 2024 TPLD1202 , TPLD1202-Q1
State machines in relation to hardware can often be divided into one of two main categories, an asynchronous state machine (ASM) or a synchronous state machine (SSM).
An ASM is a style of state machine that can transition between the states without a clock being present. Benefits of this style of state machine are the device can transition at any given time, and no clock is needed to be running and consuming power when the state machine is running. A downside of this state machine is that you cannot have two consecutive states tied to the same transition flag. An example of an ASM is a simple AND gate as seen in Figure 2-1. In this ASM A, B, and VCC are inputs into the device, and there is one output. The device powers on and remains in an idle state until the device sees one of the primary inputs go high. At this point the SM transitions into a half state where the output does not change. Once the other input goes high the SM transitions into the AND state. At which point the logic gate outputs a logic high.
A SSM is a state machine that has a clock attached to the transitions. This means that the state machine only checks the transition flags on the rising edge of the clock cycle. The benefit of this style is allowing consecutive state transitions to be run off the same transition flag. The clock allows for an inherent delay between switching states, and can assist in synchronizing multiple different SMs. A downside to this style of SM is a clock must always be running in the system consuming power.
An example of this style of state machine is a traffic light as shown in Figure 2-2. Using newer style traffic signals that have an induction loop to detect if a car is currently waiting at the light. Once a car is detected the trigger to transition states is set, but a traffic light can not transition without the cross traffic transitioning at the same time so the state machine inside them waits for the clock to signify that a change is allowed to happen. The SM enters the Green light stage and waits until a car is detected at the cross road. Once that happens the SM transitions to yellow then red at the next clock pulse. The SM starts all over again once at this point.