IEEE 200X Fast Track Change Proposal ID: FT-09 Proposer: John Ries email: johnr@model.com Status: analyzed by John Ries, johnr@model.com Proposed: - Analyzed: 8/03 Resolved: Date Enhancement Summary: General changes to bit string literal to support sizing and meta-logic values Relevant LRM section: 7.1, 7.4, 13.7 Enhancement Detail: Currently bit string literals have a number of limitation. They are 1) Don't support meta-logic values, i.e. 'X', 'Z', or '-'. 2) The size of the bit string literal must be a multiple of 4 if specified using hex, 3 if octal is used. 3) Cannot specify decimal values. To fix these limitations the following changes are proposed. A) Allow values other than 0-9, A-F, a-e, and _ in bit string literals. If a character other than an extended_digit or underline is specified, the character put in the equivalent string literal as is if base_specifier is 'B', 3 times if 'O', and 4 if 'X'. The resulting string literal must be valid for the required type. The presence of non-extended digit character cannot be use to determine type. Examples: Literal Equivalent Value Comment B"XXZZX" "XXZZX" X"ZZ" "ZZZZZZZZ" expands to 8 bits O"01-" "000001---" expands to 9 bits B) Add the concept of a sized bit string literal. The syntax for a bit string literal would now be bit_string_literal ::= sized_bit_string_literal | unsized_bit_string_literal sized_bit_string_literal ::= primary unsized_bit_string_literal unsized_bit_string_literal ::= base_specifier " [bit_value ] " base_specifier ::= B|O|D|X|SB|SO|SX|UB|UO|UX The primary occurring before the base specifier indicates the length of the sized_bit_string_literal and must be of type integer. The size of unsized_bit_string_literal is determined from the length of the equivalent string literal. The value of an unsized_bit_string_literal is its equivalent string literal. The value of the a sized_bit_string_literal is determined by the length specified and the equivalent string literal of the underlying unsized_bit_string_literal. If the sized length is greater the the underlying unsized length, the underlying string has sized_length - unsized_length number of characters prepended to the string literal. If the base specifier is 'B', 'O', 'D', ,'X', 'UB', 'UO', or 'UX' then '0' is prepended. If the base specifier is 'SB', 'SO', or 'SX' then the left most element of the equivalent bit_string literal is replicated and prepended to produce the correctly sized literal. If the sized length, L, is less than the unsized length, then only the L right most elements are used. Depending on the value of the left elements dropped an error can occur. If the base specifier is 'B', '0', 'D', 'X', 'UB', 'U0', or 'UX', then the left most elements must not be '1'. If any element is '1' then an error occurs. If the base specifier is 'SB', 'S0', or 'SX', then left most elements dropped must be the same value as the left most bit of the remaining literal. The length of a sized bit_string_literal can be an non-globally static expression. If so then the literal is non-globally static. If the length this locally static then the sized bit string literal is locally static, as long as its base type is locally static also. It is an error if the size of a sized_bit_string_literal is negative. Examples Literal Equivalent Value Comment 3X"7" "111" 9X"F" "000001111" 9SX"F" "111111111" 9SX"X" "XXXXXXXXX" 7X"8F" "0001111" Error because element dropped was '1' 7SX"CF" "1001111" 9X"XFF" "X11111111" No error because elements dropped are "XXX" C) Add the 'D' base specifier. The bit_value can contain any digit 0-9 and _. No other digits can be specified. The value is the binary equivalent of the specified decimal minium number bits needed to represent the number, log2(literal) For example: Literal Equivalent Value Comment D"17" "10001" Default size 32 bits 8D"17" "00010001" Note: The use of NOT and - are on a sized literal is not part of the literal but an expression. The result of doing these operations on a sized literal depends on the type of the literal not the optional S or U in the base specifier. For example: result when literal is of type Literal Equivalent Value SIGNED UNSIGNED -7SX"F" -"1111111" "0000001" ERROR (Unary "-" not defined) NOT 8SX"34" NOT "00110100" "11001011" "11001011"