Previous

Integer Types

The maximum range of a VHDL integer type is - (231-1) to 231-1 (-2_147_483_647 .. 2_147_483_647). Integer types are defined as subranges of this anonymous built-in type. Multi-digit numbers in VHDL can include underscores (_) to make them easier to read.

Foundation Express encodes an integer value as a bit vector whose length is the minimum necessary to hold the defined range and encodes integer ranges that include negative numbers as 2s-complement bit vectors.

The syntax of an integer type definition follows.

type type_name is range integer_range ;

type_name is the name of the new integer type, and integer_range is a subrange of the anonymous integer type.

An example of integer type definitions follows.

    type PERCENT is range -100 to 100;
          -- Represented as an 8-bit vector
          --   (1 sign bit, 7 value bits)
    
    type INTEGER is range -2147483647 to 2147483647;
          -- Represented as a 32-bit vector
          --   This is the definition of the INTEGER type

NOTE

You cannot directly access the bits of an INTEGER or explicitly state the bit width of the type. For these reasons, Express provides overloaded functions for arithmetic. These functions are defined in the std_logic package.


Next