Documente Academic
Documente Profesional
Documente Cultură
Introduction to VHDL
By
Santashraya Prasad
VHDL Presentation
1.
1.
2.
Entity
Architecture
Structural/Data Flow/Behavioral descriptions
What is it
Syntax
Special Cases
Data type
Test Benches
How to use
examples
VHDL
VHDL
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
The entity
The architecture
The Entity
The entity syntax
Name of Entity
Name of Input Pins
entity latch is
port (s,r: in bit;
q, nq: out bit);
end latch;
s
r
q
Latch
nq
The Architecture
The architecture syntax
Entity name
architecture belongs
to
Description of the
architecture (what it
is)
nq
Description of circuit
Description types
VHDL
ways.
Structural
Data flow
Behavioral
Usually,
Structural Description
Structural Syntax
Architecture description
entity latch is
describes the architecture is of
port (s,r: in bit;
the method structure description
q, nq: out bit);
and belongs to the entity latch
end latch;
architecture structure of latch is
Component Pin
component nor_gate
Specifications
port (a,b: in bit;
These are used to describe the input
and output pins of the component
c: out bit);
nor_gate that will be used in the
end component;
architecture section
begin
n1: nor_gate port map (r, nq, q);
Mapping pins to
n2: nor_gate port map (s=>a, q=>b, nq=>c);
component
The command port map is used to
end structure;
Description Representation
Architecture
a
nor_gate c
a
nor_gate c
nq
Entity
11
Internal Signals
sum
HalfAdder
b
carry
sum
Sum
HalfAdder
b
carry
Carry
Full Adder
12
Advantages of Structural
description
Hierarchy
Component Reusability
Design Independent
allows for replacing and testing components without
redesigning the circuit
13
Data Flow
14
s
q
nq
15
Behavioral Descriptions
16
Behavioral description
Elements of a Process
18
Process label
(optional)
Process is
dependent only on
variable x also
termed sensitivity
Variable is set to a value of -1
list.
count: process (x)
since the process is run once at
variable cnt : integer := -1;
startup to bring the value to 0
begin
cnt:=cnt + 1;
Increments the variable
end process
cnt every time the
signal of x changes
19
Variables
Variables in VHDL behave similar to those in
conventional programming languages
They are used to represent the state of a
process and are local to that process
They are declared in a similar way to that of a
signal in data flow or structural descriptions
20
process (y)
variable x,z : bit;
begin
x:= y;
z:= not x;
end process;
It should be realized that signals and variables are different. On the left both commands
in the process are concurrent, they occur at the same time. This results in z not being the
opposite of y but the opposite value of x when the process is begun.
Since the example on the right is using variable, which are sequential, the value of z is the
complement of y.
Signal assignment statements do not take effect immediately.
Variable assignments take effect immediately.
21
nor
nor
Data Flow
Describes how data flows from input to output
Behavioral
Describes the behavior of the circuit
within a process
process (r,s)
begin
if (r nor nq) then
q <= 1;
else
q <= 0;
endif
...
end process
22
Sequential Style
Structural Style
Name
Component type
Port map
Sequential Statements
Data Objects
Signals
Constant Declaration
Variable Declaration
Signal Assignment
Variable Assignment
CLOCK;
on
until
Clock = 1;
for
150 ns;
Built-In Operators
Logic operators
Relational operators
+, -, &
Multiplication operators
Addition operators
*, /, mod, rem
Miscellaneous operators
41
1.
2.
3.
42
Stimulus Generation/Response
There is three general ways of generating a
simulation for testing
Repetitive patterns
1.
Lookup table
2.
Constant table
I/O data
3.
(Waveform A and B)
Keyboard
Data file
Response Handling
Test Bench
Unit Under Test
Monitor Program
that generates
output
Resulting Output
File
Program that
generates Stimuli
Human Eye or
External Program
44