RE: [sv-bc] Expected behavior of macro concatenation of macro

From: Bresticker, Shalom <shalom.bresticker@intel.com>
Date: Tue Jun 22 2010 - 22:34:56 PDT

VCS failed on `VALUEb, as you said.

Another simulator failed on both `VALUEa and on `VALUEb.

The third (the one that crashed on your first example), produced

EXP: '0' GOT '0'
EXP: '0' GOT '0'

Regards,
Shalom

> Here's an example to disect further. The VALUEb one seems
> to fail on (I suspect) every simulator.
>
> `define ZERO_0 "0"
> `define CONCAT(a, b) a``b
> `define NOTNOT(a) a
> `define VALUEa(a) `CONCAT(`ZERO_,a)
> `define VALUEb(a) `CONCAT(`ZERO_,`NOTNOT(a))
>
> module t;
> initial begin
> `define CNT 0
> // Works on at least one
> $write("EXP: '0' GOT '"); $write(`VALUEa(`CNT)); $write("'\n");
> // Fails on the one that DOES work
> $write("EXP: '0' GOT '"); $write(`VALUEb(`CNT)); $write("'\n");
> end
> endmodule
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Jun 22 22:35:48 2010

This archive was generated by hypermail 2.1.8 : Tue Jun 22 2010 - 22:38:40 PDT