vhdl _unit v_hdl-v3a
TRANSCRIPT
-
7/27/2019 VHDL _unit V_hdl-v3a
1/44
HDL-Based Digital DesignPart I: Introduction to VHDL (I)
UDHAYA KUMAR.C ,Assistant Professor
Department of Electronics and CommunicationEngineering
-
7/27/2019 VHDL _unit V_hdl-v3a
2/44
What is VHDL?
VHDL: VHSICHardwareDescriptionLanguage
VHSIC: Very High Speed Integrated Circuit
Developed originally by DARPA
for specifying digital systems
International IEEE standard (IEEE 1076-1993)
Hardware Description, Simulation, Synthesis
Practical benefits:
a mechanism for digital design and reusable design documentation
Model interoperability among vendors
Third party vendor support
Design re-use.
-
7/27/2019 VHDL _unit V_hdl-v3a
3/44
VHDL vs. C/Pascal
C/Pascal:
Procedural programming languages
Typically describe procedures for computing a mathsfunction 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.
-
7/27/2019 VHDL _unit V_hdl-v3a
4/44
Lets Start Simple
Support different description levels
Structural (specifying interconnections of the gates),
Dataflow (specifying logic equations), and
Behavioral (specifying behavior)
-
7/27/2019 VHDL _unit V_hdl-v3a
5/44
Domains and Levels of
Modeling
high level of
abstraction
FunctionalStructural
GeometricY-chart due to
Gajski & Kahn
low level of
abstraction
-
7/27/2019 VHDL _unit V_hdl-v3a
6/44
Domains and Levels of
Modeling FunctionalStructural
GeometricY-chart due to
Gajski & Kahn
Algorithm
(behavioral)
Register-TransferLanguage
Boolean Equation
Di ff erential Equation
-
7/27/2019 VHDL _unit V_hdl-v3a
7/44
Domains and Levels of
Modeling FunctionalStructural
Geometric Y-chart due toGajski & Kahn
Processor-Memory
Switch
Register-Transfer
Gate
Transistor
-
7/27/2019 VHDL _unit V_hdl-v3a
8/44
Domains and Levels of
Modeling FunctionalStructural
Geometric Y-chart due toGajski & Kahn
Polygons
Sticks
Standard Cells
F loor Plan
-
7/27/2019 VHDL _unit V_hdl-v3a
9/44
VHDL Description of
Combinational Networks
-
7/27/2019 VHDL _unit V_hdl-v3a
10/44
Entity-Architecture Pair
enti ty name port names port mode (direction)
port type
reserved words
punctuation
-
7/27/2019 VHDL _unit V_hdl-v3a
11/44
VHDL Program Structure
-
7/27/2019 VHDL _unit V_hdl-v3a
12/44
4-bit Adder
-
7/27/2019 VHDL _unit V_hdl-v3a
13/44
4-bit Adder (contd)
-
7/27/2019 VHDL _unit V_hdl-v3a
14/44
4-bit Adder - Simulation
-
7/27/2019 VHDL _unit V_hdl-v3a
15/44
Modeling Flip-Flops Using
VHDL Processes
Whenever one of the signals in thesensitivity list changes, the sequentialstatements are executedin sequence one time
General form of process
-
7/27/2019 VHDL _unit V_hdl-v3a
16/44
D Flip-flop Model
Bit values are enclosed
in single quotes
-
7/27/2019 VHDL _unit V_hdl-v3a
17/44
JK Flip-Flop Model
-
7/27/2019 VHDL _unit V_hdl-v3a
18/44
JK Flip-Flop Model
-
7/27/2019 VHDL _unit V_hdl-v3a
19/44
Using Nested IFs and
ELSEIFs
-
7/27/2019 VHDL _unit V_hdl-v3a
20/44
VHDL Models for a MUX
Sel represents the integerequivalent of a 2-bit binary
number with bits A and B
If a MUX model is used inside a process,
the MUX can be modeled using a CASE statement
(cannot use a concurrent statement):
-
7/27/2019 VHDL _unit V_hdl-v3a
21/44
MUX Models (1)
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity SELECTOR is
port (
A : in std_logic_vector(15 downto 0);
SEL : in std_logic_vector( 3 downto 0);
Y : out std_logic);
end SELECTOR;
architecture RTL1 ofSELECTOR is
begin
p0 : process (A, SEL)
begin
if (SEL = "0000") then Y
-
7/27/2019 VHDL _unit V_hdl-v3a
22/44
MUX Models (2)
architecture RTL3 of SELECTOR is
begin
with SEL select
Y
-
7/27/2019 VHDL _unit V_hdl-v3a
23/44
MUX Models (3)architecture RTL2 of SELECTOR is
begin
p1 : process (A, SEL)
begin
case SEL is
when "0000" => Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
-
7/27/2019 VHDL _unit V_hdl-v3a
24/44
MUX Models (4)
architecture RTL4 of SELECTOR is
begin
Y
-
7/27/2019 VHDL _unit V_hdl-v3a
25/44
Compilation and
Simulation of VHDL CodeCompiler (Analyzer) checks the VHDL source code
does it conforms with VHDL syntax and semantic rules
are references to libraries correct
Intermediate form used by a simulator or by a synthesizer
Elaboration
create ports, allocate memory storage, create interconnections, ...
establish mechanism for executing of VHDL processes
-
7/27/2019 VHDL _unit V_hdl-v3a
26/44
Timing Model
VHDL uses the following simulation cycle tomodel the stimulus and response nature ofdigital hardware
Delay
Start Simulation
Update Signals Execute Processes
End Simulation
-
7/27/2019 VHDL _unit V_hdl-v3a
27/44
Delay Types
All VHDL signal assignment statementsprescribe an amount of time that musttranspire before the signal assumes its newvalue
This prescribed delay can be in one of threeforms:
Transport -- prescribes propagation delay only
Inertial -- prescribes propagation delay and minimuminput pulse width
Delta -- the default if no delay time is explicitlyspecified
Input
delayOutput
-
7/27/2019 VHDL _unit V_hdl-v3a
28/44
Transport Delay
Transport delay must be explicitly specified I.e. keyword TRANSPORT must be used
Signal will assume its new value after specified delay
Input Output
0 5 10 15 20 25 30 35
Input
Output
-- TRANSPORT delay exampleOutput
-
7/27/2019 VHDL _unit V_hdl-v3a
29/44
Inertial Delay
Provides for specification propagation delay and inputpulse width, i.e. inertia of output:
Inertial delay is default and REJECT is optional:
Input
Output
0 5 10 15 20 25 30 35
Input Output
target
-
7/27/2019 VHDL _unit V_hdl-v3a
30/44
Inertial Delay (cont.)
Example of gate with inertia smaller than propagationdelay
e.g. Inverter with propagation delay of 10ns whichsuppresses pulses shorter than 5ns
Note: the REJECT feature is new to VHDL 1076-1993
Input
Output
0 5 10 15 20 25 30 35
Output
-
7/27/2019 VHDL _unit V_hdl-v3a
31/44
Delta Delay
Default signal assignment propagation delay if nodelay is explicitly prescribed
VHDL signal assignments do not take place immediately
Delta is an infinitesimal VHDL time unit so that all signal
assignments can result in signals assuming their values at a
future time E.g.
Supports a model of concurrent VHDL processexecution
Order in which processes are executed by simulator does not
affect simulation output
Output
-
7/27/2019 VHDL _unit V_hdl-v3a
32/44
Simulation Example
-
7/27/2019 VHDL _unit V_hdl-v3a
33/44
Problem #1Using the labels, listthe order in which the
following signal
assignments are
evaluated if in2
changes from a '0' to a'1'. Assume in1 has
been a '1' and in2 has
been a '0' for a long
time, and then at time
tin2 changes from a
'0' to a '1'.
entity not_another_prob is
port (in1, in2: in bit;
a: out bit);
end not_another_prob;
architecture oh_behave of not_another_prob is
signal b, c, d, e, f: bit;
begin
L1: d
-
7/27/2019 VHDL _unit V_hdl-v3a
34/44
Problem #2
Under what conditions do the two assignments belowresult in the same behavior? Different behavior? Draw
waveforms to support your answers.
out
-
7/27/2019 VHDL _unit V_hdl-v3a
35/44
Modeling a Sequential
MachineMealy Machine for
8421 BCD to 8421 BCD + 3 bit serial converter
How to model this in VHDL?
-
7/27/2019 VHDL _unit V_hdl-v3a
36/44
Behavioral VHDL Model
Two processes:
the first represents the combinational network;
the second represents the state register
-
7/27/2019 VHDL _unit V_hdl-v3a
37/44
Simulation of the VHDL
ModelSimulation command file:
Waveforms:
-
7/27/2019 VHDL _unit V_hdl-v3a
38/44
Dataflow VHDL Model
33
21313213
12
21
''
''''')(
)(
)(
XQQXZ
QQXQQXQQQtQ
QtQ
QtQ
-
7/27/2019 VHDL _unit V_hdl-v3a
39/44
Structural Model
Package bit_pack is a part of library
BITLIB
includes gates, flip-flops, counters
-
7/27/2019 VHDL _unit V_hdl-v3a
40/44
Simulation of the Structural
ModelSimulation command file:
Waveforms:
-
7/27/2019 VHDL _unit V_hdl-v3a
41/44
Wait Statements
... an alternative to a sensitivity list Note: a process cannot have both wait statement(s)
and a sensitivity list
Generic form of a process with wait statement(s)
process
begin
sequential-statements
wait statement
sequential-statements
wait-statement
...
end process;
How wait statements work?
Execute seq. statement until
a wait statement is encountered.
Wait until the specified condition is satisfied.
Then execute the next
set of sequential statements until
the next wait statement is encountered.
...
When the end of the process is reached start
over again at the beginning.
-
7/27/2019 VHDL _unit V_hdl-v3a
42/44
Forms of Wait Statements
Wait on
until one of the signalsin the sensitivity listchanges
Wait for waits until the time
specified by the timeexpression haselapsed
What is this:wait for 0 ns;
Wait until
the Boolean expression isevaluated whenever oneof the signals in theexpression changes, andthe process continuesexecution when theexpression evaluates toTRUE
wait on sensitivity-list;wait for time-expression;
wait until boolean-expression;
-
7/27/2019 VHDL _unit V_hdl-v3a
43/44
Using Wait Statements (1)
-
7/27/2019 VHDL _unit V_hdl-v3a
44/44
Using Wait Statements (2)