Installation manual
Publication 1747-RM001G-EN-P - November 2008
Math Instructions 4-5
Add (ADD)
Use the ADD instruction to add one value (source A) to another value (source
B) and place the result in the destination.
Updates to Arithmetic Status Bits
The arithmetic status bits are found in Word 0, bits 0 to 3 in the status file.
After an instruction is executed, the arithmetic status bits in the status file are
updated.
Subtract (SUB)
Use the SUB instruction to subtract one value (source B) from another (source
A) and place the result in the destination.
Updates to Arithmetic Status Bits
The arithmetic status bits are found in Word 0, bits 0 to 3 in the status file.
After an instruction is executed, the arithmetic status bits in the status file are
updated.
ADD
Add
Source A N7:14
6<
Source B N7:15
8<
Dest N7:16
0<
ADD
Output Instruction
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
• •••••
Table 4.4 Processor Function
With this Bit The Processor
S:0/0 Carry (C) sets if carry is generated; otherwise resets (integer). For floating
point, it is cleared.
S:0/1 Overflow (V) sets if overflow is detected at destination; otherwise resets. On
overflow, the minor error flag is also set. For floating point, the
overflow value is placed in the destination. For an integer, the
value -32,768 or 32,767 is placed in the destination. Exception: If
you are using an SLC
5/02 or higher processor and have S:2/14 (math overflow
selection bit) set, then the unsigned, truncated overflow remains
in the destination.
S:0/2 Zero (Z) sets if result is zero; otherwise resets.
S:0/3 Sign (S) sets if result is negative; otherwise resets.
SUB
Subtract
Source A N7:17
0<
Source B N7:18
0<
Dest N7:19
0<
SUB
Output Instruction
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
• •••••
Table 4.5 Processor Function
With this Bit The Processor
S:0/0 Carry (C) sets if borrow is generated; otherwise resets (integer). For
floating point it is cleared.
S:0/1 Overflow (V) sets if underflow; otherwise reset. On underflow, the minor error
flag is also set. For floating point, the overflow value is placed in
the destination. For an integer, the value -32,768 or 32,767 is
placed in the destination. Exception: If you are using an SLC 5/02
or higher processor and have S:2/14 (math overflow selection
bit) set, then the unsigned, truncated overflow remains in the
destination.
S:0/2 Zero (Z) sets if result is zero; otherwise resets.
S:0/3 Sign (S) sets if result is negative; otherwise resets.