VHDL for Modeling - Module 10

Similar documents
Verilog for Modeling - Module 9

Sequential Logic - Module 5

Test Benches - Module 8

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

Sequential Statement

Computer-Aided Digital System Design VHDL

Problem Set 10 Solutions

Field Programmable Gate Array

Verilog Module 1 Introduction and Combinational Logic

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

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

In our case Dr. Johnson is setting the best practices

Note: Closed book no notes or other material allowed, no calculators or other electronic devices.

Summary of FPGA & VHDL

EEL 4712 Digital Design Test 1 Spring Semester 2007

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

Design Problem 3 Solutions

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

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

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

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

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

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

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

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

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

Timing in synchronous systems

Introduction to VHDL Lecture D

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

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

Experiment 0 OR3 Gate ECE 332 Section 000 Dr. Ron Hayne June 8, 2003

VHDL Examples Mohamed Zaky

Digital Design with SystemVerilog

EITF35: Introduction to Structured VLSI Design

[VARIABLE declaration] BEGIN. sequential statements

CS/EE Homework 7 Solutions

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

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3

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

VHDL And Synthesis Review

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

VHDL/Verilog Simulation. Testbench Design

CCE 3202 Advanced Digital System Design

Design Examples. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

The University of Alabama in Huntsville ECE Department CPE Final Exam Solution Spring 2004

VHDL in 1h. Martin Schöberl

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

ENGG3380: Computer Organization and Design Lab4: Buses and Peripheral Devices

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

Mridula Allani Fall Fall

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

FPGA briefing Part II FPGA development DMW: FPGA development DMW:

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

VHDL for Logic Synthesis

Quartus Counter Example. Last updated 9/6/18

Hardware Description Language VHDL (1) Introduction

VHDL Simulation. Testbench Design

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

HDL. Hardware Description Languages extensively used for:

VHDL: RTL Synthesis Basics. 1 of 59

Chapter 2 Solutions. 2.1 (a) VHDL - VHSIC Hardware Description Language VHSIC - Very High Speed Integrated Circuit

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

CSE 260 Digital Computers: Organization and Logical Design. Exam 2. Jon Turner 3/28/2012

COVER SHEET: Total: Regrade Info: Problem#: Points. 7 (14 points) 6 (7 points) 9 (6 points) 10 (21 points) 11 (4 points)

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Control and Datapath 8

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

MCPU - A Minimal 8Bit CPU in a 32 Macrocell CPLD.

Design Problem 4 Solution

EL 310 Hardware Description Languages Midterm

Introduction to VHDL #3

Lecture 12 VHDL Synthesis

EEL 4712 Name: SOLUTION Midterm 1 Spring 2016 VERSION 1 UFID:

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

PACKAGE. Package syntax: PACKAGE identifier IS...item declaration... END PACKAGE [identifier]

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

COVER SHEET: Total: Regrade Info: 1 (8 points) 2 ( 8 points) 3 (16 points) 4 (16 points) 5 (16 points) 6 (16 points) 7 (16 points) 8 (8 points)

Laboratory Exercise 8

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

CSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0

Sign here to give permission to return your test in class, where other students might see your score:

COVER SHEET: Total: Regrade Info: 2 (6 points) 3 (8 points) 4 (10 points) 8 (12 points) 6 (6 points) 7 (6 points) 9 (30 points) 10 (4 points)

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

Constructing VHDL Models with CSA

A Brief Introduction to Verilog Hardware Definition Language (HDL)

The CPU Bus : Structure 0

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

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

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

Verilog introduction. Embedded and Ambient Systems Lab

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

Verilog. Verilog for Synthesis

Assignment 01 Computer Architecture Lab ECSE

The Virtex FPGA and Introduction to design techniques

Exp#8: Designing a Programmable Sequence Detector

EEL 4712 Digital Design Test 2 Spring Semester 2008

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

Transcription:

VHDL for Modeling Module 10 Jim Duckworth, WPI 1

Overview General examples AND model Flip-flop model SRAM Model Generics DDR SDRAM Model Constraints Metastability Block Statements Just for reference Jim Duckworth, WPI 2

We have covered VHDL for Modeling VHDL for Synthesis VHDL for testing (simulation) Now - VHDL for modeling Describes the expected behavior of a component or device Can be used to test other components for example a model of a CPU could be used to test: UART DRAM memory controller cache controller Jim Duckworth, WPI 3

AND gate model -- 74LS08 model (typical delays) ENTITY ls08 IS END ls08; PORT(a, b : IN std_logic; c : OUT std_logic); ARCHITECTURE behav OF ls08 IS BEGIN END behav; c <= 1 AFTER 8 ns WHEN a = 1 AND b = 1 ELSE 0 AFTER 10 ns; Jim Duckworth, WPI 4

Simulation Results Jim Duckworth, WPI 5

D flip-flop model -- 74LS74 model (typical delays) -- 74LS74 model (typical delays) ENTITY ENTITY ls74 ls74 IS IS PORT(d, PORT(d, clr, clr, pre, pre, clk clk : : IN IN std_logic; std_logic; q : OUT std_logic); q : OUT std_logic); END END ls74; ls74; ARCHITECTURE ARCHITECTURE behav behav OF OF ls74 ls74 IS IS BEGIN BEGIN PROCESS(clk, clr, pre) PROCESS(clk, clr, pre) BEGIN BEGIN IF clr = 0 THEN IF clr = 0 THEN q <= 0 AFTER 25 ns; q <= 0 AFTER 25 ns; ELSIF pre = 0 THEN ELSIF pre = 0 THEN q <= 1 AFTER 13 ns; q <= 1 AFTER 13 ns; ELSIF clk EVENT AND clk = 1 THEN ELSIF clk EVENT AND clk = 1 THEN IF IF d d = = 1 1 THEN THEN q q <= <= 1 1 AFTER AFTER 13 13 ns; ns; ELSE ELSE q q <= <= 0 0 AFTER AFTER 25 25 ns; ns; END END IF; IF; END END IF; IF; END END PROCESS; PROCESS; END END behav; behav; Jim Duckworth, WPI 6

Simulation Results Jim Duckworth, WPI 7

Adding Constants - same as previous -- 74LS74 model (typical delays) ENTITY ls74 IS PORT(d, clr, pre, clk : IN std_logic; q : OUT std_logic); CONSTANT t_rise : TIME := 13 ns; CONSTANT t_fall : TIME := 25 ns; END ls74; ARCHITECTURE behav OF ls74 IS BEGIN PROCESS(clk, clr, pre) BEGIN IF clr = 0 THEN q <= 0 AFTER t_fall; ELSIF pre = 0 THEN q <= 1 AFTER t_rise; ELSIF clk EVENT AND clk = 1 THEN IF d = 1 THEN q <= 1 AFTER t_rise; ELSE q <= 0 AFTER t_fall; END IF; END IF; END PROCESS; END behav; Jim Duckworth, WPI 8

Adding setup and pulse width checks LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY ls74 IS PORT(d, clr, pre, clk : IN std_logic; q : OUT std_logic); CONSTANT t_rise : TIME := 13 ns; CONSTANT t_fall : TIME := 25 ns; CONSTANT t_setup : TIME := 20 ns; CONSTANT t_width : TIME := 25 ns; END ls74; Jim Duckworth, WPI 9

Basic D flip-flop description same ARCHITECTURE behav OF ls74 IS BEGIN PROCESS(clk, clr, pre) BEGIN IF clr = '0' THEN q <= '0' AFTER t_fall; ELSIF pre = '0' THEN q <= '1' AFTER t_rise; ELSIF clk'event AND clk = '1' THEN IF d = '1' THEN q <= '1' AFTER t_rise; ELSE q <= '0' AFTER t_fall; END IF; END IF; END PROCESS; Jim Duckworth, WPI 10

Add setup and pulse width checks -- process to check data setup time PROCESS(clk) BEGIN IF clk'event AND clk = '1' THEN ASSERT d'last_event > t_setup REPORT "D changed within setup time" SEVERITY ERROR; END IF; END PROCESS; -- process to check clock high pulse width PROCESS(clk) VARIABLE last_clk : TIME := 0 ns; BEGIN IF clk'event AND clk = '0' THEN ASSERT NOW - last_clk > t_width REPORT "Clock pulse width too short" SEVERITY ERROR; ELSE last_clk := NOW; END IF; END PROCESS; END behav; Jim Duckworth, WPI 11

LS74 Model in ModelSim Jim Duckworth, WPI 12

Test Bench without SRAM SRAM connections are open DSP Picoblaze ZZ Display Jim Duckworth, WPI 13

SRAM model simplified, no delays Jim Duckworth, WPI 14

New testbench Adding the SRAM model DSP Picoblaze Display SRAM Model Jim Duckworth, WPI 15

Adding the SRAM model to the test bench Jim Duckworth, WPI 16

ISSI SRAM Verilog Model (partial) // IS61LV25616 Asynchronous SRAM, 256K x 16 = 4M; speed: 10ns. // Note; 1) Please include "+define+ OEb" in running script if you want to check // timing in the case of OE_ being set. // 2) Please specify access time by defining tac_10 or tac_12. // `define OEb `define tac_10 `timescale 1ns/10ps module IS61LV25616 (A, IO, CE_, OE_, WE_, LB_, UB_); parameter dqbits = 16; parameter memdepth = 262143; parameter addbits = 18; parameter Toha = 2; parameter Tsa = 2; `ifdef tac_10 parameter Taa = 10, Thzce = 3, Thzwe = 5; `endif `ifdef tac_12 parameter Taa = 12, Thzce = 5, Thzwe = 6; `endif input CE_, OE_, WE_, LB_, UB_; input [(addbits - 1) : 0] A; inout [(dqbits - 1) : 0] IO; wire [(dqbits - 1) : 0] dout; reg [(dqbits/2-1) : 0] bank0 [0 : memdepth]; Jim Duckworth, WPI 17

Generics Generics useful for making design units more general purpose Generics allow information to be passed into a design description Example information propagation delays size of component (changing input and output ports) load capacitance/resistance Jim Duckworth, WPI 18

LS08 example with generics -- 74LS08 model ENTITY ls08 IS GENERIC(t_rise, t_fall : TIME); END ls08; PORT(a, b : IN std_logic; c : OUT std_logic); ARCHITECTURE behav OF ls08 IS BEGIN END behav; c <= 1 AFTER t_rise WHEN a = 1 AND b = 1 ELSE 0 AFTER t_fall; This is now a parameterized model (general purpose) rather than hard-coded version Actual delay is determined at simulation time (or synthesis) by value passed to model Jim Duckworth, WPI 19

Instantiating Components with Generics -- example use of LS08 with generic values ENTITY test IS PORT(in1, in2, in3 : IN std_logic; END test; out1 : OUT std_logic); ARCHITECTURE behav OF test IS BEGIN END behav; COMPONENT ls08 GENERIC(t_rise, t_fall : TIME); PORT(a, b : IN std_logic; c : OUT std_logic); END COMPONENT; SIGNAL int : std_logic; u1: ls08 GENERIC MAP(8 ns, 10 ns) -- typical delays PORT MAP(a => in1, b => in2, c => int); u2: ls08 GENERIC MAP(15 ns, 20 ns)-- max delays PORT MAP(a => int, b => in3, c => out1); Jim Duckworth, WPI 20

Another Example (with default values) Can provide default values for generics Only need GENERIC MAP if necessary to change them ENTITY and2 IS GENERIC(t_rise, t_fall : TIME := 10 ns; load : INTEGER := 3); PORT(a, b IN : IN std_logic; c : OUT std_logic); END and2; ARCHITECTURE generic_model OF and2 IS BEGIN c <= 1 AFTER (t_rise + (load * 2 ns)) WHEN a = 1 AND b = 1 ELSE 0 AFTER (t_fall + (load * 2 ns)); END generic_model; u1: and2 GENERIC MAP(5 ns, 7 ns, 4) PORT MAP (a = > ); -- default overridden u2: and2 PORT MAP(a => ); -- uses default values Jim Duckworth, WPI 21

Modifying Component Size Jim Duckworth, WPI 22

Making two copies different size Jim Duckworth, WPI 23

Schematic of two shift registers Jim Duckworth, WPI 24

DDR SDRAM Model Jim Duckworth, WPI 25

DDR SDRAM Model (cont d) Jim Duckworth, WPI 26

DDR SDRAM Model (cont d) Jim Duckworth, WPI 27

DDR SDRAM Model (cont d) Jim Duckworth, WPI 28

DDR SDRAM Model (cont d) Jim Duckworth, WPI 29

Metastability Flip-flops may go metastable if input signals do not meet setup and hold specifications relative to clock signal CLK D Q Rules: Input only drives one FF Add 2-FF synchronizer IF clk EVENT AND clk = 1 THEN input_d <= input; input_dd <= input_d; Jim Duckworth, WPI 30

Constraints (for ref) Used to guide the synthesis tools Example 32-bit counter - no constraints (speed grades -4 and -5) ====================================================== Advanced HDL Synthesis Report Macro Statistics # Counters : 1 32-bit up counter : 1 ====================================================== Timing Summary: --------------- Speed Grade: -4 Minimum period: 6.680ns (Maximum Frequency: 149.703MHz) Minimum input arrival time before clock: No path found Maximum output required time after clock: 8.094ns Maximum combinational path delay: No path found =============================================== Speed Grade: -5 Minimum period: 5.767ns (Maximum Frequency: 173.400MHz) Jim Duckworth, WPI 31

Adding timing constraint Add to UCF file: NET "clk" PERIOD = 6ns HIGH 50%; WARNING:Par:62 - Your design did not meet timing. ------------------------------------------------------------------------------------------- Constraint Check Worst Case Best Case Timing Timing Slack Achievable Errors Score ------------------------------------------------------------------------------------------- * NET "clk_bufgp/ibufg" PERIOD = 6 ns HIGH SETUP -0.456ns 6.456ns 9 1430 50% HOLD 2.432ns 0 0 ------------------------------------------------------------------------------------------- 1 constraint not met. Jim Duckworth, WPI 32

Try relaxing constraint NET "clk" PERIOD = 6.5ns HIGH 50%; ---------------------------------------------------------------------------------- Constraint Check Worst Case Best Case Timing Timing Slack Achievable Errors Score ---------------------------------------------------------------------------------- NET "clk_bufgp/ibufg" PERIOD = 6.5 ns HIG SETUP 0.203ns 6.297ns 0 0 H 50% HOLD 2.280ns 0 0 ---------------------------------------------------------------------------------- All constraints were met. Also see Timing Constraint User Guide Examples: NET abc OFFSET = OUT xx ns AFTER clk ; NET def OFFSET = IN xx ns BEFORE clk ; Jim Duckworth, WPI 33

BLOCK statements (for ref) BLOCK statements can be used to partition and logically group areas of the design Like a schematic sheet Example: design of a CPU, divide into ALU block Control block Decode block Blocks represent a self-contained area, each block can: declare lcoal signals types, constants, etc. Blocks can reference signals from a level above Jim Duckworth, WPI 34

Example ENTITY cpu IS PORT(clk : IN std_logic; input_bus : IN std_logic_vector(63 DOWNTO 0); ); -- port descriptions END cpu; ARCHITECTURE block_model OF cpu IS SIGNAL instruction_bus, src_operand : std_logic_vector(63 DOWNTO 0); BEGIN alu: BLOCK SIGNAL inst_bus, data_bus : std_logic_vector(31 DOWNTO 0); BEGIN -- statements describing ALU operation END BLOCK alu; decode: BLOCK SIGNAL ; -- signals local to this decode block BEGIN -- statements describing decode operation END BLOCK decode; END block_model; Jim Duckworth, WPI 35