[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA: Re: your mail




[ Ales here, I'm reposting this since majordomo didn't recognize the
  e-mail as being subscribed to the geda-dev mailinglist.  Please be 
  careful when you reply to this message, I (Ales) am not the original
  author. ]

-- Cut here --

Heh, yeah, that is strange... also, aparently paretheses make a primary
was well, as: y=!(!val) is also valid (or at least recognized by
icarus...)

Anyways, sounds great!

-Chris

On Thu, 20 Apr 2000, Stephen Williams wrote:

> 
> 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."
> 
>