Subtype

LRM §4.2.

A type together with a constraint.

Syntax:

subtype subtype_name is data_type;

Description:

A subtype is compatible with its base type and shares the same operations.

A value belongs to a subtype of a given type if it belongs to the type and satisfies the constraint. A type is a subtype of itself. Such a subtype is said to be unconstrained because it corresponds to a condition that imposes no restriction.

There are two predefined subtypes specified in the package Standard: Natural and Positive. Both are subtypes of the type Integer. The package Std_logic_1164 also contains declarations of subtypes, which are constrained subtypes of the std_logic.

Example:

subtype Digits is integer range 0 to 9; 
subtype MyBit is std_logic range '0' to '1'; 
subtype MyVector is std_logic_vector(2 downto 0);

Notes:

See also:

Range, Type