SlideShare a Scribd company logo
1 of 95
By
P.SIVA NAGENDRA REDDY
VHDL Introduction
 V- VHSIC
 Very High Speed Integrated Circuit
 H- Hardware
 D- Description
 L- Language
History of VHDL
 In the 1970’s the initial idea for a Hardware
Description Language was discussed.
 But, the VHSIC program wasn’t launched until 1980.
 The goal was to create a common language that would
shorten the time from concept to implementation for
hardware design.
History of VHDL
 In July 1983 the contract was awarded to create VHDL by
the Department of Defense
- Intermetrics
- IBM
- Texas Instruments
August 1985 Version 7.2 was released
History of VHDL
 It was first in December of 1987 that IEEE standardized
VHDL 1076-1987
 VHDL also became an ANSI standard in 1988
 In September of 1993 VHDL was re-standardized to
clarify and enhance the language.
 In 1998 a committee convened to update the VHDL-1993
standard.
 In 2001 IEEE revised the 1993 standard and the new
standard today is 1076-2001
 VHDL is an International IEEE Standard Specification
Language (IEEE 078-2001) for Describing Digital
Hardware Used by Industry Worldwide
 VHDL stands for VHSIC (Very High Speed Integrated
Circuit) Hardware Description Language
P.SIVA NAGENDRA REDDY 6
VHDL Benefits
1. Public Standard
2. Technology and Process Independent
 Include technology via libraries
3. Supports a variety of design methodologies
1. Behavioral modeling
2. Dataflow or RTL (Register Transfer Language)
Modeling
3. Structural or gate level modeling
VHDL Benefits (cont)
4. Supports Design Exchange
 VHDL Code can run on a variety of systems
5. Supports Design Reuse
 Code “objects” can be used in multiple designs
6. Supports Design Hierarchy
 Design can be implemented as interconnected
submodules
VHDL Benefits (cont)7. Supports Synchronous and Asynchronous Designs
8. Supports Design Simulation
 Functional (unit delay)
 Timing (“actual” delay)
9. Supports Design Synthesis
 Hardware implementation of the design obtained directly from
VHDL code.
10. Supports Design Documentation
 Original purpose for VHDL – Department of Defense
VHDL
CODE
a1
1
a2
2
3
a3
4
a4
b1
b2
b3
b4
5
6
7
8
Vcc1
0
GND
0
FPLD
VHDL
Synthsize
Software
VHDL Design Units
 Entity Declaration
 Describes external view of the design (e.g. I/O)
 Architecture Body (AB)
 Describes internal view of the design
 Configuration Declaration
 Package Declaration
 Library Declaration
 Package Body
VHDL Program Template
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Entity design_name is
port(signal1,signal2,…..:mode type;
signal3,signal4,…..:mode type);
End entity design_name;
Architecture name of entity_name is
internal signal and constant
declarations
Begin
Concurrent statement 1;
Concurrent statement 2;
Concurrent statement 3;
Concurrent statement 4;
End architecture name;
Identifiers
 May contain A-Z, a-z, 0-9, _
 Must start with letter
 May not end with _
 May not include two consecutive _
 VHDL is case insensitive
 Sel sel and SEL refer to same object
Identifier Examples
 A2G
 valid
 8bit_counter
 invalid -- starts with number
 _NewValue
 invalid -- starts with _
 first#
 invalid -- illegal character
Standard Libraries Include library ieee; before entity declaration.
 ieee.std_logic_1164 defines a standard for designers to use in
describing interconnection data types used in VHDL
modeling.
 ieee.std_logic_arith provides a set of arithmetic, conversion,
comparison functions for signed, unsigned, std_ulogic,
std_logic, std_logic_vector.
 Ieee.std_logic_unsigned provides a set of unsigned
arithmetic, conversion, and comparison functions for
std_logic_vector.
 See all available packages at
http://www.cs.umbc.edu/portal/help/VHDL/stdpkg.html
 Entity - All designs are expressed in terms of
entities. An entity is the most basic building block
in a design. The uppermost level of the design is
the top-level entity. If the design is hierarchical,
then the top-level description will have lower-level
descriptions contained in it. These lower-level
descriptions will be lower-level entities contained
in the top-level entity description.
P.SIVA NAGENDRA REDDY 15
VHDL Syntax – Entity Declaration
Describes I/O of the design. I/O Signals are
called ports.
The syntax is:
Entity design_name is
port(signal1,signal2,…..:mode type;
signal3,signal4,…..:mode type);
End entity design_name;
Entity Declaration
• An entity declaration describes the interface of the component. Avoid
using Altera’s primitive names which can be found at
c:/altera/91/quartus/common/help/webhelp/master.htm#
• PORT clause indicates input and output ports.
• An entity can be thought of as a symbol for a component.
Port Declaration
• PORT declaration establishes the interface of the object
to the outside world.
• Three parts of the PORT declaration
• Name
• Any identifier that is not a reserved word.
• Mode
• In, Out, Inout, Buffer
• Data type
• Any declared or predefined datatype.
• Sample PORT declaration syntax:
VHDL Syntax – Entity Example
Entity my_example is
port( a,b,c: in std_logic;
s: in std_logic_vector(1 downto 0);
e,f: out std_logic;
y: out std_logic_vector(4 downto 0));
end entity my_example;
Maxplus II Block Diagram
 Architecture - All entities that can be simulated
have an architecture description. The architecture
describes the behavior of the entity. A single entity
can have multiple architectures. One architecture
might be behavioral, while another might be a
structural description of the design.
P.SIVA NAGENDRA REDDY 20
 Configuration - A configuration statement is used
to bind a component instance to an entity-
architecture pair. A configuration can be
considered as a parts list for a design. It describes
which behavior to use for each entity, much like a
parts list describes which part to use for each part
in the design.
P.SIVA NAGENDRA REDDY 21
Architecture Body (AB)
 The architecture body contains the internal
description of the design entity. The VHDL
specification states that a single design entity can
contain multiple architecture bodies. Each AB can
be used to describe the design using a different level
of abstraction.
Architecture Body Syntax
 Architecture name of entity_name is
internal signal and constant declarations
Begin
Concurrent statement 1;
Concurrent statement 2;
Concurrent statement 3;
Concurrent statement 4;
End architecture name;
Architecture Declaration
• Architecture declarations describe the operation of the
component.
• Many architectures may exist for one entity, but only one may be
active at a time.
• An architecture is similar to a schematic of the component.
Modeling Styles
• There are three modeling styles:
• Behavioral (Sequential)
• Data flow
• Structural
VHDL Hierarchy
VHDL Statement Terminator
Each VHDL Statements is terminated using a semicolon
;
VHDL Comment Operator
To include a comment in VHDL, use the comment
operator
-- This is a comment
-- This is an example of a comment
y <= 0; -- can occur at any point
Signal Assignment Operator
To assign a value to a signal data object in VHDL, we use
the
signal assignment operator
<=
Example:
y <= ‘1’; -- signal y is assigned the value ONE
Simple Concurrent Statements
Assignment Operator
 Assignment operator <=
 Ex: y <= a and b; -- defines a AND gate
 For simulation purposes only, you may specify a delay.
 Ex: y <= a and b after 10 ns;
 This is useful if you want to also use VHDL to generate a known test
waveform or vector. This is known as a “test bench.” However, we
will use Maxplus II to generate test vectors. Note, you cannot
specify a delay for synthesis purposes.
VHDL
Test Bench
VHDL
Design
Output
Vector
Test
Vector
Simple Concurrent Statements
Logical Operators
 Logical operators
 And, or, nand, nor, xor, xnor, not
 Operates on std_logic or Boolean data objects
 All operators (except for the not operator) require at least two
arguments
 Ex: y <= a and b; -- AND gate
Simple Concurrent Statements
Logical Operators
 Logical operators
 Examples y <= a and not b;
 Use parenthesis to define order of execution
 Ex: y<= (a and b) or c; y <= a and (b or c);
Y
a
b
c
Y
c
b
a
Sequential vs Concurrent Statements
• VHDL provides two different types of
execution: sequential and concurrent.
• Different types of execution are useful for
modeling of real hardware.
• Supports various levels of abstraction.
• Sequential statements view hardware from a
“programmer” approach.
• Concurrent statements are order-independent
and asynchronous.
Sequential Style
Data flow Style
Complex Concurrent Statements
with-select-when
with-select-when
Syntax is
with select_signal select
signal_name <= value1 when value1_of_select_sig,
value2 when value2_of_select_sig,
value3 when value3_of_select_sig,
value_default when others;
Complex Concurrent Statements
With-select-when
 Example
---- library statements (not shown)
entity my_test is
port( a3,a2,a1,a0: in std_logic_vector(3 downto 0);
s: in std_logic_vector(1 downto 0);
y: out std_logic_vector(3 downto 0));
end entity my_test;
architecture behavior of my_test is
begin
with s select
y <= a3 when “11”,
a2 when “10”,
a1 when “01”,
a0 when others; -- default condition
end architecture behavior;
Structural Style
Sequential Style Syntax
• Assignments are executed sequentially inside
processes.
Sequential Statements
• {Signal, Variable} assignments
• Flow control
• if <condition> then <statments>
[elsif <condition> then <statments>]
else <statements>
end if;
• for <range> loop <statments> end loop;
• while <condition> loop <statments> end loop;
• case <condition> is
when <value> => <statements>;
when <value> => <statements>;
when others => <statements>;
• Wait on <signal> until <expression> for <time>;
Data Objects
• There are three types of data objects:
• Signals
• Can be considered as wires in a schematic.
• Can have current value and future values.
• Variables and Constants
• Used to model the behavior of a circuit.
• Used in processes, procedures and functions.
Constant Declaration
• A constant can have a single value of a given type.
• A constant’s value cannot be changed during the
simulation.
• Constants declared at the start of an architecture can be
used anywhere in the architecture.
• Constants declared in a process can only be used inside
the specific process.
CONSTANT constant_name : type_name [ : = value];
CONSTANT rise_fall_time : TIME : = 2 ns;
CONSTANT data_bus : INTEGER : = 16;
Variable Declaration
• Variables are used for local storage of data.
• Variables are generally not available to multiple
components or processes.
• All variable assignments take place immediately.
• Variables are more convenient than signals for the
storage of (temporary) data.
Signal Declaration
• Signals are used for communication between components.
• Signals are declared outside the process.
• Signals can be seen as real, physical signals.
• Some delay must be incurred in a signal assignment.
Signal Assignment
• A key difference between variables and signals is the
assignment delay.
Variable Assignment
IF – vs CASE – statement Syntax
Sequential Statements
Case -When Statement
Use a CASE-WHEN statement when priority is not needed. All FSMs will be
implemented using Case-when statements.
Syntax is:
Case expression is
when choice_1 =>
sequential statements;
when choice_2 =>
sequential statements;
………….
when choice_n =>
sequential statements;
when others => -- default condition
sequential statements;
end case;
FOR – vs WHILE – statement
Syntax
For is considered to be a
combinational circuit by some
synthesis tools. Thus, it cannot
have a wait statement to be
synthesized.
While is considered to be an FSM
by some synthesis tools. Thus, it
needs a wait statement to be
synthesized.
WAIT – statement Syntax
• The wait statement causes the suspension of a process statement or
a procedure.
• wait [sensitivity_clause] [condition_clause] [timeout_clause];
• Sensitivity_clause ::= on signal_name
wait on CLOCK;
• Condition_clause ::= until boolean_expression
wait until Clock = ‘1’;
• Timeout_clause ::= for time_expression
wait for 150 ns;
Sensitivity-lists vs Wait-on -
statement
Concurrent Process Equivalents
• All concurrent statements correspond to a process
equivalent.
U0: q <= a xor b after 5 ns;
is short hand notation for
U0: process
begin
q <= a xor b after 5 ns;
wait on a, b;
end process;
Structural Style
• Circuits can be described like a netlist.
• Components can be customized.
• Large, regular circuits can be created.
Structural Statements
• Structural VHDL describes the arrangement
and interconnection of components.
• Behavioral descriptions, on the other hand, define
responses to signals.
• Structural descriptions can show a more
concrete relation between code and physical
hardware.
• Structural descriptions show interconnects at
any level of abstraction.
Structural Statements
• The component instantiation is one of the building blocks of
structural descriptions.
• The component instantiation process
requires component declarations and
component instantiation statements.
• Component instantiation declares the
interface of the components used in
the architecture.
• At instantiation, only the interface is visible.
• The internals of the component are hidden.
Component Declaration
• The component declaration declares the interface of the
component to the architecture.
• Necessary if the component interface is not declared
elsewhere (package, library).
Component Instantiation
• The instantiation statement maps the interface of the
component to other objects in the architecture.
Component Instantiation Syntax
• The instantiation has 3 key parts
• Name
• Component type
• Port map
Component Libraries
• Component declarations
may be made inside
packages.
• Components do not have to
be declared in the
architecture body
Generics
• Generics allow the component to be customized upon
instantiation.
• Generics pass information from the entity to the
architecture.
• Common uses of generics
• Customize timing
• Alter range of subtypes
• Change size of arrays
entity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 doentity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 do
ENTITY adder IS
GENERIC(n: natural :=2);
PORT(
A: IN STD_LOGIC_VECTOR(n-1 DOWNTO 0);
B: IN STD_LOGIC_VECTOR(n-1 DOWNTO 0);
C: OUT STD_LOGIC;
SUM: OUT STD_LOGIC_VECTOR(n-1 DOWNTO 0)
);
END adder;
entity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 do
Technology Modeling
• One use of generics is to alter the timing of a certain component.
• It is possible to indicate a generic timing delay and then specify the
exact delay at instantiation.
• The example above declares the interface to a component named
inv.
• The propagation time for high-to-low and low-to-high transitions
can be specified later.
Structural Statements
• The GENERIC MAP is similar to the PORT MAP in that
it maps specific values to generics declared in the
component.
Generate Statement
• Structural for-loops: The GENERATE statement
• Some structures in digital hardware are repetitive in nature.
(RAM, ROM, registers, adders, multipliers, …)
• VHDL provides the GENERATE statement to automatically
create regular hardware.
• Any VHDL concurrent statement may be included in a
GENERATE statement, including another GENERATE
statement.
Generate Statement Syntax
• All objects created are similar.
• The GENERATE parameter must be discrete and is
undefined outside the GENERATE statement.
Example: Array of AND-gates
Operators
 Operators can be chained to form complex expressions, e.g. :
 Can use parentheses for readability and to control the
association of operators and operands
 Defined precedence levels in decreasing order :
 Miscellaneous operators -- **, abs, not
 Multiplication operators -- *, /, mod, rem
 Sign operator -- +, -
 Addition operators -- +, -, &
 Shift operators -- sll, srl, sla, sra, rol, ror
 Relational operators -- =, /=, <, <=, >, >=
 Logical operators -- AND, OR, NAND, NOR, XOR, XNOR
res <= a AND NOT(B) OR NOT(a) AND b;
VHDL Data Types
VHDL Data Types
 Scalar
 Integer
 Enumerated
 Real (floating point)*
 Physical*
 Composite
 Array
 Record
 Access (pointers)*
* Not supported by synthesis tools
Predefined Data Types
• bit (‘0’ or ‘1’)
• bit_vector (array of bits)
• integer
• real
• time (physical data type)
Integer
• Integer
• Minimum range for any implementation as defined by
standard: -2,147,483,647 to 2,147,483,647
• Integer assignment example
Real
• Real
• Minimum range for any implementation as defined by
standard: -1.0E38 to 1.0E38
• Real assignment example
Enumerated
• Enumerated
• User defined range
• Enumerated example
Physical
• Time units are the only predefined physical type in VHDL.
• Physical
• Can be user defined range
• Physical type example
Array
• Array
• Used to collect one or more elements of a similar type in a
single construct.
• Elements can be any VHDL data type.
Record
• Record
• Used to collect one or more elements of different types in a
single construct.
• Elements can be any VHDL data type.
• Elements are accessed through field name.
Subtype
• Subtype
• Allows for user defined constraints on a data type.
• May include entire range of base type.
• Assignments that are out of the subtype range result in error.
• Subtype example
Natural and Positive Integers
• Integer subtypes:
• Subtype Natural is integer range 0 to integer’high;
• Subtype Positive is integer range 1 to integer’high;
Boolean, Bit and Bit_vector
• type Boolean is (false, true);
• type Bit is (‘0’, ‘1’);
• type Bit_vector is array (integer range <>) of bit;
Char and String
• type Char is (NUL, SOH, …, DEL);
• 128 chars in VHDL’87
• 256 chars in VHDL’93
• type String is array (positive range <>) of Char;
IEEE Predefined data types
• type Std_ulogic is (‘U’, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’, ‘L’, ‘H’, ‘-’);
• ‘U’ -- Uninitialized
• ‘X’ -- Forcing unknown
• ‘0’ -- Forcing zero
• ‘1’ -- Forcing one
• ‘Z’ -- High impedance
• ‘W’ -- Weak Unknown
• ‘L’ -- Weak Low
• ‘H’ -- Weak High
• ‘-’ -- Don’t care
• type std_logic is resolved std_ulogic;
• type std_logic_vector is array (integer range <>) of std_logic;
Assignments
• constant a: integer := 523;
• signal b: bit_vector(11 downto 0);
b <= “000000010010”;
b <= B”000000010010”;
b <= B”0000_0001_0010”;
b <= X”012”;
b <= O”0022”;
Functions
 Produce a single return value
 Called by expressions
 Cannot modify the parameters passed to them
 Require a RETURN statement
FUNCTION add_bits2 (a, b : IN BIT) RETURN BIT IS
VARIABLE result : BIT; -- variable is local to function
BEGIN
result := (a XOR b);
RETURN result; -- the two functions are equivalent
END add_bits2;
FUNCTION add_bits (a, b : IN BIT) RETURN BIT IS
BEGIN -- functions cannot return multiple values
RETURN (a XOR b);
END add_bits;
Functions
Example of a Function (cont)
Functions
 Functions must be called by other statements
 Parameters use positional association
ARCHITECTURE behavior OF adder IS
BEGIN
PROCESS (enable, x, y)
BEGIN
IF (enable = '1') THEN
result <= add_bits(x, y);
carry <= x AND y;
ELSE
carry, result <= '0';
END PROCESS;
END behavior;
FUNCTION add_bits
(a, b : IN BIT)
?
P.SIVA NAGENDRA REDDY 94
95P.SIVA NAGENDRA REDDY

More Related Content

What's hot

Chapter 5 introduction to VHDL
Chapter 5 introduction to VHDLChapter 5 introduction to VHDL
Chapter 5 introduction to VHDLSSE_AndyLi
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language Prachi Pandey
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1Béo Tú
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorialraju reddy
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devicesAmmara Javed
 
VLSI Design Flow
VLSI Design FlowVLSI Design Flow
VLSI Design FlowA B Shinde
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDLMohamed Samy
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
 
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2Kundan Gupta
 
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)Revathi Subramaniam
 
Basic structures in vhdl
Basic structures in vhdlBasic structures in vhdl
Basic structures in vhdlRaj Mohan
 

What's hot (20)

Chapter 5 introduction to VHDL
Chapter 5 introduction to VHDLChapter 5 introduction to VHDL
Chapter 5 introduction to VHDL
 
HDL (hardware description language) presentation
HDL (hardware description language) presentationHDL (hardware description language) presentation
HDL (hardware description language) presentation
 
Hdl
HdlHdl
Hdl
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Verilog
VerilogVerilog
Verilog
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
 
VLSI Design Flow
VLSI Design FlowVLSI Design Flow
VLSI Design Flow
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
verilog
verilogverilog
verilog
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
PAL And PLA ROM
PAL And PLA ROMPAL And PLA ROM
PAL And PLA ROM
 
Flash memory
Flash memoryFlash memory
Flash memory
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
 
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2
PROGRAMMABLE LOGIC DEVICES PATR 2 OF 2
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
 
Basic structures in vhdl
Basic structures in vhdlBasic structures in vhdl
Basic structures in vhdl
 

Similar to Dica ii chapter slides

Similar to Dica ii chapter slides (20)

VHDL_VIKAS.pptx
VHDL_VIKAS.pptxVHDL_VIKAS.pptx
VHDL_VIKAS.pptx
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
 
Vhdl 1 ppg
Vhdl 1 ppgVhdl 1 ppg
Vhdl 1 ppg
 
Vhdl
VhdlVhdl
Vhdl
 
Vhdl new
Vhdl newVhdl new
Vhdl new
 
Digital principle and computer design Presentation (1).pptx
Digital principle and computer design Presentation (1).pptxDigital principle and computer design Presentation (1).pptx
Digital principle and computer design Presentation (1).pptx
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
 
VHDL-Behavioral-Programs-Structure of VHDL
VHDL-Behavioral-Programs-Structure of VHDLVHDL-Behavioral-Programs-Structure of VHDL
VHDL-Behavioral-Programs-Structure of VHDL
 
the-vhsic-.pptx
the-vhsic-.pptxthe-vhsic-.pptx
the-vhsic-.pptx
 
DLD5.pdf
DLD5.pdfDLD5.pdf
DLD5.pdf
 
vhdl
vhdlvhdl
vhdl
 
Lecture2 vhdl refresher
Lecture2 vhdl refresherLecture2 vhdl refresher
Lecture2 vhdl refresher
 
VHDL summer training (ppt)
 VHDL summer training (ppt) VHDL summer training (ppt)
VHDL summer training (ppt)
 
Vhdl
VhdlVhdl
Vhdl
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 
L6_Slides_vhdl coures temporary hair dye for dark hair
L6_Slides_vhdl coures temporary hair dye for dark hairL6_Slides_vhdl coures temporary hair dye for dark hair
L6_Slides_vhdl coures temporary hair dye for dark hair
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDL
 
hardware description language power point presentation
hardware description language power point presentationhardware description language power point presentation
hardware description language power point presentation
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 

More from SIVA NAGENDRA REDDY (12)

Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
Dica iv chapter slides
Dica iv chapter slidesDica iv chapter slides
Dica iv chapter slides
 
Dica iii chapter slides
Dica iii chapter slidesDica iii chapter slides
Dica iii chapter slides
 
Lica 3rd chapter slides
Lica 3rd chapter slidesLica 3rd chapter slides
Lica 3rd chapter slides
 
Lica 7th chapter slides
Lica 7th chapter slidesLica 7th chapter slides
Lica 7th chapter slides
 
LICA- DIFFERENTIAL APLIFIERS
LICA- DIFFERENTIAL APLIFIERSLICA- DIFFERENTIAL APLIFIERS
LICA- DIFFERENTIAL APLIFIERS
 
LICA-
LICA- LICA-
LICA-
 
Emi unit iv ppt
Emi unit iv pptEmi unit iv ppt
Emi unit iv ppt
 
Emi unit iii ppt
Emi unit iii pptEmi unit iii ppt
Emi unit iii ppt
 
Emi unit ii ppt
Emi unit ii pptEmi unit ii ppt
Emi unit ii ppt
 
Emi unit 1 ppt
Emi unit 1 pptEmi unit 1 ppt
Emi unit 1 ppt
 
Arduino simulation procedure
Arduino simulation procedureArduino simulation procedure
Arduino simulation procedure
 

Recently uploaded

Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 

Recently uploaded (20)

Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 

Dica ii chapter slides

  • 2. VHDL Introduction  V- VHSIC  Very High Speed Integrated Circuit  H- Hardware  D- Description  L- Language
  • 3. History of VHDL  In the 1970’s the initial idea for a Hardware Description Language was discussed.  But, the VHSIC program wasn’t launched until 1980.  The goal was to create a common language that would shorten the time from concept to implementation for hardware design.
  • 4. History of VHDL  In July 1983 the contract was awarded to create VHDL by the Department of Defense - Intermetrics - IBM - Texas Instruments August 1985 Version 7.2 was released
  • 5. History of VHDL  It was first in December of 1987 that IEEE standardized VHDL 1076-1987  VHDL also became an ANSI standard in 1988  In September of 1993 VHDL was re-standardized to clarify and enhance the language.  In 1998 a committee convened to update the VHDL-1993 standard.  In 2001 IEEE revised the 1993 standard and the new standard today is 1076-2001
  • 6.  VHDL is an International IEEE Standard Specification Language (IEEE 078-2001) for Describing Digital Hardware Used by Industry Worldwide  VHDL stands for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language P.SIVA NAGENDRA REDDY 6
  • 7. VHDL Benefits 1. Public Standard 2. Technology and Process Independent  Include technology via libraries 3. Supports a variety of design methodologies 1. Behavioral modeling 2. Dataflow or RTL (Register Transfer Language) Modeling 3. Structural or gate level modeling
  • 8. VHDL Benefits (cont) 4. Supports Design Exchange  VHDL Code can run on a variety of systems 5. Supports Design Reuse  Code “objects” can be used in multiple designs 6. Supports Design Hierarchy  Design can be implemented as interconnected submodules
  • 9. VHDL Benefits (cont)7. Supports Synchronous and Asynchronous Designs 8. Supports Design Simulation  Functional (unit delay)  Timing (“actual” delay) 9. Supports Design Synthesis  Hardware implementation of the design obtained directly from VHDL code. 10. Supports Design Documentation  Original purpose for VHDL – Department of Defense VHDL CODE a1 1 a2 2 3 a3 4 a4 b1 b2 b3 b4 5 6 7 8 Vcc1 0 GND 0 FPLD VHDL Synthsize Software
  • 10. VHDL Design Units  Entity Declaration  Describes external view of the design (e.g. I/O)  Architecture Body (AB)  Describes internal view of the design  Configuration Declaration  Package Declaration  Library Declaration  Package Body
  • 11. VHDL Program Template Library ieee; Use ieee.std_logic_1164.all; Use ieee.std_logic_arith.all; Entity design_name is port(signal1,signal2,…..:mode type; signal3,signal4,…..:mode type); End entity design_name; Architecture name of entity_name is internal signal and constant declarations Begin Concurrent statement 1; Concurrent statement 2; Concurrent statement 3; Concurrent statement 4; End architecture name;
  • 12. Identifiers  May contain A-Z, a-z, 0-9, _  Must start with letter  May not end with _  May not include two consecutive _  VHDL is case insensitive  Sel sel and SEL refer to same object
  • 13. Identifier Examples  A2G  valid  8bit_counter  invalid -- starts with number  _NewValue  invalid -- starts with _  first#  invalid -- illegal character
  • 14. Standard Libraries Include library ieee; before entity declaration.  ieee.std_logic_1164 defines a standard for designers to use in describing interconnection data types used in VHDL modeling.  ieee.std_logic_arith provides a set of arithmetic, conversion, comparison functions for signed, unsigned, std_ulogic, std_logic, std_logic_vector.  Ieee.std_logic_unsigned provides a set of unsigned arithmetic, conversion, and comparison functions for std_logic_vector.  See all available packages at http://www.cs.umbc.edu/portal/help/VHDL/stdpkg.html
  • 15.  Entity - All designs are expressed in terms of entities. An entity is the most basic building block in a design. The uppermost level of the design is the top-level entity. If the design is hierarchical, then the top-level description will have lower-level descriptions contained in it. These lower-level descriptions will be lower-level entities contained in the top-level entity description. P.SIVA NAGENDRA REDDY 15
  • 16. VHDL Syntax – Entity Declaration Describes I/O of the design. I/O Signals are called ports. The syntax is: Entity design_name is port(signal1,signal2,…..:mode type; signal3,signal4,…..:mode type); End entity design_name;
  • 17. Entity Declaration • An entity declaration describes the interface of the component. Avoid using Altera’s primitive names which can be found at c:/altera/91/quartus/common/help/webhelp/master.htm# • PORT clause indicates input and output ports. • An entity can be thought of as a symbol for a component.
  • 18. Port Declaration • PORT declaration establishes the interface of the object to the outside world. • Three parts of the PORT declaration • Name • Any identifier that is not a reserved word. • Mode • In, Out, Inout, Buffer • Data type • Any declared or predefined datatype. • Sample PORT declaration syntax:
  • 19. VHDL Syntax – Entity Example Entity my_example is port( a,b,c: in std_logic; s: in std_logic_vector(1 downto 0); e,f: out std_logic; y: out std_logic_vector(4 downto 0)); end entity my_example; Maxplus II Block Diagram
  • 20.  Architecture - All entities that can be simulated have an architecture description. The architecture describes the behavior of the entity. A single entity can have multiple architectures. One architecture might be behavioral, while another might be a structural description of the design. P.SIVA NAGENDRA REDDY 20
  • 21.  Configuration - A configuration statement is used to bind a component instance to an entity- architecture pair. A configuration can be considered as a parts list for a design. It describes which behavior to use for each entity, much like a parts list describes which part to use for each part in the design. P.SIVA NAGENDRA REDDY 21
  • 22. Architecture Body (AB)  The architecture body contains the internal description of the design entity. The VHDL specification states that a single design entity can contain multiple architecture bodies. Each AB can be used to describe the design using a different level of abstraction.
  • 23. Architecture Body Syntax  Architecture name of entity_name is internal signal and constant declarations Begin Concurrent statement 1; Concurrent statement 2; Concurrent statement 3; Concurrent statement 4; End architecture name;
  • 24. Architecture Declaration • Architecture declarations describe the operation of the component. • Many architectures may exist for one entity, but only one may be active at a time. • An architecture is similar to a schematic of the component.
  • 25. Modeling Styles • There are three modeling styles: • Behavioral (Sequential) • Data flow • Structural
  • 27. VHDL Statement Terminator Each VHDL Statements is terminated using a semicolon ;
  • 28. VHDL Comment Operator To include a comment in VHDL, use the comment operator -- This is a comment -- This is an example of a comment y <= 0; -- can occur at any point
  • 29. Signal Assignment Operator To assign a value to a signal data object in VHDL, we use the signal assignment operator <= Example: y <= ‘1’; -- signal y is assigned the value ONE
  • 30. Simple Concurrent Statements Assignment Operator  Assignment operator <=  Ex: y <= a and b; -- defines a AND gate  For simulation purposes only, you may specify a delay.  Ex: y <= a and b after 10 ns;  This is useful if you want to also use VHDL to generate a known test waveform or vector. This is known as a “test bench.” However, we will use Maxplus II to generate test vectors. Note, you cannot specify a delay for synthesis purposes. VHDL Test Bench VHDL Design Output Vector Test Vector
  • 31. Simple Concurrent Statements Logical Operators  Logical operators  And, or, nand, nor, xor, xnor, not  Operates on std_logic or Boolean data objects  All operators (except for the not operator) require at least two arguments  Ex: y <= a and b; -- AND gate
  • 32. Simple Concurrent Statements Logical Operators  Logical operators  Examples y <= a and not b;  Use parenthesis to define order of execution  Ex: y<= (a and b) or c; y <= a and (b or c); Y a b c Y c b a
  • 33. Sequential vs Concurrent Statements • VHDL provides two different types of execution: sequential and concurrent. • Different types of execution are useful for modeling of real hardware. • Supports various levels of abstraction. • Sequential statements view hardware from a “programmer” approach. • Concurrent statements are order-independent and asynchronous.
  • 36. Complex Concurrent Statements with-select-when with-select-when Syntax is with select_signal select signal_name <= value1 when value1_of_select_sig, value2 when value2_of_select_sig, value3 when value3_of_select_sig, value_default when others;
  • 37. Complex Concurrent Statements With-select-when  Example ---- library statements (not shown) entity my_test is port( a3,a2,a1,a0: in std_logic_vector(3 downto 0); s: in std_logic_vector(1 downto 0); y: out std_logic_vector(3 downto 0)); end entity my_test; architecture behavior of my_test is begin with s select y <= a3 when “11”, a2 when “10”, a1 when “01”, a0 when others; -- default condition end architecture behavior;
  • 39. Sequential Style Syntax • Assignments are executed sequentially inside processes.
  • 40. Sequential Statements • {Signal, Variable} assignments • Flow control • if <condition> then <statments> [elsif <condition> then <statments>] else <statements> end if; • for <range> loop <statments> end loop; • while <condition> loop <statments> end loop; • case <condition> is when <value> => <statements>; when <value> => <statements>; when others => <statements>; • Wait on <signal> until <expression> for <time>;
  • 41. Data Objects • There are three types of data objects: • Signals • Can be considered as wires in a schematic. • Can have current value and future values. • Variables and Constants • Used to model the behavior of a circuit. • Used in processes, procedures and functions.
  • 42. Constant Declaration • A constant can have a single value of a given type. • A constant’s value cannot be changed during the simulation. • Constants declared at the start of an architecture can be used anywhere in the architecture. • Constants declared in a process can only be used inside the specific process. CONSTANT constant_name : type_name [ : = value]; CONSTANT rise_fall_time : TIME : = 2 ns; CONSTANT data_bus : INTEGER : = 16;
  • 43. Variable Declaration • Variables are used for local storage of data. • Variables are generally not available to multiple components or processes. • All variable assignments take place immediately. • Variables are more convenient than signals for the storage of (temporary) data.
  • 44. Signal Declaration • Signals are used for communication between components. • Signals are declared outside the process. • Signals can be seen as real, physical signals. • Some delay must be incurred in a signal assignment.
  • 45. Signal Assignment • A key difference between variables and signals is the assignment delay.
  • 47. IF – vs CASE – statement Syntax
  • 48. Sequential Statements Case -When Statement Use a CASE-WHEN statement when priority is not needed. All FSMs will be implemented using Case-when statements. Syntax is: Case expression is when choice_1 => sequential statements; when choice_2 => sequential statements; …………. when choice_n => sequential statements; when others => -- default condition sequential statements; end case;
  • 49. FOR – vs WHILE – statement Syntax For is considered to be a combinational circuit by some synthesis tools. Thus, it cannot have a wait statement to be synthesized. While is considered to be an FSM by some synthesis tools. Thus, it needs a wait statement to be synthesized.
  • 50. WAIT – statement Syntax • The wait statement causes the suspension of a process statement or a procedure. • wait [sensitivity_clause] [condition_clause] [timeout_clause]; • Sensitivity_clause ::= on signal_name wait on CLOCK; • Condition_clause ::= until boolean_expression wait until Clock = ‘1’; • Timeout_clause ::= for time_expression wait for 150 ns;
  • 52. Concurrent Process Equivalents • All concurrent statements correspond to a process equivalent. U0: q <= a xor b after 5 ns; is short hand notation for U0: process begin q <= a xor b after 5 ns; wait on a, b; end process;
  • 53. Structural Style • Circuits can be described like a netlist. • Components can be customized. • Large, regular circuits can be created.
  • 54. Structural Statements • Structural VHDL describes the arrangement and interconnection of components. • Behavioral descriptions, on the other hand, define responses to signals. • Structural descriptions can show a more concrete relation between code and physical hardware. • Structural descriptions show interconnects at any level of abstraction.
  • 55. Structural Statements • The component instantiation is one of the building blocks of structural descriptions. • The component instantiation process requires component declarations and component instantiation statements. • Component instantiation declares the interface of the components used in the architecture. • At instantiation, only the interface is visible. • The internals of the component are hidden.
  • 56. Component Declaration • The component declaration declares the interface of the component to the architecture. • Necessary if the component interface is not declared elsewhere (package, library).
  • 57. Component Instantiation • The instantiation statement maps the interface of the component to other objects in the architecture.
  • 58. Component Instantiation Syntax • The instantiation has 3 key parts • Name • Component type • Port map
  • 59. Component Libraries • Component declarations may be made inside packages. • Components do not have to be declared in the architecture body
  • 60. Generics • Generics allow the component to be customized upon instantiation. • Generics pass information from the entity to the architecture. • Common uses of generics • Customize timing • Alter range of subtypes • Change size of arrays entity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 doentity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 do ENTITY adder IS GENERIC(n: natural :=2); PORT( A: IN STD_LOGIC_VECTOR(n-1 DOWNTO 0); B: IN STD_LOGIC_VECTOR(n-1 DOWNTO 0); C: OUT STD_LOGIC; SUM: OUT STD_LOGIC_VECTOR(n-1 DOWNTO 0) ); END adder; entity ADDER is generic(n: natural :=2); port( A: in std_logic_vector(n-1 downto 0); B: in std_logic_vector(n-1 downto 0); carry: out std_logic; sum: out std_logic_vector(n-1 do
  • 61. Technology Modeling • One use of generics is to alter the timing of a certain component. • It is possible to indicate a generic timing delay and then specify the exact delay at instantiation. • The example above declares the interface to a component named inv. • The propagation time for high-to-low and low-to-high transitions can be specified later.
  • 62. Structural Statements • The GENERIC MAP is similar to the PORT MAP in that it maps specific values to generics declared in the component.
  • 63. Generate Statement • Structural for-loops: The GENERATE statement • Some structures in digital hardware are repetitive in nature. (RAM, ROM, registers, adders, multipliers, …) • VHDL provides the GENERATE statement to automatically create regular hardware. • Any VHDL concurrent statement may be included in a GENERATE statement, including another GENERATE statement.
  • 64. Generate Statement Syntax • All objects created are similar. • The GENERATE parameter must be discrete and is undefined outside the GENERATE statement.
  • 65. Example: Array of AND-gates
  • 66. Operators  Operators can be chained to form complex expressions, e.g. :  Can use parentheses for readability and to control the association of operators and operands  Defined precedence levels in decreasing order :  Miscellaneous operators -- **, abs, not  Multiplication operators -- *, /, mod, rem  Sign operator -- +, -  Addition operators -- +, -, &  Shift operators -- sll, srl, sla, sra, rol, ror  Relational operators -- =, /=, <, <=, >, >=  Logical operators -- AND, OR, NAND, NOR, XOR, XNOR res <= a AND NOT(B) OR NOT(a) AND b;
  • 68. VHDL Data Types  Scalar  Integer  Enumerated  Real (floating point)*  Physical*  Composite  Array  Record  Access (pointers)* * Not supported by synthesis tools
  • 69. Predefined Data Types • bit (‘0’ or ‘1’) • bit_vector (array of bits) • integer • real • time (physical data type)
  • 70. Integer • Integer • Minimum range for any implementation as defined by standard: -2,147,483,647 to 2,147,483,647 • Integer assignment example
  • 71. Real • Real • Minimum range for any implementation as defined by standard: -1.0E38 to 1.0E38 • Real assignment example
  • 72. Enumerated • Enumerated • User defined range • Enumerated example
  • 73. Physical • Time units are the only predefined physical type in VHDL. • Physical • Can be user defined range • Physical type example
  • 74. Array • Array • Used to collect one or more elements of a similar type in a single construct. • Elements can be any VHDL data type.
  • 75. Record • Record • Used to collect one or more elements of different types in a single construct. • Elements can be any VHDL data type. • Elements are accessed through field name.
  • 76. Subtype • Subtype • Allows for user defined constraints on a data type. • May include entire range of base type. • Assignments that are out of the subtype range result in error. • Subtype example
  • 77. Natural and Positive Integers • Integer subtypes: • Subtype Natural is integer range 0 to integer’high; • Subtype Positive is integer range 1 to integer’high;
  • 78. Boolean, Bit and Bit_vector • type Boolean is (false, true); • type Bit is (‘0’, ‘1’); • type Bit_vector is array (integer range <>) of bit;
  • 79. Char and String • type Char is (NUL, SOH, …, DEL); • 128 chars in VHDL’87 • 256 chars in VHDL’93 • type String is array (positive range <>) of Char;
  • 80. IEEE Predefined data types • type Std_ulogic is (‘U’, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’, ‘L’, ‘H’, ‘-’); • ‘U’ -- Uninitialized • ‘X’ -- Forcing unknown • ‘0’ -- Forcing zero • ‘1’ -- Forcing one • ‘Z’ -- High impedance • ‘W’ -- Weak Unknown • ‘L’ -- Weak Low • ‘H’ -- Weak High • ‘-’ -- Don’t care • type std_logic is resolved std_ulogic; • type std_logic_vector is array (integer range <>) of std_logic;
  • 81. Assignments • constant a: integer := 523; • signal b: bit_vector(11 downto 0); b <= “000000010010”; b <= B”000000010010”; b <= B”0000_0001_0010”; b <= X”012”; b <= O”0022”;
  • 82. Functions  Produce a single return value  Called by expressions  Cannot modify the parameters passed to them  Require a RETURN statement FUNCTION add_bits2 (a, b : IN BIT) RETURN BIT IS VARIABLE result : BIT; -- variable is local to function BEGIN result := (a XOR b); RETURN result; -- the two functions are equivalent END add_bits2; FUNCTION add_bits (a, b : IN BIT) RETURN BIT IS BEGIN -- functions cannot return multiple values RETURN (a XOR b); END add_bits;
  • 83.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89. Example of a Function (cont)
  • 90. Functions  Functions must be called by other statements  Parameters use positional association ARCHITECTURE behavior OF adder IS BEGIN PROCESS (enable, x, y) BEGIN IF (enable = '1') THEN result <= add_bits(x, y); carry <= x AND y; ELSE carry, result <= '0'; END PROCESS; END behavior; FUNCTION add_bits (a, b : IN BIT)
  • 91.
  • 92.
  • 93.