MIPS Reference Data Card
MIPS Reference Data Card
MIPS Reference Data Card
M I P S Reference Data
CORE INSTRUCTION SET
FORNAME, MNEMONIC MAT
OPERATION (in Verilog)
add
Add
R R[rd] = R[rs] + R[rt]
Add Immediate
OPCODE
/ FUNCT
(Hex)
(1) 0 / 20hex
(1,2)
(2)
Add Unsigned
addu
And
and
And Immediate
andi
Branch On Equal
beq
Jump
addi
8hex
9hex
0 / 21hex
0 / 24hex
(3)
chex
(4)
4hex
(4)
(5)
jal
R[31]=PC+8;PC=JumpAddr
(5)
jr
ll
R PC=R[rs]
R[rt]={24b0,M[R[rs]
I
+SignExtImm](7:0)}
R[rt]={16b0,M[R[rs]
I
+SignExtImm](15:0)}
I R[rt] = M[R[rs]+SignExtImm]
lui
Load Word
lw
R[rt] = M[R[rs]+SignExtImm]
Nor
nor
0 / 27hex
Or
or
0 / 25hex
Or Immediate
ori
slt
lhu
sll
srl
Store Byte
sb
Store Conditional
sc
5hex
2hex
3hex
0 / 08hex
(2)
(2)
(2,7)
24hex
25hex
30hex
fhex
(2)
(3)
23hex
dhex
0 / 2ahex
31
31
sh
Store Word
sw
Subtract
sub
Subtract Unsigned
(2)
(2)
opcode
31
rs
26 25
opcode
I
31
rs
26 25
opcode
J
31
rt
21 20
28hex
38hex
29hex
2bhex
(1) 0 / 22hex
0 / 23hex
rd
16 15
shamt
11 10
rt
21 20
funct
65
immediate
16 15
address
26 25
ft
21 20
fmt
26 25
fs
16 15
ft
21 20
fd
11 10
funct
65
16 15
Copyright 2009 by Elsevier, Inc., All rights reserved. From Patterson and Hennessy, Computer Organization and Design, 4th ed.
immediate
PSEUDOINSTRUCTION SET
NAME
MNEMONIC
OPERATION
blt
if(R[rs]<R[rt]) PC = Label
Branch Less Than
bgt
if(R[rs]>R[rt]) PC = Label
Branch Greater Than
ble
if(R[rs]<=R[rt]) PC = Label
Branch Less Than or Equal
bge
if(R[rs]>=R[rt]) PC = Label
Branch Greater Than or Equal
li
R[rd] = immediate
Load Immediate
move
R[rd] = R[rs]
Move
26 25
opcode
FI
Store Halfword
(2,7)
fmt
opcode
FR
0 / 02hex
(2)
subu
OPCODE
/ FMT /FT
FOR/ FUNCT
NAME, MNEMONIC MAT
OPERATION
(Hex)
Branch On FP True bc1t FI if(FPcond)PC=PC+4+BranchAddr (4) 11/8/1/-Branch On FP False bc1f FI if(!FPcond)PC=PC+4+BranchAddr(4) 11/8/0/-div
Divide
R Lo=R[rs]/R[rt]; Hi=R[rs]%R[rt]
0/--/--/1a
divu
Divide Unsigned
R Lo=R[rs]/R[rt]; Hi=R[rs]%R[rt] (6) 0/--/--/1b
add.s FR F[fd ]= F[fs] + F[ft]
FP Add Single
11/10/--/0
FP Add
{F[fd],F[fd+1]} = {F[fs],F[fs+1]} +
add.d FR
11/11/--/0
Double
{F[ft],F[ft+1]}
11/10/--/y
FP Compare Single c.x.s* FR FPcond = (F[fs] op F[ft]) ? 1 : 0
FP Compare
FPcond = ({F[fs],F[fs+1]} op
c.x.d* FR
11/11/--/y
Double
{F[ft],F[ft+1]}) ? 1 : 0
* (x is eq, lt, or le) (op is ==, <, or <=) ( y is 32, 3c, or 3e)
FP Divide Single div.s FR F[fd] = F[fs] / F[ft]
11/10/--/3
FP Divide
{F[fd],F[fd+1]} = {F[fs],F[fs+1]} /
div.d FR
11/11/--/3
Double
{F[ft],F[ft+1]}
11/10/--/2
FP Multiply Single mul.s FR F[fd] = F[fs] * F[ft]
FP Multiply
{F[fd],F[fd+1]} = {F[fs],F[fs+1]} *
mul.d FR
11/11/--/2
Double
{F[ft],F[ft+1]}
11/10/--/1
FP Subtract Single sub.s FR F[fd]=F[fs] - F[ft]
FP Subtract
{F[fd],F[fd+1]} = {F[fs],F[fs+1]} sub.d FR
11/11/--/1
Double
{F[ft],F[ft+1]}
lwc1
I F[rt]=M[R[rs]+SignExtImm]
Load FP Single
(2) 31/--/--/-Load FP
F[rt]=M[R[rs]+SignExtImm];
(2)
ldc1
I
35/--/--/-Double
F[rt+1]=M[R[rs]+SignExtImm+4]
mfhi
R R[rd] = Hi
0 /--/--/10
Move From Hi
mflo
Move From Lo
R R[rd] = Lo
0 /--/--/12
Move From Control mfc0 R R[rd] = CR[rs]
10 /0/--/0
mult
Multiply
R {Hi,Lo} = R[rs] * R[rt]
0/--/--/18
Multiply Unsigned multu R {Hi,Lo} = R[rs] * R[rt]
(6) 0/--/--/19
sra
Shift Right Arith.
R R[rd] = R[rt] >> shamt
0/--/--/3
swc1
Store FP Single
I M[R[rs]+SignExtImm] = F[rt]
(2) 39/--/--/-Store FP
M[R[rs]+SignExtImm] = F[rt];
(2)
sdc1
I
3d/--/--/-Double
M[R[rs]+SignExtImm+4] = F[rt+1]
ARITHMETIC CORE INSTRUCTION SET
4
IEEE 754 Symbols
Exponent
Fraction
Object
0
0
0
Denorm
0
0
1 to MAX - 1 anything Fl. Pt. Num.
MAX
0
MAX
0
NaN
S.P. MAX = 255, D.P. MAX = 2047
Exponent
23 22
S
63
Fraction
30
Exponent
62
Fraction
52 51
MEMORY ALLOCATION
$sp
7fff fffchex
$gp
1000 8000hex
Stack
Dynamic Data
Static Data
1000 0000hex
pc
STACK FRAME
...
Argument 6
Argument 5
$fp
Saved Registers
Stack
Grows
Local Variables
$sp
Text
0040 0000hex
Higher
Memory
Addresses
Lower
Memory
Addresses
Reserved
0hex
DATA ALIGNMENT
Double Word
Word
Word
Halfword
Halfword
Halfword
Halfword
Byte Byte Byte Byte Byte Byte
Byte
Byte
0
15
Pending
Interrupt
15
U
M
E I
L E
Sys
Syscall Exception
15
SIZE PREFIXES
(10x
Copyright 2009 by Elsevier, Inc., All rights reserved. From Patterson and Hennessy, Computer Organization and Design, 4th ed.
MIPS Reference Data Card (Green Card) 1. Pull along perforation to separate card 2. Fold bottom side (columns 3 and 4) together
3
OPCODES, BASE CONVERSION, ASCII SYMBOLS
MIPS (1) MIPS (2) MIPS
Hexa- ASCII
Hexa- ASCII
DeciDeciopcode funct
funct
Binary
deci- Chardeci- Charmal
mal
(31:26)
(5:0)
(5:0)
mal acter
mal acter
sll
00 0000
0
0 NUL
64
40
@
add.f
(1)
sub.f
00 0001
1
1 SOH
65
41
A
j
srl
00 0010
2
2 STX
66
42
B
mul.f
jal
sra
00 0011
3
3 ETX
67
43
C
div.f
beq
sllv
00 0100
4
4 EOT
68
44
D
sqrt.f
bne
00 0101
5
5 ENQ
69
45
E
abs.f
blez
srlv
00 0110
6
6 ACK
70
46
F
mov.f
bgtz
srav
00 0111
7
7 BEL
71
47
G
neg.f
addi
jr
00 1000
8
8 BS
72
48
H
addiu jalr
00 1001
9
9 HT
73
49
I
slti
movz
00 1010 10
a LF
74
4a
J
sltiu movn
00 1011 11
b VT
75
4b
K
andi
syscall round.w.f 00 1100
12
c FF
76
4c
L
ori
break
13
d CR
77
4d
M
trunc.w.f 00 1101
xori
14
e SO
78
4e
N
ceil.w.f 00 1110
lui
sync
15
f SI
79
4f
O
floor.w.f 00 1111
mfhi
01 0000 16
10 DLE
80
50
P
mthi
(2)
01 0001 17
11 DC1
81
51
Q
mflo
01 0010 18
12 DC2
82
52
R
movz.f
mtlo
01 0011 19
13 DC3
83
53
S
movn.f
01 0100 20
14 DC4
84
54
T
01 0101 21
15 NAK
85
55
U
01 0110 22
16 SYN
86
56
V
01 0111 23
17 ETB
87
57
W
mult
01 1000 24
18 CAN
88
58
X
multu
01 1001 25
19 EM
89
59
Y
div
01 1010 26
1a SUB
90
5a
Z
divu
01 1011 27
1b ESC
91
5b
[
01 1100 28
1c FS
92
5c
\
01 1101 29
1d GS
93
5d
]
01 1110 30
1e RS
94
5e
^
01 1111 31
1f US
95
5f
_
lb
add
10 0000 32
20 Space 96
60
cvt.s.f
lh
addu
10 0001 33
21
!
97
61
a
cvt.d.f
lwl
sub
10 0010 34
22
"
98
62
b
lw
subu
10 0011 35
23
#
99
63
c
lbu
and
10 0100 36
24
$
100
64
d
cvt.w.f
lhu
or
10 0101 37
25 %
101
65
e
lwr
xor
10 0110 38
26
&
102
66
f
nor
10 0111 39
27
103
67
g
sb
10 1000 40
28
(
104
68
h
sh
10 1001 41
29
)
105
69
i
swl
slt
10 1010 42
2a
*
106
6a
j
sw
sltu
10 1011 43
2b
+
107
6b
k
10 1100 44
2c
,
108
6c
l
10 1101 45
2d
109
6d
m
swr
10 1110 46
2e
.
110
6e
n
cache
10 1111 47
2f
/
111
6f
o
ll
tge
11 0000 48
30
0
112
70
p
c.f.f
lwc1
tgeu
11 0001 49
31
1
113
71
q
c.un.f
lwc2
tlt
11 0010 50
32
2
114
72
r
c.eq.f
pref
tltu
11 0011 51
33
3
115
73
s
c.ueq.f
teq
11 0100 52
34
4
116
74
t
c.olt.f
ldc1
11 0101 53
35
5
117
75
u
c.ult.f
ldc2
tne
11 0110 54
36
6
118
76
v
c.ole.f
c.ule.f
11 0111 55
37
7
119
77
w
sc
11 1000 56
38
8
120
78
x
c.sf.f
swc1
57
39
9
121
79
y
c.ngle.f 11 1001
swc2
11 1010 58
3a
:
122
7a
z
c.seq.f
c.ngl.f
11 1011 59
3b
;
123
7b
{
c.lt.f
11 1100 60
3c
<
124
7c
|
sdc1
11 1101 61
3d
=
125
7d
}
c.nge.f
sdc2
11 1110 62
3e
>
126
7e
~
c.le.f
c.ngt.f
11 1111 63
3f
?
127
7f DEL
(1) opcode(31:26) == 0
(2) opcode(31:26) == 17ten (11hex); if fmt(25:21)==16ten (10hex) f = s (single);
if fmt(25:21)==17ten (11hex) f = d (double)