compiler directive with formal arguments

From: Marq Kole <marq.kole_at_.....>
Date: Fri Nov 03 2006 - 04:58:13 PST
All,

At least one simulator has a different interpretation of a compiler 
directive with formal arguments than any of the others (known to me) do. 
Consider the macro definition:

`define UPDATE_XML_ELEMENT(file,param,value,delta) \
if (delta) \
$fwrite(file, " <instance name=\"%M\">\n  <parameter name=\"%s\" 
value=\"%1.8g\" delta=\"%1.8g\"/>\n </instance>\n", param, value, delta);

Now I would expect that a call

`UPDATE_XML_ELEMENT(update_file, "vth0", Vth, -delta_vth)

to be expanded to:

if ( -delta_vth) \
$fwrite(update_file, " <instance name=\"%M\">\n  <parameter name=\"%s\" 
value=\"%1.8g\" delta=\"%1.8g\"/>\n </instance>\n", "vth0", Vth, 
-delta_vth);

Instead this tool expands it to:

if ( -delta_vth) \
$fwrite(update_file, " <instance name=\"%M\">\n  <parameter name=\"%s\" 
Vth=\"%1.8g\"  -delta_vth=\"%1.8g\"/>\n </instance>\n", "vth0", Vth, 
-delta_vth);

So it replaces also the occurrences of "value" and "delta" inside the 
format string of the $fwrite system task.

The weird thing is that the LRM 2.2 standard according to section 11.3.1 
only states that the scope of formal arguments extends to the end of the 
line and that a formal argument can be used in the same manner as an 
identifier. It nowhere exempts the contents of strings from formal 
argument replacement. It is my feeling that this should be added to the 
text.

Then, on the other hand the text in 1364-2005 (section 19.3.1) is exactly 
the same. Should we take the lead here?


Marq Kole
Competence Leader Robust Design

Research
NXP Semiconductors
Received on Fri Nov 3 04:58:26 2006

This archive was generated by hypermail 2.1.8 : Fri Nov 03 2006 - 04:58:41 PST