Re: [sv-bc] void casting on void function call

From: Surya Pratik Saha <spsaha_at_.....>
Date: Thu Aug 30 2007 - 08:41:48 PDT
Hi Gordon,
function_subroutine_call is part of 'primary' in the BNF. Do you want 
then void function call is an expression? Please do not compare with 
'C', as 'C' does not distinguish a statement and expression. In 'C', you 
can simply write
1 + 2;
which SV does not allow. So as per SV, any statement should not be void 
casted, hence void function call too should not be allowed like task enable.

Regards
Surya



-------- Original Message  --------
Subject: Re:[sv-bc] void casting on void function call
From: Gordon Vreugdenhil <gordonv@model.com>
To: Surya Pratik Saha <spsaha@cal.interrasystems.com>
Cc: "sv-bc@eda-stds.org" <sv-bc@eda-stds.org>
Date: Thursday, August 30, 2007 8:57:46 PM
>
> The question is whether the intent of "function_subroutine_call"
> is restricted to "function's that are expressions".  There
> is no real reason to make that restriction; C for example
> allows void casts of void functions as well.
>
> If you want to argue this too narrowly, you'll argue yourself
> into a bigger problem -- grammatically "function_subroutine_call"
> is any call (including a task).  The semantic intent is in the
> "function" prefix.  But "function_subroutine_call" isn't a
> system_tf_call so one could argue that void'($bits(x)) would
> be illegal.  Clearly that isn't the intent once you consider
> all the systf file I/O cases where one wants to through away
> return codes.
>
> I don't see any reason to not interpret this in the most
> permissive way possible.  I'd even support allowing (at least)
> systf task calls since that would be a great way for real
> user code to insulate themselves against possible variations
> in vendor implementations and/or LRM versions.  A great
> example of that is with "$system" for which there is variation
> in implementation.  Allowing a systask call in a void cast
> would allow user code to have:
>     void'($system("..."));
> as completely portable code even among different vendors.
>
> Gord
>
> Surya Pratik Saha wrote:
>> Hi,
>> As per LRM-BNF, void casted statment is:
>>
>> *Subroutine_call_statement ::= subroutine_call;
>> | void'(function_subroutine_call);*
>>
>> And for void function, LRM mentions following text (page no. 156 of 
>> IEEE 1800).
>>
>> *Function calls are expressions unless of type void, which are 
>> statements:
>> a = b + myfunc1(c, d); //call myfunc1 (defined above) as an expression
>> myprint(a); //call myprint (defined below) as a statement
>> function void myprint (int a);
>> ...
>> endfunction
>>
>> *Can **function_subroutine_call **contain void function call? I don't 
>> think so, as void function call is a statement. But some simulators 
>> don't think like that and passes the following case:
>>
>> module top;
>>     initial begin
>>         void'(f());
>>     end
>>     function void f;
>>         return ;
>>     endfunction
>> endmodule
>>
>> Any expert comment?
>>
>> -- 
>> Regards
>> Surya
>>
>>
>> -- 
>> 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 Thu Aug 30 08:42:32 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 30 2007 - 08:42:41 PDT