Re: [sv-ac] P1800-2009 : Contradictions in legality of type "event" in formal argument

From: Thomas Thatcher <Thomas.Thatcher_at_.....>
Date: Mon May 11 2009 - 09:20:40 PDT
Hi Ben,

I think the two sections are talking about different things, and there 
is not necessarily a contradiction.

Section 16.6.1 is talking about boolean expressions.  Events and 
sequences don't have a boolean value, so they may not appear in boolean 
expressions.  If s is a sequence, you can't include it in a boolean 
expression, but you could include (matched(s)), because that returns a 
boolean value.  If e is an event, you can't code (a && e).

Section 16.8.1 is talking about typed formal arguments to sequences. 
Sequences and events are allowed as formal arguments to a sequence, as 
long as those arguments are not used in a boolean context.  For example, 
an event type argument could be used as the clock for the sequence.  A 
sequence argument could be used as a sub-sequence.

Tom

On 05/09/09 22:01, ben cohen wrote:
> Reading draft 8, (same in draft 7), I found the following, which sounds 
> like contradictions in that type event, declared as illegal in 16.6.1 
> Operand types, is used as formal argument, but is illegal in local 
> variable formal argument.  Specifically: 
> 16.8.1 Typed formal arguments in sequence declarations
> If a formal argument of a named sequence is typed, then the type shall 
> be sequence, event, or one of the
> types allowed in 16.6.1 
> [Ben Cohen] Interestingly, 16.6.1 specifies "event" as illegal.  Thus, 
> this is an exception.
> p321
> The following shows an example of a formal argument with event type:
> sequence event_arg_example (event ev);
> @(ev) x ##1 y;
> endsequence
> 
> 16.8.2 Local variable formal arguments in sequence declarations
> p322
> sequence illegal_loc_var_formal (
> output logic a, // illegal: local must be specified with
> ...
> local event e, // illegal: event is a type disallowed in
> // 16.6.1
> ---
> 16.6.1 Operand types
> The following types are not allowed:
> Noninteger types (shortreal, real, and realtime)
>  string
>  event
>  chandle
>  class
>  Associative arrays
>  Dynamic arrays
> [Ben Cohen] So, If I understand this correctly, a typed formal argument 
> that is declared with local is illegal, but if declared without the 
> local is legal. 
> Thus, updating the example on page 321, I can say the following: 
> sequence event_arg_example_Ben (
>     local inout logic a,
>                       logic e, f,
>     local event evt,      // illegal: event is a type disallowed in 16.6.1
>              event ev);  // Legal: Exception to rules in 16.6.1, as 
> per 16.8.1
> @(ev) a ##1 e;
> endsequence
> It strikes me as odd, particularly, the way I view it, a formal 
> argument, by default of direction input, acts the same as a local 
> variable formal argument of direction input.  Yet, type argument of type 
> event is legal if formal argument is not declared as a local variable 
> formal argument. 
> Where am wet here? 
> Ben 
> 
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon May 11 09:21:56 2009

This archive was generated by hypermail 2.1.8 : Mon May 11 2009 - 09:23:06 PDT