Topics AliasesSubprograms Generics & Configurations.

Slides:



Advertisements
Similar presentations
COE 405 VHDL Basics Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh Computer Engineering.
Advertisements

1 Introduction to VHDL (Continued) EE19D. 2 Basic elements of a VHDL Model Package Declaration ENTITY (interface description) ARCHITECTURE (functionality)
Programming Languages and Paradigms
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
Sistemas Digitais I LESI - 2º ano Lesson 5 - VHDL U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes Dept.
SubprogramsSubprograms. SubprogramsSubprograms ä Similar to subprograms found in other languages ä Allow repeatedly used code to be referenced multiple.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Topics of Lecture Structural Model Procedures Functions Overloading.
Topics Entity DeclarationsEntity Declarations Port ClausePort Clause Component DeclarationComponent Declaration Configuration DeclarationConfiguration.
N Structural Modeling: n Entities n Ports n Architectures n Packages.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 H ardware D escription L anguages Basic Language Concepts.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Circuit Simulation 1) Functional simulation :- Propagation delay through the circuit are neglected. 2) Timing simulation :- Propagation delay through the.
IAY 0600 Digital Systems Design
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
Introduction to VHDL Arab Academy for Science, Technology & Maritime Transport Computer Engineering Department Magdy Saeb, Ph.D.
ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 6: Configurations.
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
VHDL FLI. FLI Definition FLI routines are C programming language functions that provide procedural access to information within the HDL simulator.
VHDL IE- CSE. What do you understand by VHDL??  VHDL stands for VHSIC (Very High Speed Integrated Circuits) Hardware Description Language.
7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
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.
2-Jun-16EE5141 Chapter 3 ä The concept of the signal ä Process concurrency ä Delta time ä Concurrent and sequential statements ä Process activation by.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Generate Statement A generate statement provides a mechanism for iterative or conditional elaboration of a portion of description. The iterative elaboration.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
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.
1 Introduction to VHDL Part 2 Fall We will use Std_logic And, Or have same precedence See slide 8 of part 1.
16/11/2006DSD,USIT,GGSIPU1 Packages The primary purpose of a package is to encapsulate elements that can be shared (globally) among two or more design.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
5-1 Logic System Design I VHDL Design Principles ECGR2181 Reading: Chapter 5.0, 5.1, 5.3 port ( I: in STD_LOGIC_VECTOR (1 to 9); EVEN, ODD: out STD_LOGIC.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Subprograms Lecture 6. Subprograms A subprogram defines a sequential algorithm that performs some computations. Subprograms can be: –1. functions –2.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
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.
VHDL Tutorial.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
IAY 0600 Digital Systems Design VHDL discussion Structural style Modular design and hierarchy Part 1 Alexander Sudnitson Tallinn University of Technology.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Introduction To VHDL 홍 원 의.
Structural style Modular design and hierarchy Part 1
Basic Language Concepts
IAY 0600 Digitaalsüsteemide disain
Behavioral Style Combinational Design with VHDL
Module Goals Introduce structural VHDL constructs Use of components
Structural style Modular design and hierarchy Part 1
UNIT - V STORED PROCEDURE.
IAY 0600 Digital Systems Design
Structural style Modular design and hierarchy Part 1
Instructions to get MAX PLUS running
IAY 0600 Digital Systems Design
ECE 434 Advanced Digital System L10
VHDL Discussion Subprograms
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL Discussion Subprograms
Classes, Objects and Methods
Data Object By E. Thirumeni Department of Electronics
Design units Lecture 2.
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Topics AliasesSubprograms Generics & Configurations

Guangfa Lu March 2003Advanced Topics on VHDL Aliases An alternate name for name items Can significantly improve the readability of VHDL codes by using a shorthand notation for long names. Provides a mechanism to refer to the same named item in different ways.

Guangfa Lu March 2003Advanced Topics on VHDL Aliases signal S: BIT_VECTOR (31 downto 0); Sign Exponent Mantissa OP Reg Base Offset Can represent: Or: An example:

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Syntax: alias identifier [ : identifier-type] is item-name; alias identifier [ : identifier-type] is item-name [signature]; Optional “signature” portion

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Object aliases   Constant   Signal   Variable   File Non-Object aliases   Function names   Literals   Type names   Attribute names Except: labels, loop parameters, and generate parameters

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Examples : constant number_of_bytes : integer :=4; alias N : integer is number_of_byptes; Object aliases:

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Example: Suppose we need to use objects from two different packages, work.alu_types.all and work.io_types.all, and each declare a constant named data_width with different values. Then we have to refer to them as: work.alu_tpes.data_width work.io_types.all.data_width It’s not convenient ! If we include packages as follows: Object aliases:

Guangfa Lu March 2003Advanced Topics on VHDL Aliases We can avoid this by: Introducing two alias declarations into our model! Object aliases:

Guangfa Lu March 2003Advanced Topics on VHDL Aliases None-object aliases: Example: function names literal type name

Guangfa Lu March 2003Advanced Topics on VHDL Aliases With aliases, it is possible to declare something like ‘subtypes’, if the what we required is just a somewhat restricted version of the original type. With aliases, it is possible to declare something like ‘subtypes’, if the what we required is just a somewhat restricted version of the original type. In this way, we break down complex data structures into simpler parts that can be accessed directly. In this way, we break down complex data structures into simpler parts that can be accessed directly.

Guangfa Lu March 2003Advanced Topics on VHDL Aliases An example: function names

Guangfa Lu March 2003Advanced Topics on VHDL Aliases With aliases, it is possible to declare something like ‘subtypes’, if the what we required is just a somewhat restricted version of the original type. With aliases, it is possible to declare something like ‘subtypes’, if the what we required is just a somewhat restricted version of the original type. In this way, we break down complex data structures into simpler parts that can be accessed directly. In this way, we break down complex data structures into simpler parts that can be accessed directly. Notice: we are NOT defining a new data type. However, there are real subtypes.

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Language Features: SUBTYPES SUBTYPE = TYPE + constraints on values   TYPE is the base-type of SUBTYPE   SUBTYPE inherits all the operators of TYPE   SUBTYPE can be more or less used interchangeably with TYPE examples: subtype small_float is real range 0.0 to 1.0;

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Signature alias identifier [ : identifier-type] is item-name [signature]; The “signature” portion is optional. Used for Subprograms Enumeration literals

Guangfa Lu March 2003Advanced Topics on VHDL Aliases Syntax: alias identifier [ : identifier-type] is item-name [signature]; The “signature” portion is optional. [ type_mark,… return type_mark ] Signature’s syntax rule:

Guangfa Lu March 2003Advanced Topics on VHDL Aliases None-object aliases: Example: function names literal type name

Topics AliasesSubprograms Generics & Configurations

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms   Like other programming languages, VHDL provides subprogram facilities in the form of functions and procedures.   VHDL also provided a package facility for collecting declarations and objects into modular units.   Packages also provide a measure of data abstraction and information hiding.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms Two steps: ① First they must be declared; ② Then they can be called elsewhere.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms Modes : FunctionsinputProcedures input output Mode:in in out / inout

Guangfa Lu March 2003Advanced Topics on VHDL Functions:  Can be used within an expression;  Can be used to describe frequently used sequential algorithms;  Return a single value;  Execute in zero simulation time (no WAIT allowed). Subprograms : functions

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Declaration: [pure | impure] function identifier [( parameter_interface_list )] return type_mark is { subprogram_declarative_item } begin { sequential_statements } end [ function ] [ identifier ]; Where parameter_interface_list is: ([ constant | variable | signal ] identifier {, …} : in type_indication [ := static_expression ] ) {,…} mode

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Example:

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Declaration: [pure | impure] function identifier [( parameter_interface_list )] return type_mark is { subprogram_declarative_item } begin { sequential_statements } end [ function ] [ identifier ]; Call: identifier [(parameter_association_list )]

Guangfa Lu March 2003Advanced Topics on VHDL Example: Subprograms : functions

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Declaration: [pure | impure] function identifier [( parameter_interface_list )] return type_mark is { subprogram_declarative_item } begin { sequential_statements } end [ function ] [ identifier ];  By default, functions are declared as pure;  In pure functions, the only accessible data are the input arguments; and the only returned information from this function is the returned value. Pure functions do not have access to objects outside the function.  VHDL’93 introduces impure declaration;  Impure functions must be explicitly declared;  Impure functions can modify data outside their own scope.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Example: The file bit_file is an outside object. Since the function is impure, accessing to the file bit_file is possible.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions Usages of functions:  Returning a value in an expression.  Conversion functions to convert an object of one type to another to convert an object of one type to another  Resolution functions to resolve bus contention on a multiply-driven signal to resolve bus contention on a multiply-driven signal

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions  Conversion functions. are used to convert an object of one type to another to allow mapping of signals and ports of different types. This type of situation usually arises when a designer wants to make use of an entity from anther design that uses a different data type. are used to convert an object of one type to another to allow mapping of signals and ports of different types. This type of situation usually arises when a designer wants to make use of an entity from anther design that uses a different data type.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : functions  Resolution functions are used to return the value of a signal when the signal is driven by multiple drivers. It is illegal in VHDL to have a signal with multiple drivers without a resolution function attached to it. are used to return the value of a signal when the signal is driven by multiple drivers. It is illegal in VHDL to have a signal with multiple drivers without a resolution function attached to it. A resolution function has a signal-argument input (consists of an unconstrained array of driver values for the signal) and returns a single signal value.

Guangfa Lu March 2003Advanced Topics on VHDL Procedures :  Can be used to partition large behavioral descriptions into modular sections;  A procedure call may be a sequential or concurrent statement;  Arbitrary number of parameters of any possible direction ( in / out / inout );  May or may not execute in zero simulation time. Subprograms : procedures

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Declaration: procedure identifier [( parameter_interface_list )] is { subprogram_declarative_item } begin { sequential_statements } end [ procedure ] [ identifier ]; Where parameter_interface_list is: ([ constant | variable | signal ] identifier {, …} : mode type_indication [ := static_expression ] ) {,…}

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Declaration: procedure identifier [( parameter_interface_list )] is { subprogram_declarative_item } begin { sequential_statements } end [ procedure ] [ identifier ]; Call statement: [ label : ] procedure_name [ (parameter_association_list)];

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Example:

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Default Values in the parameters: When the procedure is called, we can use either leave it out in the caller’s parameter list, or use keyword ‘open’.

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Example: or

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Declaration: procedure identifier [( parameter_interface_list )] is { subprogram_declarative_item } begin { sequential_statements } end [ procedure ] [ identifier ]; Call statement: [ label : ] procedure_name [ (parameter_association_list)]; ;

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures call_proc: p ( s1, s2, val ); call_proc: process is begin p ( s1, s2, val ); wait on s1, s2; end process call_proc; Concurrent Procedure Call Statements: are equivalent to the same procedures with a wait statement, whose sensitivity clause includes the signals mentioned in the parameter list. The equivalent procedure: A concurrent procedure call:

Guangfa Lu March 2003Advanced Topics on VHDL Subprograms : procedures Function: encapsulates a collection of statements that compute a result  generate an expression Procedure: encapsulates a collection of sequential statements to execute  generate a statement

Generics & Configurations

Guangfa Lu March 2003Advanced Topics on VHDL Generics Can we write general models instead of making specific models with VHDL ?

Guangfa Lu March 2003Advanced Topics on VHDL Generics Motivation :  Oftentimes we want to be able to specify a property separately for each instance of a component.  VHDL allows models to be parameterized with generics.  Allows one to make general models instead of making specific models for many different configurations of inputs, outputs, and timing information.  Information passed into a design description from its environment.

Guangfa Lu March 2003Advanced Topics on VHDL Generics A generic entity AND_GATE is generic ( N: natural := 2 ); port ( A: in bit_vector (1 to N ); Z: out bit); end AND_GATE; architecture generic_ex of AND_GATE is begin process (A) variable AND_OUT:bit; begin AND_OUT := ‘1’; for k in 1 to N loop AND_OUT := AND_OUT and A(k); exit when AND_OUT = ‘0’; end loop; Z<=AND_OUT; end process; end GENERIC_EX; AND gate

Guangfa Lu March 2003Advanced Topics on VHDL Generics  A generic declares a constant object of mode in (read only); The value of this constant can be specified as a static expression globally:  Then it can be used in the entity declaration and its corresponding architecture bodies.  The value of a generic must be determined at elaboration time (explicitly specified at least once).

Guangfa Lu March 2003Advanced Topics on VHDL Generics The value for a generic may be specified  in an entity declaration;  in a component declaration;  in a component instantiation.

Guangfa Lu March 2003Advanced Topics on VHDL Generics entity ANOTHER_GEN_EX is end; archiecture GEN_IN_COMP of ANOTHER_GEN_EX is component NAND_GATE generic (M: INTEGER); port (A: in bit_vector(M downto 1); z: out bit); end component; component AND_GATE generic (N: natuaral := 5); port (A: in bit_vector(1 to N); Z: out bit); end component; signal S1, S2, S3, S4: bit; signal SA: bit_vector( 1to 5); signal SB: bit_vector( 2 downto 1); signal SC: bit_vector(1 to 10); signal SD: bit_vector(5 downto 0); begin N1: NAND_GATE generic map (6) port map (SD, S1); --N2: NAND_GATE port map (SB, S2); A1: AND_GATE generic map (N => 10) port map (SC, S3); A2: AND_GATE port map (SA, S4); end GEN_IN_COMP; component declarations component instantiations

Guangfa Lu March 2003Advanced Topics on VHDL Generics Notes:  Generic information is static it can not be changed during the simulation.  Generic value is instance-specific different instances of the same component can have different values.

Guangfa Lu March 2003Advanced Topics on VHDL Configurations  Why we need configurations ? It may be convenient to specify multiple views for a single entity and use any one of them for simulation. For example, there are three architecture bodies, called FA_BEH, FA_STR, and FA_MIXED, corresponding to an entity FULL_ADDER. We can select any of them for simulation by specifying an appropriate configuration.

Guangfa Lu March 2003Advanced Topics on VHDL Configurations  Configurations A VHDL description may consist of many design entities, each with several architectures, and organized into a design hierarchy. The configuration does the job of specifying the exact set of entities and architectures to use, in other words, binding component instances to entities.

Guangfa Lu March 2003Advanced Topics on VHDL Configurations  Configurations Specify which architectures to use for a particular component Specify which architectures to use for a particular component Specify which parameter values to use for a particular component Specify which parameter values to use for a particular component

Guangfa Lu March 2003Advanced Topics on VHDL Configurations  A configuration is therefore used to bind the following pairs: An architecture body to its entity declaration An architecture body to its entity declaration A component with an entity A component with an entity  Definition: Associating an architectural description with a component in a structural model. Associating an architectural description with a component in a structural model.

Guangfa Lu March 2003Advanced Topics on VHDL Configurations  Choose component

Guangfa Lu March 2003Advanced Topics on VHDL Configurations VHDL provides two ways of binding:  By using a configuration specifications Is used to bind component instantiations to specific entities stored in design libraries. Is used to bind component instantiations to specific entities stored in design libraries.  By using a configuration declarations The binding can be performed after the architecture body has been written. The binding can be performed after the architecture body has been written. More than one configuration declaration for an entity is possible. More than one configuration declaration for an entity is possible. The power lies in that the sub-components in an entire hierarchy of a design can be bound using a single configuration declaration. The power lies in that the sub-components in an entire hierarchy of a design can be bound using a single configuration declaration.

Guangfa Lu March 2003Advanced Topics on VHDL Configurations Configuration specifications A VHDL construct which helps associate a particular architecture with an instantiated component … component MYCOMP port ( ….) ; end component ; for U1 : MYCOMP use entity work.MYCOMP(BEHAV); libraryentityarchitecture

Guangfa Lu March 2003Advanced Topics on VHDL Configurations

Guangfa Lu March 2003Advanced Topics on VHDL Configurations

Topics AliasesSubprograms Generics & Configurations