Re: [sv-bc] Mantis 1563: allow to pass macro arguments by name

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Fri Aug 18 2006 - 08:44:39 PDT
Shalom,

    Just for completeness, I want to note that this is not 100%
backward compatible with existing systems.  For instance, on
a system without this feature the line

`fun( 2, .s("yes") ); // OK

is also legal and expands to

$display(“%d %s”, 2, .s("yes"));

    I doubt if that is a serious impediment to adopting the
change, but it needs to be noted.

Greg Jaxon


Bresticker, Shalom wrote:
> Fixed an error:
> 
> I have filed Mantis 1563, an enhancement request to pass macro arguments 
> by name. For consistency, the language is similar to that of 12.4.4 for 
> tasks and functions.
> 
> In 23.2, INSERT
> 
> 23.2.1 Argument binding by name
> 
> SystemVerilog allows arguments to macros to be bound by name as well as 
> by position. This allows specifying the arguments in any order and 
> easily specifying the argument to be passed at the call. For example:
> 
> `define fun(j, s)  $display(“%d %s”, j, s)
> 
> The fun macro can be called as follows:
> 
> `fun( .j(2), .s("yes") );
> 
> `fun( .s("yes"), .j(2) );
> 
> `fun( 2, “yes” );
> 
> If both positional and named arguments are specified in a single macro 
> call, then all the positional arguments must come before the named 
> arguments. Then, using the same example as above:
> 
> `fun( .s("yes"), 2 ); // illegal
> 
> `fun( 2, .s("yes") ); // OK
> 
>  
> 
> Shalom
> 
> Shalom Bresticker
> 
> Intel Jerusalem LAD DA
> 
> +972 2 589-6852
> 
> +972 54 721-1033
> 
> I don't represent Intel 
> 
>  
> 
Received on Fri Aug 18 08:44:46 2006

This archive was generated by hypermail 2.1.8 : Fri Aug 18 2006 - 08:44:53 PDT