Initial execution of the processes and sensitivity list

V

valtih1978

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?
 
V

valtih1978

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.
 
P

Paul Uiterlinden

valtih1978 said:
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.
 
P

Paul Uiterlinden

valtih1978 said:
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.
 
V

Valentin Tihhomirov

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?
 
J

Jim Lewis

"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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top