Error conditions
Any errors that can occur in instructions which are defined in ter ms of the modulo
operators are indicated explicitly in the instruction description. For example the div
(divide) instruction indicates the cases that can cause overflow, independently of the
actual division:
if (Areg = 0) or ((Breg = MostNeg) and (Areg = -1))
{
Areg′ ← undefined
IntegerOverflow
}
else
Areg′ ← Breg / Areg
Breg′ ← Creg
Creg′ ← undefined
Checked operators
To simplify the description of checked arithmetic, the operators ‘+checked’, ‘−checked’,
etc. are used to indicate operations that perform checked arithmetic on signed
integers. These operators signal an IntegerOverflow if an overflow, divide by zero, or
other arithmetic error occurs. If no trap is taken, the operators also deliver the modulo
result.
A number of comparison operators are also used and there are versions of some of
these that treat the operands as unsigned integers. A full list of the operators used in
the instruction definitions is giv en in Table 1.7.
1.11 Functions
Type conversions
The following function is used to indicate a type conversion:
unsign(x) causes the bit-pattern in x to be interpreted as an unsigned integer.
1.12 Conditions to instructions
In many cases, the action of an instruction depends on the current state of the
processor. In these cases the conditions are shown by an if clause; this can take one
of the following forms:
• if condition
statement
• if condition
statement
else
statement
14/212
®