MIPS Instruction Format


* All MIPS instructions are encoded in binary.

* All MIPS instructions are 32 bits long.

* All instructions have:

op rs rt rd shamt funct
add 0 rs rt rd 0 32
sub 0 rs rt rd 0 34
sll 0 0 rs rd const 0
srl 0 0 rs rd const 2

NOTE: when op is 0, funct disambiguates

Example

op rs rt rd shamt funct
0 17 18 16 0 32
000000 10001 10010 10000 00000 100000


I-format

op rs rt address
lw 35 base addr dest reg. offset
sw 43 base addr source reg. offset

Example

op rs rt address
35 19 8 32
100011 10011 01000 0000000000100000


op rs rt address
addi 8 source reg. dest. reg. constant


Registers

(p. A-23)
0$zero constant 0
...
8
.
.
.
15
$t0
.
.
.
$t7
temporary (not preserved across function call)
.
.
.
temporary (not preserved across function call)
16
.
.
.
23
$s0
.
.
.
$s7
saved temporary (preserved across function call)
.
.
.
saved temporary (preserved across function call)
24$t8 temporary (not preserved across function call)
25$t9 temporary (not preserved across function call)
...