In this lesson, you will learn how to design the final piece of a Finite State Machine (FSM) by mapping your internal state and inputs to actual system outputs.
From States to Actions
In our previous lessons, we designed the "brain" of a sequential system—the Next State Logic—which determines where the machine goes next. However, a machine is only useful if it "does" something, like turning on a light, triggering a motor, or setting an error flag. This is the role of Output Logic.
Moore vs. Mealy Implementation
The way you implement output logic depends entirely on the architecture you chose in Lesson 19:
- Moore Machines: The output depends only on the current state. If your state register holds a value (e.g.,
01for "Door Open"), the output logic is a simple combinational circuit connected directly to the state bits.Output = f(CurrentState) - Mealy Machines: The output depends on both the current state and the current input. This allows the output to change faster, but it requires the output logic to accept input lines as well as state register bits.
Output = f(CurrentState, Input)
Design Procedure
To implement this, you treat the output as a standard combinational logic problem (just like we did in Lessons 4 and 7):
- Truth Table: Create a table listing all combinations of State bits and Inputs that produce an output of
1. - Boolean Expression: Derive the simplified Boolean function (using K-Maps, of course).
- Circuit Realization: Draw the gates (AND, OR, NOT) that connect your state register’s outputs and your system input lines to your output pin.
For example, if you are building a traffic light controller where the "Green" light (output G) should only be active when the state is ST_GO (encoded as 10), the implementation is simply:
G = Q1 AND (NOT Q0)
By separating the Next State Logic (which manages the flow of time) from the Output Logic (which manages the interaction with the world), you ensure your design remains modular and easy to debug.
Key Takeaway: Output logic is simply a combinational circuit that translates the abstract "state" of your system into a physical signal, either based solely on the current state (Moore) or a combination of state and current inputs (Mealy).