1 / 26

Finite State Machines Refresher

Learn about finite state machines in digital systems, their representation using state diagrams and state tables, and their design and optimization. Understand the differences between Moore and Mealy FSMs and their applications in controlling digital systems.

bearden
Download Presentation

Finite State Machines Refresher

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 545 Lecture 11 Finite State MachinesRefresher

  2. Required reading • P. Chu, RTL Hardware Design using VHDL • Chapter 10, Finite State Machine: Principle & Practice

  3. Datapath vs. Controller ECE 448 – FPGA and ASIC Design with VHDL

  4. Structure of a Typical Digital System Data Inputs Control & Status Inputs Control Signals Datapath (Execution Unit) Controller (Control Unit) Status Signals Data Outputs Control & Status Outputs

  5. Datapath (Execution Unit) • Manipulates and processes data • Performs arithmetic and logic operations, shifting/rotating, and other data-processing tasks • Is composed of registers, multiplexers, adders, decoders, comparators, ALUs, gates, etc. • Provides all necessary resources and interconnects among them to perform specified task • Interprets control signals from the Controller and generates status signals for the Controller

  6. Controller (Control Unit) • Controls data movements in theDatapath by switching multiplexers and enabling or disabling resources Example: enable signals for registers Example: select signals for muxes • Provides signals to activate various processing tasks in the Datapath • Determines the sequence of operations performed by the Datapath • Follows Some ‘Program’ or Schedule

  7. Programmable vs. Non-Programmable Controller • Controller can be programmable or non-programmable • Programmable • Has a program counter which points to the next instruction • Instructions are held in a RAM or ROM • Microprocessor is an example of a programmable controller • Non-Programmable • Once designed, implements the same functionality • Another term is a “hardwired state machine,” or “hardwired FSM,” or “hardwired instructions” • In this course we will be focusing on non-programmable controllers.

  8. Finite State Machines • Digital Systems and especially their Controllers can be described as Finite State Machines (FSMs) • Finite State Machines can be represented using • State Diagrams and State Tables - suitable for simple digital systems with a relatively few inputs and outputs • Algorithmic State Machine (ASM) Charts - suitable for complex digital systems with a large number of inputs and outputs • All these descriptions can be easily translated to the corresponding synthesizable VHDL code

  9. Finite State Machines Refresher ECE 448 – FPGA and ASIC Design with VHDL

  10. Finite State Machines (FSMs) • An FSM is used to model a system that transits among a finite number of internal states. The transitions depend on the current state and external input. • The main application of an FSM is to act as the controller of a medium to large digital system • Design of FSMs involves • Defining states • Defining next state and output functions • Optimization / minimization • Manual optimization/minimization is practical for small FSMs only

  11. Moore FSM • Output Is a Function of a Present State Only Inputs Next State function Next State Present State Present Stateregister clock reset Output function Outputs

  12. Mealy FSM • Output Is a Function of a Present State and Inputs Inputs Next State function Next State Present State Present Stateregister clock reset Output function Outputs

  13. State Diagrams ECE 448 – FPGA and ASIC Design with VHDL

  14. Moore Machine transition condition 1 state 2 / output 2 state 1 / output 1 transition condition 2

  15. Mealy Machine transition condition 1 / output 1 state 2 state 1 transition condition 2 / output 2

  16. Moore FSM - Example 1 0 1 0 S0 / 0 1 S1 / 0 S2 / 1 1 0 • Moore FSM that Recognizes Sequence “10” reset S0: No elements of the sequence observed S2: “10” observed S1: “1” observed Meaning of states:

  17. Mealy FSM - Example 1 • Mealy FSM that Recognizes Sequence “10” 0 / 0 1 / 0 1 / 0 S0 S1 reset 0 / 1 S0: No elements of the sequence observed S1: “1” observed Meaning of states:

  18. Moore & Mealy FSMs without delays clock 0 1 0 0 0 input state S0 S0 S1 S2 S0 S0 Moore output state S0 S0 S1 S0 S0 S0 Mealy output

  19. Moore & Mealy FSMs with delays clock 0 1 0 0 0 input state S0 S0 S1 S2 S0 S0 Moore output state S0 S0 S1 S0 S0 S0 Mealy output

  20. Moore vs. Mealy FSM (1) • Moore and Mealy FSMs Can Be Functionally Equivalent • Equivalent Mealy FSM can be derived from Moore FSM and vice versa • Mealy FSM Has Richer Description and Usually Requires Smaller Number of States • Smaller circuit area

  21. Moore vs. Mealy FSM (2) • Mealy FSM Computes Outputs as soon as Inputs Change • Mealy FSM responds one clock cycle sooner than equivalent Moore FSM • Moore FSM Has No Combinational Path Between Inputs and Outputs • Moore FSM is less likely to affect the critical path of the entire circuit

  22. Which Way to Go? Mealy FSM Moore FSM Safer. Less likely to affect the critical path. Fewer states Lower Area Responds one clock cycle earlier

  23. Generalized FSM Present State Next State Based on RTL Hardware Design by P. Chu

  24. Problem 1Assuming state diagram given on the next slide, supplement timing waveforms given in the answer sheet with the correct values of signals State and c, in the interval from 0 to 575 ns.

  25. Reset 0-/1 1-/0 X Y -1/0 -0/1 -1/0 Z -0/1

  26. Reset Clk a b State c 0 ns 100 ns 200 ns 300 ns 400 ns 500 ns

More Related