The sign bit is leftmost in a number. An overHow
carries into the sign-bit position and changes the sign.
However, in algebraic shifting the sign bit does not
change even if significant high-order bits are shifted
out.
Programming Notes
Two's-complement notation is particularly suited to
address computation and multiple-precision arithmetic.
The two's-complement representation of a negative
number may be considered the sum of the integer
part of the field, taken as a positive number, and the
maximum negative number. Hence, in multiple-preci­
sion arithmetic the low-order fields should be treated
as positive numbers. Also, when negative numbers are
shifted to the right, the resulting rounding, if any, is
toward minus infinity and not toward zero.
Conditic)n Code
The results of fixed-point sign-control, add, subtract, compare" and shift operations are used to set the condi­
tion code in the program status word (psw). All other
fixed-point operations leave this code undisturbed.
The condition code can be used for decision-making
by subsequent branch-on-condition instructions.
The condition code can be set to reHect three types
of results for fixed-point arithmetic. For most opera­
tions, the states 0, 1, or 2 indicate a zero, less than
zero, or greater than zero content of the result reg­
ister' while the state 3 is used when the result over­
Hows.
For a comparison, the states 0, 1, or 2 indicate that
the first operand is equal, low, or high.
For ADD LOGICAL and SUBTRACT LOGICAL, the codes ° and 1 indicate a zero or nonzero result register con­
tent in the absence of a logical carry out of thc sign
position; the codes 2 and 3 indicate a zero or nonzero
result register content with a logical carry out of the
sign position. CONDITION CODE SETTINGS FOR FIXED-POINT ARITHMETIC 0 1 2 3
Add H/F zero < zero > zero overflow
Add Logical zero not zero zero, carry
carry Compare H/F equal low high
Load and Test zero < zero > zero
Load Complement zero < zero > zero overflow
Load Negative zero < zero
Load Positive zero > zero overflow
Shift Left Double zero < zero > zero overflow
Shift Left Single zero < zero > zero overflow
Shift Right Double zero < zero > zero
Shift Right Single zero < zero > zero
Subtract H/F zero < zero > zero overflow
Subtract Logical not zero zero, carry
carry
24
Instruction Format
Fixed-point instructions use the following three for­
mats:
RR Format
7 8 11 12 15
RX Format I Op Code Rl
X
2
B2 0 7 8 11 12 1516 1920 31
RS Format Op Code Rl R3 B2
7 8 11 12 1516 1920 31
In these formats, RJ specifies the address of the gen­
eral register containing the first operand. The second
operand location, if any, is defined differently for each
format.
In the HR format, the R2 field specifies the address of
the general register containing the second operand.
The same register may be specified for the first and
second operand.
In the RX format, the contents of the general reg­
isters specified by the X 2 and B2 fields are added to
the content of the D2 field to form an address designat­
ing the storage location of the second operand.
In the RS format, the content of the general register
specified by the B2 field is added to the content of the
D.) field to form an address. This address designates storage location of the second operand in LOAD MULTIPLE and STORE MULTIPLE. In the shift operations,
the address specifies the amount of shift. The field
specifics the address of a general register in LOAD MULTIPLE and STORE MULTIPLE and is ignored in the
shift operations.
A zero in an X 2 or B2 field indicates the absence of
the corresponding address component.
An instruction can specify the same general register
both for address modification and for operand loca­
tion. Address modification is always completed before
operation execution.
Results replace the first operand, except for STORE and CONVERT TO DECIMAL, where the result replaces
the second operand.
The contents of all general registers and storage
locations participating in the addressing or execution
part of an operation remain unchanged, except for the
storing of the final result.
Instructions
The fixed-point arithmetic instructions and their mne-
monics, formats, and operation codes are listed in the
following table. The table also indicates which instruc-
tions are not included in the small binary instruction
set, when the condition code is set, and the exceptional
conditions that cause a program interruption.
NAME MNEMONIC Load LR
Load L
Load Halfword LH
Load and Test LTR
Load Complement LCR Load Positive LPR Load Negative LNR
Load Multiple LM
Add AR
Add A
Add Halfword All
Add Logical ALR
Add Logical AL Subtract SR Subtract S Subtract Halfword SH Subtract Logical SLR Subtract Logical SL Compare CR Compare C Compare Halfword CH Multiply MR
Multiply M
Multiply Halfword MH
Divide DR
Divide D Convert to Binary CVB Convert to Decimal CVD Store ST Store Halfword STH Store Multiple STM Shift Left Single SLA Shift Right Single SRA Shilt Left Double SLDA Shift Right Double SRDA Addressing exception
Condition code is set
Data exception
TYPE
RR
RX
RX
RR
RR
RR
RR RS RR
RX
RX
RR
RX
RR
RX
RX
RR
RX
RR
RX
RX
RR
RX
RX
RR
RX
RX
RX
RX
RX RS RS RS RS RS NOTES A C D
IF
IK P S Fixed-Point overflow exception
Fixed-point divide exception Protection exception
Specification exception
Programming Note EXCEPTIONS A,S A,S C C IF C IF C A,S C IF C A,S, IF C A,S, IF C C A,S C IF C A,S, IF C A,S, IF C C A,S C C A,S C A,S S A,S A,S S, IK A,S, IK A,S,D,IK P,A,S P,A,S P,A,S P,A,S C IF C C S, IF C S CODE 18
58
48
12
13 10 11
98
lA
5A
4A
IE
5E
IB
5B
4B
IF
5F
19
59
49
Ie 5C 4C ID
5D
4F
4E 50 40 90 8B
8A
8F
8E
The logical comparisons, shifts, and connectives, as
well as LOAD ADDRESS, BRANCH ON COUNT, BRANCH ON INDEX HIGH, and BRANCH ON INDEX LOW OR EQUAL, also
may be used in fixed-point calculations.
Load
LR RR I 18 R1 R2 0 7 8 11 12 15
L RX I 58 R1
X
2
B2 D2 0 7 8 11 12 1516 1920 31
The second operand is placed in the first operand loca­
tion. The second operand is not changed.
Condition Code: The code remains unchanged.
Program Interruptions:
Addressing (L only)
Specification (L only)
Load Halfword
LH RX
48
7 8 11 12 15 16 1 9 20 31
The halfword second operand is placed in the first
operand location.
The halfword second operand is expanded to a full­
word by propagating the sign-bit value through the
16 high-order bit positions. Expansion occurs after the
operand is obtained from storage and before insertion
in the register.
Program Interruptions:
Addressing
Specification
Load and Test
LTR RR
12
7 8 11 12 15
The second operand is placed in the first operand loca­
tion, and the sign and magnitude of the second op­
erand determine the condition code. The second op­
erand is not changed. Fixed-Point Arithmetic 25
Previous Page Next Page