| CS450 |
| INSTRUCTOR: GEORGE KOUTSOGIANNAKIS |
| MIPS INSTRUCTION SET |
Note the summary is not complete. See a text for the complete list.
| Instruction | Example | Meaning | Comments |
|---|---|---|---|
| add | add $1,$2,$3 | $1=$2+$3 | Always 3 operands |
| subtract | sub $1,$2,$3 | $1=$2-$3 | Always 3 operands |
| add immediate | addi $1,$2,10 | $1=$2+10 | add constant |
| add unsigned | addu $1,$2,$3 | $1=$2+$3 | Always 3 operations |
| subtract unsigned | subu $1,$2,$3 | $1=$2-$3 | Always 3 operations |
| add immed.unsigned | addiu $1,$2,10 | $1=$2+10 | Always 3 operations |
| Instruction | Example | Meaning | Comments |
|---|---|---|---|
| and | and $1,$2,$3 | $1=$2&$3 | 3 register operands |
| or | or $1,$2,$3 | $1=$2|$3 | 3 register operands |
| and immediate | andi $1,$2,10 | $1=$2&10 | AND constant |
| or immediate | or $1,$2,10 | $1=$2|10 | OR constant |
| shift left logical | sll $1,$2,10 | $1=$2<<10 | Shift left by constant |
| shift right logical | srl $1,$2,10 | $1=$2>>10 | Shift right by constant |
| Instruction | Example | Meaning | Comments |
|---|---|---|---|
| load word | lw $1,10($2) | $1=Memory[$2+10] | memory to register |
| store word | sw $1,10($2) | Memory[$2+10]=$1 | register to memory |
| load upper immed. | lui $1,10 | $1=10x2^16 | load constant into upper 16 bits |
| Instruction | Example | Meaning | Comments |
|---|---|---|---|
| branch on equal | beq $1,$2,10 | if($1==$2)go to PC+4+10 | Equal test |
| branch on not equal | bne $1,$2,10 | if($1!=$2)go to PC+4+10 | Not equal test |
| set on less then | slt $1,$2,$3 | if($2<$3)$1=1;else $1=0 | Less than compare |
| Instruction | Example | Meaning | Comments |
|---|---|---|---|
| jump | j 1000 | go to 1000 | Jump to target address |
| jump register | jr $31 | go to $31 | For switch, procedure return |
| jump and link | jal 1000 | $31=PC+4;go to 1000 | For procedure call |