|
LCS-2016-099 |
|
7 |
|
21-Mar-2017 |
|
Approved |
|
Patrick Lehmann Lieven Lemiengre |
|
Operations on Ranges |
|
Proposal Examples LCS History |
|
Allow operations on ranges by introducing a range_record . |
[...] range_constraint ::= range range range ::= range_attribute_name | simple_range[...] For values of discrete or physical types, a value V1 is said to be to the left of a value V2 within a given range if both V1 and V2 belongsimple_expression direction simple_expression| range_expression simple_range ::= simple_expression direction simple_expression direction ::= to | downto
array_type_definition ::= unbounded_array_definition| constrained_array_definition| constrained_array_definition unbounded_array_definition ::= array ( index_subtype_definition { , index_subtype_definition } ) of element_subtype_indication constrained_array_definition ::= array index_constraintof element_subtype_indicationof element_subtype_indication index_subtype_definition ::= type_mark range <> array_constraint ::= index_constraint [ array_element_constraint ] | ( open ) [ array_element_constraint ] array_element_constraint ::= element_constraint index_constraint ::= ( discrete_range { , discrete_range } ) discrete_range ::=discrete_subtype_indication | rangediscrete_subtype_indication | range
type <unnamed_range_record> is record
Left : <scalar_type>;
Right : <scalar_type>;
Direction : DIRECTION;
end record;
R'RECORD | Kind: | Type |
Prefix: | Any prefix R that is an attribute name and denotes a range. | |
Result: | The implicitly declared record type of the corresponding range record for the type of range R. |
|
R'VALUE | Kind: | Value |
Prefix: | Any prefix R that is an attribute name and denotes a range. | |
Result type: | R'RECORD. | |
Result: | A range record instance of type R'RECORD, wherein each record element is initialized by the corresponding bounds of R and the element Direction set to ASCENDING, if R is an ascending range, otherwise to DESCENDING. |
package STANDARD is -- Predefined enumeration types: type DIRECTION is ( ASCENDING, -- The range is ascending. DESCENDING -- the range is descending. ); -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function "/="(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function "<"(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function "<="(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function ">"(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function ">="(anonymous, anonymous: DIRECTION) return BOOLEAN; -- function MINIMUM (L, R: DIRECTION) return DIRECTION; -- function MAXIMUM (L, R: DIRECTION) return DIRECTION; -- Implicit defined range record for DIRECTION'RANGE_RECORD: -- type DIRECTION_range_record is record -- Left : DIRECTION; -- Right : DIRECTION; -- Direction : DIRECTION; -- end record; type BOOLEAN is (FALSE, TRUE); -- The predefined operations for this type are as follows: -- function "and"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "or"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "nand"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "nor"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "xor"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "xnor"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "not"(anonymous: BOOLEAN) return BOOLEAN; -- function "="(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "/="(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "<"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function "<="(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function ">"(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function ">="(anonymous, anonymous: BOOLEAN) return BOOLEAN; -- function MINIMUM(L, R: BOOLEAN) return BOOLEAN; -- function MAXIMUM(L, R: BOOLEAN) return BOOLEAN; -- function RISING_EDGE(signal S: BOOLEAN) return BOOLEAN; -- function FALLING_EDGE(signal S: BOOLEAN) return BOOLEAN; -- Implicit defined range record for BOOLEAN'RANGE_RECORD: -- type BOOLEAN_range_record is record -- Left : BOOLEAN; -- Right : BOOLEAN; -- Direction : DIRECTION; -- end record; type BIT is ('0', '1'); -- The predefined operations for this type are as follows: -- function "and"(anonymous, anonymous: BIT) return BIT; -- function "or"(anonymous, anonymous: BIT) return BIT; -- function "nand"(anonymous, anonymous: BIT) return BIT; -- function "nor"(anonymous, anonymous: BIT) return BIT; -- function "xor"(anonymous, anonymous: BIT) return BIT; -- function "xnor"(anonymous, anonymous: BIT) return BIT; -- function "not"(anonymous: BIT) return BIT; -- function "="(anonymous, anonymous: BIT) return BOOLEAN; -- function "/="(anonymous, anonymous: BIT) return BOOLEAN; -- function "<"(anonymous, anonymous: BIT) return BOOLEAN; -- function "<="(anonymous, anonymous: BIT) return BOOLEAN; -- function ">"(anonymous, anonymous: BIT) return BOOLEAN; -- function ">="(anonymous, anonymous: BIT) return BOOLEAN; -- function "?="(anonymous, anonymous: BIT) return BIT; -- function "?/="(anonymous, anonymous: BIT) return BIT; -- function "?<"(anonymous, anonymous: BIT) return BIT; -- function "?<="(anonymous, anonymous: BIT) return BIT; -- function "?>"(anonymous, anonymous: BIT) return BIT; -- function "?>="(anonymous, anonymous: BIT) return BIT; -- function MINIMUM (L, R: BIT) return BIT; -- function MAXIMUM (L, R: BIT) return BIT; -- function "??"(anonymous: BIT) return BOOLEAN; -- function RISING_EDGE (signal S: BIT) return BOOLEAN; -- function FALLING_EDGE (signal S: BIT) return BOOLEAN; -- Implicit defined range record for BIT'RANGE_RECORD: -- type BIT_range_record is record -- Left : BIT; -- Right : BIT; -- Direction : DIRECTION; -- end record; type CHARACTER is ( NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, HT, LF, VT, FF, CR, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC, FSP, GSP, RSP, USP, ' ', '!', '"', '#', '$', '%', '&', ''', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', DEL, C128, C129, C130, C131, C132, C133, C134, C135, C136, C137, C138, C139, C140, C141, C142, C143, C144, C145, C146, C147, C148, C149, C150, C151, C152, C153, C154, C155, C156, C157, C158, C159, ' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '-', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ' ); -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function "/="(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function "<"(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function "<="(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function ">"(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function ">="(anonymous, anonymous: CHARACTER) return BOOLEAN; -- function MINIMUM (L, R: CHARACTER) return CHARACTER; -- function MAXIMUM (L, R: CHARACTER) return CHARACTER; -- Implicit defined range record for CHARACTER'RANGE_RECORD: -- type CHARACTER_range_record is record -- Left : CHARACTER; -- Right : CHARACTER; -- Direction : DIRECTION; -- end record; type SEVERITY_LEVEL is (NOTE, WARNING, ERROR, FAILURE); -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function "/="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function "<"(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function "<="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function ">"(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function ">="(anonymous, anonymous: SEVERITY_LEVEL) return BOOLEAN; -- function MINIMUM (L, R: SEVERITY_LEVEL) return SEVERITY_LEVEL; -- function MAXIMUM (L, R: SEVERITY_LEVEL) return SEVERITY_LEVEL; -- Implicit defined range record for SEVERITY_LEVEL'RANGE_RECORD: -- type SEVERITY_LEVEL_range_record is record -- Left : SEVERITY_LEVEL; -- Right : SEVERITY_LEVEL; -- Direction : DIRECTION; -- end record; -- type universal_integer is range implementation_defined; -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: universal_integer) return BOOLEAN; -- function "/="(anonymous, anonymous: universal_integer) return BOOLEAN; -- function "<"(anonymous, anonymous: universal_integer) return BOOLEAN; -- function "<="(anonymous, anonymous: universal_integer) return BOOLEAN; -- function ">"(anonymous, anonymous: universal_integer) return BOOLEAN; -- function ">="(anonymous, anonymous: universal_integer) return BOOLEAN; -- function "+"(anonymous: universal_integer) return universal_integer; -- function "-"(anonymous: universal_integer) return universal_integer; -- function "abs"(anonymous: universal_integer) return universal_integer; -- function "+"(anonymous, anonymous: universal_integer) return universal_integer; -- function "-"(anonymous, anonymous: universal_integer) return universal_integer; -- function "*"(anonymous, anonymous: universal_integer) return universal_integer; -- function "/"(anonymous, anonymous: universal_integer) return universal_integer; -- function "mod"(anonymous, anonymous: universal_integer) return universal_integer; -- function "rem"(anonymous, anonymous: universal_integer) return universal_integer; -- function MINIMUM (L, R: universal_integer) return universal_integer; -- function MAXIMUM (L, R: universal_integer) return universal_integer; -- Implicit defined range record for universal_integer'RANGE_RECORD: -- type universal_integer_range_record is record -- Left : universal_integer; -- Right : universal_integer; -- Direction : DIRECTION; -- end record; -- type universal_real is range implementation_defined; -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: universal_real) return BOOLEAN; -- function "/="(anonymous, anonymous: universal_real) return BOOLEAN; -- function "<"(anonymous, anonymous: universal_real) return BOOLEAN; -- function "<="(anonymous, anonymous: universal_real) return BOOLEAN; -- function ">"(anonymous, anonymous: universal_real) return BOOLEAN; -- function ">="(anonymous, anonymous: universal_real) return BOOLEAN; -- function "+"(anonymous: universal_real) return universal_real; -- function "-"(anonymous: universal_real) return universal_real; -- function "abs"(anonymous: universal_real) return universal_real; -- function "+"(anonymous, anonymous: universal_real) return universal_real; -- function "-"(anonymous, anonymous: universal_real) return universal_real; -- function "*"(anonymous, anonymous: universal_real) return universal_real; -- function "/"(anonymous, anonymous: universal_real) return universal_real; -- function "*"(anonymous: universal_real; anonymous: universal_integer) return universal_real; -- function "*"(anonymous: universal_integer; anonymous: universal_real) return universal_real; -- function "/"(anonymous: universal_real; anonymous: universal_integer) return universal_real; -- function MINIMUM (L, R: universal_real) return universal_real; -- function MAXIMUM (L, R: universal_real) return universal_real; -- Implicit defined range record for universal_real'RANGE_RECORD: -- type universal_real_range_record is record -- Left : universal_real; -- Right : universal_real; -- Direction : DIRECTION; -- end record; -- Predefined numeric types: type INTEGER is range implementation_defined; -- The predefined operations for this type are as follows: -- function "**"(anonymous: universal_integer; anonymous: INTEGER) return universal_integer; -- function "**"(anonymous: universal_real; anonymous: INTEGER) return universal_real; -- function "="(anonymous, anonymous: INTEGER) return BOOLEAN; -- function "/="(anonymous, anonymous: INTEGER) return BOOLEAN; -- function "<"(anonymous, anonymous: INTEGER) return BOOLEAN; -- function "<="(anonymous, anonymous: INTEGER) return BOOLEAN; -- function ">"(anonymous, anonymous: INTEGER) return BOOLEAN; -- function ">="(anonymous, anonymous: INTEGER) return BOOLEAN; -- function "+"(anonymous: INTEGER) return INTEGER; -- function "-"(anonymous: INTEGER) return INTEGER; -- function "abs"(anonymous: INTEGER) return INTEGER; -- function "+"(anonymous, anonymous: INTEGER) return INTEGER; -- function "-"(anonymous, anonymous: INTEGER) return INTEGER; -- function "*"(anonymous, anonymous: INTEGER) return INTEGER; -- function "/"(anonymous, anonymous: INTEGER) return INTEGER; -- function "mod"(anonymous, anonymous: INTEGER) return INTEGER; -- function "rem"(anonymous, anonymous: INTEGER) return INTEGER; -- function "**"(anonymous: INTEGER; anonymous: INTEGER) return INTEGER; -- function MINIMUM (L, R: INTEGER) return INTEGER; -- function MAXIMUM (L, R: INTEGER) return INTEGER; -- Implicit defined range record for INTEGER'RANGE_RECORD: -- type INTEGER_range_record is record -- Left : INTEGER; -- Right : INTEGER; -- Direction : DIRECTION; -- end record; type REAL is range implementation_defined; -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: REAL) return BOOLEAN; -- function "/="(anonymous, anonymous: REAL) return BOOLEAN; -- function "<"(anonymous, anonymous: REAL) return BOOLEAN; -- function "<="(anonymous, anonymous: REAL) return BOOLEAN; -- function ">"(anonymous, anonymous: REAL) return BOOLEAN; -- function ">="(anonymous, anonymous: REAL) return BOOLEAN; -- function "+"(anonymous: REAL) return REAL; -- function "-"(anonymous: REAL) return REAL; -- function "abs"(anonymous: REAL) return REAL; -- function "+"(anonymous, anonymous: REAL) return REAL; -- function "-"(anonymous, anonymous: REAL) return REAL; -- function "*"(anonymous, anonymous: REAL) return REAL; -- function "/"(anonymous, anonymous: REAL) return REAL; -- function "**"(anonymous: REAL; anonymous: INTEGER) return REAL; -- function MINIMUM (L, R: REAL) return REAL; -- function MAXIMUM (L, R: REAL) return REAL; -- Implicit defined range record for REAL'RANGE_RECORD: -- type REAL_range_record is record -- Left : REAL; -- Right : REAL; -- Direction : DIRECTION; -- end record; -- 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: INTEGER) return TIME; -- function "*"(anonymous: TIME; anonymous: REAL) return TIME; -- function "*"(anonymous: INTEGER; anonymous: TIME) return TIME; -- function "*"(anonymous: REAL; anonymous: TIME) return TIME; -- function "/"(anonymous: TIME; anonymous: INTEGER) 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; -- Implicit defined range record for TIME'RANGE_RECORD: -- type TIME_range_record is record -- Left : TIME; -- Right : TIME; -- Direction : DIRECTION; -- end record; [...] -- The predefined types for opening files: type FILE_OPEN_KIND is ( READ_MODE, -- Resulting access mode is read-only. WRITE_MODE, -- Resulting access mode is write-only. APPEND_MODE -- Resulting access mode is write-only; ); -- information is appended to the end of the existing file. -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function "/="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function "<"(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function "<="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function ">"(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function ">="(anonymous, anonymous: FILE_OPEN_KIND) return BOOLEAN; -- function MINIMUM (L, R: FILE_OPEN_KIND) return FILE_OPEN_KIND; -- function MAXIMUM (L, R: FILE_OPEN_KIND) return FILE_OPEN_KIND; -- Implicit defined range record for FILE_OPEN_KIND'RANGE_RECORD: -- type FILE_OPEN_KIND_range_record is record -- Left : FILE_OPEN_KIND; -- Right : FILE_OPEN_KIND; -- Direction : DIRECTION; -- end record; type FILE_OPEN_STATUS is ( OPEN_OK, -- File open was successful. STATUS_ERROR, -- File object was already open. NAME_ERROR, -- External file not found or inaccessible. MODE_ERROR -- Could not open file with requested access mode. ); -- The predefined operations for this type are as follows: -- function "="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function "/="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function "<"(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function "<="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function ">"(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function ">="(anonymous, anonymous: FILE_OPEN_STATUS) return BOOLEAN; -- function MINIMUM (L, R: FILE_OPEN_STATUS) return FILE_OPEN_STATUS; -- function MAXIMUM (L, R: FILE_OPEN_STATUS) return FILE_OPEN_STATUS; -- Implicit defined range record for FILE_OPEN_STATUS'RANGE_RECORD: -- type FILE_OPEN_STATUS_range_record is record -- Left : FILE_OPEN_STATUS; -- Right : FILE_OPEN_STATUS; -- Direction : DIRECTION; -- end record; [...] end package STANDARD;
range ::= range_attribute_name | simple_rangesimple_expression direction simple_expression| range_expression simple_range ::= simple_expression direction simple_expression array_type_definition ::= unbounded_array_definition| constrained_array_definition| constrained_array_definition constrained_array_definition ::= array index_constraintof element_subtype_indicationof element_subtype_indication discrete_range ::=discrete_subtype_indication | rangediscrete_subtype_indication | range