Re: Merged version of chapter 6

From: Geoffrey.Coram <Geoffrey.Coram_at_.....>
Date: Mon Jun 19 2006 - 06:18:58 PDT
Graham -
I can't find where the LRM prevents one from putting an event inside
a conditional.  It's not mentioned in 6.7 Events.  Events are 
analog statements, so it seems that they should be allowed inside
constant-expression conditionals.

I think one could disable a cross by shifting the threshold:

if (V(enable) > 0)
  thresh = 1e100;
else
  thresh = 0;

@(cross(V(clk) + thresh, +1)) begin
  // do something
end

One might need to set thresh to +/- 1e100 based on the current state
of the clock if one wants to disable the detection for both positive
and negative crossings.

It's not as clean and tidy as using a value other than +1/-1/0 to
mean "disable detection."

-Geoffrey


Graham Helwig wrote:
> 
> Hello Arpad,
> 
> This is not allowed in the LRM. However, if conditional event control
> statements were allowed in analog block then it would provide a common
> mechanism to enable/disable any event function (include digital event
> functions) within the analog block.Then the big question with
> conditional event control statements is what to do about the event
> function's internal state when it is enabled part way through a simulation?
> 
> Here are my thoughts on the matter. Looking at constant event control
> statements, they are effectively enabled at time zero along with the
> rest of the simulation. As a result the first time point (time zero)
> behavior is different to subsequent time point's behavior because the
> event functions internal state information is being initialized. For
> conditional event control statements, the first time point after being
> disabled can be treated as a initialization time point (like at time
> zero), the event function are initialized using the current values of
> from the simulation.
> 
> Regards
> Graham
> 
> Muranyi, Arpad wrote:
> > Can events be disabled by putting them into
> > an IF statement?  Or is that not allowed?
> >
> > Thanks,
> >
> > Arpad
Received on Mon Jun 19 06:19:08 2006

This archive was generated by hypermail 2.1.8 : Mon Jun 19 2006 - 06:19:18 PDT