Professional Documents
Culture Documents
Behav Fin
Behav Fin
Behavioral Modeling
• Entity & Architecture
• Process statement
• Sequential statements
• Signal & Variable assignment
• Multiple Process
2
Behavioral Modeling
• In this style of modeling, the behavior of the
entity is expressed using sequentially
executed, procedural code, which is very
similar in syntax to that of a high-level
programming language like C or Pascal.
• VHDL Syntax :
entity entity-name is
[generic( list-of-generics-and-their-types );]
[port( list-of-interface-port-names-and-their-
types );]
( entity-item-declarations ]
[begin
entity-statements ]
end [entity][ entity-name];
entity half_adder is port (
a,b: in bit;
CS: out bit_vector (1 downto 0);
end half_adder ;
Entity Declaration 4
• VHDL Syntax :
Architecture architecture name of entity-name is
[architecture-item-declarations ]
begin
concurrent-statements ; these are -->
process-statement
block-statement
concurrent-procedure-call-statement
concurrent-assertion-statement
concurrent-signal-assignment-statement
component- instantiation -statement
generate-statement
end [ architecture ][architecture-name ];
9
Architecture Body
• All concurrent statements execute in parallel;
therefore, their textual order of appearance within the
architecture body has no impact on the implied
behavior.
• Items declared in the entity declaration, are available
for use within the architecture body due to the
association of the entity name with the architecture
body by the statement:
architecture architecture-name of entity-name is .
• An entity is represented using one entity declaration
( provides the external view) and one or more
architecture bodies (provide the internal view).
Process Statement 10
VHDL Syntax :
[ process-label : ] process [(sensitivity-list) ][is]
[ process-item-declarations ]
begin
sequential-statements; these are -->
variable-assignment-statement
signal-assignment-statement
wait-statement
if-statement
case-statement
loop-statement
null-statement
exit-statement
next-statement
assertion-statement
report-statement
procedure-call-statement
return-statement
end process [ process-label ] ;
Process Statement 11
• null ,
is a sequential statement that does not
cause any action to take place;
execution continues with the next
statement.
• One example of this statement's use is in an
if statement or in a case statement where, for
certain conditions, it may be useful or
necessary to explicitly specify that no action
needs to be performed .
24
Loop Statement
• A loop statement is used to iterate through a set of
sequential statements.
• VHDL syntax :
[ loop-label:] iteration-scheme loop
sequential-statements
end loop [loop-label];
• There are three types of iteration schemes:
1. For iteration scheme,
for identifier in range
For loop will loop as many times as specified in range.
– An example
FACTORIAL := 1;
for i in 2 to N loop
FACTORIAL := FACTORIAL * i;
end loop;
25
Loop Statement
• The index value i is locally declared by the for statement,it does
not need to be declared explicitly in the process,function,or
procedure.If another variable of same name exists in the
process then these two variable are treated as separate
variables .
Assertion Statement
• Reporting textual string to the designer.
• VHDL Syntax:
assert boolean-expression
[report string-expression ]
[severity expression ] ;
• Checks the boolean expression :
– True: does nothing
– False:Output a user specified text string to the standard output to
the terminal with any of four severity levels: Note , warning,error
& failure.
Note: Inform the user that what is currently happening in the model
Warning: Alert the designer of conditions that,while not
catastrophic,can erroneous behavior later.
Assertion Statement 32
Signal Drivers
• A driver is created for every signal that is assigned a
value in a process. The driver of a signal holds its current value
and all its future values as a sequence of one or more
transactions,where each transaction identifies the value to
appear on the signal along with the time at which the value is to
appear.
• An Example
process
begin
RESET <= 3 after 5 ns, 21 after 10 ns, 14 after 17 ns;
end process;
• All transactions on the driver are ordered in increasing order of
time. A driver always contains at least one transaction, which
could be the initial value of the signal.
40
Effect of Transport Delay on Signal Drivers
Example 1:signal RX_DATA: NATURAL;
process
begin
RXDATA <= transport 11 after 10 ns;
RXDATA <= transport 20 after 22 ns;
RXDATA <= transport 35 after 18 ns;
end process; -- 11@ t+10 ns,35@t +18ns
Rules for adding transactions from a signal assignment
using transport delays
•All transactions on the driver that occur at or
after the delay time of the first new transaction
are deleted.
• All the new transactions are added at the end
of the driver.
41
Effect of Inertial Delay on Signal Drivers
• When inertial delays are used, both the signal
value being assigned and the delay value affect
the deletion and addition of transactions.
• Example 1
process
begin
TX_DATA <= 11 after 10 ns;
TX_DATA <= reject 15 ns inertial 22 after 20 ns;
TX_DATA <= 33 after 15ns;
Wait;
End process;-- 33@15ns
42
Effect of Inertial Delay on Signal Drivers
Rules for adding transactions from a signal assignment
using inertial delays are the following:
1. All transactions on a driver that are scheduled to occur
at or after the delay of the first new transaction are
deleted.(as in the transport case)
2. Add all the new transactions to the driver.
3. For all the old transactions on the driver that occur at
times between the time of the first new transaction (say
F) and F minus the pulse rejection limit, delete the old
transactions whose value is different from the value of
the first new transaction.
Multiple Processes 43
Multiple Processes
Multiple Processes
entity INTERACTING is
45
Thank you
47
48
49
50
51
52
53
If Statement
• The if statement is executed by checking
each condition sequentially until the first true
condition is found then, the set of sequential
statements associated with this condition is
executed.
• The if statement can have zero or more elsif
clauses and an optional else clause(maximum
one).It is a sequential statement.
54