IC-UNICAMP MC 603/613 - 20061 - 1 Finite State Machines Mixed Style RTL Modeling Extraído da George Mason Univ. ECE 545 Lecture 5.

Slides:



Advertisements
Similar presentations
Finite State Machine (FSM) Quando a sequencia das ações no seu projeto dependem do estado de um elemento sequüencial, uma máquina de estados finitos (FSM)
Advertisements

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.
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
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.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Finite State Machines Discussion D8.1 Example 36.
55:035 Computer Architecture and Organization
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,
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)
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 8: Synchronous Sequential Circuits Chapter 8.
George Mason University Finite State Machines Based on lectures from George Mason and CMU יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
Finite State Machines VHDL ET062G & ET063G Lecture 6 Najeem Lawal 2012.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
Introduction to Computer Organization and Architecture Lecture 3 By Juthawut Chantharamalee wut_cha/home.htm.
George Mason University Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts ECE 545 Lecture 14.
1 ECE 545—Digital System Design with VHDL Lecture 6 Behavioral VHDL Coding (for Synthesis): Finite State Machines and ASMs 9/30/08.
George Mason University Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code ECE 448 Lecture 6.
VHDL Discussion Finite State Machines
VHDL for Finite State Machines. Sorry – no standard way One way –Use TYPE and SIGNAL ARCHITECTURE Behavior OF two_ones_fsm IS TYPE State_type IS ( A,
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.
Instructor: Oluwayomi Adamo Digital Systems Design.
Registers; State Machines Analysis Section 7-1 Section 5-4.
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.
State Machine & Timing Design
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.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.
George Mason University Design of Controllers using Algorithmic State Machine (ASM) Charts ECE 545 Lecture 12.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
George Mason University Finite State Machines Refresher ECE 545 Lecture 11.
Finite State Machines Mealy machine inputs Outputs next state function
Sequential statements (1) process
Finite State Machines (part 1)
Week #7 Sequential Circuits (Part B)
Describing Combinational Logic Using Processes
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.
Simple Processor Control Unit
CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
VHDL (VHSIC Hardware Description Language)
ECE 545 Lecture 12 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
ECE 545 Lecture 10 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
ECE 545 Lecture 9 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL Introduction.
ECE 545 Lecture 11 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
Behavioral Modeling of Sequential-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
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.
Sequntial-Circuit Building Blocks
(Sequential-Circuit Building Blocks)
Presentation transcript:

IC-UNICAMP MC 603/ Finite State Machines Mixed Style RTL Modeling Extraído da George Mason Univ. ECE 545 Lecture 5

IC-UNICAMP MC 603/ Finite State Machines (FSMs) Any Circuit with Memory Is a Finite State Machine –Even computers can be viewed as huge FSMs Design of FSMs Involves –Defining states –Defining transitions between states –Optimization / minimization Above Approach Is Practical for Small FSMs Only

IC-UNICAMP MC 603/ Máquina de Estados Circuito Sequencial Síncrono Genérico CC FF CC SiSi S i+1 X Y CC FF SiSi S i+1 X Y Máquina de MooreMáquina de Mealy Saída Y muda apenas na transição do clock Saída Y pode mudar em qualquer instante, em função da entrada X

IC-UNICAMP MC 603/ Síntese de uma máquina de estados S0S0 S1S1 S2S2 S3S3 Diagrama de Transição de Estados  Moore entr Mealy entr / saída Tabela de Transição de Estados

IC-UNICAMP MC 603/ Síntese de uma máquina de estados Codificação dos estados S 0 = 00 etc Equações booleanas dos circuitos combinacionais S i+1 = f S (S i, X) Y = f Y (S i, X) (em maq. de Moore, só S) Sintetizar os CCs Elementos de memória podem ser FF-D ou FF-JK

IC-UNICAMP MC 603/ Moore FSM Output Is a Function of Present State Only Present State Register Next State function Output function Inputs Present State Next State Outputs clock reset

IC-UNICAMP MC 603/ Mealy FSM Output Is a Function of a Present State and Inputs Next State function Output function Inputs Present State Next State Outputs Present State Register clock reset

IC-UNICAMP MC 603/ Moore Machine state 1 / output 1 state 2 / output 2 transition condition 1 transition condition 2

IC-UNICAMP MC 603/ Mealy Machine state 1 state 2 transition condition 1 / output 1 transition condition 2 / output 2

IC-UNICAMP MC 603/ 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

IC-UNICAMP MC 603/ 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 more likely to have a shorter critical path

IC-UNICAMP MC 603/ Moore FSM - Example 1 Moore FSM that Recognizes Sequence “10” S0 / 0S1 / 0S2 / reset Meaning of states: S0: No elements of the sequence observed S1: “1” observed S2: “10” observed

IC-UNICAMP MC 603/ Mealy FSM - Example 1 Mealy FSM that Recognizes Sequence “10” S0S1 0 / 0 1 / 0 0 / 1 reset Meaning of states: S0: No elements of the sequence observed S1: “1” observed

IC-UNICAMP MC 603/ Moore & Mealy FSMs – Example 1 clock input Moore Mealy S0 S1 S2 S0 S0 S0 S1 S0 S0 S0

IC-UNICAMP MC 603/ FSMs in VHDL Finite State Machines Can Be Easily Described With Processes Synthesis Tools Understand FSM Description If Certain Rules Are Followed State transitions should be described in a process sensitive to clock and asynchronous reset signals only Outputs described as concurrent statements outside the process

IC-UNICAMP MC 603/ Moore FSM Present State Register Next State function Output function Inputs Present State Next State Outputs clock reset process(clock, reset) concurrent statements

IC-UNICAMP MC 603/ Mealy FSM Next State function Output function Inputs Present State Next State Outputs Present State Register clock reset process(clock, reset) concurrent statements

IC-UNICAMP MC 603/ FSM States (1) architecture behavior of FSM is type state is (list of states); signal FSM_state: state; begin process(clk, reset) begin if reset = ‘1’ then FSM_state <= initial state; elsif (clock = ‘1’ and clock’event) then case FSM_state is

IC-UNICAMP MC 603/ FSM States (2) case FSM_state is when state_1 => if transition condition 1 then FSM_state <= state_1; end if; when state_2 => if transition condition 2 then FSM_state <= state_2; end if; end case; end if; end process;

IC-UNICAMP MC 603/ Moore FSM - Example 1 Moore FSM that Recognizes Sequence “10” S0 / 0S1 / 0S2 / reset

IC-UNICAMP MC 603/ Moore FSM in VHDL (1) TYPE state IS (S0, S1, S2); SIGNAL Moore_state: state; U_Moore: PROCESS (clock, reset) BEGIN IF(reset = ‘1’) THEN Moore_state <= S0; ELSIF (clock = ‘1’ AND clock’event) THEN CASE Moore_state IS WHEN S0 => IF input = ‘1’ THEN Moore_state <= S1; ELSE Moore_state <= S0; END IF;

IC-UNICAMP MC 603/ Moore FSM in VHDL (2) WHEN S1 => IF input = ‘0’ THEN Moore_state <= S2; ELSE Moore_state <= S1; END IF; WHEN S2 => IF input = ‘0’ THEN Moore_state <= S0; ELSE Moore_state <= S1; END IF; END CASE; END IF; END PROCESS; Output <= ‘1’ WHEN Moore_state = S2 ELSE ‘0’;

IC-UNICAMP MC 603/ Mealy FSM - Example 1 Mealy FSM that Recognizes Sequence “10” S0S1 0 / 0 1 / 0 0 / 1 reset

IC-UNICAMP MC 603/ Mealy FSM in VHDL (1) TYPE state IS (S0, S1); SIGNAL Mealy_state: state; U_Mealy: PROCESS(clock, reset) BEGIN IF(reset = ‘1’) THEN Mealy_state <= S0; ELSIF (clock = ‘1’ AND clock’event) THEN CASE Mealy_state IS WHEN S0 => IF input = ‘1’ THEN Mealy_state <= S1; ELSE Mealy_state <= S0; END IF;

IC-UNICAMP MC 603/ Mealy FSM in VHDL (2) WHEN S1 => IF input = ‘0’ THEN Mealy_state <= S0; ELSE Mealy_state <= S1; END IF; END CASE; END IF; END PROCESS; Output <= ‘1’ WHEN (Mealy_state = S1 AND input = ‘0’) ELSE ‘0’;

IC-UNICAMP MC 603/ Moore FSM – Example 2: State diagram Cz1=  resetn Bz0=  Az0=  w0= w1= w1= w0= w0= w1=

IC-UNICAMP MC 603/ Present Next state Output state w=0w=1 z AAB0 BAC0 CAC1 Moore FSM – Example 2: State table

IC-UNICAMP MC 603/ Moore FSM Present State Register Next State function Output function Input: w Present State: y Next State Output: z clock resetn process(clock, reset) concurrent statements

IC-UNICAMP MC 603/ USE ieee.std_logic_1164.all ; ENTITY simple IS PORT (clock : IN STD_LOGIC ; resetn : IN STD_LOGIC ; w : IN STD_LOGIC ; z : OUT STD_LOGIC ) ; END simple ; ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y : State_type ; BEGIN PROCESS ( resetn, clock ) BEGIN IF resetn = '0' THEN y <= A ; ELSIF (Clock'EVENT AND Clock = '1') THEN Moore FSM – Example 2: VHDL code (1)

IC-UNICAMP MC 603/ CASE y IS WHEN A => IF w = '0' THEN y <= A ; ELSE y <= B ; END IF ; WHEN B => IF w = '0' THEN y <= A ; ELSE y <= C ; END IF ; WHEN C => IF w = '0' THEN y <= A ; ELSE y <= C ; END IF ; END CASE ; Moore FSM – Example 2: VHDL code (2)

IC-UNICAMP MC 603/ Moore FSM – Example 2: VHDL code (3) END IF ; END PROCESS ; z <= '1' WHEN y = C ELSE '0' ; END Behavior ;

IC-UNICAMP MC 603/ Moore FSM Present State Register Next State function Output function Input: w Present State: y_present Next State: y_next Output: z clock resetn process (w, y_present) concurrent statements process (clock, resetn)

IC-UNICAMP MC 603/ ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y_present, y_next : State_type ; BEGIN PROCESS ( w, y_present ) BEGIN CASE y_present IS WHEN A => IF w = '0' THEN y_next <= A ; ELSE y_next <= B ; END IF ; WHEN B => IF w = '0' THEN y_next <= A ; ELSE y_next <= C ; END IF ; Alternative VHDL code (1)

IC-UNICAMP MC 603/ WHEN C => IF w = '0' THEN y_next <= A ; ELSE y_next <= C ; END IF ; END CASE ; END PROCESS ; PROCESS (clock, resetn) BEGIN IF resetn = '0' THEN y_present <= A ; ELSIF (clock'EVENT AND clock = '1') THEN y_present <= y_next ; END IF ; END PROCESS ; z <= '1' WHEN y_present = C ELSE '0' ; END Behavior ; Alternative VHDL code (2)

IC-UNICAMP MC 603/ A w0=z0=  w1=z1=  B w0=z0=  resetn w1=z0=  Mealy FSM – Example 2: State diagram

IC-UNICAMP MC 603/ Present Next stateOutput z state w=0w=1w=0w=1 AAB00 BAB01 Mealy FSM – Example 2: State table

IC-UNICAMP MC 603/ Mealy FSM Next State function Output function Input: w Present State: y Next State Output: z Present State Register clock resetn process(clock, reset) concurrent statements

IC-UNICAMP MC 603/ LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY Mealy IS PORT ( clock : IN STD_LOGIC ; resetn : IN STD_LOGIC ; w : IN STD_LOGIC ; z : OUT STD_LOGIC ) ; END Mealy ; ARCHITECTURE Behavior OF Mealy IS TYPE State_type IS (A, B) ; SIGNAL y : State_type ; BEGIN PROCESS ( resetn, clock ) BEGIN IF resetn = '0' THEN y <= A ; ELSIF (clock'EVENT AND clock = '1') THEN Mealy FSM – Example 2: VHDL code (1)

IC-UNICAMP MC 603/ Mealy FSM – Example 2: VHDL code (2) CASE y IS WHEN A => IF w = '0' THEN y <= A ; ELSE y <= B ; END IF ; WHEN B => IF w = '0' THEN y <= A ; ELSE y <= B ; END IF ; END CASE ;

IC-UNICAMP MC 603/ Mealy FSM – Example 2: VHDL code (3) END IF ; END PROCESS ; WITH y SELECT z <= w WHEN B, z <= ‘0’ WHEN others; END Behavior ;