Initial execution of the processes and sensitivity list

V

valtih1978

Guest
The processes must be executed only when sensitivity signals are
changed. However, LRM says that "For each nonpostponed process P in the
model, The process executes until it suspends" in the initialization.

How is this related with sensitivity wait statement?
 
I think that this is because given two processes,

X <= A + 1;

and

A <= 1;

Both will execute but A has a wrong value during first execution. Then,
X start waiting for A, which updated during first execution, will
re-trigger X for the second time. This time, A value is ok and X is
updated properly. *It does not matter if wait on A is located in the
beginning of X or in the end.*

Is it right? I am not sure what about wait in the middle of process and
how (shared) variables, who take values immediately, react.
 
valtih1978 wrote:

The processes must be executed only when sensitivity signals are
changed. However, LRM says that "For each nonpostponed process P in the
model, The process executes until it suspends" in the initialization.

How is this related with sensitivity wait statement?
What do you mean by "sensitivity wait statement"? There is a wait statement,
and there is a sensitivity list.

A process with a sensitivity list is the same as a process with a "WAIT ON"
(with the same signals) at the end of the process.

p1: PROCESS(a, b, c) IS
BEGIN
statement1;
statement2;
END PROCESS p1;

p2: PROCESS IS
BEGIN
statement1;
statement2;
WAIT ON a, b, c;
END PROCESS p2;

Processes p1 an p2 are equivalent.

At time zero and delta zero process p2 is run until it hits the WAIT
statement and suspends until an event occurs on one of the signals.
 
valtih1978 wrote:

I think that this is because given two processes,

X <= A + 1;

and

A <= 1;

Written as processes with a wait statement:

p_x: PROCESS IS
BEGIN
x <= a + 1;
WAIT ON a;
END PROCESS p_x;

p_a: PROCESS IS
BEGIN
a <= 1;
WAIT; -- for ever
END PROCESS p_a;

Both will execute but A has a wrong value during first execution. Then,
X start waiting for A, which updated during first execution, will
re-trigger X for the second time. This time, A value is ok and X is
updated properly. *It does not matter if wait on A is located in the
beginning of X or in the end.*

Is it right?
No. The result on x will be different from time 0 ns + 1 delta to 0 ns + 2
delta.

I am not sure what about wait in the middle of process and
how (shared) variables, who take values immediately, react.
A signal is updated one delta cycle after the signal assignment. First grasp
the idea what that means.

Run the above example with "AFTER 1 ns" in each signal assignment and look
at the result in the wave form viewer. The deltas are now replaced by 1 ns.
It should make things clear.

By the way: ModelSim has the ability the show the deltas in the wave form
viewer, so adding the 1 ns delays is not strictly necessary to be able to
see the order of events. And there is also a list window that shows the
events down to the delta level.
 
It seems that I have discovered rationale for making sensitivity wait
the last statement in the process. As Ashenden writes in the "Designer's
Guide":

each of the process instances in the design
is started and executes the sequentialstatements in its body. **We
usually write a model so that at least some of these initial statements
schedule some transactions to get the simulation under way, then suspend
by executing a wait statement.** When all of the process instances have
suspended, initialization is complete and the simulator can start the
first simulation cycle."

I have emphasized the key idea, IMO. If the wait statement would be the
first one then all the processes would wait for another and execution
would never start. Right?
 
On 17/01/13 10:09, Valentin Tihhomirov wrote:
It seems that I have discovered rationale for making sensitivity wait
the last statement in the process. As Ashenden writes in the "Designer's
Guide":

"[During initialization] each of the process instances in the design
is started and executes the sequentialstatements in its body. **We
usually write a model so that at least some of these initial statements
schedule some transactions to get the simulation under way, then suspend
by executing a wait statement.** When all of the process instances have
suspended, initialization is complete and the simulator can start the
first simulation cycle."

I have emphasized the key idea, IMO. If the wait statement would be the
first one then all the processes would wait for another and execution
would never start. Right?
Hi Valentin,
Yes some processes need to start to create events so that simulation
does something. But it would also be possible to design a language where
processes with a sensitivity list do *not* execute at time zero. That
language is called Verilog.

I think the key point is that if *every* process runs at time zero,
including those with sensitivity lists (as they are equivalent in VHDL
to a "wait on" at the bottom of the process) it guarantees initialisation.

The maintainers of Verilog have realised this is a good thing - in
SystemVerilog, the

always_comb

statement behaves like a VHDL process in that it runs at time zero
independently of events on its (implicit) sensitivity list,

regards
Alan

--
Alan Fitch
 
"Initialization" is the execution phase of time 0, delta cycle 0.
"Elaboration + Initialization" are simply a specialized simulation
cycle that starts all VHDL simulations.

"The process executes until it suspends" means:
Processes with sensitivity lists run in their entirety.
Concurrent assignments are treated as their equivalent
process with a sensitivity list.
Processes with wait statements run until they hit the first wait statement.

Cheers,
Jim
 

Welcome to EDABoard.com

Sponsor

Back
Top