The basic data types in VHDL are similar to those of programming
languages like Pascal or C:
- Boolean:
- Both boolean values true and false are
boolean literals.
- Integer:
- Integer numbers in the range -231 + 1 to
+231 - 1 (-2147483647 to +2147483647). The
default number representation is decimal. In order to use another
base it must be explicitly specified:
binary |
2#...# |
octal |
8#...# |
hexadecimal |
16#...# |
Format:
[+|-][2#|8#|16#]number[#]
The following additional subtypes of integer are defined:
positive |
: 1 ...n |
natural |
: 0 ...n |
- Real:
- Floating point numbers are provided within the range
between -1.0e + 38 and +1.0e + 38. The default number representation
is decimal.
Format:
[+|-][2#|8#|16#]number.number[#][e[+|-]number]
- Character:
- The character literals enumerate the ASCII
character set. Nonprinting characters are represented by a
three-letter name, such as NUL for the null character. Printable
characters are represented by themselves, in single quotation
marks: '0'-'9', 'a'-'z',
'A'-'Z'.
- Bit:
- The two logical values '0' and '1' are bit
literals.
1
- Std_Ulogic and Std_Logic:
- The standard 1164 of IEEE is
defined within the package std_logic_1164 which resides in
the library IEEE. It introduces a system, named std_ulogic, consisting of nine different logical values. The
reason for this enhancement is given by the fact, that the type bit is not suitable for the precise modelling of digital circuits
due to missing values, for example, uninitialized or high impedance
states. The type std_ulogic consists of the the following
elements:
'U' |
uninitialized |
'X' |
forcing unknown |
'0' |
forcing logical 0 |
'1' |
forcing logical 1 |
'Z' |
high impedance - for three-state bus systems |
'W' |
weak unknown |
'L' |
weak logical 0 |
'H' |
weak logical 1 |
'-' |
don't care - for logic synthesis |
This data type includes values for modelling three-state bus
systems. In addition, a resolution function is defined which allows modeling of multiple drivers for one signal (see
7.3, page
).
- Physical Types:
- A physical type represents a physical value,
such as time, length, voltage, and so on. It consists of an integer
or a floating point literal followed by a unit name. The package
STANDARD defines the type TIME with the following units:
fs, ps, ns, us, ms, sec, min, hr.
With this physical type delay times can be described as:
C <= ... after 2 ns;
- Enumeration Types:
- In order to describe a problem without
specifying a coding scheme any appropriate enumeration type can be
defined.2
Syntax:
type enum_name is (enum_liter {, enum_liter});
Any desired identifier (first example) or literal ( character literals in the second example) can be used for enum_liter.
Example:
- for traffic lights:
type LIGHT is (RED, YELLOW, GREEN);
- logic system with four values for simulation:
type FOURVAL is ('X', '0', '1', 'Z');
- Subtypes:
- A subtype is a type with a constraint. The
constraint defines a subset of values by specifying certain
restrictions to the range of the parent type. Such restrictions can
also be specified in the declaration of an object. The definition of
a subtype has the advantage that it can be done once in a package,
and then globally shared.
Example:
subtype DIGIT is integer range 0 to 9;
...
variable MSD, LSD: DIGIT;
-- is equal to --
variable MSD, LSD: integer range 0 to 9;