ECEU530. Homework 4 due Wednesday Oct 25. ECE U530 Digital Hardware Synthesis. VHDL for Synthesis with Xilinx. Schedule

Similar documents
EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 6 Combinational and sequential circuits

Sequential Logic - Module 5

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

Timing in synchronous systems

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

ECE 545 Lecture 7. VHDL Description of Basic Combinational & Sequential Circuit Building Blocks. Required reading. Fixed Shifters & Rotators

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Summary of FPGA & VHDL

CHAPTER Pearson Education, Inc. S_n. R_n. Q_n. 0 ps 20 ns 40 ns 60 ns 80 ns. C S R Q Q_n. 0 ps 50 ns 100 ns 150 ns 200 ns

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

Lecture 12 VHDL Synthesis

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

Sequential Circuit Design: Principle

The process. Sensitivity lists

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Concurrent & Sequential Stmts. (Review)

VHDL: RTL Synthesis Basics. 1 of 59

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

[VARIABLE declaration] BEGIN. sequential statements

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. Behavioral Design Style: Registers & Counters.

CprE 583 Reconfigurable Computing

VHDL for Synthesis. Course Description. Course Duration. Goals

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

VHDL And Synthesis Review

Verilog Sequential Logic. Verilog for Synthesis Rev C (module 3 and 4)

Digital Design: An Embedded Systems Approach Using VHDL

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

8 Register, Multiplexer and

VHDL simulation and synthesis

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

VHDL for FPGA Design. by : Mohamed Samy

Finite State Machines (FSM) Description in VHDL. Review and Synthesis

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

VHDL in 1h. Martin Schöberl

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

IT T35 Digital system desigm y - ii /s - iii

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

3 Designing Digital Systems with Algorithmic State Machine Charts

Sequential Circuit Design: Principle

ECE 4514 Digital Design II. Spring Lecture 15: FSM-based Control

Quick Introduction to SystemVerilog: Sequental Logic

CS/EE Homework 7 Solutions

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

In our case Dr. Johnson is setting the best practices

Digital Design with SystemVerilog

EITF35: Introduction to Structured VLSI Design

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

The University of Alabama in Huntsville Electrical and Computer Engineering CPE/EE 422/522 Spring 2005 Homework #6 Solution

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

Lattice VHDL Training

Sequential Statement

Abstraction of State Elements. Sequential Logic Implementation. Forms of Sequential Logic. Finite State Machine Representations

Counters. Counter Types. Variations. Modulo Gray Code BCD (Decimal) Decade Ring Johnson (twisted ring) LFSR

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

HDL. Hardware Description Languages extensively used for:

Finite State Machines

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Sign here to give permission for your test to be returned in class, where others might see your score:

VHDL for Logic Synthesis

State Machine Descriptions

ECEU530. Project Presentations. ECE U530 Digital Hardware Synthesis. Rest of Semester. Memory Structures

A bird s eye view on VHDL!

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA

Nanosistemų programavimo kalbos 5 paskaita. Sekvencinių schemų projektavimas

EEL 4783: HDL in Digital System Design

Inferring Storage Elements

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

Mealy and Moore examples

Verilog for Synthesis Ing. Pullini Antonio

Lecture 08 Finite State Machine Design Using VHDL

SEQUENTIAL STATEMENTS

Computer-Aided Digital System Design VHDL

Control and Datapath 8

Blocking(=) vs Nonblocking (<=) Assignment. Lecture 3: Modeling Sequential Logic in Verilog HDL. Procedural assignments

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project


Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

Introduction to VHDL #3

VHDL for Logic Synthesis

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement

Hardware Description Languages. Modeling Complex Systems

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

Sequential Logic Design

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

FINITE STATE MACHINES (FSM) DESCRIPTION IN VHDL. Cristian Sisterna UNSJ

Homework deadline extended to next friday

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

Transcription:

EEU530 EE U530 igital Hardware Synthesis Lecture 11: Prof. Miriam Leeser mel@coe.neu.edu October 18, 2005 Sequential Logic in VHL Finite State Machines in VHL Project proposals due now HW 4 due Wednesday, October 25 Use the discussion board to post questions Homework 4 due Wednesday Oct 25 Write a testbench for the ALU from Homework 3 Write the MUX function from lecture 10 Write code that calls the MUX function EE U530 F06 2 Schedule Homework 4 due Wednesday, October 25 Review in class on Monday, October 30 Midterm in class on Wednesday, November 1 Homework 5: based on EEU323 Lab 4 ue Wednesday November 8 VHL for Synthesis with Xilinx ocumentation available from Xilinx: link on course web page (External Links) http://www.xilinx.com/support/sw_manuals/xilinx6/index.htm From the PF collection, we are interested in: Synthesis and Verification esign Guide XST Users Guide Some material in this lecture is from: XST Users Guide hapter 6 VHL language support: Sequential ircuits 3 4

EEU530 Sequential HW in VHL We will describe synchronous, sequential hardware in VHL Synchronous, sequential hardware is clocked flip-flops registers and shift registers counters state machines I can describe sequential hardware with sequential VHL statements concurrent VHL statements signal assignments same as combinational hardware ombinational Hardware in VHL Process has no wait statements or clock signals All signals on RHS of assignments appear in process sensitivity list Example of a good combinational HW description: A B process(a, B, ) variable : Std_Logic; if A='1' then := B; else := B or ; F <= ; F 5 6 Good ombinational Techniques All signals that effect result go in process sensity list Any signal assigned in one branch is assigned in all branches: of a case statement of if-then-else clause Use case statements (NOT nested if-then-else statements) to avoid inferring priority encoder Use don t cares to assign to outputs Never use don t cares in a comparison statement Sequential Logic when you don t want it You can write combinational VHL that synthesizes to sequential hardware that you did not intend No clock signal, no wait signal latches are synthesized If you use the VHL term unaffected Why? If you use the VHL term null Why? If you do NOT put the same assignment on every branch of your if--then--else or ASE statements Why? 7 8

EEU530 GOO If statement example signal A, B,, P1, P2, Y, Z: std_logic; process ( A, B,, P1, P2 ) Y <= 0 ; Z <= 1 ; if (P1 = 1 ) then Y <= A; elsif (P2 = 0 ) then Y <= B; else Z <= ; Null and Unaffected case opcode is when add => Acc1 <= Acc + operand; when subtract => Acc1 <= Acc - operand; when nop => null; end case; with sel select Z <= A when 0, Z <= B when 1, Z <= unaffected when others; 9 10 Sequential Logic when you want it Process statement with lock on sensitivity list or wait statement Wait statement or sensitivity list, never both locked, sequential hardware with sensitivity list o NOT put all signals on Right hand side on sensitivity list o put on sensitivity list clock plus any asynchronous inputs: lock, or lock and reset, or lock and set, or lock and reset and set 11 wait statements wait can be used to suspend a process for a specified time period Example: Using wait in a testbench: -- ********************************* -- process for simulating the clock process clk <= not(clk); wait for 20 ns; -- ********************************* an also wait on a signal or on an event wait until clk event wait until clk event and clk = 1 wait until clk event and clk = 0

EEU530 Process Simulation Process can have wait statement or sensitivity list, but not both If process has sensitivity list, process is executed once at simulation start up, and after that when a signal on the sensitivity list changes If process has has a wait statement, process is executed at simulation start up, until wait statement is executed, then it suspends Process wakes up when wait condition is met Sequential vs. ombinational HW ombinational ircuits Output depends on current values of inputs only No feedback No memory Sequential Hardware Feedback Output depends on current inputs and current state ircuit has memory elements Sequential Hardware = ombinational Hardware plus memory elements: latches, flipflops, memories... 13 14 Sequential Hardware in VHL Synchronous Only lock May or may not have a reset signal Sequential Hardware is defined with a particular style VHL synthesis tool looks for hardware described using that style, and translates it to flip-flops and combinational logic lock signal is special. Usually called LK 15 Latch in VHL -- _LATH.VH library IEEE; use IEEE.std_logic_1164.all; entity d_latch is port ( EN, ATA: in ST_LOGI; Q: out ST_LOGI); end d_latch; architecture BEHAV of d_latch is LATH: process (EN, ATA) if (EN = '1') then Q <= ATA; end BEHAV; 16

EEU530 -Flipflop library IEEE; use IEEE.std_logic_1164.all; entity d_ff is port ( LK, ATA: in ST_LOGI; Q: out ST_LOGI ); end d_ff; architecture BEHAV of d_ff is process (LK) if (LK'event and LK='1') then Q <= ATA; end BEHAV; -Flipflop with wait statement library IEEE; use IEEE.std_logic_1164.all; entity d_ff is port ( LK, ATA: in ST_LOGI; Q: out ST_LOGI ); end d_ff; architecture with_wait of d_ff is process wait until rising_edge(lk); Q <= ATA; end BEHAV; 17 18 Edge etection Functions FUNTION rising_edge (SIGNAL s : std_logic) RETURN BOOLEAN IS BEGIN RETURN (s EVENT AN (s = 1 )); EN; FUNTION falling_edge (SIGNAL s : std_logic) RETURN BOOLEAN IS BEGIN RETURN (s'event AN s = 0 )); EN; IMPORTANT: Use these only with the clk signal -FF with Reset process (LK, RST) if RST = '1' then Q <= 0 ; elsif LK'EVENT and LK = '1' then Q <= ata; Asynchronous Set is similar 19 20

EEU530 -FF with lock Enable Not supported: wait until LOK'event and LOK = '0' and ENABLE = '1' ; Supported: wait until LOK'event and LOK = '0' ; if ENABLE = '1' then... process() if 'event and ='1' then -- or rising_edge() if ENABLE = '1' then Q <= ATA; -FF with Asynchronous Reset and Synchronous Enable process(rst, ) if Rst = '0' then Q <= '0'; elsif rising_edge() then if EN = 1 then Q <= ; 21 22 locked Flip-flop Active Low Reset on a FF Q Q Q Q process() if rising_edge() then Q <= ; -- or -- process wait until rising_edge(lk); Q <= ; end process Rst R process(rst, ) if Rst = '0' then Q <= '0'; elsif rising_edge() then Q <= ; Active low 23 24

EEU530 (7 downto 0) Q(7 downto 0) Register (Eight-bit) (7) (6) (5) (4) (3) (2) (1) (0) process() if rising_edge() then Q <= ; This register has no reset 25 Q(7) Q(6) Q(5) Q(4) Q(3) Q(2) Q(1) Q(0) 8 bit register entity EXAMPLE is port (I : in ST_LOGI_VETOR (7 downto 0); LK : in ST_LOGI; O : out ST_LOGI_VETOR (7 downto 0)); end EXAMPLE; architecture ARH1 of EXAMPLE is process (LK) if LK'EVENT and LK = '1' then O <= I ; end ARH1; architecture ARH2 of EXAMPLE is process wait until LK'EVENT and LK = '1'; O <= I; end ARH2; 26 8 bit register with reset entity EXAMPLE is port ( I : in ST_LOGI_VETOR (7 downto 0); LK : in ST_LOGI; RST : in ST_LOGI; O : out ST_LOGI_VETOR (7 downto 0) ); end EXAMPLE; architecture ARHI of EXAMPLE is process (LK, RST) if RST = '1' then O <= "00000000"; elsif LK'EVENT and LK = '1' then O <= I ; end ARHI; Shift Register (Eight-bit) Ser_In Q(7 downto 0) process() if rising_edge() then Q <= Q(6 downto 0) & Ser_In; 27 28

EEU530 Parallel-In/Serial-Out Shift Register (Eight-bit) signal :Std_Logic_Vector(7 downto 0); ount Binary ounter (Eight-bit) Q(7 downto 0) Ser_Out <= Q(7); process() if rising_edge() then if Load = '0' then Q <= ; else Q <= Q(6 downto 0) & '0'; Load Ser_Out "00000001" + Q(7 downto 0) process() ount if rising_edge() then if ount = '1' then Q <= Q + 1; Note: The VHL shown must have a function "+" defined to be complete. 29 30 ounter with Asynchronous Reset What hardware gets inferred? entity EXAMPLE is port (LK : in ST_LOGI; RST : in ST_LOGI; O : out ST_LOGI_VETOR (7 downto 0) ); end EXAMPLE; architecture ARHI of EXAMPLE is process (LK, RST) variable OUNT : ST_LOGI_VETOR (7 downto 0); if RST = '1' then OUNT := "00000000"; elsif LK'EVENT and LK = '1' then OUNT := OUNT + "00000001"; O <= OUNT; end ARHI; <= A and B; <= not ; process() if rising_edge() then Q_r <= ; A B Q Q_r 31 32

EEU530 What hardware gets inferred? process() if rising_edge() then <= A and B; <= not ; Q_r <= ; A B 33 Q clk Q clk Q clk Q_r A B Q A B SAs with Processes (one flip-flop) 0 ns 10 ns 20 ns 30 ns 40 ns 50 ns 60 ns Q Q_r <= A and B after 5 ns; <= not after 10 ns; process() if rising_edge() then Q_r <= ; 34 SAs with Processes (multiple flip-flops) A B A_r Q B_r 0 ns 10 ns 20 ns 30 ns 40 ns 50 ns 60 ns B A Q Q A_r B_r Q Q_r <= A_r and B_r after 5 ns; <= not after 10 ns; process() if rising_edge() then Q_r <= ; A_r <= A; B_r <= B; 35 36

EEU530 37 38 Latches Flip-Flops Registers Shift registers ounters Sequential Hardware Finite state machines 39 40

EEU530 Sequential Hardware Model Finite State Machine Input Present State Variables omb kt Memory Feedback Outputs Next State Variables Inputs Next state logic State register This is a Moore machine Outputs depend on current state only Output Logic Outputs 41 42 Finite State Machine State Machine iagram State Name Inputs Next state logic State register Output Logic Outputs State0 Out1<= 0 Out2<= 1 Moore Machine Outputs Moore machine: outputs depend on current state only Mealy machine: outputs depend on current state and inputs Asynch reset will be shown once In1= 0 and In2= 1 Reset ondition to transition between states 43 44

EEU530 Example: Stop Watch 1 State iagram Inputs: Start_stop, Reset Outputs: ount enable: advance time lear: reset time START_STOP E RESET STOPWATH LEAR ounter and isplay 45 46 To escribe an FSM in VHL Next state function Output function State register to store current state Each can be its own process Which processes are combinational? Which processes are sequential? FSM escription in VHL architecture FSM of EMO is type STATE_TYPE is ( ); signal URRENT_STATE, NEXT_STATE : STATE_TYPE; STATE_REG: process(lk, RESET)... NEXT_STATE_LOGI: process(urrent_state, <inputs>)... OUTPUT_LOGI: process(urrent_state)... end FSM; 47 48

EEU530 Stopwatch FSM Entity library IEEE; use IEEE.std_logic_1164.all; entity STOPWATH is port( LK, RESET, START_STOP: in std_logic; E, LEAR: out std_logic); end STOPWATH; START_STOP E efining States architecture FSM of STOPWATH is type STATE_TYPE is (ZERO, START, OUNT, STOP, STOPPE);...... end FSM; RESET STOPWATH LEAR ounter and isplay 49 50 State Register is only Sequential Part architecture FSM of STOPWATH_TRL is type STATE_TYPE is (ZERO, START, OUNT, STOP, STOPPE); signal URRENT_STATE, NEXT_STATE : STATE_TYPE; STATE_REG: process(lk, RESET) if (RESET = '0') then URRENT_STATE <= ZERO; elsif (rising_edge(lk)) then URRENT_STATE <= NEXT_STATE;... end FSM; Next State Logic NS_LOGI: process (URRENT_STATE, START_STOP) case URRENT_STATE is when ZERO => if(start_stop = '1')then NEXT_STATE <= START; else NEXT_STATE <= ZERO; when START => if(start_stop = '1')then NEXT_STATE <= START; else NEXT_STATE <= OUNT; when OUNT => if(start_stop = '1')then NEXT_STATE <= STOP; else NEXT_STATE <= OUNT; 51 52

EEU530 Next State Logic (cont d) when STOP => if(start_stop = '1')then NEXT_STATE <= STOP; else NEXT_STATE <= STOPPE; when STOPPE => if(start_stop = '1')then NEXT_STATE <= START; else NEXT_STATE <= STOPPE; when others => NEXT_STATE <= ZERO; end case; Output Logic OUTPUT_LOGI: process(urrent_state) case URRENT_STATE is when ZERO => E <= '0'; LEAR <= '1'; when START => E <= '1'; LEAR <= '0'; when OUNT => E <= '1'; LEAR <= '0'; when STOP => E <= '0'; LEAR <= '0'; when STOPPE => E <= '0'; LEAR <= '0'; when others => E <= '0'; LEAR <= '1'; end case; 53 54 To escribe FSM in VHL reate an enumerated type for states Three processes for behavior of FSM 1. clocked process for state register 2. combinational process for next state logic sensitivity list : inputs and current state 3. combination process for outputs Moore Machine: sensitivity list: current state Mealy Machine: sensitivity list: current state and inputs Where does reset go? 55 56