4.8 Alias declarations

...
ENTITY e IS
    ...
BEGIN
    ...
END e ;

...
ARCHITECTURE a OF e IS
    ...
BEGIN
    ...
END a ;

...
CONFIGURATION c
        OF e IS
    ...
    ...
    ...
END

...
PACKAGE pkg IS
    ...
    ...
    ...
END pkg ;

alias_declaration ::=

alias
alias_designator
    [ : subtype_indication ] is
        name [ signature ];

...
PACKAGE BODY pck
        IS
    ...
    ...
    ...
END pck ;

...
b: BLOCK IS
    ...
BEGIN
    ...
END BLOCK b ;

FUNCTION f (...)
    RETURN r IS
    ...
BEGIN
    ...
END f ;

PROCEDURE p (...) IS
    ...
BEGIN
    ...
END p ;

p : PROCESS
    ...
BEGIN
    ...
END PROCESS p ;

4.8.1 Further definitions

alias_designator ::= identifier | character_literal | operator_symbol

subtype_indication ::=
    [ resolution_function_ name ] type_mark [ constraint ]

name ::=
    simple_name
    | operator_symbol
    | selected_name
    | indexed_name
    | slice_name
    | attribute_name

signature ::= [ [ type_mark { , type_mark } ] [ return type_mark ] ]

4.8.2 Additional information

Alias can be used for all named entities except labels, loop parameters and generate parameters. An alias for an object (constant, variable, signal, file) is an object alias. All others are nonobject aliases.

The alias of an overloadable object is itself overloadable.

The following rules apply to object aliases:

  1. Signatures are not allowed.
  2. The name in an alias declaration has to be a static name (See Name). If the subtype indication is present it has to be match the basetype of the name in the alias declaration. This type must not be a multi-dimensional array type. The following rules apply:

If the subtype indication is absent or it denotes an unconstrained array type:

If the alias designator denotes a slice of an object, then the subtype of the object is viewed as if it were of the subtype specified by the slice.

Otherwise the object has the same type as implied by the name.

If the subtype indication denotes a constrained array type, then the object is of this subtype. Moreover the subtype must have matching elements for each element of the type denoted by the name.

If the subtype indication denotes a scalar type, then the object is of this subtype. Moreover the bounds and direction must be the same.

  1. The same applies to attribute references where the prefix of the attribute name denotes the alias.
  2. A reference of a object alias is automatically a reference to the original object (also applies to slices of arrays).

The following rules apply to nonobject aliases:

  1. Subtype indications are not allowed.
  2. If the name denotes a subprogram (including a operator) or a enumeration literal, then a signature is required. The signature has to match the parameter and result type profile (See Overloading) of exactly one subprogram or enumeration literals denoted by the name.
  3. If the name denotes a enumeration type, then the alias declaration implies further aliases for every enumeration literal (alias_designator = enumeration_literal; name = enumeration_type.enumeration_literal).
  4. The equivalent applies to an alias of an physical type.
  5. If the name denotes a type, then the alias declaration implies further aliases for defined operators of this type and if needed for corresponding values and units. Every implicit operator alias declaration has a signature which matches exactly one of the parameter and result type profile (See Overloading) of the original operator.

4.8.3 Examples

CONSTANT tc : time := 2.5 ns ;
ALIAS delay : time IS tc ;

Because of the alias declaration the constant tc can now
also be addressed via the name delay .

VARIABLE vector : bit_vector(0 TO 7);
ALIAS reverse_vector : bit_vector
     ( vector'length DOWNTO 1 )
       IS vector ;

Through the alias the variable vector can now be
addressed via the name reverse_vector with the
indices ranging from 8 to 1.

VARIABLE real_number : bit_vector
      ( 0 TO 31 ) ;
ALIAS sign : bit IS real_number(0) ;

ALIAS
mantissa : bit_vector( 0 TO 23 )
      IS real_number( 8 TO 31 ) ;

ALIAS
exponent : bit_vector( 1 TO 7 )
      IS real_number( 1 TO 7 ) ;

Here the variable real_number is aliased differently.

Via sign the MSB of real_number can be addressed.

With mantissa the elements 8 to 31 of real_number are
addressed with the indices ranging from 0 to 23.

With exponent the elements 1 to 7 of real_number are
addressed with the indices ranging from 1 to 7 as well.

ALIAS std_bit IS STD.STANDARD.BIT ;

-- ALIAS `0' IS STD.STANDARD .'0'
--        [ RETURN STD.STANDARD.BIT ] ;
-- ALIAS `1' IS STD.STANDARD .'1' ;
--        [ RETURN STD.STANDARD.BIT ] ;

-- ALIAS "and" IS STD.STANDARD ."and" ;
--[ STD.STANDARD.BIT , STD.STANDARD.BIT
--        RETURN STD.STANDARD.BIT ] ;
-- ALIAS "or" IS STD.STANDARD ."or" ;
--[ STD.STANDARD.BIT , STD.STANDARD.BIT
--        RETURN STD.STANDARD.BIT ] ;
-- ···

The predefined type BIT of the automatically visible
package STADARD of the library STD is aliased to
std_bit .

With this further alias declarations for the values of
the enumeration type and the predefined operators are
implied.