Statements (processes, wait statements, if, loops, conditional assignments)
Main behavioral statement is a process. A process can contain any of a number of statements
-
Variable assignments
-
Variables are local to the process
-
Variables are assigned their value instantaneously
-
Variables maintain their value throughout the simulation run (processes are never exited)
-
Variables get their value from the variable assignment operator :=
-
Signal assignments
-
Signals can be passed into the process
-
Signal assignments within a process are considered sequential signal assignments
-
Signal values are not updated instantaneously, but only after a specified time or a delta delay
Delta delays: A delta delay is a mechanism for scheduling events and assignments in a digital simulation. The delta delay does not take any real time, but is a way of specifying the order in which things happen. When a signal gets assigned a value, that value gets put on the signal driver along with a simulation time at which the signal is to be updated. Then other statements are executed (at the current simulation time). Then simulation time is updated by delta, and any signal assigments or events at that simulation time are executed.
-
Example: Z <= A; B <= Z;
-
Since there is a delta delay before Z is assigned A, B is scheduled to get the old value of Z, event though the B <= Z statement came after the signal assignment Z <= A.
-
Signals get their assignment from the signal assignment operator <=
-
wait statements
-
wait statements suspend a process until a set of conditions is true
-
wait on sensititvity-list;
-
wait until boolean-expression;
-
wait for time-expression;
-
wait on sensitivity-list until boolean-expression for time-expression;
-
The last statement means to wait until all of the conditions are true.
-
You can use wait statements to create waveforms
-
You can use wait statements to allow processes to talk to one another
-
if statements
-
if X then statements elsif Y then statements else statements end if;
-
case statements
-
case expression is when choices => statements;
-
loop statements
-
for, while, loop expressions
-
loops can have labels (a good thing)
-
loop1: for index in 1 to N loop statements end loop loop1;
-
loop2: while N < 20 loop statements end loop loop2;
-
loop3: loop statements exit when N > 20; end loop loop3;
-
null statements
-
Useful in case or if statements where you don't want to do anything
-
exit statements
-
Can exit loops
-
exit with no identifier leaves the innermost loop
-
exit with an identifier leaves the identified loop
-
next statements
-
Like the continue statement in C, goes back to the top of the loop
-
assertion statements
-
Used for debugging purposes
-
report statements
-
Can be used to display a message
-
procedure calls
-
return statements
Concurrent v. Sequential Statements and how VHDL models digital systems
We've covered the basic syntax for sequential statements, now we need to turn to a more detailed analysis of how VHDL models digital systems. In particular, how does it deal with signals, which form the basis for the transfer of information and the dataflow level of modeling.
Signal drivers
Creating signal waveforms
-
Signal assignments can contain multiple values with the "after" keyword
-
CLOCK <= `0', `1' after 8 ns, `0' after 12 ns, `1' after 20 ns, `0' after 24 ns;
-
This assignment schedules 5 events for the CLOCK signal driver
-
If another sequential statement does something like:
-
CLOCK <= `1' after 15 ns;
then all of the events in the signal driver on or after 15 ns are removed from the queue.
Sequential v. Concurrent signal assignments
A concurrent signal assignment (not in a process) is executed whenever there is an event on one of the signals on the right hand side of the assignments.
Example: propagating signals
-
Architecture using a process to pass a value from A to B to C
-
Architecture using concurrent statements to pass a value from A to B to C
Concurrent statements still use delta delays to pass events around at a given simulation time (unless specific event times are given in the assignment statement(s)).
Example: flip-flop
pp. 109 of Bhasker
Concurrent signal drivers
Each concurrent signal assignment statement creates a driver for that signal.
What happens if more than one statement assigns a value to a single signal (multiple drivers)?
-
You create a resolution function: it decides what value the signal should have given the list of proposed values from all of the signal drivers
-
You can implement a wired-or or a wired-and function using a resolution function
-
The type std_logic is a resolved type (std_ulogic is not)