RE: define and strings

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

Thanks for your explanation, it does start making
sense.  But I sill have a question.  What if I modify
your example this way: 

parameter string strParName = "print a string";
`define PRT(x) $strobe(x);
`PRT(strParName)

What is $strobe(x) going to get from x?

$strobe("print a string") or
$strobe(print a string)   or
$strobe(strParName)       ?

Now I am getting the impression that it would be the
last one, but before I though it should be the second.
It all boils down to when strParName is evaluated, and
I thought that would happen at compile time while the
macro is expanded.

Thanks,

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

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

Arpad -
I don't know where you got the idea that expanding a macro
gets rid of the quotes.  It certainly doesn't happen in C.
The macro expansion simply replaces the formal arguments
with the actual arguments.  Thus, my example from before

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

would work for
`PRT("print a string")
`PRT(5.0)

because "print a string" and 5.0 are both valid expressions.

...
...
...

-Geoffrey
Received on Tue Jul 26 13:40:34 2005

This archive was generated by hypermail 2.1.8 : Tue Jul 26 2005 - 13:40:41 PDT