Lecture 2-Intro VHDL
Lecture 2-Intro VHDL
languages
HDL— 2
hardware description language
A hardware description language (HDL) is a
specialized computer language used to describe
the structure and behavior of digital systems
A hardware description language looks much like
a programming language such as C.
The main difference with software programming
languages is the nature of HDL is parallel; while
the nature of software languages is sequential
It is a textual description consisting of
expressions, statements and control structures
Most commercial designs built using HDLs
HDL — 3
HDL vs. Schematic
Schematic’s advantages
Useful for small projects
Easy to learn and design
Schematic’s disadvantages
difficult to manage when
complexity grows (million gates
ASICs-FPGAs)
difficult to maintain for a long
lifetime
HDL — 4
Types of HDL languages
• Two leading HDLs:
– Verilog
• developed in 1984 by Gateway Design Automation
• became an IEEE standard (1364) in 1995
– VHDL
• Developed in 1981 by the Department of Defense
• Became an IEEE standard (1076) in 1987
• Other HDL languages
• GEZEL
• SystemC (enhance C for hardware design)
• System Verilog (Add system level design to Verilog)
• Ruby
• JHDL
• Etc.
HDL — 5
VHDL vs. Verilog
Verilog is based on C, while VHDL is based on Pascal and Ada.
Unlike Verilog, VHDL is strongly typed.
Unlike VHDL, Verilog is case sensitive.
Verilog is easier to learn compared to VHDL.
Verilog has very simple data types, while VHDL allows users to create more
complex data types
Verilog will not allow programmers to put needed modules in separate files that
are called during compilation. Large projects on Verilog might end up in a large,
and difficult to trace, file.
VHDL more popular with European companies, Verilog more popular with US
companies
HDL — 6
VHDL vs. Verilog
High level constructs
VHDL:
There are more constructs and features for high-level
modeling in VHDL than there are in Verilog.
Abstract data types can be used along with the following
statements:
package statements for model reuse,
configuration statements for configuring design structure,
generate statements for replicating structure,
generic statements for generic models that can be individually
characterized, for example, bit width.
Verilog:
there is no equivalent to the high-level VHDL modeling
statements in Verilog
HDL — 7
VHDL vs. Verilog
Libraries
VHDL:
A library is a store for compiled entities,
architectures, packages and configurations. Useful
for managing multiple design projects.
Verilog:
There is no concept of a library in Verilog. This is
due to it's origins as an interpretive language.
HDL — 8
VHDL vs. Verilog
Low level constructs
VHDL
Simple two input logical operators are built into the language,
they are: NOT, AND, OR, NAND, NOR, XOR and XNOR.
Any timing must be separately specified using the after
clause.
Verilog
The Verilog language was originally developed with gate
level modeling in mind, and so has very good
constructs for modeling at this level and for modeling the cell
primitives of ASIC and FPGA libraries.
Examples include User Defined Primitives (UDP), truth tables
and the specify block for specifying timing delays across a
module.
HDL — 9
VHDL vs. Verilog
Example [Binary up counter]
process (clock) VHDL
begin
if clock='1' and clock'event then
counter <= counter + 1;
end if;
end process;
Verilog
reg [upper:0] counter;
always @(posedge clock)
counter <= counter + 1;
HDL — 10
VHDL vs. Verilog
Verilog and VHDL are equivalent for RTL modeling (code
that will be synthesized).
For high level behavioral modeling, VHDL is better
Verilog does not have ability to define new data types
Other missing features for high level modeling
Verilog has built-in gate level and transistor level primitives
Verilog much better than VHDL at below the RTL level.
The choice of which to use is not therefore based solely
on technical capability but on:
Personal preferences
EDA (Electronic design automation) tool availability
Commercial, business and marketing issues
Bottom Line: You should know both!!!!!
HDL — 11
VHDL
HDL — 12
Introduction to VHDL
VHDL: VHSIC Hardware Description Language
VHSIC: Very High Speed Integrated Circuit
History of VHDL
1980: initiated by US army (Pentagon) to describe and
to document of electronic systems
1985: 7.2 version of VHDL by IBM, Intermetrics and
Texas Instruments
1986: All rights transfer to IEEE
1987: first IEEE version – IEEE1067-1987
1993: Revised Standard- IEEE1076-1993 (vhdl-93)
2000: minor revision
2002: minor revision
2008: major revision
2019: major revision (latest version of VHDL)
13
Introduction to VHDL
How is VHDL used?
For design specification
For simulation
For documentation
For implementation
For test & verification
As an alternative to schematic design
Why VHDL?
Achieve Maximum Reliability With
Minimum cost
Minimum development time
Allow Automatic Synthesis of Design into
Hardware
14
Introduction to VHDL
C:
Procedural (method) programming languages
Typically describe methods for computing a math function
or manipulation of data (e.g., sorting, matrix computing)
A program is a recipe or a sequence of steps for how to
perform a computation or manipulate data.
VHDL:
A language to describe digital systems.
Purposes: simulation and synthesis of digital systems.
15
Design Process
HDL — 16
Digital System Design Process
HDL — 17
Different perspectives of a system
Behavioral view:
Describe functionalities and i/o behavior
Treat the system as a black box
Use flowcharts, Pseudocode, flow graph
Structural view:
Describe the internal implementation (components and
interconnections)
Essentially block diagram
Registers, logic components are connected via buses
(directional or bi-directional)
Physical view:
Add more info to structural view: component size, component
locations, routing wires
E.g., layout of a print circuit board
Structural view vs. physical view
HDL — 19
VHDL: Abstraction Levels (I)
Abstraction levels of System Design
HDL — 20
VHDL: Abstraction Levels (II)
HDL — 21
Behavioral Description in VHDL
• This level describes a system by
concurrent algorithms (Behavioral).
• Each algorithm itself is sequential
(consists of a set of instructions that
are executed one after the other.)
• Functions, procedures are the main
elements. There is no regard to the
structural realization of the design.
The transforming of the data is performed by the combinational logic that exists
between the registers.
The description is divided into combinational logic and storage elements. The
storage elements (flip-flops, latches) are controlled by a system clock.
Modern definition of a RTL code is "Any code that is synthesizable is called
RTL code".
The description is synthesizable. HDL — 23
Gate-level in VHDL (Structural)
HDL — 26
Let’s Start Simple
The structure of a Full Adder
s1
In1 sum
In2
s2
s3 c_out
c_in
HDL — 27
Entity-Architecture Pair
1- in
2- out
3- inout
4- buffer
reserved words
28
Entity Declarations
The entity describes the interface to the
outside world.
It specifies the number of ports, the direction
of the ports, and the type of the ports
The interface signals are listed in the PORT
clause
In this respect, the entity is akin to the
29
Entity Example
x
FULL cout
y sum
Adder
cin
ENTITY full_adder IS
30
Entity Declarations
Port Clause
PORT
PORT (signal_name
(signal_name :: mode
mode data_type);
data_type);
PORT
PORT (( input
input :: IN
IN BIT_VECTOR(3
BIT_VECTOR(3 DOWNTO
DOWNTO 0);
0);
ready,
ready, output
output :: OUT
OUT BIT
BIT );
);
31
Entity Declarations
entity Mux8to1 is
port (
Inputs : in Std_Logic_Vector(7 downto 0);
Select_s : in Std_Logic_Vector(2 downto 0);
Output : out Std_Logic
);
end Mux8to1;
HDL — 34
Architecture Body
Describes the operation of the component, Not just
its interface
It describes the underlying functionality of the entity
and contains the statements that model the behavior
of the entity.
35
Architecture Body (II)
Consists of Two Parts
1. Declarative part -- includes necessary declarations,
e.g.
Type declarations
Signal declarations
Component declarations
Subprogram declarations
2. Statement part -- includes statements that describe
organization and/or functional operation of
component, e.g.
Concurrent signal assignment statements
Process statements
Component instantiation statements
36
Architecture Body, e.g. The
architecture
name
END structural ;
End of
architecture
37
VHDL Description of Combinational Networks
38
Lexical Elements of VHDL
Comments
two dashes to end of line is a comment, e.g.,
--this is a comment
Basic Identifiers
Can Only Use
alphabetic letters ( A-Z, a-z ), or
Decimal digits ( 0-9 ), or
Underline character ( _ )
Not case sensitive
( LastValue = = lAsTvALue)
Reserved Words
Do not use as identifiers
Special Symbols
Single characters
& ‘ ( ) * + , - . / : ; < = > |
Double characters (no intervening space)
=> ** := /= >= <= <>
41
Reserved Words
we cannot use reserved words as identifiers for items we define
42
Strings
Bit Strings
B for binary ( b”0100_1001” )
O for Octal ( o”76443” )
X for hexadecimal ( x”FFFE_F138” )
43