Overflow Detection; Decimal Instruction Nomenclature; Condition Code Settings - Xerox 560 Reference Manual

Hide thumbs Also See for 560:
Table of Contents

Advertisement

OVERFLOW DETECTION
Arithmetic overflow can occur during execution of the
following decimal instructions:
DECIMAL ADD.
Overflow occurs when the sum of the
two decimal numbers exceeds the 31-digit capacity of the
decimal accumulator (+103 1 -1 to -1031 +
1).
DECIMAL SUBTRACT. Overflow occurs when the difference
between the two decimal numbers exceeds the 31-digit
capacity of the decimal accumulator.
DECIMAL DIVIDE. Overflow occurs either when the divisor
is zero, or when the dividend is greater than 14 digits in
length and the absolute value of the significant digits
to the left of the 15th digit position (counting from the
right) is greater than or equal to the absolute value of
the divisor.
If
arithmetic overflow occu;"s during execution of DECIMAL
ADD, DECIMAL SUBTRACT, or DECIMAL DIVIDE, the
basic processor unconditionally aborts execution of the
instruction (at the time of overflow detection), resets CCl
to 0, and sets CC2 to 1.
Then,
if
the decimal arithmetic
fault trap mask (PSWslO) is a 1, the basic processor traps
to location Xl45
1
;
if the decimal arithmetic fault trap mask
is a
0,
the basic processor executes the next instruction in
sequence.
In either case, the contents of the decimal
accumulator, memory storage, CC3, and CC4 remain
unchanged.
DECIMAL INSTRUCTION NOMENCLATURE
For the purpose of abbreviating the instruction descriptions
to follow, the symbolic term "DECA" is used to represent
the decimal accumulator, and the symbolic term "EDO" is
used to represent the effective decimal operand of the in-
struction. For the instructions DECIMAL LOAD, DECIMAL
ADD, DECIMAL SUBTRACT, DECIMALMULTIPLY, DECIMAL
DIVIDE, and DECIMAL COMPARE, the effective decimal
operand is a packed decimal number that is
II
L" bytes
in length, where L is the numeric value of bit posi-
tions 8-11 of the instruction word, and a value of
0
for L
designates 16 bytes.
The effective byte addresses of
these instructions point to the byte location that contains
the most significant byte (high-order digits) of the decimal
number, and the effective byte address plus L-l (where
L
=
°
=
16) points to the least significant byte (low-order
digit and sign) of the decimal number.
Thus, for these in-
structions, the effective decimal operand (EDO) is the con-
tents of the byte string that begins with the effective byte
location, is L bytes in length, and ends with the effective
byte location plus L-l.
82
Decimal Instructions
CONDITION CODE SETTINGS
All decimal instructions provide condition code settings,
using CCl to indicate whether or not an illegal digit or
sign has been detected, and CC2 to indicate whether or
not overflow has occurred. Most (but not all) of the deci-
mal instructions provide condition code settings, using CC3
and CC4 to indicate whether the decimal number in the
decimal accumulator is zero, negative, or positive, as
follows:
CC3
CC4
Result in DECA
o
o
DL
°
Zero - the decimal accumulator contains a
positive or negative decimal sign code in the
four low-order bit positions; the remainder of
the decimal accumulator contains all
OIS.
Negative - the decimal accumulator con-
tains a negative decimal sign code in the
four low-order bit positions; the remainder
of the decimal accumulator contains at least
one nonzero decimal digit.
o
Positive - the decimal accumulator contains
a positive decimal sign code in the four low-
order bit positions; the remainder of the deci-
mal accumulator contains at least one nonzero
decimal digit.
DECIMAL LOAD
(Byte index alignment)
If
no illegal digit or sign is detected in the effective
decimal operand, DECIMAL LOAD expands the effective
decimal operand to 16 bytes (31 digits + sign) by appending
high-order
OIS,
and then loads the expanded decimal num-
ber into the decimal accumulator.
If
the result in the
decimal accumulator is zero! the converted sign remains
unchanged.
Affected: (DECA), CC
Trap: Decimal arithmetic
(EBL to EBL + L -
1) -
DECA
Condition code settings:
2
3
4
Result in DECA
°
-
Illegal digit or sign detected, i nstructi on
aborted
0 0 0
0
Zero
I
0 0 0
Negative
No illegal digit or illegal sign
detected, instruction completed
0 0
0
Positive

Advertisement

Table of Contents
loading

Table of Contents