Re: compiler directive with formal arguments

From: Geoffrey.Coram <Geoffrey.Coram_at_.....>
Date: Fri Nov 03 2006 - 05:23:59 PST
Marq -
I had a look in mantis and see that Shalom is assigned a few related
items, but I don't see your question addressed in 1119, 1053, nor 1333.

I'm not sure what the bit about identifiers means, but one could
twist it to mean that the formal arguments are not replaced in a
string, just as
  parameter real mypar = 1.0;
 
  $strobe("mypar = ", mypar);

doesn't give you 1.0 = 1.0, because the identifier is not replaced
inside the string.

-Geoffrey



Marq Kole wrote:
> 
> 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
Received on Fri Nov 3 05:24:08 2006

This archive was generated by hypermail 2.1.8 : Fri Nov 03 2006 - 05:24:10 PST