L6.1: Finite State Machine (FSM) [P6] Example application: designing toggle flip-flop (T_FF) as FSM |
[25/4] |
2.5. Finite State Machine (FSM).
FSM applications |
- Motion control and robotics - User interfaces - Traffic control system - Self-driving cars - Media players and entertainment devices - Elevator control systems, washing machines, dishwashers, home appliances - Vending machines, ATM's, payment processing, etc. - HVAC (heating, ventilation and air conditioning) and Climate control systems - and many more... |
2.5.1.Specifications
2.5.1.1. Function table, symbol, state diagram
2.5.1.2. CLK and CD circuits
2.5.1.3. Example of timing diagram
2.5.1.4. Systematic design procedure (pdf). The sequence for designing FSM in our CSD course:
Ref. General ideas on designing FSM (Advanced Micro Devices AMD, 1993).
2.5.2.Planning
2.5.2.1. Architecture: canonical, synchronous, plan C1: hierarchical, structural in a single VHDL file
Let us introduce the key concept and architecture of finite state machine (FSM) as the standard canonical synchronous sequential system to solve most of applications. In CSD we represent the FSM as hierarchical, three blocks (or processes), hierarchical structure in a single VHDL file: plan C1 (the only circuit in CSD where plan C1 is used for practical reasons).
2.5.2.2. State diagram, and FSM adaptation
2.5.2.3. State register: r-bit memory (D_FF), state encoding (binary sequential, Gray, one-hot, etc.)
2.5.2.4. Output logic (CC2): truth table, behavioural interpretation: flowchart
2.5.2.5. Next state logic (CC1): truth table, behavioural interpretation: flowchart
2.5.3. Developing
2.5.3.1. VHDL translation, state enumeration, project location.
2.5.3.2. Synthesis project for a target chip. FSM encoding options
2.5.3.3. Target chip resource usage (D_FF registers)
2.5.3.4. RTL and technology view discussion
2.5.3.5. FSM state diagram discussion
2.5.4. Testing (functional)
2.5.4.1. Test-bench fixture schematic and test-bench VHDL file
2.5.4.2. CLK and other signals stimulus processes
2.5.4.3. Functional simulation and wave results discussion
2.5.4.3. Internal signals representation (current_state, next_state)
2.5.5. Testing (technology)
2.5.5.1. Gate-level (timing) simulation and results discussion
2.5.5.2. Propagation time CLK to output measurements (tCO). How does a cricuit behave in a given active CLK transition?
2.5.5.3. Timing analyser spreadsheet and measurement of the maximum frequency of operation. What is the worst longuest propagation delay in a given synchronous circuit?
2.5.6. Prototyping
Our applications can be put into practice using FPGA traning boards. Example of prototyping are given in LAB6 and LAB7 tutorials.
2.6. Examples of FSM in VHDL: single-file (plan C1) projects
2.6.1. Designing flip-flops as FSM (two-state machines)
We have developed full tutorials on designing basic flip-flops as FSM in VHDL. You ca use these materials for both, comprehending how flip-flops work, and also as introductory examples to FSM design becasue they contain only two states.
2.6.1.1. RS flip-flop (RS_FF is JK_FF never using J = 1; K = 1}
2.6.1.2. D-type (data) flip-flop {D_FF}
2.6.1.3. JK flip-flop {JK_FF}
2.6.1.4. T-type (toggle) flip-flop {T_FF}
And now, once considered these simple two-state systems, we can continue examining any other example of FSM application. For instance, before attempting the next class on a 16-key matrix keypad, we can get an idea on a bicycle flashing lamp with a single push-button.