ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL.

Slides:



Advertisements
Similar presentations
1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
Advertisements

Arbitrary Waveform Discussion 5.5 Example 34.
Sequential-Circuit Building Blocks
George Mason University ECE 448 – FPGA and ASIC Design with VHDL ECE 448 Lecture 10 Advanced Testbenches.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
Simple Testbenches Behavioral Modeling of Combinational Logic
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
ECE 448: Spring 12 Lab Midterm Exam Review. Part 1: Detailed discussion of a selected midterm from Spring Part 2: Review & discussion of common.
Data Flow Modeling of Combinational Logic Simple Testbenches
Design Verification VHDL ET062G & ET063G Lecture 5 Najeem Lawal 2012.
Graduate Computer Architecture I VHDL Structure and Testing Michael Sorensen.
VHDL Project I: Introduction to Testbench Design Matthew Murach Slides Available at:
George Mason University ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 1 Developing Effective Testbenches.
Introduction to Experiment 7 Sorting Using PicoBlaze ECE 448 Spring 2010.
ECE 545 Project 2 Specification. Schedule of Projects (1) Project 1 RTL design for FPGAs (20 points) Due date: Tuesday, November 22, midnight (firm) Checkpoints:
George Mason University ECE 545 Lecture 7 Advanced Testbenches.
George Mason University ECE 545 – Introduction to VHDL Variables, Functions, Memory, File I/O ECE 545 Lecture 7.
1 ECE 545 – Introduction to VHDL Dataflow Modeling of Combinational Logic Simple Testbenches ECE 656. Lecture 2.
Mixed Style RTL Modeling
ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Introduction to FPGA Tools
George Mason University Simple Testbenches ECE 545 Lecture 4.
George Mason University VHDL Basics Lecture 3 Testbenches.
Assignment write a short notes on 1.Manufacturing Testing. 2.Functional Testing. 3.Files and Text I/O. 4.Differentiate the cpld and fpga architecture.
George Mason University Data Flow Modeling in VHDL ECE 545 Lecture 7.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches Concurrent Statements & Adders.
Data Flow Modeling in VHDL
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 1 Implementing Combinational Logic in VHDL.
George Mason University Advanced Testbenches Lecture 4.
ECE 448 Lab 1 Developing Effective Testbenches
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
CDA 4253 FPGA System Design VHDL Testbench Development Hao Zheng Comp. Sci & Eng USF.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Implementing Combinational
Behavioral Style Combinational Design with VHDL
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 545 Lecture 10 Advanced Testbenches.
ECE 448 Lab 1a Developing Effective Testbenches
Review of Aldec Active HDL Implementing Combinational
Developing More Advanced Testbenches
ECE 448 Lecture 6 Modeling of Circuits with a Regular Structure Aliases, Constants, Packages Mixing Design Styles ECE 448 – FPGA and ASIC Design with.
ECE 448 Lab 1 Developing Effective Testbenches
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Data Flow Modeling of Combinational Logic
VHDL Discussion Subprograms
Implementing Combinational
ECE 448 Lab 1 Developing Effective Testbenches
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL Discussion Subprograms
Data Flow Description of Combinational-Circuit Building Blocks
ECE 448 Lab 1 Developing Effective Testbenches
Implementing Combinational and Sequential Logic in VHDL
Data Flow Description of Combinational-Circuit Building Blocks
Developing Effective Testbenches
ECE 545 Lecture 5 Simple Testbenches.
Implementing Combinational
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
ECE 448 Lab 1 Developing Effective Testbenches
(Simple Testbenches & Arithmetic Operations)
Presentation transcript:

ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL

Part 1: Hands-on Session: Simulation Using Aldec Active-HDL Part 2: Introduction to Lab 2 Part 3: Asserts and Reports Part 4: Advanced Testbenches with test vectors stored in arrays of records Part 5: Advanced Testbenches with test vectors stored in text files Part 6: Demos of Lab 1 Agenda for today

ECE 448 – FPGA and ASIC Design with VHDL Part 1 Hands-on Session Simulation Using Aldec Active-HDL

Hands-on Session based on the MLU example with simple testbench

ECE 448 – FPGA and ASIC Design with VHDL Part 2 Introduction to Lab 2

Discussion of the Pseudocode, Requirements, and Hints

Part 1: Example of a Block Diagram (for a different circuit)

Bonus Task Variable Rotator Example of a Problem Similar to the Bonus Task

Function C = A <<< B A – 4-bit data input B – 2-bit rotation amount

Interface A B C

Block diagram C

Fixed Rotation in VHDL A(3) A(2) A(1) A(0) A(2)A(1)A(0)A(3) A<<<1 SIGNAL A : STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL ArotL: STD_LOGIC_VECTOR(3 DOWNTO 0); ArotL <= A(2 downto 0) & A(3); ArotL A

ECE 448 – FPGA and ASIC Design with VHDL Advanced Testbenches

14 Simple Testbench Processes Generating Stimuli Design Under Test (DUT) Observed Outputs

15 Advanced Testbench (1) Processes Generating Input Stimuli Design Under Test (DUT) Process Comparing Actual Outputs vs. Expected Outputs Design Correct/Incorrect Yes/No

16 Advanced Testbench (2) Processes Generating Input Stimuli Design Under Test (DUT) Process Comparing Actual Outputs vs. Expected Outputs Design Correct/Incorrect Yes/No Testvector file(s)

17 Test vectors Set of pairs: {Input i, Expected Output i} Input 1, Expected Output 1 Input 2, Expected Output 2 …………………………… Input N, Expected Output N Test vectors can be: - defined in the testbench source file - stored in a data file

18 Representative Inputs VHDL Design Manual Calculations or Reference Software Implementation (C, Java, Matlab ) expected results Testbench actual results = ? Possible sources of expected results used for comparison

19ECE 448 – FPGA and ASIC Design with VHDL Part 3 Asserts and Reports

20 Assert Assert is a non-synthesizable statement whose purpose is to write out messages on the screen when problems are found during simulation. Depending on the severity of the problem, The simulator is instructed to continue simulation or halt.

21 Assert - syntax ASSERT condition [REPORT "message“] [SEVERITY severity_level ]; The message is written when the condition is FALSE. Severity_level can be: Note, Warning, Error (default), or Failure.

22 Assert – Examples (1) assert initial_value <= max_value report "initial value too large" severity error; assert packet_length /= 0 report "empty network packet received" severity warning; assert false report "Initialization complete" severity note;

23 Assert – Examples (2) stim_proc: process begin wait for 20 ns assert false report "PASSED CHECKPOINT 1" severity note; wait for 10 ns; assert false report "PASSED CHECKPOINT 2" severity warning;

24ECE 448 – FPGA and ASIC Design with VHDL wait for 10 ns; assert false report "PASSED CHECKPOINT 3" severity error; wait for 10 ns; assert false report "PASSED CHECKPOINT 4" severity failure; wait; end process; Assert – Examples (3)

Example 1 Asserts & Reports

26 Format of messages in Aldec Active-HDL

27 Format of messages in Xilinx ISim

28 Report - syntax REPORT "message" [SEVERITY severity_level ]; The message is always written. Severity_level can be: Note (default), Warning, Error, or Failure.

29 Report - Examples report "Initialization complete"; report "Current time = " & time'image(now); report "Incorrect branch" severity error;

30 library IEEE; use IEEE.STD_LOGIC_1164.all; entity example_1_tb is end example_1_tb; architecture behavioral of example_1_tb is signal clk : std_logic := '0'; begin clk <= not clk after 100 ns; process begin wait for 1000 ns; report "Initialization complete"; report "Current time = " & time'image(now); wait for 1000 ns; report "SIMULATION COMPLETED" severity failure; end process; end behavioral; Report - Examples

31ECE 448 – FPGA and ASIC Design with VHDL Part 4 Advanced Testbenches with Test Vectors Stored in an Array of Records

32 Advanced Testbench (1) Processes Generating Input Stimuli Design Under Test (DUT) Process Comparing Actual Outputs vs. Expected Outputs Design Correct/Incorrect Yes/No

33ECE 448 – FPGA and ASIC Design with VHDL Records

34 Records TYPE test_vector IS RECORD operation : STD_LOGIC_VECTOR(1 DOWNTO 0); a : STD_LOGIC; b: STD_LOGIC; y : STD_LOGIC; END RECORD; CONSTANT num_vectors : INTEGER := 16; TYPE test_vectors IS ARRAY (0 TO num_vectors-1) OF test_vector; CONSTANT and_op : STD_LOGIC_VECTOR(1 DOWNTO 0) := "00"; CONSTANT or_op : STD_LOGIC_VECTOR(1 DOWNTO 0) := "01"; CONSTANT xor_op : STD_LOGIC_VECTOR(1 DOWNTO 0) := "10"; CONSTANT xnor_op : STD_LOGIC_VECTOR(1 DOWNTO 0) := "11";

35 Records CONSTANT test_vector_table: test_vectors :=( (operation => AND_OP, a=>'0', b=>'0', y=>'0'), (operation => AND_OP, a=>'0', b=>'1', y=>'0'), (operation => AND_OP, a=>'1', b=>'0', y=>'0'), (operation => AND_OP, a=>'1', b=>'1', y=>'1'), (operation => OR_OP, a=>'0', b=>'0', y=>'0'), (operation => OR_OP, a=>'0', b=>'1', y=>'1'), (operation => OR_OP, a=>'1', b=>'0', y=>'1'), (operation => OR_OP, a=>'1', b=>'1', y=>'1'), (operation => XOR_OP, a=>'0', b=>'0', y=>'0'), (operation => XOR_OP, a=>'0', b=>'1', y=>'1'), (operation => XOR_OP, a=>'1', b=>'0', y=>'1'), (operation => XOR_OP, a=>'1', b=>'1', y=>'0'), (operation => XNOR_OP, a=>'0', b=>'0', y=>'1'), (operation => XNOR_OP, a=>'0', b=>'1', y=>'0'), (operation => XNOR_OP, a=>'1', b=>'0', y=>'0'), (operation => XNOR_OP, a=>'1', b=>'1', y=>'1') );

36ECE 448 – FPGA and ASIC Design with VHDL Variables

37 Variables - features Can only be declared within processes and subprograms (functions & procedures) Initial value can be explicitly specified in the declaration When assigned take an assigned value immediately Variable assignments represent the desired behavior, not the structure of the circuit Can be used freely in testbenches Should be avoided, or at least used with caution in a synthesizable code

38 Variables - Example testing: PROCESS VARIABLE error_cnt: INTEGER := 0; BEGIN FOR i IN 0 to num_vectors-1 LOOP test_operation <= test_vector_table(i).operation; test_a <= test_vector_table(i).a; test_b <= test_vector_table(i).b; WAIT FOR 10 ns; IF test_y /= test_vector_table(i).y THEN error_cnt := error_cnt + 1; END IF; END LOOP; END PROCESS testing;

Example 2 Testbenches with Test Vectors Stored in Arrays of Records

40ECE 448 – FPGA and ASIC Design with VHDL Part 5 Advanced Testbenches with Test Vectors Stored in Text Files

41 Advanced Testbench (2) Processes Generating Input Stimuli Design Under Test (DUT) Process Comparing Actual Outputs vs. Expected Outputs Design Correct/Incorrect Yes/No Testvector file(s)

Example 3 Testbenches with Test Vectors Stored in a Text File

43 Hex format In order to read/write data in the hexadecimal notation, replace read with hread, and write with hwrite

44ECE 448 – FPGA and ASIC Design with VHDL Part 6 Lab 1 Demos