Download Print this page

Shift And Round Decimal - IBM 4300 Manual

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

Advertisement

Data
Specification
Programming Notes
1. An example of the use of MUL TIPL Y
DECIMAL is given in Appendix A.
2.
The product cannot exceed 31 digits and sign.
The leftmost digit of the product is always zero.
SHIFT AND ROUND DECIMAL
The first operand is shifted in the direction and for
the number of decimal-digit positions specified by
the second-operand address, and, when shifting to
the right is specified, the absolute value of the first
operand is rounded by the rounding digit, 1
3 ,
The
first operand and the result are in the packed
format.
The first operand is considered to be in the
packed-decimal format. Only its digit portion is
shifted; the sign position does not participate in the
shifting. Zeros are supplied for the vacated digit
positions. The result replaces the first operand.
Nothing is stored outside of the specified
first-operand location.
The second-operand address, specified by the B2
and D2 fields, is not used to address data; bits
26-31 are the shift value, and the high-order bits of
the address are ignored.
The shift value is a six-bit signed binary integer,
indicating the direction and the number of
decimal-digit positions to be shifted. Positive shift
values specify shifting to the left. Negative shift
values, which are represented in two's complement
notation, specify shifting to the right. The
following are examples of the interpretation of shift
values.
Sh i·ft Va 1 ue
011111
000001
000000
111111
100000
Amount and Direction
31 digits to the left
One digit to the left
No shift
One digit to the right
32 digits to the right
For a right shift, the 13 field, bits 12-15 of the
instruction, are used as a decimal rounding digit.
The first operand, which is treated as positive by
ignoring the sign, is rounded by decimally adding
8-10
IBM 4300 Processors Principles of Operation
the rounding digit to the leftmost of the digits to be
shifted out and by propagating the carry, if any, to
the left. The result of this addition is then shifted
. right. Except for validity checking and the
participation in rounding, the digits shifted out of
the low-order decimal-digit position are ignored
and are lost.
If one or more significant digits are shifted out
of the high-order digit positions during a left shift
decimal overflow occurs. The operation is
'
completed. The result is obtained by ignoring the
overflow information, and condition code 3 is set.
If
the decimal-overflow mask is one, a program
interruption for decimal overflow takes place.
Overflow cannot occur for a right shift, with or
without rounding, or when no shifting is specified.
In the absence of overflow, the sign of· a zero
result is made positive. Otherwise, the sign of the
result is the same as the original sign, but the code
is the preferred sign code.
A data exception is recognized when the first
operand does not have valid sign and digit codes or
when the rounding digit is not a valid digit code.
The validity of the first-operand codes is checked
even when no shift is specified, and the validity of
the rounding digit is checked even when no
addition for rounding takes place.
Resulting Condition Code:
o
Result is zero
1
Result is less than zero
2
Result is greater than zero
3
Overflow
Program Exceptions:
Access (fetch and store, operand 1)
Data
Decimal Overflow
Programming Notes
1. Examples of the use of SHIFT AND ROUND
are given in Appendix A.
2.
SHIFT AND ROUND can be used for shifting
up to 31 digit positions left and up to 32 digit
positions right. This is sufficient to clear all
digits of any decimal number even with
rounding.
3.
For right shifts, the rounding digit 5 provides
conventional rounding of the result. The
rounding digit 0 specifies truncation without
rounding.
4. When the B2 field is zero, the six-bit shift value
is obtained directly from bits 42-47 of the
instruction.

Advertisement

loading