Re: [sv-bc] Type bounds and "type" operator

From: Steven Sharp <sharp_at_.....>
Date: Fri Aug 26 2005 - 13:54:20 PDT
>From: Gordon Vreugdenhil <gordonv@model.com>

>I think that the rule should be that for a simple
>reference to a element of an unpacked type, the type
>should be the type of the element.  For other integral
>expressions, the type is [width-1:0]; for other types
>it is the self-determined type.

I'm not sure I agree that a reference to an element that
is an integral type should always devolve to [width-1:0].
Consider a case like

module top;

typedef logic [10:2] my_vect;
my_vect a[0:10];
typedef type(a[1]) t1;

wire t1 w;

endmodule

It seems to me that the type of a[1] is my_vect, since a[1] is
an element of an array of my_vect.  If you are selecting an
entire element of an array, I would expect that to have the
type of an element of the array, as specified in the declaration
of the array.  Therefore I would expect w to have a range of [10:2].

Now if you use a part-select to select multiple elements of an array
or vector, then you are referencing something whose type was never
really defined.  There you are synthesizing an equivalent type, and
I would expect the range to be [width-1:0].  I would expect this even
if the part-select happened to select the entire object.

This is a harder rule to specify, but it seems more correct.  Maybe
that correctness isn't worthwhile though.


Steven Sharp
sharp@cadence.com
Received on Fri Aug 26 13:54:41 2005

This archive was generated by hypermail 2.1.8 : Fri Aug 26 2005 - 13:56:01 PDT