[sv-bc] Mantis 1338 - Clarificaion on String literal behavior in macros

From: Alsop, Thomas R <thomas.r.alsop_at_.....>
Date: Fri Nov 16 2007 - 15:05:00 PST
I have updated mantis item 1338 with a proposal on what I believe is the
intended behavior of string literals inside of macros WRT to argument
substitution. 

 

I am slightly hesitant on adding this wording simply because some vendor
tools do not distinguish on this behavior.  Shalom is asking for
clarification about how we treat macro argument substitution WRT string
literals.  I agree about the ambiguity of the current wording.  The fact
that we have `" in macros that allow us keep the string character after
substitution means that string literals without the back tick have an
alternative meaning.  I would interpret that meaning as a string
literal, not a replacement on the string token.  

 

This does collide with current implementation.  For example I ran VCS on
the following code snippets:

 

`define msg(x,y) `"x: `\`"y`\`"`"

`define msg_nobacktick(x,y) "x: \"y\""

`define msg_nosubsitute(x) "x"

`define msg_subsitute(x) `"x`"

 

module foo();

 

initial begin

  //$fsdbDumpvars(0,foo,"+all");

 

  $display(`msg(left side,right side));

  $display(`msg_nobacktick(left side,right side));

  $display(`msg_nosubsitute(left side));

  $display(`msg_subsitute(left side));

 

end

endmodule

 

 

This produced the following results:

 

left side: "right side"

left side: "right side"

left side

left side

 

The conclusion being that " is treated exactly the same way as `".

 

With the change in the proposal this would have the following results
instead:

 

left side: "right side"

x: "y"

x

left side

 

I am happy to shoot down the proposal.  The intent is to come up with
one and discuss it.  I don't see a strong need for this change.  The
alternative proposal is to clarify that " and `" behave the same.

 

 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Nov 16 15:05:21 2007

This archive was generated by hypermail 2.1.8 : Fri Nov 16 2007 - 15:05:54 PST