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

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

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

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Assignment 01 Computer Architecture Lab ECSE

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

Introduction to VHDL #3

Homework deadline extended to next friday

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

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

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

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

Sequential Logic - Module 5

Summary of FPGA & VHDL

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

EECE 353: Digital Systems Design Lecture 10: Datapath Circuits

In our case Dr. Johnson is setting the best practices

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

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

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

ELCT 501: Digital System Design

Timing in synchronous systems

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

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)

VHDL in 1h. Martin Schöberl

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

EITF35: Introduction to Structured VLSI Design

ECE 545 Lecture 4. Simple Testbenches. George Mason University

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

Test Benches - Module 8

Contents. Chapter 9 Datapaths Page 1 of 28

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

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

Field Programmable Gate Array

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

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

VHDL: RTL Synthesis Basics. 1 of 59

Control Unit: Binary Multiplier. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

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

Lecture 5: Aldec Active-HDL Simulator

Introduction to VHDL #1

Designing with VHDL and FPGA

ECE U530 Digital Hardware Synthesis. Programming Assignments

Controller FSM Design Issues : Correctness and Efficiency. Lecture Notes # 10. CAD Based Logic Design ECE 368

Lecture 12 VHDL Synthesis

ENGR 5865 DIGITAL SYSTEMS

Computer-Aided Digital System Design VHDL

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

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

Sequential Statement

Basic Language Concepts

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

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

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

Control and Datapath 8

DOD, VHSIC ~1986, IEEE stnd 1987 Widely used (competition Verilog) Commercial VHDL Simulators, Synthesizers, Analyzers,etc Student texts with CDROMs

VHDL Notes for Week 4. VHDL Programming in CprE 381. Entity and Component 9/22/2014. Generic Constant. Test bench

Hardware Description Language VHDL (1) Introduction

Step 1 in transitioning to behavioral modeling. But here 1-to-1 with our gate level model.

Problem Set 10 Solutions

Writing VHDL for RTL Synthesis

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

Tutorial on Simulation using Aldec Active-HDL Ver 1.0

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

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

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

CprE 381 Computer Organization and Assembly Level Programming

[VARIABLE declaration] BEGIN. sequential statements

Exp#8: Designing a Programmable Sequence Detector

FPGA for Software Engineers

VHDL Examples Mohamed Zaky

Digital Design and Computer Architecture

CCE 3202 Advanced Digital System Design

Solutions - Homework 4 (Due date: November 9:30 am) Presentation and clarity are very important!

ECE 545 Lecture 12. FPGA Resources. George Mason University

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1)

ECE 587 Hardware/Software Co-Design Lecture 11 Verification I

ECE 3220 Digital Design with VHDL. Course Information. Lecture 1

VHDL for Modeling - Module 10

VHDL Simulation. Testbench Design

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

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

Lecture 2B. RTL Design Methodology. Transition from Pseudocode & Interface to a Corresponding Block Diagram

ENSC E-123: HW D3: Counter Applications; Counter in Verilog

EL 310 Hardware Description Languages Midterm

Hardware Description Languages. Modeling Complex Systems

Digital Design Laboratory Lecture 2

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

8 Register, Multiplexer and

CS/EE Homework 7 Solutions

CprE 583 Reconfigurable Computing

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

ECEU530. Last Few Lectures. ECE U530 Digital Hardware Synthesis. What is on Quiz 2. Projects. Today:

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

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

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

Lab 3. Advanced VHDL

EEL 4712 Digital Design Test 1 Spring Semester 2008

VHDL simulation and synthesis

Transcription:

ECE U530 Digital Hardware Synthesis Prof. Miriam Leeser mel@coe.neu.edu November 6, 2006 Classes November 6 and 8 are in 429 Dana! Lecture 15: Homework 5: Datapath How to write a testbench for synchronous circuits HW 5: Due Wednesday, November 8 Project Progress reports due Friday, November 10 Schedule Classes on November 6 and 8 will be in 429 Dana Homework 5 due Wednesday, November 8 Write the Datapath for the calculator from ECEU323 in VHDL Use the posted entity Project progress report due Friday, November 10: and email to me telling me where your project stands some working VHDL code in your home directory Homework 6: Lab 5 due Wednesday November 15 November 15 th and 20 th : student presentations on projects: sign up for a date to do your project presentation Sign up to demo your working project code November 20 th or 21 st ECE U530 F06 2 Datapath for the Calculator (HW 5) HW 5 Datapath Entity library ieee; use ieee.std_logic_1164.all; entity datapath is port ( din : in std_logic_vector (3 downto 0); dout : out std_logic_vector (3 downto 0); cout : out std_logic; sm : in std_logic; -- mux selector sa : in std_logic_vector (2 downto 0); -- alu mode selectors ss : in std_logic_vector (1 downto 0); -- stack mode selectors clk : in std_logic -- clock ); end datapath; 3 4

Stack for Datapath entity stack is port( clk, reset : in std_logic; -- clock ss : in std_logic_vector (1 downto 0); din : in std_logic_vector (4 downto 0); tos : out std_logic_vector (4 downto 0) ); end stack; architecture behavioral of stack is begin -- <<enter your statements here>> end behavioral; Implement the Stack: Stack Function Stack select hold 0, 1 push 2 pop 3 In lab, used shift registers to implement the stack In VHDL, use behavioral code to implement the stack How? Hint: Create internal state for the stack Looks like a simple state machine Output is simply TOS Note: Stack has an asynchronous reset 5 6 Stack Shift Register ARCHITECTURE behavioral of stack IS SUBTYPE five_bit is std_logic_vector (4 downto 0); TYPE four_array IS ARRAY (3 downto 0) OF five_bit; SIGNAL stk, next_stack : four_array; begin -- process for updating stack state Why do you need a new stack? entity shift is port(clk, SI : in std_logic; SO : out std_logic); end shift; architecture archi of shift is signal next_state, state: std_logic_vector(3 downto 0); begin process begin next_state <= state(2 downto 0) & SI; wait until (Clk'event and Clk = '1'); state <= next_state; end process; SO <= state(3); end archi; 7 8

Testbench Design Already seen basics of how to write one (Lecture 7) Libraries, Entity, Architecture Instance of Unit Under Test (UUT) Process to control clock Today: More important concepts Which input combinations should I try? Self-checking testbenches Simple UUTs Combinational circuits are easy to test Inputs can come in any order Outputs are only dependent on current input, not previous inputs Usually we can test combinational circuits exhaustively (all possible combinations of inputs) loops are often useful here 9 10! " #$ $% &&' ()!%"#%% &' Simple UUT: AOI Simple UUT: Testbench (1) &** '' & + $ $% + 11 12

Simple UUT: Testbench (2) $', -% $ $ +).,% )./% ).% ).-% ).% What does it do? cycles through 0(0000) to 15(1111) are assigned to bits of This covers all possible inputs to the circuit &$ '$$)- -0 () '' % /- & Coverage is an important term when testing any circuit How much functionality did I actually test? 13 14 How do I know it works? (1) Inspection: Run it in Modelsim and see if the output is what you expect Have to figure out all the correct outputs yourself There are only 4 inputs (16 possible values) here, so this is pretty easy and doable What if I have a lot of inputs, or a more complex circuit? How do I know it works? (2) Golden Standard: Compare the output to another circuit which implements the same function Ex.: Behavioral model vs. Structural model Instantiate a standard circuit alongside the UUT, connected to the same inputs If the outputs are the same, the UUT works Requires a circuit that already works! 15 16

Golden Standard example $& + ).,% )./% ).% ).-% ).% $ + ).,% )./% ).% ).-% ).% How do I know it works? (3) Self-checking: Write the correct answers directly into the testbench VHDL has an function for just this sort of concept (textbook p.77) You still need to know what the outputs are supposed to be No more squinting at Modelsim waveforms! $ % 17 18 Assert: Syntax Assert: Parameters 1% 23+4 5 2' ' 5 ' )67 The error message is printed if the assertion fails, i.e. the condition is not met In other words, 1 should be the CORRECT value There is a default error message ( Assertion violation ) if you don t include one ' defaults to Setting ' to will cause your simulation to stop if the assertion fails This is configurable inside the simulator 19 20

Assert: Example $ +).,% )./% ).% ).-% ).% &$ '$$)- -0 () '' % / ),%/%% %-%%%% 384 ' 9 Complex Circuits What makes a circuit harder to test? Memory devices (stack, registers, RAM, FSMs) Large numbers of inputs We can t just specify all combinations anymore A, then B is now different from B, then A Our simulation would take days! We have to pick and choose our test vectors so that we cover as much functionality as possible 21 22 What is a Test Vector? A collection of inputs (possibly extending across multiple clock cycles) and the expected corresponding outputs When you apply the inputs, you should get the outputs You can write your testbenches as a collection of test vectors, complete with output checking Designing Test Vectors (1) Questions to ask yourself: What functions can my circuit perform? Along what paths can the data flow? Which inputs are data, and which are control? 23 24

Designing Test Vectors (2) What functions can my circuit perform? An ALU can Add, Subtract, AND, XOR, etc. A stack can Push, Pop, and Hold If there s only one function, you probably have a simple circuit Different levels of abstraction lead to different answers: a datapath can Push, And(TOS,Inp), And(TOS,TOS2), etc Designing Test Vectors (3) Along what paths can the data flow? 25 26 Designing Test Vectors (4) Which inputs are control? It s most important to test all possible control combinations if one of these doesn t work, part of your circuit is unusable Which inputs are data? For now, you only need to worry about each data path not all possible data words Pick input words that are convenient (5+A=F) Testbench = A Set of Vectors A good series of test vectors gives you confidence that the entire circuit works Not every vector needs to test every gate Coverage is a way of talking about which gates (or functions) are tested by which test vectors The union of the coverage of all your test vectors should be your entire circuit 27 28

Test Vector Example Coverage Chart (1) A ** :-1 +();-<()3--4 ()3--4()3-4 /- ()3----4()3-4 /- )3--4% # 1 Mux A B Push Stack Pop Hold PassA ALU PassB Add XOR PassA Hold Push What have we covered? Goal: Every column should have at least one check mark once all the test vectors are designed 29 30 Coverage Chart (2) Implementation Details 1 Input- Mux Reg- Mux Mux- ALU Stack- ALU ALU- Reg Reg- Stack Stack- Output It s good to write testbenches as a series of test vectors Use comments (and whitespace) to delineate each test vector Use a single process with statements between vectors Run your infrastructure signals (like clk) in a second process Don t forget to count coverage on your datapaths also 31 32

Summary Simple circuits can be exhaustively tested using loops Simple circuits have only one or two functions and no memories or sequential elements Self-checking test vectors make debugging your circuit much easier The statement makes it easy Summary Think about complex circuits in terms of the functions they provide Make sure you test every function at least once Don t forget to cover every datapath, too Good testbenches: Have 100% coverage Are easy for a human to follow Check themselves 33 34 Handshaking Handshaking En -- an input signal telling the hardware to start Valid -- an output signal saying the result is ready What is wrong with this model? Sender En Valid inputs result Hardware One signal for input: Enable One signal for output: Valid How do you know if HW is ready? How do you know that HW has read the input data? How does HW know that Sender has read the output? 35 36

Signaling Protocol Signaling Protocol: communication protocol req: initiate an action ack: signal completion of that action Two handshake signals for send data Control Signaling Protocol Four-phase Handshaking protocol Sender req data ack Receiver req Level signaling or return to zero ack Sender Receiver data 37 38 Control Signaling Protocol Two-phase Handshaking protocol Importance of Handshaking Hardware needs to know when inputs are ready Software needs to know when results are valid Different designs can have different timing Behavioral Register Transfer Level (RTL) Pipelined version vs. non-pipelined version Transition signaling or Non-return to zero req Sender data 39 ack Receiver Can use the same testbench with different hardware timing if you use handshaking in your hardware design 40