Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Lec6 simulation semantics (revised version 1 of

yesterday’s rough draft )

SBP
17 August 2019

1 Simulation of a process–end process


Now I have touched it up a bit.

• Let simT denote the present time at which the logic circuit’s behaviour
is being evaluated.
• We are going to discuss only the following kind of process .... end process.
• process
< variable / constant / type declarations >
begin
< sequential statements >
wait on ... .... .... ;
end process ;

• A process is either ”sleeping” or is ”just awakened” or is being


”evaluated”.
• The simulator is either ”Evaluating a Process” or performing
”AdvanceSimTime” or performing ”Signal Update”
• ”simT” does **not** change when the simulator is ”evaluating
a process”.
• ”simT” changes only when simulator performs ”AdvanceSim-
Time”
• ( clearly all processes must be sleeping for this to happen ).

• When simulator performs ”AdvanceSimTime”, it advances ”simT”


to the **earliest** time in future at which some signal is to as-
sume its updated value.

1
– .... consider this for physical interpretation ... cmos logic gate’s in-
put(s) changed at ”simT” , so the pmos/nmos transistors ”immedi-
ately” adjusted to on/off suitably ( at ”simT” itself .... immediately
) .....
– However the output capacitance as well as the load capacitance and
the charging/discharging resistive path through switched-on mosfet
would cause ”inertial delay” before the output signal assumes the
updated value .... This ”inertial delay” is ”modeled” by the implicit
(∆ delay) or specified explicitely in ”after ... ” clause.
• Immediately after ”AdvanceSimTime” is performed, the sim-
ulator performs ”SignalUpdate” on the signals that are to be
updated at this advanced simT.
• If a ”SignalUpdate” results in a change in the value of the signal,
an **event** is said to have occurred on that signal.
• Only when an event occurs, the simulator checks, whether there is any
process that would be affected by it ( i.e. a process that is ”waiting on
that signal” ).
• If there is such a ”affected process”, then the simulator awakens
( resumes ) that process. Else ( if there is no affected process ),
then the simulator again performs ”AdvanceSimTime”
• Once any process has been awakened / resumed, simulator per-
forms ”Evaluation of awakened process” ... And after ”Eval-
uation” the process would be again put to sleep ( because an
implicit/explicit ”wait” statement must be encountered again
in a properly written process ).
• So here is what happens during ”Evaluation of a resumed/awakened
process” .....
– Bear in mind the following, during ”evaluation” of a ”process...end
process”, simT does **not** change.
– While ”evaluating a resumed process”, the simulator goes through
the statements ... right from the point of resumption ..... up to
the next ”wait” statement ... in the given order ( i.e. sequential
execution ) .... doing the following.
– Evaluate all the expressions on RHSs ( right hand sides ) and in
condition clauses ( of if / case statements etc. ) , and update the
target variables ( on LHS ) immediately ( before moving on to next
sequential statement ... during this ”evaluation” )
– However the target signals ( signals on LHS ) are not updated
immediately, rather it is recorded that that signal will be updated
at a future time after implicitly / explicitly specified delay, e.g. at
simT+∆ or (simT + x ns) .

2
– As mentioned earlier, such ”evaluation of a process–end process” ends
when ”wait” statement is encountered, and the process is put to sleep
again.
• Only when all processes are ”sleeping”, the simT can be advanced. That is,
”AdvanceSimT” is performed whereby ”simT” is advanced to the earliest
time in future at which some signal is to be updated.

2 Example
process ( a,b,c,s_tmp1,s_tmp2 ) begin
s_tmp1 <= ( a or b ) after 1 ns ;
s_tmp2 <= ( a and b ) or ( c and s_tmp1 ) after 1 ns ;
cout <= s_tmp2 after 1 ns ;
end process ;

• Assume at simT=0 , (a,b,c,s tmp1,s tmp2,cout) = ”000000”


• Assume signals b,c both change to ’1’ at time 10 ns
• So this process was sleeping and got awakened at time simT=10ns.
• At simT=10ns the following things happen during ”evaluation” of this
awakened process.
• All statements of this process .... from point of resumption ... up to
the (implicit/explicit) wait statement are processed in sequential order as
follows.
• ( at simT=10ns ), the expressions on RHSs of all these 3 statements get
evaluated ... the resulting values are as follows :

– value ’1’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 10+1=11


ns )
– value ’0’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 11 ns ).
– value ’0’ to be driven onto signal cout after 1 ns ( i.e. at 11ns ).
– On encountering the implicit ”wait on a,b,c,s tmp1, s tmp2;” state-
ment , this process is put to sleep.
– Once again, hammer it in your head that ”simT” does not change
during such ”evaluation of a process”

• Now that all processes ( this is assumed to be the only process ) are
sleeping, the simulator performs ”AdvanceSimTime” and ”SignalUpdate”.
• ”simT” is advanced to ..... 11ns ... Why ? ... because earliest future time
at which some signal is to be updated is this one ( s tmp1 , s tmp2 , cout
are all to be updated at time 11ns ).

3
• So simulator performs ”SignalUpdate” to update s tmp1 to ’1’ , s tmp2
to ’0’ and cout to ’0’
• Now as a result of ”SignalUpdate”, event occurs only on s tmp1 ( its value
has changed from ’0’ to ’1’ ). But that is good enough. The process is
awakened. ”simT” is at 11ns.
• Now ”evaluation” is performed at simT=11ns ..... Present values of signals
are (a,b,c,s tmp1,s tmp2,cout)=”011100”
• – value ’1’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 11+1=12
ns )
– value ’1’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 12 ns ).
– value ’0’ to be driven onto signal cout after 1 ns ( i.e. at 12ns ).
– On encountering the implicit ”wait on a,b,c,s tmp1, s tmp2;” state-
ment , this process is put to sleep.
– Once again, note that ”simT” does not change during such ”evalu-
ation of a process” ... simT=11ns throughtout this ”evaluation” of
this process.
• Now that all processes ( this is assumed to be the only process ) are
sleeping, the simulator performs ”AdvanceSimTime” and ”SignalUpdate”.

• ”simT” is now advanced to ..... 12ns .. why ? ... because earliest future
time at which some signal is to be updated is this one ( s tmp1 , s tmp2
, cout are all to be updated at time 12ns ).
• So simulator performs ”SignalUpdate” to update s tmp1 to ’1’ , s tmp2
to ’1’ and cout to ’0’

• Now as a result of ”SignalUpdate”, event occurs only on s tmp2 ( its value


has changed from ’0’ to ’1’ ). But that is good enough. The process is
awakened. ”simT” is at 12ns.
• Now ”evaluation” is performed at simT=12ns ..... Present values of signals
are (a,b,c,s tmp1,s tmp2,cout)=”011110”
– value ’1’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 12+1=13
ns )
– value ’1’ to be driven onto signal s tmp1 after 1 ns ( i.e. at 13 ns ).
– value ’1’ to be driven onto signal cout after 1 ns ( i.e. at 13ns ).
– On encountering the implicit ”wait on a,b,c,s tmp1, s tmp2;” state-
ment , this process is put to sleep.
– Once again, note that ”simT” does not change during such ”evalu-
ation of a process” ... simT=12ns throughtout this ”evaluation” of
this process.

4
• Now that all processes ( this is assumed to be the only process ) are
sleeping, the simulator performs ”AdvanceSimTime” and ”SignalUpdate”.
• ”simT” is now advanced to .... 13ns .. why ? ... because earliest future
time at which some signal is to be updated is this one ( s tmp1 , s tmp2
, cout are all to be updated at time 13ns ).
• So simulator performs ”SignalUpdate” to update s tmp1 to ’1’ , s tmp2
to ’1’ and cout to ’1’
• Now as a result of ”SignalUpdate”, event occurs only on cout ( its value
has changed from ’0’ to ’1’ ). But there is **nobody** waiting on signal
”cout”.
• So simulator tries to ”AdvanceSimTime” .... but there is no future time
beyond 13ns at which any signal is to be updated.
• Therefore ”AdvanceSimTime” does NOT change simT .... it stays at 13ns.
So everything is now at dead-end.
• Final value of cout is ’1’ ( it only changed at simT=13ns in response to
change at b,c that happened at simT=10n).

You might also like