Lecture 3 Concurrent Behavioral
Lecture 3 Concurrent Behavioral
(Behavioral)
VHDL
—2
Introduction to Behavioral Modeling
The signal assignment statement
a <= b;
read as follows: a gets the value of b.
The current value of signal b is assigned to signal a.
This statement is executed whenever signal b
changes value.
Introduce a nonzero delay value for the
assignment
a <= b after 10 ns;
Read as follows: a gets the value of b when 10
nanoseconds of time have elapsed.
Both of the preceding statements are concurrent
signal assignment statements.
Example: A simple AND gate
ENTITY and2 IS
PORT ( a, b : IN BIT;
PORT ( c : OUT BIT );
END and2;
5
Delay Types (I)
Delay is created by scheduling a signal
assignment for a future time
Just for simulation (Not Synthesizable)
There are three main types of delay
supported by VHDL
Inertial delay
Transport delay
Delta delay
Input Delay Output
6
Delay Types (II)
Inertial Delay
It absorbs pulses and wavelets of shorter
duration than the specified delay
Output <= inertial not Input after 10 ns;
Output
Input
5 10 15 20 25 30 35
10 ns
7
Delay Types (III)
Transport Delay
Must be explicitly specified by user
Passes all input transitions with delay
Output
Input
5 10 15 20 25 30 35
10 ns 10 ns 8
Delta Delay (IV)
Default signal assignment propagation delay if no
delay is explicitly prescribed
VHDL signal assignments do not take place immediately
E.g.
Input Dealy Output
Output
Input
5 10 15 20 25 30 35
9
Check Yourself
Draw a waveform for the following signal assignment. For
each requested statement, please determine the time.
X <= Y after 5 ns;
X <= transport Y after 5 ns;
X<=Y;
— 10
Inerial Delay vs. Transport delay
The transport delay is used to model the delay introduced by wire connection
The inertial delay models the delay introduced by an analog port, which means,
it is analogous to the delay in devices that respond only if the signal value
persists on their inputs for a given amount of time.
It is useful in order to ignore input glitches whose duration is less than the
port delay.
— 11
Concurrent Statements
12
Concurrent Statements (I)
13
Concurrent Statements (II)
When – Else : (Conditional concurrent signal
assignment)
target_signal <= value1 when condition1 else
value2 when condition2 else
. . .
valueN-1 when conditionN-1 else
valueN;
Value N
…
Value N-1
Target Signal
Value 2
Value 1
Condition N-1
Condition 2
Condition 1
14
Concurrent Statements (III)
When-else Example: MUX
Entity mux is
Port(I0, I1, I2, I3 : in bit;
A, B : in bit;
F : out bit);
End mux;
Architecture mux_arch of mux is
Signal S: bit_vector(1 downto 0); We do not talk
Begin about logic gate,
S<= A & B; and or nand ect, we
F <= I0 when (s = "00") else are describing the
behavior of circuit
I1 when (s = "01") else using a high level
I2 when (s = "10") else description.
I3;
end mux_arch; 15
Unaffected signals
Value of the signal is not changed
VHDL 1993 only! library IEEE;
use IEEE.std_logic_1164.all;
— 17
Concurrent Statements (IV)
With –Select-When : (selected concurrent signal
assignment)
with choice_expression select
target_signal <= expression1 when choices_1,
expression2 when choices_2,
. . .
expressionN when choices_N;
expression1 choices_1
expression2 choices_2
target_signal
expressionN choices_N
choice expression
18
Concurrent Statements (V)
With-select-when Example: MUX
Entity mux is
Port(I0, I1, I2, I3 : in bit;
A, B : in bit;
F : out bit);
End mux;
Architecture mux_arch of mux is
Signal S: bit_vector(1 downto 0);
Begin We do not talk
S<= A & B; about logic gate,
With S select and or nand ect, we
F<= I0 when “00“, are describing the
I1 when "01“, behavior of circuit
using a high level
I2 when “10“,
description.
I3 when “11”;
end mux_arch;
19
Check yourself
Using With-select-when statement,
implement an active-high 2-4 decoder
— 20
Concurrent Statements (Boolean equations)
Example: MUX
Entity mux is
Port(I0, I1, I2, I3 : in bit;
A, B : in bit;
F : out bit);
End
Architecture mux_arch of mux is
Begin
F<= ( not A and not B and I0) or
( not A and B and II) or
( A and not B and I2) or
( A and B and I3)
end mux_arch;
21
Generics and Constants
22
Generics
If the model has a parameter, then it is defined using generics.
generics
Generics are a means of passing specific information into an entity. They
do not have a mode (direction):
entity entity_name is
generic (generic list);
port (port list);
end entity_name;
23
Example
Define a parameterize value
entity AN2_GENERIC is
generic (DELAY: time := 10 ns);
port (A,B : in bit;
Z : out bit);
end AN2_GENERIC;
24
More about Generics
Generics are basically useful when you make
multiple instances of a component.
You can have different value of generic for each
instance.
Example
Instantiate a simple AND gate that has a generic
declared for its Propagation Delay
You can have different value of propagation delay for
each instance.
If the value of generic is not specified in instance then
its default value is used which you can specify in the
entity of this AND gate.
More examples, when the structural model
(components) is taught.
25
Constants
It is also possible to include model specific
constants in the entity using the standard
declaration of constants method
constant constant_name : type_name := constant_value;
constant delay1 : time := 5 ns;
Improve the readability of the code
Allow for easy updating
Constants can be declared in any declarative
region, and can be used within that region.
Their value cannot be changed once
declared.
26
Example
entity AN2_GENERIC is
entity AN2_GENERIC is
port (A,B : in bit;
port (A,B : in bit;
Z : out bit);
Z : out bit);
end AN2_GENERIC;
constant delay: time:= 10 ns;
end AN2_GENERIC;
architecture BEH of AN2_GENERIC is
constant delay: time:= 10 ns;
architecture BEH of AN2_GENERIC is
begin
begin
Z <= A and B after delay;
Z <= A and B after delay;
end Beh;
end Beh;
27
VHDL Objects
There are three types of objects in VHDL
Constants
Signals
Variables
VHDL is strongly depends on types
You cannot assign a value to a different type
You should use “type conversion”
28
VHDL Objects (Signals I)
Signals are used for communication
between components
Signals can be seen as real and physical
wires
Signal assignment
Signal_name <= value
Signals can be declared in
Package declaration
Architecture
Block
Subprograms (Functions and Procedures)
29
VHDL Objects (Signals II)
Signals must be declared outside a process
Declaration form
signal list_of_signal_names : type_name
[ := initial value ];
31
VHDL Objects (Variables II)
What are they for:
Local storage in processes, procedures, and
functions
Declaring variables
variable list_of_variable_names : type_name
[ := initial value ];
34
Signals vs. variables
variables:
They are local;
no delay;
declared within process
signals:
They are global (before begin);
delay due to wire;
declared before keyword begin
— 35
Objects scope
VHDL limits the visibility of the objects,
depending on where they are declared
The scope of the object is as follows
Objects declared in a package are global to all entities
that use that package
Objects declared in an entity are global to all
architectures that use that entity
Objects declared in an architecture are available
to all statements in that architecture
Objects declared in a process are available to
only that process
Scoping rules apply to constants, variables, and
signals
36