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

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Thu Aug 30 2007 - 08:27:46 PDT
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.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Aug 30 08:54:37 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 30 2007 - 08:54:45 PDT