RE: [sv-bc] Mantis 1571: proposal for macro defaults

From: Alsop, Thomas R <thomas.r.alsop_at_.....>
Date: Wed Aug 15 2007 - 22:29:58 PDT
Can we change the examples on the defaults?  See highlights below.  This
will explicitly show what gets printed by the $display statement.  I
only gave examples for MACRO1 so the same should happen for MACRO2 & 3. 

Thanks, -Tom
From this:
Example with defaults:

`define MACRO1(a=5,b="B",c) $display(a,,b,,c); 

`MACRO1 ( , 2, 3 )  // argument a omitted, replaced by default
`MACRO1 ( 1 , , 3 ) // argument b omitted, replaced by default
`MACRO1 ( , 2, )    // ILLEGAL: c omitted, no default
`MACRO1 ( 1 )       // ILLEGAL: b and c omitted, no default for c

To this

Example with defaults:

`define MACRO1(a=5,b="B",c) $display(a,,b,,c); 

`MACRO1 ( , 2, 3 )  // argument a omitted, prints "5,2,3"
`MACRO1 ( 1 , , 3 ) // argument b omitted, prints "1,B,3"
`MACRO1 ( , 2, )    // ILLEGAL: c omitted, no default
`MACRO1 ( 1 )       // ILLEGAL: b and c omitted, no default for c

-----Original Message-----
From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Wednesday, August 15, 2007 1:19 AM
To: Rich, Dave; sv-bc
Subject: RE: [sv-bc] Mantis 1571: proposal for macro defaults

Hi, Dave. 

> How do you explicitly pass empty text as an argument and not 
> use the default?

I assume you mean, if I have a non-empty default, how can I explicitly
make the argument empty? Answer: I don't have a solution for that.
Specifying a non-empty default loses me that ability. It is still an
enhancement relative to today where there are no defaults at all. If I
need to be able to specify an empty argument, I will not be able to use
a non-empty default. I would be happy to get a suggestion for a solution
to this.

> In a similar vein, wt happens if an argument to the macrosis 
> itself a macro that turns into empty text. Does the default apply?
> 
> When is the default expression evaluated?

I want to think about these more before I answer.

Thanks,
Shalom

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, 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 Wed Aug 15 22:30:32 2007

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2007 - 22:30:58 PDT