Name Mnemonic Format Operation OPCODE/FUNCT Add add R R[rd]= R[rt] + R[rs] 0/2016 Note: May cause overflow exception
Opcode | RS | RT | RD | shamt | funct |
---|---|---|---|---|---|
31 26 | 25 21 | 20 16 | 15 11 | 10 6 | 5 0 |
Category Inst Example Meaning Comment Arithmetic add add $s1, $s2, $s3 $s1 = $s2+$s3 Three register operation
Name Mnemonic Format Operation OPCODE/FUNCT Load Word lw I R[rt] = M[R[rs]+SignExtendImm] 2316 Note: SignExtImm = { 16{immediate[15],immediate}
Opcode | RS | RT | immediate |
---|---|---|---|
31 26 | 25 21 | 20 16 | 15 0 |
Category Inst Example Meaning Comment Data Trans lw lw $s1, 20($s2) $s1=M[$s2+20] Word from mem to register
Name Mnemonic Format Operation OPCODE/FUNCT Jump J J PC = JumpAddr 2 Note: JumpAddr = {PC+4[31:28],address,2'b0}
Opcode | address |
---|---|
31 26 | 25 0 |
Category Inst Example Meaning Comment Uncond B jump jump 2500 to to 10000 Jump to target address
.data a: .word 100 .text .globl main main: lw $t1, a add $t2, $t1, $t1 li $v0, 1 move $a0, $t2 syscall j exit exit: li $v0, 10 syscall