Data Types 85
PHYSICAL TYPES Physical types are used to represent physical
quantities such as distance, current, time, and so on. A physical type pro-
vides for a base unit, and successive units are then defined in terms of this
unit. The smallest unit representable is one base unit; the largest is deter-
mined by the range specified in the physical type declaration. An example
of a physical type for the physical quantity current is shown here:
TYPE current IS RANGE 0 to 1000000000
UNITS
na; --nano amps
ua = 1000 na; --micro amps
ma = 1000 ua; --milli amps
a = 1000 ma; --amps
END UNITS;
The type definition begins with a statement that declares the name of the
type (current) and the range of the type (0 to 1,000,000,000). The first unit
declared in the UNITSsection is the base unit. In the preceding example,
the base unit is na. After the base unit is defined, other units can be defined
in terms of the base unit or other units already defined. In the preceding
example, the unit uais defined in terms of the base unit as 1000 base
units. The next unit declaration is ma. This unit is declared as 1000 ua.
The units declaration section is terminated by the END UNITSclause.
More than one unit can be declared in terms of the base unit. In the pre-
ceding example, the maunit can be declared as 1000 maor 1,000,000 na. The
range constraint limits the minimum and maximum values that the phys-
ical type can represent in base units. The unit identifiers all must be unique
within a single type. It is illegal to have two identifiers with the same name.
PREDEFINED PHYSICAL TYPES
The only predefined physical type in VHDL is the physical type TIME. This
type is shown here:
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;