Introduction to VHDL

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

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

VHDL for FPGA Design. by : Mohamed Samy

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

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

Introduction to VHDL #1

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

Very High Speed Integrated Circuit Har dware Description Language

VHDL And Synthesis Review

Lattice VHDL Training

Lecture 4. VHDL Fundamentals. George Mason University

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

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

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

Basic Language Constructs of VHDL

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

VHDL is a hardware description language. The code describes the behavior or structure of an electronic circuit.

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

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

EEL 4783: Hardware/Software Co-design with FPGAs

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

Contents. Appendix D VHDL Summary Page 1 of 23

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

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

Hardware Description Language VHDL (1) Introduction

Lecture 3 Introduction to VHDL

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

INTRODUCTION TO VHDL. Lecture 5 & 6 Dr. Tayab Din Memon Assistant Professor Department of Electronic Engineering, MUET

VHDL for Complex Designs

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

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

Digital Systems Design

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

Basic Language Concepts

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

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

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

Inthis lecture we will cover the following material:

Lecture 3. VHDL Design Units and Methods. Entity, Architecture, and Components Examples of Combinational Logic Hands-on in the Laboratory

ENGIN 241 Digital Systems with Lab

Combinational Logic COMB. LOGIC BLOCK. A Combinational Logic Block is one where the outputs depend only on the current inputs

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

Introduction to VHDL. Main language concepts

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

Review of Digital Design with VHDL

Lecture 3. VHDL Design Units and Methods. Notes. Notes. Notes

Digital Systems Design

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

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

ECOM 4311 Digital Systems Design

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

Subprograms, Packages, and Libraries

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

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

CprE 583 Reconfigurable Computing

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

ECE 3401 Lecture 10. More on VHDL

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

VHDL: Code Structure. 1

Design units can NOT be split across different files

HDL. Hardware Description Languages extensively used for:

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

EE434 ASIC & Digital Systems

COE 405 Design Methodology Based on VHDL

Lecture 12 VHDL Synthesis

VHDL Basics. Mehdi Modarressi. Department of Electrical and Computer Engineering, University of Tehran. ECE381(CAD), Lecture 4:

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)

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

Design Entry: Schematic Capture and VHDL ENG241: Digital Design Week #4

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

Computer-Aided Digital System Design VHDL

Introduction to VHDL #3

C-Based Hardware Design

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

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Chapter 6 Combinational-Circuit Building Blocks

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

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

Lecture 10 Subprograms & Overloading

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

Concurrent & Sequential Stmts. (Review)

Control and Datapath 8

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

[VARIABLE declaration] BEGIN. sequential statements

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

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

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

VHDL 200X: The Future of VHDL

Writing VHDL for RTL Synthesis

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

VHDL: RTL Synthesis Basics. 1 of 59

SRI SUKHMANI INSTITUTE OF ENGINEERING AND TECHNOLOGY, DERA BASSI (MOHALI)

Verilog Module 1 Introduction and Combinational Logic

VHDL Synthesis Reference

LANGUAGE VHDL FUNDAMENTALS

VHDL for Synthesis. Course Description. Course Duration. Goals

Mridula Allani Fall Fall

VHDL Sample Slides Rev Sample Slides from the 2-day and 4-day VHDL Training Courses

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

Synthesis of Digital Systems CS 411N / CSL 719. Part 3: Hardware Description Languages - VHDL

Transcription:

Introduction to VHDL

Agenda Introduce VHDL Basic VHDL constructs Implementing circuit functions Logic, Muxes Clocked Circuits Counters, Shifters State Machines FPGA design and implementation issues FPGA resource utilization Implementation constraints 2

Section 1 Introduction What is VHDL? VHDL Design Flow Basic VHDL constructs Entity/ Architecture Logical operators Using Tools to synthesize VHDL 3

Introducing VHDL VHDL was designed ed under the VHSIC program by the Department of Defense VHDL acronym stands for Very High Speed Integrated Circuit (VHSIC) Hardware Description Language 4

What is VHDL? VHDL is a language used to describe systems s It can be used to design and simulate digital circuits VHDL was adopted by IEEE in 1987 as a standard IEEE 1076-1987 -Most Common version VHDL 93 Most recent version VHDL 2008 STD_LOGIC Libraries are covered by IEEE 1164 Simulation enhancements covered in VITAL 5

Why VHDL? Capable of more complex designs s than schematics cs Not bound to a vendor Supports design abstraction It is a standard Supports design reuse The DOD requires it 6

Synthesis vs. Simulation Simulatable VHDL Synthesizable 7

VHDL Design Flow Specify Design Write VHDL Code Simulate VHDL Synthesize Design Implement design Feed Back to any up stream point. Verify Timing Done 8

Building Blocks The Entity / Architecture e pair The basis of all VHDL designs Entities can have more then one Architecture Architectures can have only one entity Entities define the interface (i.e. I/Os) for the design Architectures define the function of the design 9

The Entity Details entity entity_name is generic (generic_list); port (port_list); end entity_ name; 10

The Entity Details D Q clk DFLOP = entity DFLOP is Port ( D : in std_ logic; clk : in std_logic; Q : out std_logic ); end DFLOP; (Port_names : MODE type); MODE types: in, out, inout or buffer 11

The Architecture Details architecture architecture_name of entity_name is declaration section begin concurrent statements end architecture_name; Declaration section Signals, constants and components local to the architecture can be declared here Concurrent statements t t Where the circuit is defined 12

Logical Operators VHDL predefines the logic operators NOT HIGHER PRECEDENCE AND NAND There is no implied precedence OR for these operators. If there are NOR two or more different operators in an equation, the order of XOR precedence is from left to right XNOR Note: XNOR supported in standard 1076-1993 13

Comments -- (Double minus sign) is the comment mark All text after the -- on the same line is taken as a comment Comments only work on a single line There is no block comment in VHDL 93 (Availible in 2008 /* */ 14

Example Entity/Architecture -- Example of two input AND gate library IEEE; use IEEE.std_logic_1164.all; entity and2vhdl is port ( In_ a : in std_ logic; In_b : in std_logic; Out_c : out std_logic ); end and2vhdl; architecture Behavioral of and2vhdl is begin Out_c <= In_a and In_b; -- Note <= in this context is the -- Signal assignment operator end Behavioral; 15

Lab WorkShop

Section 2 Data Types & Statements Data types Predefined types, additional types & Arrays Concurrent and sequential statements Relational operators More VHDL constructs Process IF WHEN CASE SELECT Lab 2 - Implementing a Multiplexer 17

Data Types DATA types: An ordered set of possible values define a particular type Example: Type character is the ISO character set VHDL is a strongly typed language All variables must be assigned a type Type conversion functions are supplied in add on functions but are not part of the core of VHDL 18

Predefined Types Boolean FALSE, TRUE Bit ( 0, 1 ) bit_vector( vector( 101010 ) --Notice Double quotes for the group Integers: range -(2^31-1) to 2^31-1 Floating real: -1.E38 to 1.0E38 Time Character String Enumerated (User defined) Records, file & access types (Used in Simulation only) 19

Std_logic & std_ulogic Not part of 1076 Part of 1164 library Std_logic is a resolved type Std_logic is a subtype of std_ulogic Std_ulogic Values: TYPE std_ulogic IS ('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 ); Note case is important, upper case for U,X,Z,W,L,H 20

Resolution of Multiple Drivers Z Output=? 1 In the case of STD_ULOGIC the output of this circuit is undefined A method of resolving multiple drivers is needed 21

Std_logic Resolution Function Unlike std_ulogic, std_logic can resolve multiple drivers on a signal ------------------------------------------------------------------- -- resolution function ------------------------------------------------------------------- CONSTANT resolution_table : stdlogic_table := ( -- --------------------------------------------------------- -- U X 0 1 Z W L H - -- --------------------------------------------------------- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- U ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- X ( 'U', 'X', '0', 'X', '0', '0', '0', '0', 'X' ), -- 0 ( 'U', 'X', 'X', '1', '1', '1', '1', '1', 'X' ), -- 1 ( 'U', 'X', '0', '1', 'Z', 'W', 'L', 'H', 'X' ), -- Z ( 'U', 'X', '0', '1', 'W', 'W', 'W', 'W', 'X' ), -- W ( 'U', 'X', '0', '1', 'L', 'W', 'L', 'W', 'X' ), -- L ( 'U', 'X', '0', '1', 'H', 'W', 'W', 'H', 'X' ), -- H ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- - ); 22

Standard Logic Vectors STD_LOGIC_VETOR de facto standard from Synopsis std_ logic _ vector & std_ ulogic _ vector A collection of std_logic or std_ulogic Defined in the packages STD_LOGIC_ARITH with either STD_LOGIC_UNSIGNED or STD_LOGIC_SIGNED. Ordered set of signals library IEEE; use IEEE.std_logic_1164.all; use IEEE. entity busses is port ( In_bus1, In_bus2 : in std_logic_vector t (7 downto 0); In_bus3 : in std_logic_vector (0 to 7); Out_bus : out std_logic_vector (7 downto 0) ); end busses; 23

Vector Properties Vectors are filled from left to right, always Indexes are assigned ascending or descending depending on the key word to or downto In_bus1, In_bus2 : in std_logic_vector (7 downto 0); In_bus3 : in std_logic_vector (0 to 7); Out_bus : out std_logic_vector (7 downto 0) In_bus1 <= 10110010 ; -- IN_BUS1(7)= 1, IN_BUS1(0) = 0 In_bus2(3) < = 1 ; -- IN_BUS2 = (U,U,U,U,1,U,U,U,) In_bus2(6 downto 4) < = 101 ; -- IN_BUS2 = (U101UUUU) (U,1,0,1,U,U,U,U,) In_bus3 <= 10110010 ; -- IN_BUS3(7)= 0, IN_BUS3(0) = 1 24

Array Ordering Bus1 : std_logic_vector ( 3 downto 0); Bus2 : std_logic_vector ( 0 to 3); Bus1 <= Bus2; Bus1(3) Bus1(2) Bus1(1) Bus1(0) Bus2(0) Bus2(1) Bus2(2) Bus2(3) 25

Aggregates signal X_bus, Y_bus, Z_bus : std_logic_vector (3 downto 0); signal Byte_bus : std_logic_vector (7 downto 0); Aggregates: Special array operation can be used to fill a std_logic_vector in sections Byte_bus <= ( 7 => 1, 6 downto 4 => 0, others => 1 ); -- Byte_bus =10001111 -- Others refers to all the values of the array not yet mentioned Aggregates can be used to set all members of a std_logic vector to a particular value without knowing the width of the std_ logic _ vector Z_bus <= (others=> 0 ); 26

Concatenation Concatenation (&) is used to gather pieces of an array to construct a bigger array signal x_bus, y_bus, z_bus : std_logic_vector (3 downto 0); signal byte_bus : std_logic_vector (7 downto 0); signal a,b,c,d : std_logic; Building a larger std_ logic _ vector from small vectors Byte_bus <= x_bus & y_bus; -- Concatenation operator & Building a std_logic_vector t from std_logic z_bus <= a&c&b&d; Note: the total width of the right hand side must be equal to the width of the left hand side 27

Concurrent Statements Exist inside the Architechture e Concurrent statements are Order independent!!! 28

Concurrent Statement Example A B C D X Y Z Z<=X or Y; X<=A and B; Y<=C and D; = Y<=C and D; X<=A and B; Z<=X or Y; 29

Relational Operators Used for comparison = Equals /= Not equal < Ordering, less than <= Ordering, less than or equal > Ordering, greater than >= Ordering, greater than or equals 30

Process and Sequential Statements Processes exist inside the Architecture Processes have local variables Processes contain Sequential Statements Processes have a sensitivity list or an optional wait statement Processes execute only when a signal in the sensitivity list changes Processes can be used to make clocked circuits 31

The Process Framework Lbl Label:-- optional label l process (optional sensitivity list) -- local lprocess declarations begin -- sequential statements t t -- optional wait statements end process; Processes must have a sensitivity list or a wait statement, but never both 32

If Statements Can have aeoeapp overlapping gcod conditions os Imply priority, first true condition is always taken Can have incomplete condition lists Useful to control signal assignments 33

Sequential If Statement Used inside the Process Can be used to control variable and signal assignments Has optional elsif structure 34

The If Framework Sequential Version if <condition> then sequential _ statements elsif <condition> then sequential_statements else sequential_statements end dif; 35

Example Multiplexer MUX_IN1 MUX_IN2 MUX_IN3 MUX_IN4 MUX_OUT SEL(1:0) 36

Sequential If Example library IEEE; use IEEE.std_logic_1164.all; entity MUX is port ( MUX_IN1, MUX_IN2, MUX_IN3, MUX_IN4 : in std_logic; SEL : in std_logic_vector (1 downto 0); MUX_OUT : out std_logic); end MUX; architecture IF_MUX_arch of MUX is begin process (SEL, MUX_IN1, MUX_IN2, MUX_IN3, MUX_IN4) begin if SEL = "00" then MUX_OUT <= MUX_IN1; elsif SEL = "01" then MUX_OUT <= MUX_IN2; elsif SEL = "10" then MUX_OUT <= MUX_IN3; else MUX_OUT <= MUX_IN4; end if; end process; end IF_MUX_arch; 37

What Goes Into the Sensitivity List If a change on an input signal causes an IMMEDIATE change in any signal that is assigned in that process then it should be in the sensitivity list If there is no IMMEDIATE change in a signal assigned in the process based on the change of a particular input signal, then that input signal should NOT be in the sensitivity list 38

When Statement The concurrent version of the IF statement LABEL1: -- optional label SIG_NAME <= <expression> when <condition> else <expression> when <condition> else <expression>; 39

When Example library IEEE; use IEEE.std_logic_1164.all; entity MUX is port ( MUX_IN1,MUX_IN2 IN2 : in std_logic; dl MUX_IN3,MUX_IN4 : in std_logic; SEL : in std_logic_vector(1 downto 0); MUX_OUT : out std_logic ); end MUX; architecture WHEN_MUX_arch of MUX is begin MUX_OUT <= MUX_IN1 when SEL="00" else MUX_IN2 when SEL="01" else MUX_IN3 when SEL="10" else MUX _ IN4; end WHEN_MUX_arch; 40

The Case Statement Used to control o signal assignments s No priority implied Control expression must cover all possible signal assignments No conditions may overlap 41

Sequential Case Statement Must be inside a process case <expression> is when <choices> hi => <statements> when <choices> => <statements> when others => <statements> end case; 42

Case Example architecture CASE_MUX_arch of MUX is begin process (MUX_IN1, MUX_IN2, MUX_IN3, MUX_IN4, SEL) begin case sel is when "00" => MUX_OUT <= MUX_IN1; when "01" => MUX_ OUT <= MUX_ IN2; when "10" => MUX_OUT <= MUX_IN3; when others => MUX_OUT <= MUX_IN4; end case; end process; end dcase _ MUX _ arch; c; 43

Select the Concurrent Case Statement LABEL1: -- optional label with <choice_expression> expression> select SIG_NAME <= <expression> when <choices>, <expression> when <choices>, <expression> when others; 44

Select Example library IEEE; use IEEE.std_logic_1164.all; entity MUX is port ( MUX _ IN1,MUX _ IN2 : in std sd_ logic; MUX_IN3,MUX_IN4 : in std_logic; SEL : in std_logic_vector(1 downto 0); MUX_ OUT : out std_ logic ); end MUX; architecture SEL_MUX_arch of MUX is begin with SEL select MUX_OUT <= MUX_IN1 when "00", MUX_IN2 when "01", MUX_IN3 when "10", MUX_IN4 when others; end SEL_MUX_arch; 45

Importance of the Process Sensitivity process(s,a) begin if S= 1 then OUTS<=A; else OUTS<=not A; end if; end process; process(s) begin if S= 1 then OUTS<=A; else OUTS<=not A; end if; end process; The second process must remember the last value of A based on a change in S. Assuming the synthesis tool accepts it, the Synthesizer will infer a latch. 46

Thank You & Happy Coding