[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gEDA: Mime-Version: 1.0
You're not going to believe this, but:
reg [3:0] val, y;
initial begin
val = 2;
y = !!val;
end
As I read the 1995 LRM, this is not legal. Honest! I wonder if the
BNF is FUBAR. Here are the applicable rules:
expression ::= primary
| unary_operator primary
[etc]
primary ::=
number
| identifier
| identifier [ expression ]
| identifier [ constant_expression : constant_expression ]
| concatenation
| multiple_concatenations
| function_call
| ( mintypmax_expression )
And that's all she wrote. You wrote ``!!val'' which is a ``! primary''
but ``!val'' is not a primary. !
I would not have guessed that. I wonder if the 2000 LRM is different
in this regard. Anyhow, if you write it like this:
y = !{!val}
it'll work correctly, as ``{!val}'' *is* a primary. Go figure.
--
Steve Williams "The woods are lovely, dark and deep.
steve@icarus.com But I have promises to keep,
steve@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."