Architecture

3.4 Computational Instructions

Computational instructions perform arithmetic, logical or shift operations on 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 16-bit immediate data. Computational instructions can be classified as follows.

ALU immediate (Table 3-4)

Three-operand register-type (Table 3-5)

Shift (Table 3-6)

Multiply/Divide (Table 3-7,Table3-8)

Table 3-4. ALU immediate instructions

Instruction

Format and Description

 

 

 

 

 

op

rs

rt

immediate

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Add

ADDI rt, rs, immediate

 

 

 

 

 

Immediate

Add 32-bit sign-extended immediate to the contents of register rs, and store the

 

result in register rt. An exception is raised in the event of a two’s-complement

 

overflow.

 

 

 

 

 

 

Add

ADDIU rt, rs, immediate

 

 

 

 

 

Immediate

Add 32-bit sign-extended immediate to the contents of register rs, and store the

Unsigned

result in register rt.

No exception is raised on a two’s-complement overflow.

Set on Less

SLTI rt, rs, immediate

 

 

 

 

 

Than

Compare 32-bit sign-extended immediate with the contents of register rs as

Immediate

signed 32-bit data.

If rs is less than immediate, set 1 in rt as the result;

 

otherwise store 0 in rt.

 

 

 

 

 

Set on Less

SLTUI rt, rs, immediate

 

 

 

 

 

Than

Compare 32-bit sign-extended immediate with the contents of register rs as

Unsigned

unsigned 32-bit data. If rs is less than immediate, set 1 in rt as the result;

Immediate

otherwise store 0 in rt.

 

 

 

 

 

AND

ANDI rt, rs, immediate

 

 

 

 

 

Immediate

AND 32-bit zero-extended immediate with the contents of register rs, and store

 

the result in register rt.

 

 

 

 

 

OR

ORI rt, rs, immediate

 

 

 

 

 

Immediate

OR 32-bit zero-extended immediate with the contents of register rs, and store

 

the result in register rt.

 

 

 

 

 

Exclusive

XORI rt, rs, immediate

 

 

 

 

 

OR

Exclusive-OR 32-bit zero-extended immediate with the contents of register rs,

Immediate

and store the result in register rt.

 

 

 

 

 

Load Upper

LUI rt, immediate

 

 

 

 

 

 

Immediate

Shift 16-bit immediate left 16 bits, zero-fill the least significant 16 bits of the

 

word, and store the result in register rt.

 

 

 

 

27

Page 36
Image 36
Toshiba TX39 user manual Computational Instructions