Re: [sv-bc] Usage of named event

From: Steven Sharp <sharp_at_.....>
Date: Tue Mar 25 2008 - 16:52:46 PDT
>From: Surya Pratik Saha <spsaha@cal.interrasystems.com>

>Consider the following e.g.:
>
>module top;
>event line_end_event;
>initial
>begin
>  
>   if (line_end_event)   // --> is it an error?
>    begin
>    end
>   wait(line_end_event);  // --> is it an error?
>end
>
>endmodule

Yes, these are technically errors.

>SV allows 'null' to be assigned to named event. Considering that fact, 
>wrt SV, is the case legal, because 'if (line_end_event)' can be read as 
>'if (line_end_event != null)'.

Except that the LRM does not say that 'if (value)' can be read as
'if (value != null)'  for named events or for any other type to which
'null' can be assigned.  

It says that 'if (value)' can be read as 'if (value != 0)', which is
not a legal expression for a named event or any other type to which
'null' can be assigned.

Some implementations may be allowing this for some of those types, by
analogy with C (where the constant 0 is treated as a null pointer in
comparisons, so 'if (value != 0)' is the same as 'if (value != NULL)').
But currently, this is a nonstandard extension.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Mar 25 16:54:43 2008

This archive was generated by hypermail 2.1.8 : Tue Mar 25 2008 - 16:55:37 PDT