ECE- 1551 DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.

Slides:



Advertisements
Similar presentations
VHDL 5 FINITE STATE MACHINES (FSM) Some pictures are obtained from FPGA Express VHDL Reference Manual, it is accessible from the machines in the lab at.
Advertisements

Chapter #8: Finite State Machine Design 8
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Give qualifications of instructors: DAP
EKT 221 : Digital 2 ASM.
Finite State Machine Chapter 10 RTL Hardware Design by P. Chu.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
ECE 331 – Digital System Design
6/27/20061 Sequence Detectors Lecture Notes – Lab 5 Sequence detection is the act of recognizing a predefined series of inputs A sequence detector is a.
6/12/20151 Sequence Detectors Lecture Notes – Lab 4 Sequence detection is the act of recognizing a predefined series of inputs A sequence detector is a.
3/20/20091 More State Machines. Multiple processes.
The Control Unit: Sequencing the Processor Control Unit: –provides control signals that activate the various microoperations in the datapath the select.
10/20/20081 Lab 6 – More State Machines. Multiple processes.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Give qualifications of instructors: DAP
10/13/ Lab 6 - Algorithmic State Machines ECE238L 10/13/2009.
4/10/20081 Lab 9 RT methodology introduction Register operations Data Path Control Path ASM Example TA: Jorge Crichigno.
Algorithmic State Machine (ASM) Charts
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 20 Datapath and Control Datapath - performs data transfer and processing operations.
Lecture #5 In this lecture we will introduce the sequential circuits.
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Introduction to VHDL (part 2)
Dr. H.v.d.Biggelaar / Mar3-Ver2 / 1 Engineering Technology Dr. H.v.d.Biggelaar March 22, 2000 State Machines in VHDL.
Sequential Logic Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer Organization and.
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
George Mason University Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts ECE 545 Lecture 14.
George Mason University Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code ECE 448 Lecture 6.
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Logic Design.
VHDL Discussion Finite State Machines
Datapath - performs data transfer and processing operations The control unit sends: – Control signals – Control outputs The control unit receives: – External.
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Controllers ENGIN 341 – Advanced Digital Design University of Massachusetts Boston Department of Engineering Dr. Filip Cuckov.
Digital System Design using VHDL
Algorithmic State Machines Sorting Signed & Unsigned Data Types
Hao Zheng Comp Sci & Eng USF CDA 4253 FPGA System Design Chapter 5 Finite State Machines.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
1 ECE 545 – Introduction to VHDL Algorithmic State Machines Sorting Example ECE 656 Lecture 8.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
ASM block The state box represents the state in the FSM, and the output in the state box describes the desired output values when the FMS enters this state.
George Mason University Design of Controllers using Algorithmic State Machine (ASM) Charts ECE 545 Lecture 12.
COMBINATIONAL AND SEQUENTIAL CIRCUITS Guided By: Prof. P. B. Swadas Prepared By: BIRLA VISHVAKARMA MAHAVDYALAYA.
Digital Design with SM Charts
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
Finite State Machines (part 1)
Week #7 Sequential Circuits (Part B)
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Hao Zheng Comp Sci & Eng USF
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Instructor: Alexander Stoytchev
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
ECE 545 Lecture 12 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
State Machine Design with an HDL
ECE 545 Lecture 11 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
Instructor: Alexander Stoytchev
Lecture #5 In this lecture we will introduce the sequential circuits.
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
Instructor: Alexander Stoytchev
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Presentation transcript:

ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015

Finite State Machine (FSM)  FSMs are sequential machines with "random" next-state logic  Used to implement functions that are realized by carrying out a sequence of steps -- commonly used as a controller in a large system.  The state transitions within an FSM are more complicated than for regular sequential logic such as a shift register.  An FSM is specified using five entities: symbolic states, input signals, output signals, next-state function and output function. 2

Representation of FSM  A node represents a unique state.  An arc represents a transition from one state to another.  Is labeled with the condition that causes the transition  Moore outputs are shown inside the bubble Mealy outputs are shown on the arcs Only asserted outputs are listed. 3

Example Memory Controller 4  Consider a memory controller that sits between a processor and a memory unit Commands include mem, rw and burst mem is asserted when a memory access is requested rw when ’1’ indicates a read, when ’0’ indicates a write burst is a special read operation in which 4 consecutive reads occur Two control signals oe (output enable) and we (write enable) One Mealy output we_me

Example Memory Controller  The controller is initially in the idle state, waiting for mem to be asserted.  Once mem is asserted, the FSM inspects the rw signal and moves to either the read1 or write state.  The logic expressions are given on the arcs  They are checked on the rising edge of the clock  For example, if mem is asserted and rw is ’1’, a transition is made to read1 and the output signal oe is asserted on rising edge of clk. 5

ASM (algorithmic state machine) chart  ASM (algorithmic state machine) chart  Flowchart-like diagram  Flowchart-like diagram with transitions controlled by the rising edge of clk  Provide the same info as an FSM  More descriptive, better for complex description  ASM block  One state box  One ore more optional decision boxes: with T or F exit path  One or more conditional output boxes: for Mealy output 6

State diagram and ASM chart conversion 7  Conversion process is trivial for the left example.  For right example, a decision box is added to accommodate the conditional transition to state s1 when a is true.  A conditional output box is added to handle the Mealy output that depends on both state_reg=s0 and a=’1

State diagram and ASM chart conversion  The same general structure is apparent for either state diagrams or ASMs.  The biggest difference is in how the decisions and conditional outputs are expressed  In VHDL, you must view the decision and conditional output logic following a state (up to the next state(s)) as combinational next-state logic 8

State diagram and ASM chart conversion 9

10

ASM chart  Difference between a regular flowchart and ASM chart:  Transition governed by clock  Transition done between ASM blocks  Basic rules:  For a given input combination, there is one unique exit path from the current ASM block  The exit path of an ASM block must always lead to a state box. The state box can be the state box of the current ASM block or a state box of another ASM block.  Incorrect Examples 11

ASM Chart-Interpretation  How do we interpret the ASM chart.  At the rising edge of clk, the FSM enters a new state (a new ASM block).  During the clock period, the FSM performs several operations.  It activates Moore output signals asserted in this new state.  It evaluates various Boolean expressions of the decision boxes and activates the Mealy output signals accordingly.  At the next rising edge of clk (the end of the current clock period), the results of Boolean expression are examined simultaneously.  An exit path is determined and the FSM stays or enters a new ASM block 12

Timing Analysis  Timing Analysis of an FSM (similar to regular sequential circuit).  Consider a circuit with both a Moore and Mealy output.  The timing parameters are Tcq, Tsetup, Thold, Tnext(max).  Toutput(mo) (Moore logic) and Toutput(me) (Mealy logic) 13

Timing Analysis  Consider a circuit with both Moore and Mealy outputs 14

Timing Analysis  Similar to the analysis of a regular sequential circuit, the minimum clock period (max clk freq) of a FSM is given by Tc = Tcq + Tnext(max) + Tsetup 15

Timing Analysis  Since the FSM is frequently used in a controller application, the delay of the output signals are important.  For Moore  Tco(mo) = Tcq + Toutput(mo)  For Mealy (when change is due to a change in state and input signals)  Tco(me) = Tcq + Toutput(me).  Although the difference between a Moore and Mealy output seem subtle, as you can see from the timing diagram, there behaviors can be very different And, in general, it takes fewer states to realize a given function using a Mealy machine (note that both are equivalent in ’power’) But greater care must be exercised 16

Moore and Mealy Circuits: Edge detection circuit  Consider an edge detection circuit  The circuit is designed to detect the rising edge of a slow strobe input, i.e., it generates a "short" (1-clock period or less) output pulse. 17

Edge detection circuit 18

Comparison of Moore and Mealy outputs  Comparison  Mealy machine uses fewer states  Mealy machine responds faster  Mealy machine may be transparent to glitches  Which one is better?  Types of control signal  Edge sensitive  E.g., enable signal of counter  Both can be used but Mealy is faster  Level sensitive  E.g., write enable signal of SRAM  Moore is preferred 19

VHDL Description of FSM  Follow the basic block diagram  Code the next-state/output logic according to the state diagram/ASM chart  Use enumerate data type for states 20

Edge detection circuit 21 library ieee; use ieee.std_logic_1164.all; entity edge_detector1 is port( clk, reset: in std_logic; strobe: in std_logic; p1: out std_logic ); end edge_detector1; architecture moore_arch of edge_detector1 is type state_type is (zero, edge, one); signal state_reg, state_next: state_type; Begin -- state register process(clk, reset) begin if (reset = ’1’) then state_reg <= zero; elsif (clk’event and clk = ’1’) then state_reg <= state_next; end if; end process;

Edge detection circuit next-state logic Process (state_reg, strobe) begin case state_reg is when zero=> if (strobe = ’1’) then state_next <= edge; else state_next <= zero; end if; when edge => if (strobe = ’1’) then state_next <= one; else state_next <= zero; end if; when one => if (strobe = ’1’) then state_next <= one; else state_next <= zero; end if; end case; end process; -- Moore output logic p1 <= ’1’ when state_reg = edge else ’0’; end moore_arch;

Next Class  Exam Review  Covers all topics 23