RE: [sv-bc] Where, oh where, can my comment be?

From: Gran, Alex <alex_gran_at_.....>
Date: Tue Sep 25 2007 - 12:58:41 PDT
One place that I have heard user's claim that implementations are
different with respect to allowing comments is in multi-line macros

User's who I have worked with have provided code similar to this example
and claimed at least 1 implementation allows it, and at least one
results in syntax error(s)

 `define foo(a,b,c,d) \
        a = b;     \  //a gets a value
        c = d;        //c gets a value \
        $display("I'm done");

module top();
   reg a,b,c,d;
   initial begin
        `foo(a,b,c,d);
   end
endmodule


IEEE 1364-2005 Sec 19.3.1 says :
	If more than one line is necessary to specify the text, the
newline shall be preceded by a backslash (\).


The implementation that errors on the above example appears to be
interpreting that to mean:
	If more than one line is necessary to specify the text, the
newline shall be *immediately* preceded by a backslash (\).


The implementation that allows it appears to be interpreting that to
mean:
	If more than one line is necessary to specify the text, the
newline shall be preceded by a backslash (\). *Ignoring white space and
comments*


~Alex


-----Original Message-----
From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Greg Jaxon
Sent: Tuesday, September 25, 2007 11:27 AM
To: sv-bc@server.eda-stds.org
Cc: shalom.bresticker@intel.com
Subject: Re: [sv-bc] Where, oh where, can my comment be?

Steven Sharp wrote:
>> This sounds weird, but the LRM does not seem to say anywhere where a
>> comment can be placed (unless otherwise specified). I think the
general
>> rule is that a comment can be placed anywhere white space can.
> 
> You could say that comments are tokens that are ignored.

A lot turns on the wordsmithing of this text.  I think it belongs in
an extensive discussion of preprocessing.  Recall that the aboriginal
form of "token gluing" relied on a comment that behaved like a token
separator at one layer of macro expansion, but would then vanish
leaving no whitespace so that the next layer would "glue" the expanded
tokens together.

I also note that comments cannot appear on `line directives, and
perhaps there are other exceptions.

Finally, the infamous directives inside comments live with (some of) us
still.
These contradict the idea that all comments are "ignored" and
yet they need to behave outwardly just like comments - either
becoming whitespace, or admitting token gluing.  (Imagine: a directive
mid-token; what a powerful language 8-) gag...

> The LRM already states that they are tokens.  It fails to say that
they
> are ignored.  It does state that white space is a token, and that it
is
> ignored.  So yes, comments would follow the same rule as white space.
> 
> Steven Sharp
> sharp@cadence.com
> 
> 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Sep 25 12:59:00 2007

This archive was generated by hypermail 2.1.8 : Tue Sep 25 2007 - 12:59:24 PDT