Language Change Specification for Long Integers

LCS Number: LCS-2016-026b
Version: 2
Date: 24-Mar-2017
Status: Voting
Author: Patrick Lehmann
Email: Main.PatrickLehmann
Source Doc: Long Integers
Summary: Extends the range of integer types values.

Voting Results: Cast your votes here

Yes:

  1. Patrick Lehmann - 2017-03-24 - ver 2

No:

Abstain:

Style Notes

Changes are shown in red font.
Deletions are crossed out.
Editing or reviewing notes in green font.

Reviewing Notes

Version 2: 24-Mar-2017
  • Added overload with universal integer to solve ambiguity problems

Version 1: 28-Jan-2017

  • This is a new variation of the LCS 026 series. It widens the range of universal integer and other related integer sizes but keeps INTEGER as is.

Details of Language Change

5.2.3.1 General

[Editor note: Paragraph 8]

An implementation may restrict the bounds of the range constraint of integer types other than type universal_integer . However, an implementation
shall allow the declaration of any integer type whose range is wholly contained within the bounds -(2**63)2147483647 and +(2**63)-1+2147483647
inclusive.

5.2.3.2 Predefined integer types

The only predefined integer type is the type INTEGER. The range of INTEGER is implementation dependent, but it is guaranteed
to include the range 2147483647 to +2147483647. It is defined with an ascending range.

There are three predefined integer types: SYSTEM_INTEGER, INTEGER64 and INTEGER32. The range of SYSTEM_INTEGER is implementation
dependent, but it is guaranteed to include the range -(2**63) to +(2**63)-1. The range of INTEGER64 is -(2**63) to +(2**63)-1 and the range of INTEGER32 is
-(2**31) to +(2**31)-1. All are defined with an ascending range. The declaration of types SYSTEM_INTEGER, INTEGER64 and INTEGER32 appear in package
STANDARD in Clause 16.


type SYSTEM_INTEGER is range <implementation_defined%gt;;
type INTEGER64 is -(2**63) to (2**63) - 1;
type INTEGER32 is -(2**31) to (2**31) - 1;

NOTE The range of SYSTEM_INTEGER in a particular implementation is determinable from the values of its 'LOW and 'HIGH attributes. It represents
the biggest available integer range in the tool.

5.2.3.3 Predefined integer subtypes [New]

The following integer subtypes are predefined: NATURAL64, POSITIVE64, NATURAL32 and POSITIVE32. The listed subtypes appears in
package STANDARD in Clause 16.


subtype NATURAL64  is INTEGER64 range 0 to INTEGER64'HIGH;
subtype POSITIVE64 is INTEGER64 range 1 to INTEGER64'HIGH;

subtype NATURAL32  is INTEGER32 range 0 to INTEGER32'HIGH;
subtype POSITIVE32 is INTEGER32 range 1 to INTEGER32'HIGH;

For compatibility, the following aliases are defined:


alias INTEGER  is INTEGER32;
alias NATURAL  is NATURAL32;
alias POSITIVE is POSITIVE32;

5.2.4.1 General

[Editor note: Paragraph 14]

An implementation may restrict the bounds of the range constraint of a physical type. However, an implementation shall allow the declaration of any
physical type whose range is wholly contained within the bounds -(2**63)2147483647 and +(2**63)-1+2147483647 inclusive.

5.2.4.2 Predefined physical types

The only predefined physical type is type TIME. The range of TIME is implementation dependent, but it is guaranteed to include the range
-(2**63)2147483647 to +(2**63)-1+2147483647. It is defined with an ascending range. All specifications of delays and pulse rejection limits shall
be of type TIME. The declaration of type TIME appears in package STANDARD in Clause 16.

5.2.5.2 Predefined floating-point types

The only predefined floating-point type is the type REAL. The range of REAL is host-dependent, but it is guaranteed to be the largest allowed by the
chosen representation. It is defined with an ascending range. The declaration of type REAL appears in package STANDARD in Clause 16.

5.3.2.2 Index constraints and discrete ranges

An index constraint determines the index range for every index of an array type and, thereby, the corresponding array bounds. For a discrete range
used in a constrained array definition and defined by a range, an implicit conversion to the predefined type INTEGER32 is assumed if the type of
both bounds (prior to the implicit conversion) is the type universal_integer. Otherwise, the type of the range shall be determined by applying the rules
of 12.5 to the range, considered as a complete context, using the rules that the type shall be discrete and that both bounds shall have the same type.
These rules apply also to a discrete range used in a loop parameter specification (see 10.10) or a generate parameter specification (see 11.8).

5.3.2.3 Predefined array types

The predefined array types are STRING, BOOLEAN_VECTOR, BIT_VECTOR, INTEGER64_VECTOR, INTEGER32_VECTOR, REAL_VECTOR, and
TIME_VECTOR, defined in package STANDARD in Clause 16. For compatibility, the alias INTEGER_VECTOR is declared.

The values of the predefined type STRING are one-dimensional arrays of the predefined type CHARACTER, indexed by values of the predefined
subtype POSITIVE32:

subtype POSITIVE is INTEGER range 1 to INTEGER'HIGH;
type STRING is array (POSITIVE32 range <>) of CHARACTER;

The values of the predefined types BOOLEAN_VECTOR, BIT_VECTOR, INTEGER64_VECTOR, INTEGER32_VECTOR, REAL_VECTOR, and
TIME_VECTOR, are one-dimensional arrays of the predefined types BOOLEAN, BIT, INTEGER64, INTEGER32, REAL, and TIME, respectively, indexed
by values of the predefined subtype NATURAL32:

subtype NATURAL is INTEGER range 0 to INTEGER'HIGH;
type BOOLEAN_VECTOR is array (NATURAL32 range <>) of BOOLEAN;
type BIT_VECTOR is array (NATURAL32 range <>) of BIT;
type INTEGER64_VECTOR is array (NATURAL32 range <>) of INTEGER64;
type INTEGER32_VECTOR is array (NATURAL32 range <>) of INTEGER32;
type REAL_VECTOR is array (NATURAL32 range <>) of REAL;
type TIME_VECTOR is array (NATURAL32 range <>) of TIME;

For compatibility, the following aliases are defined:

alias INTEGER_VECTOR is INTEGER32_VECTOR;

9.2.4 Shift operators

[Editor note: first table]

Operator Operation Left operand type Right operand type Result type
sll Shift left
logical
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left
srl Shift right
logical
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left
sla Shift left
arithmetic
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left
sra Shift right
arithmetic
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left
rol Rotate left
logical
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left
ror Rotate right
logical
Any one-dimensional array type whose
element type is BIT or BOOLEAN
INTEGER32 Same as left

9.2.7 Multiplying operators

[Editor note: second table]

Operator Operation Left operand type Right operand type Result type
* Multiplication Any physical type INTEGER32 Same as left
    Any physical type INTEGER64 Same as left
    Any physical type Universal integer Same as left
    Any physical type REAL Same as left
    INTEGER32 Any physical type Same as right
    INTEGER64 Any physical type Same as right
    Universal integer Any physical type Same as right
    REAL Any physical type Same as right
/ Division Any physical type INTEGER32 Same as left
    Any physical type INTEGER64 Same as left
    Any physical type Universal integer Same as left
    Any physical type REAL Same as left
    Any physical type The same type Universal integer
mod Modulus Any physical type Same type Same type
rem Remainder Any physical type Same type Same type

Multiplication of a value P of a physical type Tp by a value I of type INTEGER64 is equivalent to the following computation:

Tp'Val( Tp'Pos(P) * I )

Multiplication of a value P of a physical type Tp by a value F of type REAL is equivalent to the following computation:

Tp'Val( INTEGER64( REAL( Tp'Pos(P) ) * F ))

Division of a value P of a physical type Tp by a value I of type INTEGER64 is equivalent to the following computation:

Tp'Val( Tp'Pos(P) / I )

[...]

The exponentiating operator ** is predefined for each integer type and for each floating-point type. In either case the right operand,
called the exponent, is of the predefined type INTEGER32.

[Editor note: last table]

Operator Operation Left operand type Right operand type Result type
** Exponentiation Any integer type INTEGER32 Same as left
    Any floating-point type INTEGER32 Same as left

16.3 Package STANDARD

package STANDARD is
[...]
  type SYSTEM_INTEGER is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "**"(anonymous: universal_integer; anonymous: SYSTEM_INTEGER) return universal_integer;
  -- function "**"(anonymous: universal_real; anonymous: SYSTEM_INTEGER) return universal_real;
  -- function "="(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function "/="(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function "<"(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function "<="(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function ">"(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function ">="(anonymous, anonymous: SYSTEM_INTEGER) return BOOLEAN;
  -- function "+"(anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "-"(anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "abs"(anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "+"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "-"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "*"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "/"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "mod"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "rem"(anonymous, anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function "**"(anonymous: SYSTEM_INTEGER; anonymous: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function MINIMUM (L, R: SYSTEM_INTEGER) return SYSTEM_INTEGER;
  -- function MAXIMUM (L, R: SYSTEM_INTEGER) return SYSTEM_INTEGER;

  type INTEGER64 is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "**"(anonymous: universal_integer; anonymous: INTEGER64) return universal_integer;
  -- function "**"(anonymous: universal_real; anonymous: INTEGER64) return universal_real;
  -- function "="(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function "/="(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function "<"(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function "<="(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function ">"(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function ">="(anonymous, anonymous: INTEGER64) return BOOLEAN;
  -- function "+"(anonymous: INTEGER64) return INTEGER64;
  -- function "-"(anonymous: INTEGER64) return INTEGER64;
  -- function "abs"(anonymous: INTEGER64) return INTEGER64;
  -- function "+"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "-"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "*"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "/"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "mod"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "rem"(anonymous, anonymous: INTEGER64) return INTEGER64;
  -- function "**"(anonymous: INTEGER64; anonymous: INTEGER64) return INTEGER64;
  -- function MINIMUM (L, R: INTEGER64) return INTEGER64;
  -- function MAXIMUM (L, R: INTEGER64) return INTEGER64;

  type INTEGER32 is range implementation_defined;
  -- The predefined operations for this type are as follows:
  -- function "**"(anonymous: universal_integer; anonymous: INTEGER32) return universal_integer;
  -- function "**"(anonymous: universal_real; anonymous: INTEGER32) return universal_real;
  -- function "="(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function "/="(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function "<"(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function "<="(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function ">"(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function ">="(anonymous, anonymous: INTEGER32) return BOOLEAN;
  -- function "+"(anonymous: INTEGER32) return INTEGER32;
  -- function "-"(anonymous: INTEGER32) return INTEGER32;
  -- function "abs"(anonymous: INTEGER32) return INTEGER32;
  -- function "+"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "-"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "*"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "/"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "mod"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "rem"(anonymous, anonymous: INTEGER32) return INTEGER32;
  -- function "**"(anonymous: INTEGER32; anonymous: INTEGER32) return INTEGER32;
  -- function MINIMUM (L, R: INTEGER32) return INTEGER32;
  -- function MAXIMUM (L, R: INTEGER32) return INTEGER32;
[...]
  -- Predefined type TIME:
  type TIME is range implementation_defined
    units
      fs;             -- femtosecond
      ps  = 1000 fs;  -- picosecond
      ns  = 1000 ps;  -- nanosecond
      us  = 1000 ns;  -- microsecond
      ms  = 1000 us;  -- millisecond
      sec = 1000 ms;  -- second
      min =   60 sec; -- minute
      hr  =   60 min; -- hour
    end units;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "/="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "<"(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "<="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function ">"(anonymous, anonymous: TIME) return BOOLEAN;
  -- function ">="(anonymous, anonymous: TIME) return BOOLEAN;
  -- function "+"(anonymous: TIME) return TIME;
  -- function "- (anonymous: TIME) return TIME;
  -- function "abs"(anonymous: TIME) return TIME;
  -- function "+"(anonymous, anonymous: TIME) return TIME;
  -- function "-"(anonymous, anonymous: TIME) return TIME;
  -- function "*"(anonymous: TIME; anonymous: INTEGER32) return TIME;
  -- function "*"(anonymous: TIME; anonymous: INTEGER64) return TIME;
  -- function "*"(anonymous: TIME; anonymous: REAL) return TIME;
  -- function "*"(anonymous: INTEGER32; anonymous: TIME) return TIME;
  -- function "*"(anonymous: INTEGER64; anonymous: TIME) return TIME;
  -- function "*"(anonymous: REAL; anonymous: TIME) return TIME;
  -- function "/"(anonymous: TIME; anonymous: INTEGER32) return TIME;
  -- function "/"(anonymous: TIME; anonymous: INTEGER64) return TIME;
  -- function "/"(anonymous: TIME; anonymous: REAL) return TIME;
  -- function "/"(anonymous, anonymous: TIME) return universal_integer;
  -- function "mod"(anonymous, anonymous: TIME) return TIME;
  -- function "rem"(anonymous, anonymous: TIME) return TIME;
  -- function MINIMUM (L, R: TIME) return TIME;
  -- function MAXIMUM (L, R: TIME) return TIME;
[...]
  -- Predefined numeric subtypes:
  subtype NATURAL64  is INTEGER64 range 0 to INTEGER64'HIGH;
  subtype POSITIVE64 is INTEGER64 range 1 to INTEGER64'HIGH;
  
  subtype NATURAL32  is INTEGER32 range 0 to INTEGER32'HIGH;
  subtype POSITIVE32 is INTEGER32 range 1 to INTEGER32'HIGH;

  alias INTEGER  is INTEGER32;
  alias NATURAL  is NATURAL32;
  alias POSITIVE is POSITIVE32;
[...]
  -- Predefined array types:
  type STRING is array (POSITIVE32 range <>) of CHARACTER;
  -- The predefined operations for these types are as follows:
[...]
 
  type BOOLEAN_VECTOR is array (NATURAL32 range <>) of BOOLEAN;
  -- The predefined operations for this type are as follows:
[...]

  type BIT_VECTOR is array (NATURAL32 range <>) of BIT;
  -- The predefined operations for this type are as follows:
[...]

  type INTEGER64_VECTOR is array (NATURAL64 range <>) of INTEGER64;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function "/="(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function "<"(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function "<="(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function ">"(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function ">="(anonymous, anonymous: INTEGER64_VECTOR) return BOOLEAN;
  -- function "&"(anonymous: INTEGER64_VECTOR; anonymous: INTEGER64_VECTOR) return INTEGER64_VECTOR;
  -- function "&"(anonymous: INTEGER64_VECTOR; anonymous: INTEGER64) return INTEGER64_VECTOR;
  -- function "&"(anonymous: INTEGER64; anonymous: INTEGER64_VECTOR) return INTEGER64_VECTOR;
  -- function "&"(anonymous: INTEGER64; anonymous: INTEGER64) return INTEGER64_VECTOR;
  -- function MINIMUM (L, R: INTEGER64_VECTOR) return INTEGER64_VECTOR;
  -- function MAXIMUM (L, R: INTEGER64_VECTOR) return INTEGER64_VECTOR;
  -- function MINIMUM (L: INTEGER64_VECTOR) return INTEGER64;
  -- function MAXIMUM (L: INTEGER64_VECTOR) return INTEGER64;
	
  type INTEGER32_VECTOR is array (NATURAL32 range <>) of INTEGER32;
  -- The predefined operations for this type are as follows:
  -- function "="(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function "/="(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function "<"(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function "<="(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function ">"(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function ">="(anonymous, anonymous: INTEGER32_VECTOR) return BOOLEAN;
  -- function "&"(anonymous: INTEGER32_VECTOR; anonymous: INTEGER32_VECTOR) return INTEGER32_VECTOR;
  -- function "&"(anonymous: INTEGER32_VECTOR; anonymous: INTEGER32) return INTEGER32_VECTOR;
  -- function "&"(anonymous: INTEGER32; anonymous: INTEGER32_VECTOR) return INTEGER32_VECTOR;
  -- function "&"(anonymous: INTEGER32; anonymous: INTEGER32) return INTEGER32_VECTOR;
  -- function MINIMUM (L, R: INTEGER32_VECTOR) return INTEGER32_VECTOR;
  -- function MAXIMUM (L, R: INTEGER32_VECTOR) return INTEGER32_VECTOR;
  -- function MINIMUM (L: INTEGER32_VECTOR) return INTEGER32;
  -- function MAXIMUM (L: INTEGER32_VECTOR) return INTEGER32;

  alias INTEGER_VECTOR is INTEGER32_VECTOR;
[...]
	
  type REAL_VECTOR is array (NATURAL32 range <>) of REAL;
  -- The predefined operations for this type are as follows:
[...]
  
  type TIME_VECTOR is array (NATURAL32 range <>) of TIME;
  -- The predefined operations for this type are as follows:
[...]

  -- Predefined TO_STRING operations on scalar types
  -- function TO_STRING (VALUE: BOOLEAN) return STRING;
  -- function TO_STRING (VALUE: BIT) return STRING;
  -- function TO_STRING (VALUE: CHARACTER) return STRING;
  -- function TO_STRING (VALUE: SEVERITY_LEVEL) return STRING;
  -- function TO_STRING (VALUE: universal_integer) return STRING;
  -- function TO_STRING (VALUE: universal_real) return STRING;
  -- function TO_STRING (VALUE: SYSTEM_INTEGER) return STRING;
  -- function TO_STRING (VALUE: INTEGER32) return STRING;
  -- function TO_STRING (VALUE: INTEGER64) return STRING;
  -- function TO_STRING (VALUE: REAL) return STRING;
  -- function TO_STRING (VALUE: TIME) return STRING;
  -- function TO_STRING (VALUE: FILE_OPEN_KIND) return STRING;
  -- function TO_STRING (VALUE: FILE_OPEN_STATUS) return STRING;
  -- Predefined overloaded TO_STRING operations
  -- function TO_STRING (VALUE: REAL; DIGITS: NATURAL32) return STRING;
  -- function TO_STRING (VALUE: REAL; FORMAT: STRING) return STRING;
  -- function TO_STRING (VALUE: TIME; UNIT: TIME) return STRING;

Annex D (Potentially nonportable constructs)

The use of the following constructs may lead to nonportable VHDL descriptions:
  • Resolution functions that do not treat all inputs symmetrically
  • The comparison of floating-point values
  • Events on floating-point-valued signals
  • The use of explicit type conversion to convert floating-point values to integer values
  • Any value that does not fall within the minimum guaranteed range for the type
  • The use of architectures and subprogram bodies implemented via the foreign language interface (the 'FOREIGN attribute)
  • Processes that communicate via file I/O, including TEXTIO
  • Impure functions
  • Linkage ports
  • Ports and generics in the root of a design hierarchy
  • Use of a time resolution greater than 1 fs
  • Shared variables
  • Procedure calls passing a single object of an array or record type to multiple formals where at least one of the formals is of mode out or inout
  • Models that depend on a particular format of T'IMAGE
  • Declarations of integer or physical types that have a secondary unit whose position number is outside of the range (2**311) to 2**311
  • The predefined attributes 'INSTANCE_NAME or 'PATH_NAME, if the behavior of the model is dependent on the values returned by the attributes
  • Use of a conversion specifier F, a, or A in the value for the FORMAT parameter of a call to the predefined function TO_STRING

Comments

Version 1

Topic revision: r5 - 2020-02-17 - 15:34:41 - JimLewis
 
Copyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback