Initial execution of the processes and sensitivity list

Discussion in 'VHDL' started by valtih1978, Jan 7, 2013.

  1. valtih1978

    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?
     
    valtih1978, Jan 7, 2013
    #1
    1. Advertising

  2. valtih1978

    valtih1978 Guest

    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, Jan 7, 2013
    #2
    1. Advertising

  3. 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.
     
    Paul Uiterlinden, Jan 7, 2013
    #3
  4. 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.
     
    Paul Uiterlinden, Jan 7, 2013
    #4
  5. 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?
     
    Valentin Tihhomirov, Jan 17, 2013
    #5
  6. valtih1978

    Jim Lewis Guest

    "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
     
    Jim Lewis, Jan 21, 2013
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elinore
    Replies:
    6
    Views:
    5,542
    Ahmed Samieh
    Jun 10, 2007
  2. AG
    Replies:
    45
    Views:
    9,099
  3. Marc Heiler
    Replies:
    1
    Views:
    187
    Robert Klemme
    May 24, 2009
  4. alb
    Replies:
    19
    Views:
    683
  5. Raja Harsha
    Replies:
    4
    Views:
    164
    Daniel Kho
    Mar 4, 2014
Loading...

Share This Page