Professional Documents
Culture Documents
MIPS-SPIM Reference PDF
MIPS-SPIM Reference PDF
jr
jalr
R
R
Move
Load Byte
Load Byte Unsigned
Load Halfword
Load Halfword Unsigned
Load Upper Imm.
Load Word
Load Immediate
Load Address
Store Byte
Store Halfword
Store Word
move
lb
lbu
lh
lhu
lui
lw
li
la
sb
sh
sw
P
I
I
I
I
I
I
P
P
I
I
I
(1)
(1)(2)
(2)
(2)
(1)
(3)
(3)
(2)
(2)(6)
(6)
(4)
(4)
OPCODE/
FUNCT
(Hex)
0/20
8
9
0/21
0/22
0/23
0/24
c
0/27
0/25
d
0/26
e
0/00
0/02
0/03
0/04
0/06
0/07
0/2a
a
b
0/2b
4
5
(5)
(5)
2
2
0/08
0/09
(3)
(2)
(3)
(2)
(2)
20
24
25
25
f
23
(2)
(2)
(2)
28
29
2b
REGISTERS
(1) May cause overflow exception
NAME NMBR
USE
STORE?
(2) SignExtImm ={16{immediate[15]},immediate }
$zero
0 The Constant Value 0
N.A.
(3) ZeroExtImm ={16{1b0},immediate }
$at
1 Assembler Temporary
No
(4) BranchAddr = {14{immediate[15]},immediate,2b0 }
$v0-$v1 2-3 Values for Function Results and No
(4) JumpAddr = {PC[31:28], address, 2b0 }
Expression Evaluation
(6) Operands considered unsigned numbers (vs. 2 s comp.)
$a0-$a3 4-7 Arguments
No
$t0-$t7 8-15 Temporaries
No
BASIC INSTRUCTION FORMATS,
$s0-$s7 16-23 Saved Temporaries
Yes
FLOATING POINT INSTRUCTION FORMATS
$t8-$t9 24-25 Temporaries
No
31
16 15
R
opcode 26 25
rs 21 20
rt
rd 11 10 shamt 6 5
$k0-$k1 26-27 Reserved for OS Kernel
No
31
26 25
21 20
16 15
I
opcode
rs
rt
immediate
$gp
28 Global Pointer
Yes
31
26 25
J
opcode
immediate
$sp
29 Stack Pointer
Yes
16 15
65
$fp
30 Frame Pointer
Yes
FR 31 opcode 26 25 fmt 21 20
ft
fs 11 10
fd
31
16 15
$ra
31 Return Address
Yes
FI
opcode 26 25 fmt 21 20
rt
immediate
$f0-$f31 0-31 Floating Point Registers
Yes
funct
0
0
0
funct
0
0
Divide
MNEMONIC
div
Divide Unsigned
divu
Multiply
Multiply Unsigned
Branch On FP True
Branch On FP False
FP Compare Single
FP Compare Double
mult
multu
bc1t
bc1f
c.x.s
c.x.d
R
R
FI
FR
FR
FR
FP Add Single
FP Divide Single
FP Multiply Single
FP Subtract Single
FP Add Double
FP Divide Double
FP Multiply Double
FP Subtract Double
Move From Hi
Move From Lo
Move From Control
Load FP Single
Load FP Double
add.s
div.s
mul.s
sub.s
add.d
div.d
mul.d
sub.d
mfhi
mflo
mfc0
lwc1
ldc1
FR
FR
FR
FR
FR
FR
FR
FR
R
R
R
I
I
Store FP Single
Store FP Double
swc1
sdc1
NAME
I
I
OPCODE/
FMT/FT/
FUNCT
0///1a
(6)
(6)
(4)
(4)
0///1b
0///18
0///19
11/8/1/
11/8/0/
11/10//y
11/11//y
(2)
(2)
11/10//0
11/10//3
11/10//2
11/10//1
11/11//0
11/11//3
11/11//2
11/11//1
0///10
0///12
16/0//0
31///
35///
(2)
(2)
39///
3d///
ASSEMBLER DIRECTIVES
.data [addr]
.kdata [addr]
.ktext [addr]
.text [addr]
EXCEPTION CODES
SYSCALLS
SERVICE
$v0
ARGS
print_int
1 integer $a0
print_float 2 float $f12
print_double 3 double $f12/$f13
print_string 4 string $a0
read_int
5
read_float
6
read_double 7
read_string 8 buf $a0, buflen $a1
sbrk
9 amount $a
exit
10
RESULT
Number
0
4
Name
Int
AdEL
5
6
7
8
9
10
11
12
13
15
AdES
IBE
DBE
Sys
Bp
RI
CpU
Ov
Tr
FPE
Cause of Exception
Interrupt (hardware)
Address Error Exception (load or instruction
fetch)
Address Error Exception (store)
Bus Error on Instruction Fetch
Bus Error on Load or Store
Syscall Exception
Breakpoint Exception
Reserved Instruction Exception
Coprocessor Unimplemented
Arithmetic Overflow Exception
Trap
Floating Point Exception
[1] Patterson, David A; Hennessy, John J.: Computer Organization and Design, 3rd Edition. Morgan Kaufmann Publishers. San Francisco, 2005.