addic.
Add Immediate Carrying and Record
addic. RT, RA, SI
Adds an immediate, updates Carry, and updates Condition Register Field 0 (CR0).
Details
The addic instruction adds an immediate value to a register and records the result in another register. It also sets the carry flag if the addition results in a carry-out.
Pseudocode Operation
RT <- (RA) + EXTS(SI); CA <- Carry; CR0 <- Compare(RT, 0)
Programming Note
The addic instruction is useful for adding an immediate value to a register while also handling potential overflow by setting the carry flag. Be cautious of overflow conditions that may affect subsequent operations. The result and comparison are recorded in separate registers, so ensure proper register management to avoid unintended data loss.
Example
addic. r3, r4, -5
Encoding
Binary Layout
13
0
RT
6
RA
11
SI
16
Operands
-
RT
Target Register -
RA
Source Register -
SI
Signed 16-bit Immediate