Download Print this page

IBM 4300 Manual page 284

Processors principles of operation for ecps: vse mode
Hide thumbs Also See for 4300:

Advertisement

is executed, the two numbers are added as follows:
FPR6:
-43 08 21 00
Shifted no. from storage: +43 00 12 34
5
Sum:
-43 08 OE CB
B
1Guard digit
The guard digit participates in the addition but is
discarded. The unnormalized sum replaces the left
half of FPR6. Condition code 1 is set because the
result is negative.
The result in FPR6 (C3 08 OE CB 00 00 00 OO)
shows a loss of a significant digit when compared
to the result of short-precision normalized addition.
COMPARE (CD, CDR, CE, CER)
Assume that FPR4 contains 43 00 00 00 00 00 00
00 (=O), and FPR6 contains 34 12 34 56 78 9A
BC DE (a positive number). The contents of the
two registers are to be compared using a
long-precision COMPARE instruction.
Machine Format
Op Code
Rl
R2
29
4
6
Assembler Format
Op Code
R1,RZ
CDR
4,6
The number with the smaller characteristic,
which is the one in register FPR6, is right-shifted
15 hexadecimal digit positions so that the two
characteristics agree. The shifted contents of FPR6
are 43 00 00 00 00 00 00 00, with a guard digit of
zero. Therefore, when the two numbers are
compared, condition code
0
is set, indicating an
equality.
As the above. example implies, when
floating-point numbers are compared, more than
two numbers may compare equal if one of the
numbers is unnormalized. For example, the
unnormalized floating-point number 41 00 12 34
56 78 9A BC compares equal to all numbers of the
form 3F 12 34 56 78 9A BC OX (X represents any
hexadecimal digit). When the COMPARE
instruction is executed, the two rightmost digits are
shifted right two places, the 0 becomes the guard
digit, and the X does not participate in the
comparison.
However, when two normalized floating-point
numbers are compared, the relationship between
numbers that compare equal is unique: each digit in
one number must be identical to the corresponding
digit in the other number.
Floating-Point-Number Conversion
The following examples illustrate one method of
converting between binary fixed-point numbers
(32-bit signed binary integers) and normalized
floating-point numbers. Conversion must provide
for the different representations used with negative
numbers: the two's-complement form for signed
binary integers, and the signed-absolute-value form
for the fractions of floating-point numbers.
Fixed Point to Floating Point
The method used here inverts the leftmost bit of
the signed binary integer which, after appending
additional zero bits on the left as necessary, is
equivalent to adding 2
31
to the number. This
changes it from a signed integer in the range
2
31 -
1 through _2
31
to an unsigned integer in the
range 2
32 -
1 through O. After conversion to the
long floating-point format, the value 2
31
is
subtracted again.
Assume that general register 9 (GR9) contains
the integer -59 in two's-complement form':
GR9
FF FF FF C5
Further, assume two eight-byte fields in storage:
TEMP, for use as temporary storage, and TW031,
which contains the floating-point constant 2
31
in
the following format:
TW031
4E 00000080000000
This is an unnormalized long floating-point
number with the characteristic 4E, which
corresponds to a radix point to the right of the
number.
The following instruction sequence performs the
conversion:
Result
X
9,TW031+4
GR9:
7F FF FF C5
ST
9,TEMP+4
TEMP:
7F FF FF C5
MVC TEMP(4),TW031
TEMP:
4E 00 00 00 7F FF FF C5
LO
2,TEMP
FPR2:
4E 00 00 00 7F FF FF C5
SO
2,TW031
FPR2:
C2 3B 00 00 00 00 00 00
The EXCLUSIVE OR (X) instruction inverts
the leftmost bit in general register 9, using the right
half of the constant as the source for a leftmost one
Appendix A. Number Representation and Instruction-Use Examples
A-31

Advertisement

loading