Re: [sv-bc] Mantis 1571: Add default values for macro arguments

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Fri Oct 20 2006 - 10:02:46 PDT
Yes, of course, you and Steven are right that this currently
reports an error.  The pre-processing logic just eluded me for
a moment.  #([ list_of_parameter_assignments ]) is a feasible
solution.  `ABC`(...) would also work, if someone wanted more
lexical distance from object language syntax.  Of course,
`ABC #(...) must continue to expand simple macro definitions
such as "`define ABC dictionary".

One concern I'd have with the choice of #() as a preprocessor
feature is that this syntactic pattern is only a partial analogy
to the argument list features in the object language (SV).
The expectations that sets up are going to confuse some readers.

One way you might expect to follow through on this pattern is, for example:
    `define ABC #(f,A,B,C) begin f(A); f(B); f(C); end
... where the definition syntax matches the invocation syntax.
Of course, this definition of ABC is already legal and /has/ no arguments.

The biggest improvement to Verilog pre-processing that I can
imagine would be to overturn context-determined expression rules,
so that cut & paste edits (as done during preprocessing) would
be more sane.  The context-sensitive ideas in e that Jonathon
mentioned require processing at a later phase of parsing.

Greg

Disclaimer: I am not representing Synopsys official positions on
these topics, only engaging in design idea discussions.

Bresticker, Shalom wrote:
> Greg,
> 
>> Just noting that despite any other merits, this design is not
>> backward compatible with existing uses of macro expansion.
>>
>> In  the expansion of `ABC(.arg1(arg1), ...), existing products
>> will use the token sequences .arg1(arg1) and this may have been
>> the user's intent.
> 
> [SB] I have acknowledged that.
> 
>> In the expansion of `ABC #(.arg1(arg1),...), `ABC has no arguments
>> so it's expansion will be followed by #(.arg1(arg1),...).
> 
> [SB] No. If `ABC has a defined formal argument list, it is required to
> give it an actual argument list. The # (which has only an initial
> suggestion thrown out in order to initiate a discussion) would indicate
> that the actual argument list which is required to follow it, would be
> by name and not by position.
> 
> As others have said in other situations, if there are problems, let's
> find solutions instead of saying that we can't do it.
> 
> Shalom
Received on Fri Oct 20 10:02:52 2006

This archive was generated by hypermail 2.1.8 : Fri Oct 20 2006 - 10:03:10 PDT