TYPE
A
IS RANGE
1
TO
10 ;
TYPE
B
IS RANGE
1
TO
10 ;
|
Two Integer types
A
and
B, both of which have a
range of 1 to 10, are declared.
|
TYPE
capacitance
IS RANGE
0
TO
1E16
UNITS
fF ; -- Femtofarad
pF = 1000 fF ; -- Picofarad
nF = 1000 pF ; -- Nanofarad
uF = 1000 nF ; -- Microfarad
END UNITS
;
|
The physical type
capacitance
is declared as a Real-type with a range of
0 to 1E16. Afterwards a base unit and
units derived from it are declared.
|
TYPE
cell ;
TYPE
link
IS ACCESS
cell ;
TYPE
cell
IS
RECORD
value : integer ;
succ : link ;
pred : link ;
END RECORD
;
|
A recursive structure is created. At first type
cell
is
declared incompletely. As a consequence the access
type
link
is declared on the type
cell
.
Afterwards type
cell
is declared completely as Record.
The elements
succ
and
pred
are declared as index
types. By doing so an interlinked list can be created in
which every element receives an index to both its
predecessor and its successor.
|
TYPE
boolean
IS
( false, true ) ;
TYPE
bit
IS
( '0', '1' ) ;
TYPE
string
IS ARRAY
(positive
RANGE
<>)
OF
character ;
TYPE
bit_vector
IS ARRAY
(natural
RANGE
<>)
OF
bit ;
|
These are examples of standard predefined types.
boolean
,
bit
and
character
are enumeration types.
string
and
bit_vector
are arrays which can have
any width (RANGE <>) with the maximum
width being determined by the corresponding type
(
positive
,
natural
).
|