TSK3000A Core Instruction - ADDI, ADDIU

Frozen Content

Instruction:                      Add Immediate Word

Assembler Format:       addi rB, rA, IMM16

Example:                          addi $3, $4, 0x1234

Description:                     Sign-extends the 16-bit immediate value, IMM16, adds it to the contents of GPR rA and puts the result in GPR rB.

Operation:                        rB <-- rA + SignExtend(IMM16)

Instruction Type:            I-Type

Instruction Fields:          rA = Register index of operand A

                                            rB = Register index of destination

                                            IMM16 = 16-bit immediate data value

Encoding:

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 1
rA
rB
IMM16

Latency: 1

Notes

The following code example illustrates how overflow detection can be handled, in software, when adding two signed operands:

addi rB, rA, IMM16
xor rC, rB, rA      -----compare sign of sum and operand rA
xori rD, rB, IMM16  -----compare sign of sum and IMM16
and rC, rC, rD      -----bitwise logically AND the comparison values
slt rC, rC, $0      -----if result less than '0', flag overflow

rC will be set to '1' if an overflow occurred, otherwise it will be set to '0'

You are reporting an issue with the following selected text and/or image within the active document: