Different types are declared.
TYPE Bit IS ( '0', '1' ) ; TYPE switch_level IS ( '0', '1', 'X' ) ; TYPE states IS (out, sleeping, working); TYPE colors IS ( red, green, blue );
TYPE byte_length_integer IS RANGE 0 TO 255 ; TYPE word_index IS RANGE 31 DOWNTO 0 ; TYPE my_real IS RANGE 0.0 TO 9.99 ; SUBTYPE high_bit_low IS byte_length_integer RANGE 0 TO 127 ;
With physical types a real-type is defined first. Afterwards the basic unit and its derivative units are declared.
As examples the definitions of the units of length (distance) and the units of time (time) are shown here.
The physical unit time is a predefined type.
TYPE distance IS RANGE 0 TO 1E16 UNITS -- Basiseinheit : A -- Angström -- Metrische Einheiten : nm = 10 A ; -- Nanometer um = 1000 nm ; -- Mikrometer mm = 1000 um ; -- Millimeter cm = 10 mm ; -- Centimeter m = 1000 mm ; -- Meter km = 1000 m ; -- Kilometer END UNITS ; TYPE time IS RANGE -1E18 TO 1E18 UNITS fs ; --Femtosekunde ps = 1000 fs ; -- Picosecond ns = 1000 ps ; -- Nanosecond us = 1000 ns ; -- Microsecond ms = 1000 us ; -- Millisecond sec = 1000 ms ; -- Second min = 60 sec ; -- Minute END UNITS