Re: Merged version of chapter 6

From: Graham Helwig <graham.helwig_at_.....>
Date: Mon Jun 19 2006 - 17:50:39 PDT
Hello Geoffrey,

Yes, the LRM is vague about how the event control statement can be used with analog block, particularly conditional statements.  I have always assumed that event control statements could never be used within non-constant conditional statements because I have never seen any implementation support it. The merged section 6 that Sri has updated should make these usage restrictions clear.  Does any implementation support the use of analog event control statement within non-constant conditional statements?

Regarding your example. I agree your example is less readable but it works. I have taken you example an reworked it assuming event control statement are allowed within non-constant conditional statements. See below.
if (V(enable) <= 0) begin
  @(cross(V(clk), +1)) begin
    // do something
  end
end

This example is now much more readable.

Regards
Graham

Geoffrey.Coram wrote:
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
      



  


-- 
==========================================================
Graham Helwig
AMS Verification
Australian Semiconductor Technology Company (ASTC) Pty Ltd

Location: 76 Waymouth St, Adelaide, SA, 5000, Australia
Phone     +61-8-82312782
Moblie:   +61-4-03395909 
Email:    graham.helwig@astc-design.com
Web:      www.astc-design.com
==========================================================
Received on Mon Jun 19 17:51:20 2006

This archive was generated by hypermail 2.1.8 : Mon Jun 19 2006 - 17:51:25 PDT