|Characters and strings in VHDL|
Elements of behaviour
Elements of structure
Characters and strings
Constants and variables
Floating point types
Loop and exit statements
Array types & array operations
Conditional signal assignment
Selected signal assigment
Library and library clauses
Unconstrained array parameter
Package declarations and bodies
Subprograms in package
Resolved signals and subtypes
Resolved signals and ports
A character literal can be written in VHDL code by enclosing it in single quotation marks. Any of the printable characters in the standard character set (including a space character) can be written in this way. Some examples are
'A' – – uppercase letter
'z' – – lowercase letter
',' – – the punctuation character comma
''' – – the punctuation character single quote
' ' – – the separator character space
Want To have highly paid VLSI jobs ?? then you may contact at Contact : webmaster@freehost7com
Want To have highly paid VLSI jobs ?? then you may contact at
Contact : webmaster@freehost7com
A string literal represents a sequence of characters and is written by enclosing the characters in double quotation marks. The string may include any number of charac- ters (including zero), but it must fit entirely on one line. Some examples are
"We can include any printing characters (e.g., &%@^*) in a string!!"
"" – – empty string
If we need to include a double quotation mark character in a string, we write two double quotation mark characters together. The pair is interpreted as just one char- acter in the string. For example:
"A string in a string: ""A string"". "
If we need to write a string that is longer than will fit on one line, we can use the concatenation operator (“&”) to join two substrings together. For example:
"If a string will not fit on one line, "
& "then we can break it into parts on separate lines."
VHDL includes values that represent bits (binary digits), which can be either ‘0’ or ‘1’.
A bit-string literal represents a sequence of these bit values. It is represented by a string of digits, enclosed by double quotation marks and preceded by a character that specifies the base of the digits. The base specifier can be one of the following:
• B for binary,
• O for octal (base 8) and
• X for hexadecimal (base 16).
For example, some bitstring literals specified in binary are
B"0100011" B"10" b"1111_0010_0001" B""
Notice that we can include underline characters in bit-string literals to make the literal more readable. The base specifier can be in uppercase or lowercase. The last
of the examples above denotes an empty bit string.
If the base specifier is octal, the digits ‘0’ through ‘7’ can be used. Each digit rep- resents exactly three bits in the sequence. Some examples are
O"372" – – equivalent to B"011_111_010"
o"00" – – equivalent to B"000_000"
If the base specifier is hexadecimal, the digits ‘0’ through ‘9’ and ‘A’ through ‘F’ or
‘a’ through ‘f’ (representing 10 through 15) can be used. In hexadecimal, each digit represents exactly four bits. Some examples are
X"FA" – – equivalent to B"1111_1010"
x"0d" – – equivalent to B"0000_1101"