Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: help on a complex macro

25 views
Skip to first unread message
Message has been deleted

sh...@cadence.com

unread,
Sep 5, 2008, 7:07:42 PM9/5/08
to
On Sep 5, 3:44 am, very_very_log <sgiitne...@gmail.com> wrote:
> Hi,
> Can somebody explain what is m3 meant to be doing in this code?
> And before that, is it a valid verilog code?
>
> `define m3(t)       `" calling : `\`"m1(t)`\`"AND `\`m2(t)` \`"`"

It is not valid Verilog code. It is SystemVerilog code.

The `" sequence turns into an ordinary quote after arguments have been
substituted (and presumably nested macros expanded, as this case
requires). If ordinary quotes were used, this would be a string
literal, and macro arguments and macro invocations would not be
recognized as such inside of it. This gives the same capability as
the C language macro "stringizing" operator, letting macros build
strings from pieces that include arguments.

The `\`" sequence turns into a \" in the resulting expansion. Inside
a string literal, that \" sequence means that there is a literal "
character inside the string.

The other SV macro extension is ``, which acts as a token delimiter
when looking for macro arguments, but is then discarded. This allows
you to connect the expansion of a macro argument to an identifier
without any spaces between them, building a larger identifier. This
gives the
same capability as the C language macro "token pasting" operator,
letting macros build identifiers from pieces that include arguments.

0 new messages