Derived types for range records
Is your capability/feature request related to a problem? Please describe.
Integer ranges are at the bottom of many types, such as unsigned and ufixed.
subtype IntegerRangeRecType is integer'range'record ;
signal A4 : ufixed(3 downto -3) ;
constant B4_RANGE : IntegerRangeRecType := (
Left => 3,
Right => -3,
Direction => DESCENDING
) ;
signal B4 : ufixed(B4_RANGE) ;
-- Assuming that we defined "+" here
signal Y5, Z5 : ufixed(A4'range'record + B4_RANGE) ;
. . .
Y5 <= A4 + B4 ;
Z5 <= A4 + C4 ;
Describe the solution you'd like.
The "+" above uses the properties of the type to
define the range. Unfortunately, the range calculations
for unsigned and ufixed are different - however, they both
share the same index types - IntegerRangeRecType.
Hence, what we need to be able to do is derive types for the indices of different packages.
type unsigned_range_record is new integer'range'record ;
type ufixed_range_record is new integer'range'record ;
This is necessary so we can define different versions of "+" for unsigned_range_record and ufixed_range_record.
Describe alternatives you've considered.
None.
Additional context
None.