CWRU EECS 317 EECS 317 Computer Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University This.

Slides:



Advertisements
Similar presentations
CWRU EECS 317 EECS 317 CAD Computer Aided Design LECTURE 2: Delay models, std_ulogic and with-select-when Instructor: Francis G. Wolff
Advertisements

©2004 Brooks/Cole FIGURES FOR CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC Click the mouse to move to the next page. Use the ESC key to exit this chapter. This.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 6 – Part 1.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
Modeling & Simulating ASIC Designs with VHDL Reference: Smith text: Chapters 10 & 12.
ENGIN112 L20: Sequential Circuits: Flip flops October 20, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 20 Sequential Circuits: Flip.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
CS 151 Digital Systems Design Lecture 20 Sequential Circuits: Flip flops.
Latches and Flip-Flops Discussion D4.1 Appendix J.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 2 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
1 Chapter 5: Datapath and Control CS 447 Jason Bakos.
Counting with Sequential Logic Experiment 8. Experiment 7 Questions 1. Determine the propagation delay (in number of gates) from each input to each output.
Introduction to Counter in VHDL
LECTURE 8: VHDL PROCESSES
ENG241 Digital Design Week #6 Sequential Circuits (Part A)
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
1 Sequential Logic Lecture #7. 모바일컴퓨팅특강 2 강의순서 Latch FlipFlop Shift Register Counter.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
1 ECE 545—Digital System Design with VHDL Lecture 6 Behavioral VHDL Coding (for Synthesis): Finite State Machines and ASMs 9/30/08.
ENG2410 Digital Design LAB #6 LAB #6 Sequential Logic Design (Flip Flops)
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Additional Details & Examples.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE Simulator 1: Synopsys Simulator Instructor: Francis G. Wolff Case Western.
LECTURE 7: VHDL Standard Cell Library Package
CWRU EECS 317 EECS 317 Computer Design LECTURE 1: The VHDL Adder Instructor: Francis G. Wolff Case Western Reserve University.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 5: AOIs, WITH-SELECT-WHEN, WHEN-ELSE Instructor: Francis G. Wolff Case Western.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
CEC 220 Digital Circuit Design Latches and Flip-Flops Monday, March 03 CEC 220 Digital Circuit Design Slide 1 of 19.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE Simulator 2: Textio, Wait, Clocks, and Test Benches Instructor: Francis G. Wolff
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
Sequential statements (1) process
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
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.
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
B e h a v i o r a l to R T L Coding
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Flip Flops.
D Flip-Flop.
ECE Digital logic Lecture 16: Synchronous Sequential Logic
Sequential-Circuit Building Blocks
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
SYNTHESIS OF SEQUENTIAL LOGIC
Synthesis مرتضي صاحب الزماني.
VHDL (VHSIC Hardware Description Language)
CSE 370 – Winter Sequential Logic-2 - 1
VHDL Introduction.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
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.
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
(Sequential-Circuit Building Blocks)
Presentation transcript:

CWRU EECS 317 EECS 317 Computer Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University This presentation uses powerpoint animation: please viewshow

CWRU EECS 317 Gated-Clock SR Flip-Flop (Latch Enable) S R Q Q LE Q <= (S NAND LE) NAND NQ; Asynchronous terminology: Preset and Clear Synchronous terminology: Set and Reset NQ <= (R NAND LE) NAND Q; CLR PS Suppose each gate was 5ns: how long does the clock have to be enabled to latch the data? Answer: 15ns Latches require that during the gated-clock the data must also be stable (i.e. S and R) at the same time

CWRU EECS 317 Structural SR Flip-Flop (Latch) NAND R S Q n U Q n R S Q Q ENTITY Latch IS PORT(R, S: IN std_logic; Q, NQ: OUT std_logic); END ENTITY; ARCHITECTURE latch_arch OF Latch IS BEGIN Q<= R NAND NQ; NQ<= S NAND Q; END ARCHITECTURE;

CWRU EECS 317 Inferring Behavioral Latches: Asynchronous ARCHITECTURE Latch2_arch OF Latch IS BEGIN PROCESS (R, S) BEGIN IF R= ‘0’ THEN Q <= ‘1’; NQ<=‘0’; ELSIF S=‘0’ THEN Q <= ‘0’; NQ<=‘1’; END IF; END PROCESS; END ARCHITECTURE; NAND R S Q n U Q n R S Q Q Sensitivity list of signals: Every time a change of state or event occurs on these signals this process will be called Sequential Statements

CWRU EECS 317 Gated-Clock SR Flip-Flop (Latch Enable) S R Q Q LE ARCHITECTURE Latch_arch OF GC_Latch IS BEGIN PROCESS (R, S, LE) BEGIN IF LE=‘1’ THEN IF R= ‘0’ THEN Q <= ‘1’; NQ<=‘0’; ELSIF S=‘0’ THEN Q <= ‘0’; NQ<=‘1’; END IF; END IF; END PROCESS; END ARCHITECTURE;

CWRU EECS 317 Rising-Edge Flip-flop

CWRU EECS 317 Rising-Edge Flip-flop logic diagram Do not want to code this up as combin- atorial logic! Too much work! Do not want to code this up as combin- atorial logic! Too much work!

CWRU EECS 317 Inferring D-Flip Flops: Synchronous ARCHITECTURE Dff_arch OF Dff IS BEGIN PROCESS (Clock) BEGIN IF Clock’EVENT AND Clock=‘1’ THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; Sensitivity lists contain signals used in conditionals (i.e. IF) Notice the Process does not contain D: PROCESS(Clock, D) Clock’EVENT is what distinguishes a D- FlipFlip from a Latch

CWRU EECS 317 Inferring D-Flip Flops: rising_edge ARCHITECTURE Dff_arch OF Dff IS BEGIN PROCESS (Clock) BEGIN IF Clock’EVENT AND Clock=‘1’ THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; ARCHITECTURE dff_arch OF dff IS BEGIN PROCESS (Clock) BEGIN IF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; Alternate and more readable way is to use the rising_edge function

CWRU EECS 317 Inferring D-Flip Flops: Asynchronous Reset ARCHITECTURE dff_reset_arch OF dff_reset IS BEGIN PROCESS (Clock, Reset) BEGIN IF Reset= ‘1’ THEN -- Asynchronous Reset Q <= ‘0’ ELSIF rising_edge(Clock) THEN --Synchronous Q <= D; END IF; END PROCESS; END ARCHITECTURE;

CWRU EECS 317 Inferring D-Flip Flops: Synchronous Reset PROCESS (Clock, Reset) BEGIN IF rising_edge(Clock) THEN IF Reset=‘1’ THEN Q <= ‘0’ ELSE Q <= D; END IF; END IF; END PROCESS; PROCESS (Clock, Reset) BEGIN IF Reset=‘1’ THEN Q <= ‘0’ ELSIF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; Synchronous Reset Synchronous FF Synchronous Reset Synchronous FF Asynchronous Reset Synchronous FF Asynchronous Reset Synchronous FF

CWRU EECS 317 D-Flip Flops: Asynchronous Reset & Preset PROCESS (Clock, Reset, Preset) BEGIN IF Reset=‘1’ THEN --highest priority Q <= ‘0’; ELSIF Preset=‘1’ THEN Q <= ‘0’; ELSIF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; PROCESS (Clock, Reset, Preset) BEGIN IF Reset=‘1’ THEN --highest priority Q <= ‘0’; ELSIF Preset=‘1’ THEN Q <= ‘0’; ELSIF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS;

CWRU EECS 317 VHDL clock behavioral component ENTITY clock_driver IS GENERIC (Speed: TIME := 5 ns); PORT (Clk: OUT std_logic); END; ENTITY clock_driver IS GENERIC (Speed: TIME := 5 ns); PORT (Clk: OUT std_logic); END; ARCHITECTURE clock_driver_arch OF clock_driver IS SIGNAL Clock:std_logic := ‘0’; BEGIN Clk <= Clk XOR ‘1’ after Speed; Clock <= Clk; END ARCHITECTURE; CONFIGURATION clock_driver_cfg OF clock_driver IS FOR clock_driver_arch END FOR; END CONFIGURATION; ARCHITECTURE clock_driver_arch OF clock_driver IS SIGNAL Clock:std_logic := ‘0’; BEGIN Clk <= Clk XOR ‘1’ after Speed; Clock <= Clk; END ARCHITECTURE; CONFIGURATION clock_driver_cfg OF clock_driver IS FOR clock_driver_arch END FOR; END CONFIGURATION;

CWRU EECS 317 Synchronous Sequential Circuit

CWRU EECS 317 Abstraction: Finite State Machine

CWRU EECS 317 FSM Representations

CWRU EECS 317 Moore Machines

CWRU EECS 317 Simple Design Example ENTITY FSM_Parity IS PORT (i1:INstd_logic; o1:OUT std_logic; CLK:INstd_logic; --Clock RST:IN std_logic --Reset ); END;

CWRU EECS 317 State Encoding – –State Encoding is sequentially done by VHDL TYPE FSMStates IS (s1, s2); --s1=0, s2=1 SIGNAL State, NextState: FSMStates; – –The non-sequential case requires the following ATTRIBUTE FSMencode: string; ATTRIBUTE FSMencode of FSMStates: TYPE IS “1 0”;

CWRU EECS 317 Simple Design Example PROCESS (State, i1 ) BEGIN CASE State IS WHEN s1 =>if i1=‘1’ then NextState <= s2; else NextState <= s1; end if; WHEN s2 =>if i1=‘1’ then NextState <= s1; else NextState <= s2; end if; WHEN OTHERS => NextState <= NextState; END CASE; END PROCESS;

CWRU EECS 317 FSM Controller: Current State Process ARCHITECTURE FSM_Parity_arch OF FSM_Parity IS TYPEFSMStates IS (s1, s2); SIGNALState, NextState: FSMStates; BEGIN PROCESS (State, i1) BEGIN CASE State IS WHEN s1 =>if i1=‘1’ thenNextState <= s2; else NextState <= s1; end if; WHEN s2 =>if i1=‘1’ thenNextState <= s1; elseNextState <= s2; end if; WHEN OTHERS => NextState <= NextState; END CASE; END PROCESS; WITH State SELECT o1 <=‘0’ WHEN s1, ‘1’ WHEN s2, ‘1’ WHEN OTHERS; - - X, L, W, H, U

CWRU EECS 317 Alternative: less coding ARCHITECTURE FSM_Parity_arch OF FSM_Parity IS TYPE FSMStates IS (s1, s2); SIGNAL State, NextState: FSMStates; BEGIN PROCESS (State, i1) BEGIN CASE State IS WHEN s1 =>if i1=‘1’ thenNextState <= s2; else NextState <= s1; end if; o1 <= ‘0’; WHEN s2 =>if i1=‘1’ thenNextState <= s1; elseNextState <= s2; end if; o1 <= ‘1’; WHEN OTHERS => o1 <= ‘1’; NextState <= NextState; END CASE; END PROCESS; Important Note: every input to the state machine must be in the PROCESS sensitivity list Important Note: every WHEN must assign the same set of signals: i.e. NextState and o1. if you miss one assignment latches will show up!

CWRU EECS 317 FSM controller: NextState Process PROCESS (CLK, RST) BEGIN IF RST='1' THEN -- Asynchronous Reset State <= s1; ELSIF rising_edge(CLK) THEN State <= NextState; END IF; END PROCESS; END ARCHITECTURE; CONFIGURATION FSM_Parity_cfg OF FSM_Parity IS FOR FSM_Parity_arch END FOR; END CONFIGURATION;

CWRU EECS 317 Logic Implementations Synthesis

CWRU EECS 317 Coke Machine Example

CWRU EECS 317 Coke Machine State Diagram

CWRU EECS 317 Coke Machine Diagram II

CWRU EECS 317 Assignment #6 a) Write the VHDL synchronous code (no latches!) and test bench for the coke II machine. Note: the dc_shell synthesis analyze command will tell you if you inferred latches. Hand code and simulation using the Unix script command. b) Synthesize the your design and hand in the logic diagram, Unix script include cell, area, timing report.