Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.

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

History TTL-logic PAL (Programmable Array Logic)
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 2 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
ECE 331 – Digital System Design Course Introduction and VHDL Fundamentals (Lecture #1)
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
EENG 2910 – Digital Systems Design Fall Course Introduction Class Time: M9:30am-12:20pm Location: B239, B236 and B227 Instructor: Yomi Adamo
1 H ardware D escription L anguages Basic Language Concepts.
Introduction to VHDL for Synthesis
VHDL Training ©1995 Cypress Semiconductor 1 Introduction  VHDL is used to:  document circuits  simulate circuits  synthesize design descriptions 
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Data Flow Modeling of Combinational Logic Simple Testbenches
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 4: Modeling Dataflow.
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
IAY 0600 Digital Systems Design
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
VHDL IE- CSE. What do you understand by VHDL??  VHDL stands for VHSIC (Very High Speed Integrated Circuits) Hardware Description Language.
ENG241 Digital Design Week #4 Combinational Logic Design.
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
IAY 0600 Digital Systems Design VHDL discussion Dataflow&Behavioral Styles Combinational Design Alexander Sudnitson Tallinn University of Technology.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #16 – Introduction.
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Refresher Lecture 2.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
VHDL Basics. VHDL BASICS 2 OUTLINE –Component model –Code model –Entity –Architecture –Identifiers and objects –Operations for relations VHDL ET062G &
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
IAY 0600 Digital Systems Design VHDL discussion Dataflow Style Combinational Design Alexander Sudnitson Tallinn University of Technology.
L19 – Resolved Signals. Resolved Signals  What are resolved signals In systems In VHDL Resolution – Isn’t that for resolving conflicts?  Ref: text Unit.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
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)
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
CDA 4253 FPGA System Design Introduction to VHDL
Lecture 2 VHDL Refresher ECE 448 – FPGA and ASIC Design with VHDL.
VHDL Programming Fundamentals Presented By Dr. Pradyut Kumar Biswal Department of Electronics, IIIT Bhubaneswar.
George Mason University Introduction to VHDL for Synthesis Lecture 3.
CEC 220 Digital Circuit Design Introduction to VHDL Friday, February 21 CEC 220 Digital Circuit Design Slide 1 of 10.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Refresher Lecture 2.
Slide 1 3.VHDL/Verilog Description Elements. Slide 2 To create a digital component, we start with…? The component’s interface signals Defined in MODULE.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
CDA 4253 FPGA System Design Introduction to VHDL
Combinational logic circuit
Basic Language Concepts
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
Design Entry: Schematic Capture and VHDL
Dataflow 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 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC 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.
Data Flow Modeling of Combinational Logic
VHDL Discussion Subprograms
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
Lecture 2 VHDL Refresher ECE 448 – FPGA and ASIC Design with VHDL.
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s VHDL course webpage

2Kazi Fall 2006 EEGN 494 Naming Conventions and Labeling (1) VHDL is not case sensitive Example: Names or labels databus Databus DataBus DATABUS are all the same

3Kazi Fall 2006 EEGN 494 Naming and Labeling (2) General rules of thumb (according to VHDL-87) 1. All names should start with an alphabet character (a-z or A-Z) 2. Use only alphabet characters (a-z or A-Z) digits (0-9) and underscore (_) 3. Do not use any punctuation or reserved characters within a name (!, ?,., &, +, -, etc.) 4. Do not use two or more consecutive underscore characters (__) within a name (e.g., Sel__A is invalid) 5. All names and labels in a given entity and architecture must be unique

4Kazi Fall 2006 EEGN 494 Free Format VHDL is a “free format” language No formatting conventions, such as spacing or indentation imposed by VHDL compilers. Space and carriage return treated the same way. Example: if (a=b) then or if (a=b)then or if (a = b) then are all equivalent

5Kazi Fall 2006 EEGN 494 Comments: A must for Code Readability; Use them wisely Comments in VHDL are indicated with a “double dash”, i.e., “--”  Comment indicator can be placed anywhere in the line  Any text that follows in the same line is treated as a comment  Carriage return terminates a comment  No method for commenting a block extending over a couple of lines Examples: -- main subcircuit Data_in <= Data_bus; -- reading data from the input FIFO

6Kazi Fall 2006 EEGN 494 Recapping: Entity Declaration Entity Declaration describes the interface of the component, i.e. input and output ports. ENTITY nand_gate IS PORT( a : IN STD_LOGIC; b : IN STD_LOGIC; z : OUT STD_LOGIC ); END nand_gate; Reserved words Entity name Port names Port type Semicolon No Semicolon Port modes (data flow directions)

7Kazi Fall 2006 EEGN 494 Mode In a Entity Port signal Driver resides outside the entity

8Kazi Fall 2006 EEGN 494 Mode out Entity Port signal Driver resides inside the entity Can’t read out within an entity z c <= z c

9Kazi Fall 2006 EEGN 494 Mode out with signal Port signal Entity Driver resides inside the entity Signal X can be read inside the entity x c z z <= x c <= x

10Kazi Fall 2006 EEGN 494 Mode inout – Infers bi-directionality: Under most circumstances avoid using this construct Signal can be read inside the entity Entity Port signal Driver may reside both inside and outside of the entity a Use this construct in modeling bi-directional pads.

11Kazi Fall 2006 EEGN 494 Mode buffer : This construct not synthesis friendly (dependent on specific tools) Entity Port signal Driver resides inside the entity Port signal Z can be read inside the entity c z c <= z

12Kazi Fall 2006 EEGN 494 Summarizing: Port Modes The Port Mode of the interface describes the direction in which data travels with respect to the component In: Data comes in this port and can only be read within the entity. It can appear only on the right side of a signal or variable assignment. Out: The value of an output port can only be updated within the entity. It cannot be read. It can only appear on the left side of a signal assignment. Inout: The value of a bi-directional port can be read and updated within the entity model. It can appear on both sides of a signal assignment. Buffer: Used for a signal that is an output from an entity. The value of the signal can be used inside the entity, which means that in an assignment statement the signal can appear on the left and right sides of the <= operator

13Kazi Fall 2006 EEGN 494 STD_LOGIC Demystified

14Kazi Fall 2006 EEGN 494 STD_LOGIC What is STD_LOGIC you ask? LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY nand_gate IS PORT( a : IN STD_LOGIC; b : IN STD_LOGIC; z : OUT STD_LOGIC); END nand_gate; ARCHITECTURE model OF nand_gate IS BEGIN z <= a NAND b; END model;

15Kazi Fall 2006 EEGN 494 STD_LOGIC type demystified ValueMeaning ‘X’Forcing (Strong driven) Unknown ‘0’Forcing (Strong driven) 0 ‘1’Forcing (Strong driven) 1 ‘Z’High Impedance ‘W’Weak (Weakly driven) Unknown ‘L’ Weak (Weakly driven) 0. Models a pull down. ‘H’ Weak (Weakly driven) 1. Models a pull up. ‘-’Don't Care

16Kazi Fall 2006 EEGN 494 More on STD_LOGIC Meanings (1) ‘1’ ‘0’ ‘X’ Contention on the bus X

17Kazi Fall 2006 EEGN 494 More on STD_LOGIC Meanings (2) Output drive buffers in High Impedance state (also known to be in tri-state): Used when multiple drivers on the same wire or bus

18Kazi Fall 2006 EEGN 494 More on STD_LOGIC Meanings (4) Do not care. Can be assigned to outputs for the case of invalid inputs(may produce significant improvement in resource utilization after synthesis). Use with caution ‘1’ = ‘-’ give FALSE ‘-’

19Kazi Fall 2006 EEGN 494 Resolving logic levels X 0 1 Z W L H - X X X X X X X X X 0 X 0 X X 1 X X X Z X 0 1 Z W L H X W X 0 1 W W W W X L X 0 1 L W L W X H X 0 1 H W W H X - X X X X X X X X

20Kazi Fall 2006 EEGN 494 Signals: Elaborated SIGNAL a : STD_LOGIC; SIGNAL b : STD_LOGIC_VECTOR(7 DOWNTO 0); wire a bus b 1 8

21Kazi Fall 2006 EEGN 494 Standard Logic Vectors SIGNAL a: STD_LOGIC; SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL d: STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL e: STD_LOGIC_VECTOR(15 DOWNTO 0); SIGNAL f: STD_LOGIC_VECTOR(8 DOWNTO 0); ………. a <= ‘1’; b <= ”0000”; -- Binary base assumed by default c <= B”0000”; -- Binary base explicitly specified d <= ”0110_0111”; -- You can use ‘_’ to increase readability e <= X”AF67”; -- Hexadecimal base f <= O”723”; -- Octal base

22Kazi Fall 2006 EEGN 494 Vectors and Concatenation SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL c, d, e: STD_LOGIC_VECTOR(7 DOWNTO 0); a <= ”0000”; b <= ”1111”; c <= a & b; -- c = ” ” d <= ‘0’ & ” ”; -- d <= ” ” e <= ‘0’ & ‘0’ & ‘0’ & ‘0’ & ‘1’ & ‘1’ & ‘1’ & ‘1’; -- e <= ” ”

23Kazi Fall 2006 EEGN 494 VHDL Design Styles

24Kazi Fall 2006 EEGN 494 VHDL Design Styles Components and interconnects structural VHDL Design Styles dataflow Concurrent statements behavioral Registers State machines Test benches Sequential statements Subset most suitable for synthesis

25Kazi Fall 2006 EEGN 494 xor3 Example

26Kazi Fall 2006 EEGN 494 Entity xor3 ENTITY xor3 IS PORT( A : IN STD_LOGIC; B : IN STD_LOGIC; C : IN STD_LOGIC; Result : OUT STD_LOGIC ); end xor3;

27Kazi Fall 2006 EEGN 494 Dataflow Description Describes how data moves through the system and the various processing steps. Data Flow uses series of concurrent statements to realize logic. Concurrent statements are evaluated at the same time; thus, order of these statements doesn’t matter. Data Flow is most useful style when series of Boolean equations can represent a logic.

28Kazi Fall 2006 EEGN 494 Dataflow Architecture (xor3 gate) ARCHITECTURE dataflow OF xor3 IS SIGNAL U1_out: STD_LOGIC; BEGIN U1_out <=A XOR B; Result <=U1_out XOR C; END dataflow; U1_out

29Kazi Fall 2006 EEGN 494 Structural Architecture (xor3 gate) ARCHITECTURE structural OF xor3 IS SIGNAL U1_OUT: STD_LOGIC; COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; BEGIN U1: xor2 PORT MAP (I1 => A, I2 => B, Y => U1_OUT); U2: xor2 PORT MAP (I1 => U1_OUT, I2 => C, Y => Result); END structural; A B C ResultXOR3

30Kazi Fall 2006 EEGN 494 Component and Instantiation (1) Named association connectivity (recommended) COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; U1: xor2 PORT MAP (I1 => A, I2 => B, Y => U1_OUT);

31Kazi Fall 2006 EEGN 494 COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; U1: xor2 PORT MAP (A, B, U1_OUT); Component and Instantiation (2) Positional association connectivity (not recommended)

32Kazi Fall 2006 EEGN 494 Structural Description Structural design is the simplest to understand. This style is the closest to schematic capture and utilizes simple building blocks to compose logic functions. Components are interconnected in a hierarchical manner. Structural descriptions may connect simple gates or complex, abstract components. Structural style is useful when expressing a design that is naturally composed of sub-blocks.

33Kazi Fall 2006 EEGN 494 Behavioral Architecture (xor3 gate) ARCHITECTURE behavioral OF xor3 IS BEGIN xor3_behave: PROCESS (A,B,C) BEGIN IF ((A XOR B XOR C) = '1') THEN Result <= '1'; ELSE Result <= '0'; END IF; END PROCESS xor3_behave; END behavioral;

34Kazi Fall 2006 EEGN 494 Behavioral Description It accurately models what happens on the inputs and outputs of the black box (no matter what is inside and how it works). This style uses PROCESS statements in VHDL.

35Kazi Fall 2006 EEGN 494 Concurrent Statements vs. Sequential Statements Concurrent statements implies the code is being executed in parallel. Combinatorial logic is a good example of concurrent behavior Output of the combinatorial logic is dependent on its inputs: i.e., as soon as the input changes, the output changes. Sequential statements imply that the output is dependent on previous state This requires some storage elements connected to combinatorial logic through feedback loop

36Kazi Fall 2006 EEGN 494 Sequential Code VHDL Code inside the Processes, Functions and Procedures are executed sequentially. However, as a whole, any of the blocks of code are executed in parallel

37Kazi Fall 2006 EEGN 494 Example of Concurrent Code Library ieee; USE ieee.std_logic_1164.all; ENTITY mux IS PORT( a, b, c, d, s0, s1: std_logic; y: out std_logic); END mux; Architecture pure_logic OF mux IS BEGIN y <= (a AND NOT s1 AND NOT s0) OR (b AND NOT s1 and s0) OR (c AND s1 AND NOT s0) OR (d AND s1 AND S0); END pure_logic;

38Kazi Fall 2006 EEGN 494 Example of Concurrent Code: Using WHEN / ELSE Library ieee; USE ieee.std_logic_1164.all; ENTITY mux IS PORT( a, b, c, d : IN std_logic; sel: IN std_logic_vector (1 downto 0); y: out std_logic); END mux; Architecture mux1 OF mux IS BEGIN y <= a WHEN sel = “00” ELSE b WHEN sel = “01” ELSE c WHEN sel = “10” ELSE d; END mux1;

39Kazi Fall 2006 EEGN 494 Example of Concurrent Code: Using WITH / SELECT / WHEN Library ieee; USE ieee.std_logic_1164.all; ENTITY mux IS PORT( a, b, c, d : IN std_logic; sel: IN std_logic_vector (1 downto 0); y: out std_logic); END mux; Architecture mux2 OF mux IS BEGIN WITH sel SELECT y <= a WHEN “00”,-- notice “,” instead of “;” b WHEN “01”, c WHEN “10”, d WHEN OTHERS;-- cannot be “d WHEN “11” “ END mux2;

40Kazi Fall 2006 EEGN 494 BLOCK There are two kinds of BLOCK statements: Simple Guarded

41Kazi Fall 2006 EEGN 494 BLOCK Simple This represents only a way of locally partitioning the code. It allows a set of concurrent statements to be clustered into a BLOCK. The main intent is to make the code more readable. Label: BLOCK [declarative part] BEGIN (concurrent statements) END BLOCK label;

42Kazi Fall 2006 EEGN 494 BLOCK: Simple ARCHITECTURE example……… BEGIN block1: BLOCK BEGIN (concurrent statements) END BLOCK block1; block2: BLOCK BEGIN (concurrent statements) END BLOCK block2; ……….. END example;

43Kazi Fall 2006 EEGN 494 BLOCK: Guarded Guarded BLOCK is a special kind of BLOCK, which includes an additional expression, called guard expression A guarded statement in a guarded BLOCK is executed only when the guard expression is TRUE. Label: BLOCK (guard expression) [declarative part] BEGIN (concurrent guarded and unguarded statements) END BLOCK LABEL;

44Kazi Fall 2006 EEGN 494 BLOCK: Guarded Library ieee; USE ieee.std_logic_1164.all; ENTITY latch IS PORT( d, clk : IN std_logic; q: out std_logic); END latch; Architecture latch OF latch IS BEGIN b1: BLOCK (clk = ‘1’) BEGIN Q <= GUARDED d; END BLOCK b1; END latch; Recommendation: Do not use this construct of Latches or Flip Flops. Use Processes instead!!

45Kazi Fall 2006 EEGN 494 BLOCK: Guarded Library ieee; USE ieee.std_logic_1164.all; ENTITY dff IS PORT( d, rst, clk : IN std_logic; q: out std_logic); END dff; Architecture latch OF latch IS BEGIN b1: BLOCK (clk’EVENT AND clk = ‘1’) BEGIN Q <= GUARDED ‘0’ WHEN rst = ‘1’ ELSE d; END BLOCK b1; END dff; Recommendation: Do not use this construct of Latches or Flip Flops. Use Processes instead!!

46Kazi Fall 2006 EEGN 494 Assignment 2 Write the VDHL code for a 16 bit multiplexer using WHEN / ELSE Write VDHL code for a 16 bit multiplexer using WITH / SELECT / WHEN

47Kazi Fall 2006 EEGN 494 Assignment 2 continued Write the VHDL code for the circuit shown on the right Hint: try using two separate blocks and an internal signal that connects the out of the first mux and the input of the 2 nd mux