View
216
Download
0
Embed Size (px)
8/3/2019 Vhdl [Compatibility Mode]
1/187
HDL For EmbeddedHDL For EmbeddedHDL For EmbeddedHDL For Embedded
SystemSystemSystemSystem
1
Mukesh Maheshwari
8/3/2019 Vhdl [Compatibility Mode]
2/187
VHDLVHDLVHDLVHDL
INTRODUCTION
2
2
8/3/2019 Vhdl [Compatibility Mode]
3/187
IntroductionIntroductionIntroductionIntroduction
WHAT IS VHDL ?
3
3
FEATURES OF VHDL
HISTORY OF VHDL
LEVELS OF ABSTRACTION
8/3/2019 Vhdl [Compatibility Mode]
4/187
What is VHDL?What is VHDL?What is VHDL?What is VHDL?
DIGITAL SYSTEM DESIGN USINGHDLS IS AN ESTABLISHED
4
4
.
VHDL stands for
Very High Speed Integrated Circuits
Hardware Description Language.
8/3/2019 Vhdl [Compatibility Mode]
5/187
Features of VHDLFeatures of VHDLFeatures of VHDLFeatures of VHDL
VHDL is the amalgamation of following languages:
Concurrent Language
Sequential Language
Timing Specification Simulation Language
Test Language
5
Powerful Language Constructs Ex: if---else, with---select, etc.
Design Hierarchies to create Modular designs
Supports Design LibrariesFacilitates device independent design and
Portability
8/3/2019 Vhdl [Compatibility Mode]
6/187
Concurrent LanguageConcurrent LanguageConcurrent LanguageConcurrent Language
Concurrent Statements execute atatatatthe same time in parallelthe same time in parallelthe same time in parallelthe same time in parallel, as in
6
6
.
8/3/2019 Vhdl [Compatibility Mode]
7/187
Sequential LanguageSequential LanguageSequential LanguageSequential Language
Sequential Statements execute one atone atone atone at
a timea timea timea time in sequence.As the case with any conventional
lan ua e
7
7
Sequence of statements is important.
8/3/2019 Vhdl [Compatibility Mode]
8/187
Timing SpecificationTiming SpecificationTiming SpecificationTiming Specification
Example:
process
8
8
clk
8/3/2019 Vhdl [Compatibility Mode]
9/187
Test LanguageTest LanguageTest LanguageTest Language
Test bench Is part of a VHDL model that generates a set of test
vectors and sends them to the Module being tested.
Collects the responses made by the Module Under Test
and compares them against a specification of correct
results.
9
9
Need
To ensure that design is correct.
Model is operating as required.
8/3/2019 Vhdl [Compatibility Mode]
10/187
Design HierarchyDesign HierarchyDesign HierarchyDesign Hierarchy
Hierarchy can be represented using VHDL.
Consider example of a Full-adder which is the top-
level module, being composed of three lower level
modules I.e. Half-Adder and OR gate.
10
1 0
8/3/2019 Vhdl [Compatibility Mode]
11/187
Design Unit
Is any block of VHDL code or collection of VHDLcodes that may be independently analysed and
inserted into a design library.
Design librariesDesign librariesDesign librariesDesign libraries 11
1 1
Is a storage facility in which analysed VHDL
descriptions are stored.
8/3/2019 Vhdl [Compatibility Mode]
12/187
History of VHDLHistory of VHDLHistory of VHDLHistory of VHDL
In 1981 the Institute for Defense Analysis (IDA) had arranged
a workshop to study
Various Hardware Description methods Need for a standard language
Features required by such a standard.
12
1 2
A team of three companies, IBM, Texas Instruments, andIntermetrics were awarded contract by DoD to develop a
language.
Version 7.2 of VHDL was released along with LanguageReference Manual (LRM) in 1985.
Standardized by IEEE in 1987 known as the IEEE Std 1076-
1987.
8/3/2019 Vhdl [Compatibility Mode]
13/187
Logic SystemsLogic SystemsLogic SystemsLogic Systems
Need for a multi-valued Logic System
Conventional Logic systems had only three valuesI.e. 0 , 1 and Z
Consider truth table for AND gate
A B Y
0 0 0
13
1 3
1 0 0
1 1 1
For
0 Z ???
A 9-value package STD_LOGIC_1164 was developedand accepted as IEEE Std 1164-1993.
8/3/2019 Vhdl [Compatibility Mode]
14/187
Logic SystemsLogic SystemsLogic SystemsLogic Systems
Need for a standard Logic System
Different vendors used different logic systems.
Sharing of codes developed on different toolsets wasdifficult.
14
1 4
Multivalued logic
Unknown : Value was known, but is not anymore.
Un-initialized : Value was never known in the firstplace !
High impedance : Net has no driver.
Drive strengths : Handle different output drivers.
Dont care : Optimizes synthesis implementation.
8/3/2019 Vhdl [Compatibility Mode]
15/187
MultiMultiMultiMulti----Valued LogicValued LogicValued LogicValued Logic
A 9-value package STD_LOGIC_1164
was developed and accepted as IEEE
Std 1164-1993.U : Uninitialized
15
1 5
: n nown
0 : Logic 0
1 : Logic 1
Z : High impedance
W : weak unknown
L : weak logic 0
H : weak logic 1
- : Dont care
8/3/2019 Vhdl [Compatibility Mode]
16/187
ELEMENTS OF VHDLELEMENTS OF VHDLELEMENTS OF VHDLELEMENTS OF VHDL AgendaAgendaAgendaAgenda
BASIC BUILDING BLOCKS
ENTITY
ARCHITECTURE
LANGUAGE ELEMENTS
16
1 6
SEQUENTIAL STATEMENTS
SIGNALS & VARIABLES
CONFIGURATION
PACKAGE
8/3/2019 Vhdl [Compatibility Mode]
17/187
Basic Building BlocksBasic Building BlocksBasic Building BlocksBasic Building Blocks
Entity
A designs interface to the external circuitry.
Architecture
Describes a designs behavior and functionality.
17
1 7
Configuration
Binds an entity to an architecture when there are multiple
architectures for a single entity.
Package Contains frequently used declarations, constants,
functions, procedures, user data types and components.
8/3/2019 Vhdl [Compatibility Mode]
18/187
Basic Building BlocksBasic Building BlocksBasic Building BlocksBasic Building Blocks
Library
Is a collection of compiled VHDL units
Promotes sharing of compiled designs and hides thesource code from the users
Commonly used functions, procedure and user data types
can be compiled into a user-defined library for use in all
18
1 8
designs Library should be declared before EACH entity declaration
even if it is in the same VHDL file.
Syntax library IEEE;
use IEEE.std_logic_1164.all
use IEEE.std_logic_unsigned.all
8/3/2019 Vhdl [Compatibility Mode]
19/187
EntityEntityEntityEntity
Equivalent to pin configuration of an IC.
Syntax: entity entity_name is
port (port_list);
end entity_name;
19
1 9
Example :entity and_gate is
port ( 1A, 2A, 3A, 4A : in std_logic;
1B, 2B, 3B, 4B : in std_logic;
1Y, 2Y, 3Y, 4Y : out std_logic) ;
end and_gate ;
8/3/2019 Vhdl [Compatibility Mode]
20/187
EntityEntityEntityEntity
VHDL design description must include,
ONLY ONE ENTITY
Entity Declaration
Defines the input and output ports of the design.
20
2 0
ac por n e por s mus e g ven,
a name
data flow direction
a type.
Can be used as a component in other entities after being
compiled into a library.
8/3/2019 Vhdl [Compatibility Mode]
21/187
EntityEntityEntityEntity
Proper documentation of the ports in an entity
is very important.
A specified port should have a self explanatory
name that provides information about its
21
2 1
.
Ports should be well documented with
comments at the end of the line providing
additional information about the signal.
Consider example of an ALU.
8/3/2019 Vhdl [Compatibility Mode]
22/187
ModesModesModesModes
Signal in the port has a Mode which
indicates the driver direction.
Mode also indicates whether or not theport can be read from within the
22
2 2
.
Four types of Modes are used in
VHDL.
Mode IN Mode OUT
Mode INOUT
Mode BUFFER
8/3/2019 Vhdl [Compatibility Mode]
23/187
ModeModeModeMode ININININ
Value can be read but notassigned.
Example:
Port SignalPort SignalPort SignalPort SignalEntityEntityEntityEntity
23
2 3
entity driver is
port ( A : in std_logic;
B : out std_logic;
Data : inout std_logic;
Count : buffer std_logic) ;
end driver ;
Drivers resideDrivers resideDrivers resideDrivers resideoutside the entityoutside the entityoutside the entityoutside the entity
8/3/2019 Vhdl [Compatibility Mode]
24/187
ModeModeModeModeOUTOUTOUTOUT
Value can be assigned but not
read.
Example:
Entit
y
Port Signal
24
2 4
port ( A : in std_logic;B : out std_logic;
Data : inout std_logic;
Count : buffer std_logic )
;
end driver ;
Drivers resideinside the entity
8/3/2019 Vhdl [Compatibility Mode]
25/187
ModeModeMod