Publication 1766-RM001A-EN-P - October 2008
Math Instructions
207
Source and Destination do not have to be the same data type. However, if
the signed result does not fit in Destination, the following will occur.
The following table shows how the math status bits are updated upon
execution of the ABS instruction:
ABS Result Does Not Fit in Destination
When Both Operands Are Integers
When At Least One Operand is Floating Point Data
•
If the Math Overflow Selection Bit is clear, a saturated result
(32767 for word or 2,147,836,647 for long word) is stored in
the Destination.
•
If the Math Overflow Selection Bit is set, the unsigned truncated
value of the result is stored in the Destination.
•
The ABS instruction clears the sign bit. No operation is performed
on the remaining bits.
•
If Destination is an integer and Source is NAN or infinity, a
saturated result (32767 for word or 2,147,836,647 for long
word) is stored in Destination and the Math Overflow
Selection Bit is ignored.
•
If Destination is an integer, the rounded result is stored. If an
overflow occurs after rounding, a saturated result (32767 for
word or 2,147,836,647 for long word) is stored in Destination
and the Math Overflow Selection Bit is ignored.
Updates to Math Status Bits
When Both Operands Are Integers
When At Least One Operand is Floating Point Data
•
Carry - Is set if input is negative, otherwise resets.
•
Overflow - Is set if the signed result cannot fit in the Destination;
otherwise it is reset.
•
Zero - Is set if Destination is all zero’s, otherwise it is reset.
•
Sign - Is set if the most significant bit of the Destination is set,
otherwise it is reset.
•
Overflow Trap - The Math Overflow Trap Bit is only set if the
Overflow bit is set. Otherwise, it remains in its last state.
•
Carry - Is reset.
•
Overflow - Is set if the signed result is infinity, NAN, or cannot fit
in the Destination; otherwise it is reset.
•
Zero - Is set if Destination is all zero’s, otherwise it is reset.
•
Sign - Is set if the most significant bit of the Destination is set,
otherwise it is reset.
•
Overflow Trap - The Math Overflow Trap Bit is only set if the
Overflow bit is set. Otherwise, it remains in its last state.
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive