CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value

Similar documents
Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

Outline. CPE/EE 422/522 Advanced Logic Design L15. Files. Files

Outline CPE 626. Advanced VLSI Design. Lecture 3: VHDL Recapitulation. Intro to VHDL. Intro to VHDL. Entity-Architecture Pair

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX

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

BASIC VHDL LANGUAGE ELEMENTS AND SEMANTICS. Lecture 7 & 8 Dr. Tayab Din Memon

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

Hardware Description Language VHDL (1) Introduction

ELCT 501: Digital System Design

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

VHDL And Synthesis Review

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

Design units can NOT be split across different files

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

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

Contents. Appendix D VHDL Summary Page 1 of 23

ECE 3401 Lecture 10. More on VHDL

ECOM 4311 Digital System Design using VHDL. Chapter 7

VHDL Packages for Synthesis Base Types Standard bit types may be used Typically IEEE 1164 Std. types are used. CPE 528: Session #9

Review of Digital Design with VHDL

Introduction to VHDL. Main language concepts

ECOM4311 Digital Systems Design

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Introduction to VHDL #1

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

VHDL BASIC ELEMENTS INTRODUCTION

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

Summary of basic structures

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)

COE 405 Design Methodology Based on VHDL

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is

EEL 4783: Hardware/Software Co-design with FPGAs

Basic Language Constructs of VHDL

VHDL: RTL Synthesis Basics. 1 of 59

C-Based Hardware Design

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

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

VHDL for Complex Designs

Performance Engineering of Real-Time and Embedded Systems. Introduction to VHDL

VHDL: skaitmeninių įtaisų projektavimo kalba. 2 paskaita Pradmenys

HDL. Hardware Description Languages extensively used for:

! Initially developed under DOD auspices, later standardized as IEEE standards , , & (standard logic data type)

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

A bird s eye view on VHDL!

ENGIN 241 Digital Systems with Lab

[1] Douglas L. Perry, VHDL, third edition, ISBN , McRaw- Hill Series on Computer Engineering.

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

Embedded Systems CS - ES

Inthis lecture we will cover the following material:

Subprograms, Packages, and Libraries

VHDL for FPGA Design. by : Mohamed Samy

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used.

VHDL Synthesis Reference

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Lecture 4. VHDL Fundamentals. George Mason University

Declarations. Lexical elements. Type declaration Subtype declaration Constant declaration Signal declaration Variable declaration.

Topics. Midterm Finish Chapter 7

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

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

Very High Speed Integrated Circuit Har dware Description Language

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

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

Corrections for Digital Systems Design Using VHDL, 3rd printing

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

Getting Started with VHDL

Chapter 2 Basic Logic Circuits and VHDL Description

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Lecture #2: Verilog HDL

Lecture 12 VHDL Synthesis

Lecture 10 Subprograms & Overloading

Computer-Aided Digital System Design VHDL

14:332:231 DIGITAL LOGIC DESIGN. Hardware Description Languages

Microcomputers. Outline. Number Systems and Digital Logic Review

VHDL 200X: The Future of VHDL

N-input EX-NOR gate. N-output inverter. N-input NOR gate

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

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

Contents. Chapter 9 Datapaths Page 1 of 28

Digital Design with SystemVerilog

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

Arithmetic Operators There are two types of operators: binary and unary Binary operators:

VHDL simulation and synthesis

VHDL Objects. Lecture 8: VHDL (2) Variables. VHDL Objects - Constant. Files. EE3109 Gopi K. Manne Fall 2007

Writing Circuit Descriptions 8

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

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

Contents. Appendix D Verilog Summary Page 1 of 16

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

VHDL Structural Modeling II

VHDL: Code Structure. 1

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

Transcription:

CPE/EE 422/522 Chapter 8 - Additional Topics in VHDL Dr. Rhonda Kay Gaede UAH 1 8.1 Attributes - Signal Attributes that return a value A event true if a has just occurred A active true if A has, even if A does not change Page 2 of 54 1

8.1 Attributes - Signal Attribute Evaluation Example Signal Attributes A <= B - - B changes at time T Event occurs on a signal every time it is Transaction occurs on a signal every time it is Example: T T + 1d A event B event Page 3 of 54 UAH CPE/EE 422/522 Chapter 8 8.1 Attributes - Signal Attributes that create a signal Page 4 of 54 2

8.1 Attributes - Attribute Test VHDL and Waveforms Page 5 of 54 8.1 Attributes - Using Attributes for Error Checking check: process begin wait until rising_edge(clk); assert (D stable(setup_time)) report( Setup time violation ) severity error; wait for hold_time; assert (D stable(hold_time)) report( Hold time violation ) severity error; end process check; Page 6 of 54 3

Assert Statement assert boolean-expression report string-expression severity severity-level If boolean expression is display the string expression on the monitor Severity levels:,,, Page 7 of 54 8.1 Attributes - Array Attributes A can be either an or an. Array attributes work with,, and. Page 8 of 54 4

8.1 Attributes - Procedure for Adding Vectors without Using Attributes Note: Add1 and Add2 vectors must be dimensioned as N-1 downto 0. Use to write more general procedure that places no restrictions on the range of vectors other than the must be the same. Page 9 of 54 UAH CPE/EE 422/522 Chapter 8 8.1 Attributes - Procedure for Adding Vectors with Using Attributes Page 10 of 54 5

8.2 Transport and Inertial Delays Reject is equivalent to a combination of inertial and transport delay: Zm <= X after 4 ns; Z3 <= transport Zm after 6 ns; Page 11 of 54 8.3 Operator Overloading Operators +, - operate on integers Write procedures for bit vector addition/subtraction addvec, subvec Operator overloading allows using + operator to implicitly call an appropriate addition function How does it work? When compiler encounters a function declaration in which the function name is an operator enclosed in double quotes, the compiler treats the function as an operator overloading ( + ) when a + operator is encountered, the compiler automatically checks the types of operands and calls appropriate functions Page 12 of 54 6

8.3 Operator Overloading - VHDL Package Page 13 of 54 8.3 Operator Overloading - Overloading Procedures and Functions A, B, C bit vectors A <= B + C + 3? A <= 3 + B + C? Overloading can also be applied to procedures and functions procedures have the same name type of the actual parameters in the procedure call determines which version of the procedure is called Page 14 of 54 7

8.4 Multivalued Logic and Signal Resolution Bit (0, 1) Tristate buffers and buses => high impedance state Z Unknown state X e. g., a gate is driven by Z, output is unknown a signal is simultaneously driven by 0 and 1 Page 15 of 54 8.4 Multivalued Logic and Signal Resolution - VHDL for Tristate Buffers Resolution function to determine the actual value of f since it is driven from two different sources Page 16 of 54 8

8.3 Multivalued Logic and Signal Resolution VHDL signals may either be or Resolved signals have an associated Bit type is unresolved there is no resolution function if you drive a bit signal to two different values in two concurrent statements, the compiler will Page 17 of 54 8.3 Multivalued Logic and Signal Resolution - Resolution Function signal R : X01Z := Z ;... R <= transport 0 after 2 ns, Z after 6 ns; R <= transport 1 after 4 ns; R <= transport 1 after 8 ns, 0 after 10 ns; Page 18 of 54 9

8.3 Multivalued Logic and Signal Resolution - Resolution Function VHDL Page 19 of 54 8.5 IEEE-1164 Standard Logic 9-valued logic system U Uninitialized X Forcing Unknown 0 Forcing 0 1 Forcing 1 Z High impedance W Weak unknown L Weak 0 H Weak 1 - Don t care If forcing and weak signal are tied together, the forcing signal dominates. Useful in modeling the internal operation of certain types of ICs. In this course we use a subset of the IEEE values: X10Z Page 20 of 54 10

8.5 IEEE-1164 Standard Logic - Resolution Function Page 21 of 54 UAH CPE/EE 422/522 Chapter 8 8.5 IEEE-1164 Standard Logic - AND Definition Page 22 of 54 11

8.5 IEEE-1164 Standard Logic - AND Function VHDL Page 23 of 54 8.6 Generics Used to specify for a in such a way that the values must be specified when the is instantiated Example: rise/fall time modeling Page 24 of 54 12

8.6 Generics - Values are given in Component Instantiations Page 25 of 54 8.7 Generate Statements Provides an easy way of instantiating components when we have an array of identical components Example: 4-bit ripple carry adder Page 26 of 54 13

8.7 Generate Statements - Example: 4- bit Adder without Generate Statements Page 27 of 54 UAH CPE/EE 422/522 Chapter 8 8.7 Generate Statements - Example: 4- bit Adder with Generate Statements Page 28 of 54 14

8.8 Synthesis of VHDL Code Synthesizer take a VHDL model as an input synthesize the logic: output is a structural gate level imiplementation Synthesizers accept a subset of VHDL as input Efficient implementation? Context... A <= B and C; wait until clk event and clk = 1 ; A <= B and C; Implies CM for A Implies a register or flip-flop Page 29 of 54 8.8 Synthesis of VHDL Code (cont d) Always use constrained integers if not specified, the synthesizer may infer 32-bit register When integer range is specified, most synthesizers will implement integer addition and subtraction using binary adders with appropriate number of bits integer range 0 to 7 gives 3 unsigned bits Integer range -8 to 7 gives 4 signed bits General rule: when a signal is assigned a value, it will hold that value until it is assigned new value Page 30 of 54 15

8.8 Synthesis of VHDL Code - Unintentional Latch Creation What if a = 3? The previous value of b should be held in the latch, so G should be 0 when a = 3. Page 31 of 54 8.8 Synthesis of VHDL Code - How are Unspecified Cases Handled? if A = 1 then NextState <= 3; end if; What if A /= 1? Retain the previous value for NextState? Synthesizer might interpret this to mean that NextState is unknown! if A = 1 then NextState <= 3; else NextState <= 2; end if; Page 32 of 54 16

8.8 Synthesis of VHDL Code - Case Statement Page 33 of 54 UAH CPE/EE 422/522 Chapter 8 8.8 Synthesis of VHDL Code - Case Statement: Pre- and Post- Optimization Page 34 of 54 17

8.8 Synthesis of VHDL Code - If Statement Synthesized code before optimization Page 35 of 54 8.8 Synthesis of VHDL Code - Standard VHDL Synthesis Package Every VHDL synthesis tool provides its own package of functions for operations commonly used in hardware models IEEE is developing a standard synthesis package, which includes functions for arithmetic operations on bit_vectors and std_logic vectors numeric_bit package defines operations on bit_vectors type unsigned is array (natural range<>) of bit; type signed is array (natural range<>) of bit; package include overloaded versions of arithmetic, relational, logical, and shifting operations, and conversion functions numeric_std package defines similar operations on std_logic vectors Page 36 of 54 18

8.8 Synthesis of VHDL Code - Numeric_bit, Numeric_std Overloaded operators Unary: abs, - Arithmetic: +, -, *, /, rem, mod Relational: >, <, >=, <=, =, /= Logical: not, and, or, nand, nor, xor, xnor Shifting: shift_left, shift_right, rotate_left, rotate_right, sll, srl, rol, ror Page 37 of 54 UAH CPE/EE 422/522 Chapter 8 8.8 Synthesis of VHDL Code - Numeric_bit, Numeric_std (cont d) Page 38 of 54 19

8.8 Synthesis of VHDL Code - Numeric_bit, Numeric_std (cont d) Page 39 of 54 8.9 Synthesis Examples Page 40 of 54 20

8.9 Synthesis Examples - Mealy BCD to BCD + 3 Converter Page 41 of 54 UAH CPE/EE 422/522 Chapter 8 8.9 Synthesis Examples - Mealy BCD to BCD + 3 Converter Page 42 of 54 21

8.9 Synthesis Examples - Mealy BCD to BCD + 3 Converter 3 FF, 13 gates Page 43 of 54 8.10 Files and TEXTIO File input/output in VHDL Used in of test data for test results VHDL provides a standard TEXTIO package read/write lines of text Page 44 of 54 22

8.10 Files and TEXTIO - File Declarations Page 45 of 54 8.10 Files and TEXTIO - Standard TEXTIO Package Contains and for working with composed of lines of text Defines a file type named text: type text is file of string; Contains procedures for of text from a file of type text and for of text to a file Page 46 of 54 23

8.10 Files and TEXTIO - Reading from a text file reads a line of text and places it in a buffer with an associated pointer The pointer to the buffer must be of type line, which is declared in the textio package as: type line is access string; When a variable of type line is declared, it creates a pointer to a string Code variable buff: line;... readline (test_data, buff); reads a line of text from test_data and places it in a buffer which is pointed to by buff Page 47 of 54 8.10 Files and TEXTIO - Extracting Data from the Line Buffer To extract data from the line buffer, call a procedure one or more times For example, if bv4 is a bit_vector of length four, the call read(buff, bv4) extracts a 4-bit vector from the buffer, sets bv4 equal to this vector, and adjusts the pointer buff to point to the next character in the buffer. Another call to read will then extract the next data object from the line buffer. Page 48 of 54 24

8.10 Files and TEXTIO - Extracting Data from the Line Buffer TEXTIO provides overloaded read procedures to read data of types,,,,,,, and from buffer Read forms read(pointer, value) read(pointer, value, good) good is that returns TRUE if the read is and FALSE if it is not type and size of value determines which of the read procedures is called character, strings, and bit_vectors within files of type text are not delimited by quotes Page 49 of 54 8.10 Files and TEXTIO - Writing to TEXTIO files Call one or more procedures to write data to a line buffer and then call to write the line to a file variable buffw : line; variable int1 : integer; variable bv8 : bit_vector(7 downto 0);... write(buffw, int1, right, 6); --right just., 6 ch. wide write(buffw, bv8, right, 10); writeln(buffw, output_file); Write parameters: 1) buffer pointer of type line, 2) a value of any acceptable type, 3) justification (left or right), and 4) field width (number of characters) Page 50 of 54 25

8.10 Files and TEXTIO - An Example Procedure to read data from a file and store the data in a memory array Format of the data in the file address N comments byte1 byte2... byten comments address 4 hex digits N indicates the number of bytes of code bytei - 2 hex digits each byte is separated by one space the last byte must be followed by a space anything following the last state will not be read and will be treated as a comment Page 51 of 54 8.10 Files and TEXTIO - An Example (cont d) Code sequence: an example 12AC 7 (7 hex bytes follow) AE 03 B6 91 C7 00 0C (LDX imm, LDA dir, STA ext) 005B 2 (2 bytes follow) 01 FC_ TEXTIO does not include read procedure for hex numbers we will read each hex value as a string of characters and then convert the string to an integer How to implement conversion? table lookup constant named lookup is an array of integers indexed by characters in the range 0 to F this range includes the 23 ASCII characters: 0, 1,... 9, :, ;, <, =, >,?, @, A,... F corresponding values: 0, 1,... 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15 Page 52 of 54 26

8.10 Files and TEXTIO - VHDL Code to Fill Memory Array Page 53 of 54 UAH CPE/EE 422/522 Chapter 8 8.10 Files and TEXTIO - VHDL Code to Fill Memory Array Page 54 of 54 27