COMP 230 MIPS Instructions:
Final Summary

 


Arithmetic Instructions

Name Syntax Meaning
add add $rd, $rs, $rt $rd = $rs + $rt
addu addu $rd, $rs, $rt $rd = $rs + $rt (unsigned)
sub sub $rd, $rs, $rt $rd = $rs - $rt
subu subu $rd, $rs, $rt $rd = $rs - $rt (unsigned)
addi addi $rd, $rs, constantValue $rd = $rs + constantValue
addiu addiu $rd, $rs, constantValue $rd = $rs + constantValue (unsigned)

Logical Instructions (so far)

Name Syntax Meaning
and (bit-wise AND) and $rd, $rs, $rt $rd = $rs bitwise-AND $rt ($rs & $rt)
or (bit-wise OR) or $rd, $rs, $rt $rd = $rs bitwise-OR $rt ($rs | $rt)
nor (bit-wise NOR) nor $rd, $rs, $rt $rd = $rs bitwise-NOR $rt
andi (bit-wise AND) andi $rd, $rs $rd = $rs bitwise-AND constantValue
ori (bit-wise OR) ori $rd, $rs $rd = $rs bitwise-OR constantValue
sll (shift left logical) sll $rd, $rs, shiftAmount shift $rd by shiftAmount, put in $rd
srl (shift right logical) srl $rd, $rs, shiftAmount shift $rd by shiftAmount, put in $rd

Memory Access Instructions (so far)

Name Syntax Meaning
lw (load word) lw $rd, offset($base) load word from address ($base+offset) to $rd
sw (store word) sw $rs, offset($base) store word from $rs to address ($base+offset)
lui (load upper immediate) lui $rd, value load immed. value into high-order bits of $rd

Branch-Related Instructions (so far)

Name Syntax Meaning
beq (branch on equal) beq $rs, $rt, label branch to label if $rs == $rt
bne (branch on not equal) bne $rs, $rt, label branch to label if $rs != $rt
slt (set on less than) slt $rd, $rs, $rt set $rd to 1 if $rs < $rt
slti (set on less than) slti $rd, $rs, value set $rd to 1 if $rs < value
sltu (set on less than) sltu $rd, $rs, $rt set $rd to 1 if $rs < $rt (unsigned)
sltiu (set on less than) sltiu $rd, $rs, value set $rd to 1 if $rs < value (unsigned)

Jump Instructions

Name Syntax Meaning
jr jr $ra jump to the address in $ra
j j label jump to the address associated with label
jal jal label store the program counter (PC) in $ra and then
jump to the address associated with label
View Register Table

Alyce Brady, Kalamazoo College