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

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Fri Aug 26 2005 - 16:21:18 PDT
Steven,  I can argue both what you are suggesting and what
I am since there are semi-conflicting indications in the LRM.
The LRM wants to be able to treat a select into a packed
element as being equivalent to a part select or indexed
part select or the equivalent vector.  If we distinguish between
the two cases for the purposes of type range determination, I
am a bit concerned about what the implications of that are for
tool implementation choices about when and how to equate
various referentially equivalent forms.

I think that where you are is in thinking about operations
that are "type constructive" versus "type referencing".  I
can buy that approach, but I'm not sure that I am convinced
that is the better of the two approaches.

Gord.


Steven Sharp wrote:

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

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Fri Aug 26 16:21:34 2005

This archive was generated by hypermail 2.1.8 : Fri Aug 26 2005 - 16:23:41 PDT