Finite state machines Modelling FSM in VHDL.

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

VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Sequential Circuits Storage elements
Analysis of Clocked Sequential Circuits
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
ECE 353 Computer Systems Lab II VHDL AND LABORATORY TOOLS TUTORIAL Professors Maciej Ciesielski & T. Baird Soules.
DISCUSSION CSE 140L 3 rd November 2010 Vikram Murali.
Integer Square Root.
Simple Sequential Circuits in VHDL. Contents Sequential circuit examples: - SR latch in dataflow style - D flip-flop in behavioral style - shift register.
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.
Discussed in class and on Fridays n FSMs (only synchronous, with asynchronous reset) –Moore –Mealy –Rabin-Scott n Generalized register: –With D FFs, –With.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Finite State Machines Discussion D8.1 Example 36.
Lab 10 RT methodology (cont’d) Example 1 – a counter Example 2 – a repetitive-adder multiplier.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
Introduction to VHDL (part 2)
Sequential Logic in Verilog
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
1/8/ L20 Project Step 8 - Data Path Copyright Joanne DeGroat, ECE, OSU1 State Machine Design with an HDL A methodology that works for documenting.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
1 ECE 545—Digital System Design with VHDL Lecture 6 Behavioral VHDL Coding (for Synthesis): Finite State Machines and ASMs 9/30/08.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
Computer Organization & Programming Chapter 5 Synchronous Components.
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Modern VLSI Design 4e: Chapter 8 Copyright  2008 Wayne Wolf Topics VHDL register-transfer modeling: –basics using traffic light controller; –synthesis.
VHDL Discussion Finite State Machines
Finite state machines Modelling FSM in VHDL. Types of automata (FSM) A sequential automaton has: –Inputs –States (a finite number of states) –Outputs.
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Controllers ENGIN 341 – Advanced Digital Design University of Massachusetts Boston Department of Engineering Dr. Filip Cuckov.
Digital System Design using VHDL
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
Introduction to Sequential Logic Design Finite State-Machine Analysis.
ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.
Interrupt, again! Lin Zhong ELEC424, Fall 2010.
Dr. ClincyLecture Slide 1 CS Chapter 3 (3A and ) Part 8 of 8 Dr. Clincy Professor of CS.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
State Machine Design with an HDL
Sequential statements (1) process
Finite State Machines (part 1)
Week #7 Sequential Circuits (Part B)
Lecture 4. Sequential Logic #2
Figure 8.1. The general form of a sequential circuit.
Lecture L5.1 Mealy and Moore Machines
Introduction to Sequential Logic Design
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Some VHDL Details 10/8/08 ECE Lecture 8.
Simple Processor Control Unit
VHDL 5 FINITE STATE MACHINES (FSM)
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
VHDL (VHSIC Hardware Description Language)
State Machine Design with an HDL
Finite State Machines.
ECE 465 Sequential Multiplication Techniques
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
The Verilog Hardware Description Language
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.
Design of Networks for Arithmetic Operation
L25 – Final Review AU 15 Final Exam – Classroom – Journalism 300
Sequntial-Circuit Building Blocks
Presentation transcript:

Finite state machines Modelling FSM in VHDL

Types of automata (FSM) A sequential automaton has: Inputs States (a finite number of states) Outputs Transitions from one state to another Types of FSM: Moore: outputs depend only on the current state Mealy: outputs depend on both state and inputs

VHDL modelling Can be done with one process two processes We define a type states (of type ennumeration) TYPE states IS (s0, s1, s2, s3); TYPE states IS (init, add, shift); We have: Either present state (present_state) and next state (next_state) of type states Or only state (state) of type states The states (present_state, next_state, state) may be signals or variable, depending on the implementation (they should be signals if we implement FSM with two processes) One process determines next state and the outputs Contains a CASE after the present state, and on each branch (choice) there are IF statements with the inputs in conditions

Modelling With two processes: With one process: Moore / Mealy: one process is sensitive to clock and does only present_state<=next_state; The other process is sensitive to present_state and inputs; it computes next_state With one process: The process is sensitive to clock The state (state) may be a variable Moore / Mealy: For Moore: outputs depend only on the current state For Mealy: outputs depend on both state and inputs One possibility would be to use the negative (falling) edge of the clock for the FSM, if the other sequential circuits use the positive (rising) edge of the clock The outputs of the FSM are commands for the other circuits (e.g. shift, load, etc)

Moore FSM example x=‘0’ x=‘1’ stare = s0 z=“00” s0 s3 stare = s1

ENTITY FSM_Moore IS GENERIC(tp:TIME:=5ns); PORT(x: IN BIT; clock: IN BIT; z: OUT BIT_VECTOR(1 DOWNTO 0)); END ENTITY; ARCHITECTURE one_process OF FSM_Moore IS TYPE states IS (s0, s1, s2, s3); SIGNAL display_state: states; BEGIN PROCESS (clock) VARIABLE state: states:=s0; --VARIABLE count: integer:=0; IF clock='0' AND clock'EVENT THEN --display_state<=state; -- visualize present state CASE state IS WHEN s0 => z<="00" after tp; --count:=0;--init count IF x='0' THEN state:=s0; ELSE state:=s3; END IF; WHEN s1 =>

z<="01" after tp; --count:= count+1;-- increment count IF x='0' THEN state:=s1; ELSE state:=s0; END IF; WHEN s2 => z<="10" after tp; --IF count>=5 THEN -- test count state:=s2; WHEN s3 => z<="11" after tp; ELSE state:=s1; END CASE; display_state<=state;--visualize next state END PROCESS; END ARCHITECTURE;

Example of Mealy FSM x=‘0’ x=‘1’ present_state = s0 s0 / “00”

ENTITY FSM_Mealy IS GENERIC(tp:TIME:=5ns); PORT(x: IN BIT; clock: IN BIT; z: OUT BIT_VECTOR(1 DOWNTO 0)); END ENTITY; ARCHITECTURE two_processes OF FSM_Mealy IS TYPE states IS (s0, s1, s2, s3); SIGNAL present_state, next_state: states:=s0; BEGIN proc_clock: PROCESS(clock) IF clock='0' AND clock'EVENT THEN present_state <= next_state; END IF; END PROCESS proc_clock; compute_next_state: PROCESS (present_state, x) --VARIABLE count: integer:=0; CASE present_state IS WHEN s0 => --count:=0;--initialize count IF x='0' THEN next_state<=s0; z<="00" after tp; ELSE next_state<=s3; z<="11" after tp; WHEN s1 => --count:= count+1;-- increment count

IF x='0' THEN next_state<=s1; z<="01" after tp; ELSE next_state<=s0; z<="00" after tp; END IF; WHEN s2 => --IF count>=5 THEN -- test count next_state<=s2; z<="10" after tp; WHEN s3 => END CASE; END PROCESS compute_next_state; END ARCHITECTURE;