Subtype
A subtype declaration is used to give an explicit name to a subtype, which is
itself a type plus a constraint. The constraint is used to restrict the values that
a data object can take during simulation or synthesis. An anonymous subtype
occurs when a DataType with a constraint is used directly without declaring a
named subtype.
Syntax
subtype NewName is DataType;
Where
See Declaration
Rules
A subtype is compatible with its base type, and shares the same operations
as its base type.
An array type can only be constrained once, whereas with an integer or
enumeration type you can create subtypes of subtypes ad infinitum.
Example
subtype Std_logic is Resolved Std_ulogic;
subtype MyBit is Std_logic range '0' to '1';
subtype ShortVector is Std_logic_vector(1 downto 0);
See Also
Type, Data Type, Range
|