TSK3000A - Arithmetic Instructions

Frozen Content

Arithmetic instructions perform arithmetic operations and store the resulting values in registers. The instruction format can be R-type or I-type. With R-type instructions, the two operands and the result are register values. With I-type instructions, one of the operands is a 16-bit immediate value, sign or zero extended to 32 bits.

Table 1. Arithmetic Instructions.
        Mnemonic        
              Instruction              
Description

ADD rC, rA, rB

Add Word

Adds the contents of GPRs rA and rB and puts the result in GPR rC

ADDI rB, rA, IMM16

Add Immediate Word

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

DIV rA, rB

Divide Word

Divides the contents of GPR rA by the contents of GPR rB, treating both operands as 32-bit two's complement integers. The quotient word is loaded into special register LO, the sign of which will be negative if the operands are of opposite signs. The remainder word is loaded into special register HI, the sign of which will be the same as the numerator

DIVU rA, rB

Divide Unsigned Word

Divides the contents of GPR rA by the contents of GPR rB, treating both operands as 32-bit unsigned positive values. The quotient word is loaded into special register LO and the remainder word into special register HI. Both quotient and remainder values will always be positive

LUI rB, IMM16

Load Upper Immediate

Left-shifts 16-bit immediate value, IMM16, by 16 bits, zero-fills the low-order 16 bits of the word, and puts the result in GPR rB

MULT rA, rB

Multiply Word

Multiplies the contents of GPR rA by the contents of GPR rB, treating both operands as 32-bit two's complement values. The low-order word of the multiplication result is put in special register LO, and the high-order word of the result is put in special register HI. This instruction cannot raise an integer overflow exception

MULTU rA, rB

Multiply Unsigned Word

Multiplies the contents of GPR rA by the contents of GPR rB, treating both operands as 32-bit unsigned positive values. The low-order word of the multiplication result is put in special register LO and the high-order word of the result is put in special register HI. This instruction cannot raise an integer overflow exception

SUB rC, rA, rB

Subtract Word

Subtracts the contents of GPR rB from GPR rA and puts the result in GPR rC

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