Comments in VHDL start with two adjacent hyphens ('--') and extend to the end of the line. They have no part in the meaning of a VHDL description.
Identifiers in VHDL are used as reserved words and as programmer defined names. They must conform to the rule:
identifier ::= letter { [ underline ] letter_or_digit }
Note that case of letters is not considered significant, so the identifiers cat and Cat are the same. Underline characters in identifiers are significant, so This_Name and ThisName are different identifiers.
Literal numbers may be expressed either in decimal or in a base between two and sixteen. If the literal includes a point, it represents a real number, otherwise it represents an integer. Decimal literals are defined by:
decimal_literal ::= integer [ . integer ] [ exponent ]
integer ::= digit { [ underline ] digit }
exponent ::= E [ + ] integer | E - integer
Some examples are:
0 1 123_456_789 987E6 -- integer literals
0.0 0 0.5 2.718_28 12.4E-9 -- real literals
Based literal numbers are defined by:
based_literal ::= base # based_integer [ . based_integer ] # [ exponent ]
base ::= integer
based_integer ::= extended_digit { [ underline ] extended_digit }
extended_digit ::= digit | letter
The base and the exponent are expressed in decimal. The exponent indicates the power of the base by which the literal is multiplied. The letters A to F (upper or lower case) are used as extended digits to represent 10 to 15. Some examples:
2#1100_0100# 16#C4# 4#301#E1 -- the integer 196
2#1.1111_1111_111#E+11 16#F.FF#E2 -- the real number 4095.0
Literal characters are formed by enclosing an ASCII character in single-quote marks. For example:
'A' '*' ''' ' '
Literal strings of characters are formed by enclosing the characters in double-quote marks. To include a double-quote mark itself in a string, a pair of double-quote marks must be put together. A string can be used as a value for an object which is an array of characters. Examples of strings:
"A string"
"" --
empty string
"A string in a string: ""A string"". "
-- contains quote marks
VHDL provides a convenient way of specifying literal values for arrays of type bit ('0's and '1's, see Section 2.2.5). The syntax is:
bit_string_literal ::= base_specifier " bit_value "
base_specifier ::= B | O | X
bit_value ::= extended_digit { [ underline ] extended_digit }
Base specifier B stands for binary, O for octal and X for hexadecimal. Some examples:
B"1010110" --
length is 7
O"126" --
length is 9, equivalent to B"001_010_110"
X"56" --
length is 8, equivalent to B"0101_0110"