RE: define and strings

From: Muranyi, Arpad <arpad.muranyi_at_.....>
Date: Tue Jul 26 2005 - 09:37:13 PDT
Geoffrey,

I meant a string parameter used as a string argument to a macro.
Here is why:

The ultimate goal I tried to achieve was to pass a file name
into the $table_model as a parameter.  Regardless of an earlier
response that the $table_model can only take a double quote
enclosed string literal, the tool I experimented with does
allow the usage of a macro for the file name.

By the way, can this string literal come from a macro then?
And if string parameters are treated a constants which can
only change at compile time, why couldn't it come from a
string parameter?

Anyway, since the macro worked, the next thought I got was
to parameterize the macro, so I wrote a macro that used an
argument.  The argument that I passed into the macro was a
string parameter (i.e. a constant), which generated an error
with the $table_model.

The explanation I received from the tool vendor was that
string parameters are not evaluated until run time, so the
compiler doesn't know how to expand the macro, and leaves
the string parameter name there as an identifier to be
evaluated at runtime.  I guess the vendor missed the point
that string parameters are constants and can only change
at compile time, therefore the macro should have expanded
it into a fixed file name in the $table_model.  Of course,
one might argue that if this was implemented correctly, the
usage of the string parameter in the $table_model should
have also worked without having to go through the macro.

Arpad
===========================================================



-----Original Message-----
From: geoffrey.coram@analog.com [mailto:geoffrey.coram@analog.com] 
Sent: Tuesday, July 26, 2005 3:40 AM
To: Muranyi, Arpad
Cc: VerilogAMS Reflector
Subject: define and strings

Arpad -
Do you mean "string parameters" or string arguments?

I think you mean arguments to the macro that are strings.

`define PRT(x) $strobe(x);

`PRT("this is fine")


-Geoffrey


"Muranyi, Arpad" wrote:
...
> 3)  `define with string parameters.  Since the macro text which
> is defined is not surrounded by the double quote signs, it is
> technically not a string type.  It is "just text".  What happens
> if I pass in a string as an argument to be part of this text?
> Is it going to get flattened out as "just text", or is it going
> to remain a string type?  Since this is a compiler directive, I
> would expect that the compiler would take the content of the string
> argument, turn it into "just text" and pass it on to the simulator
> as such.  However, a tool vendor's opinion is different, they
> say that at compile time the string parameters are not evaluated
> yet, so the macro expansion is not aware of what the contents
> of the string parameters are, therefore it can't be expanded
> yet as "just text".  I don't see anything on this in the LRM
> v2.2 either.
> 
> Please let me know if I missed something, or if these are real
> problems, please put these on the agenda for further discussion.
>
Received on Tue Jul 26 09:37:25 2005

This archive was generated by hypermail 2.1.8 : Tue Jul 26 2005 - 09:37:28 PDT