Re: [sv-bc] part selects on arbitrary expressions

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Wed Mar 07 2007 - 11:07:19 PST
Bresticker, Shalom wrote:
> Steven Sharp once pointed out the following:
>  
> "Making bit and part selects operators that can act on any vector value
> would also allow some strange syntax. Since the result of a bit or part
> select is a vector, there would be nothing to prevent taking another bit
> or part select of that result. That would allow things like r[i][j][k],
> which might look like a reference to a multidimensional array, but is
> just a bit-select of a bit-select of a bit-select.

I submit that the disturbing thing here is the silent treatment of
a scalar as a one element vector.  This is something that could issue
a warning without infuriating too many users.

> Or it would allow
> things like r[7:0][6:0] or r[7:0][3], which look like some kind of array
> slicing that isn't legal in Verilog, but are just further selects of the
> result of a part select.

That's right, but it's less disturbing, and is something that I wouldn't
mind a LINT tool pointing out as probably wrong.  Since it isn't legal
Verilog, we're free to define it.  But since it might be misread as a
more complex 2D slice access (you might write "r[7:0, 6:0]" to mean that),
we could have the LRM insist that a lint warning be issued.

> You could even use r[i][3:0], which looks like
> a part select of an array reference, but is actually a part select of a
> bit select, with all but one of the selected bits out of range.

Combining the two might not justify doubling the warnings, but that would be OK.

> This means that if you put too many subscripts on your array reference,
> your tool wouldn't give you an error message any more. This is already
> an issue with allowing bit selects of array elements, since one too many
> subscripts will be treated as a bit select. But this would allow an
> arbitrary number of excess subscripts without any error."

If there is a warning about the scalar coerced to a vector and you can
raise the severity of this to an error, I think that anticipates where
the language wants to go with this.   Do you know of methodologically sound
uses for selecting from a scalar value?

Greg


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Mar 7 11:07:38 2007

This archive was generated by hypermail 2.1.8 : Wed Mar 07 2007 - 11:07:50 PST