vrajeshmaheta@gcet.ac.in
V.D. Maheta EC 529 1
Introduction to VHDL
Hardware Description Language (HDL)
High-level language to model, simulate, and synthesize digital
circuits and systems.
History
1980: US Department of Defense Very High Speed Integrated
Circuit program (VHSIC)
1987: Institute of Electrical and Electronics Engineers approves
IEEE Standard 1076 (VHDL’87)
1993: VHDL language was revised and updated
Architecture Body
Configuration Declaration
Package Declaration
Package Body
Architecture alternative
describes function (contents) architecture #2
of entity
can be numerous alternative
arch’s etc..
Package
Architecture
Architecture Architecture
(structural)
Concurrent Concurrent
process Architecture
statement statement
Sequential
V.D. Maheta EC 529 statement 8
Terminology
Dataflow modeling
Describes the functionality of a component/system as a set of
concurrent signal assignment statements
Behavioral modeling
Describes the functionality of a component/system as a set of
sequential statements
Structural modeling
A component is described by the interconnection of lower level
components/primitives
Synthesis:
Translating the HDL code into a circuit, which is then optimized
Assignment A[7:0]
compare1 EQ
operator
B[7:0]
V.D. Maheta EC 529 11
Basic VHDL Language Elements-Ports
Used to define inputs and outputs of an entity
The means by which information is fed into and out of the circuit
Each port defined by:
Name: specifies name of the ports
P P
O O
R ENTITY R
T T
S S
V.D. Maheta EC 529 12
Port Modes
Describes direction of data transfer
Port in : data flows only into circuit
In
Out
Buffer
In
Inout
In
Signals
Variables
Files
Package my_pack is
constant NO_OF_INPUTS: INTEGER;
end my_pack;
Package body my_pack is
constant NO_OF_INPUTS: INTEGER:= 3; -- complete constant
declaration
end my_pack;
Variables can be declared and used only within a PROCESS, i.e. they
cannot be used to communicate information between processes
Examples:
variable CTRL_STATUS: BIT_VECTOR(10 downto 0);
variable SUM: INTEGER range O to 100 := 10;
variable FOUND, DONE: BOOLEAN;
Examples:
signal CLOCK: BIT;
signal DATA_BUS: BIT_VECTOR(0 to 7);
signal GATE_DELAY: TIME := 10ns;
Unless specified otherwise, all signals are given datatype’left (data type’s
first value in the type declaration) value.
type DIGIT is ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') ;
subtype MIDDLE is DIGIT range '3' to '7' ;
Integer literals
56349, 6E2, 0, 98_71_28
OR
type REAL_DATA is range 0.0 to 31.9;
Subtype RD16 is REAL_DATA range 0.0 to 15.9;
variable LENGTH: RD16;
Floating point literals:
16.26, 0.0, 0.002, 3_1.4_2, 62.3E-2,5.0E+2
Syntax:
base # based-value # --form1
Examples:
(i) 2#101_101_000# --represents (101101000)2 = (360) in decimal
Example:
type CURRENT is range 0 to 1E9
units
nA; -- (base unit) nano-ampere
uA = 1000 nA; -- micro-ampere
mA = 1000 μA; --milli-ampere
Amp = 1000 mA; -- ampere
end units;
Example:
variable OP_CODES : BIT_VECTOR(1 to 5);
OP_CODES := ('0', '1', '0', '0', '1');
OP_CODES := (2=>'1', 5=>'1', others=>'0');
OP_CODES := (others=>'0'); -- All values set to '0'.
Instantiation
inst: nand2 PORT MAP (h, g, f);
Example:
signal A, Z: INTEGER;
...
PZ: process (A) --PZ is a label for the process.
variable V1, V2: INTEGER;
begin
V1 := A - V2; --statement 1
Z <= - V1; --statement 2
V2 := Z+V1 * 2; -- statement 3
end process PZ;
e.g. SUM := 1; J := 0;
L3: loop
J:=J+21;
SUM := SUM* 10;
if (SUM > 100) then
exit L3; -- "exit;" also would have been sufficient.
end if;
end loop L3;
Syntax:
next [loop-label] [when condition ];
e.g. for J in 10 downto 5 loop
if (SUM < TOTAL_SUM) then
SUM := SUM +2;
elsif (SUM = TOTAL_SUM) then
next;
else
null;
end if;
K:=K+1;
end loop;
BEGIN a
c
mux: PROCESS (a,b,s,en) x
b
BEGIN
en
IF s = '0' THEN c <= a;
ELSE c <= b; Desired Circuit
END IF;
x <= (x AND (NOT en)) OR (c AND en);
END PROCESS mux; -- c is updated here!
END archmux2ltch;
Example:
for U1: INV use entity work.INV(rtl);
Syntax:
component-label: component-name port map (association-list);
There are two ways to perform the association of locals with actuals:
(i) positional association,
(ii) named association.