summaryrefslogtreecommitdiff
path: root/opcodes
blob: b848061c3b77d72fe437168748ccbe410213205f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# format of a line in this file:
# <instruction name> <opcode> <args>
#
# <opcode> is given by specifying one or more range/value pairs:
# highbit..lowbit=value (e.g. 31..25=0x45 14..12=0x0)
#
# <args> is one of xa,xb,xc,fa,fb,fc,fd,imm,imm20,imm27,shamt,shamtw

unimp   31..0=0

j       31..27=0x18 imm27 # opcodes 0x60-0x64
jal     31..27=0x19 imm27 # opcodes 0x64-0x68

lui     31..25=0x71 xa imm20

beq     31..25=0x73 14..12=0 xa xb imm
bne     31..25=0x73 14..12=1 xa xb imm
blt     31..25=0x73 14..12=4 xa xb imm
bge     31..25=0x73 14..12=5 xa xb imm
bltu    31..25=0x73 14..12=6 xa xb imm
bgeu    31..25=0x73 14..12=7 xa xb imm

addi    31..25=0x74 14..12=0 xa xb imm
slti    31..25=0x74 14..12=2 xa xb imm
sltiu   31..25=0x74 14..12=3 xa xb imm
andi    31..25=0x74 14..12=4 xa xb imm
ori     31..25=0x74 14..12=5 xa xb imm
xori    31..25=0x74 14..12=6 xa xb imm
slli    31..25=0x74 14..12=7 11..6=1 xa xb shamt
srli    31..25=0x74 14..12=7 11..6=2 xa xb shamt
srai    31..25=0x74 14..12=7 11..6=3 xa xb shamt

add     31..25=0x75 14..12=0 11..5=0 xc xb xa
sub     31..25=0x75 14..12=0 11..5=1 xc xb xa
slt     31..25=0x75 14..12=0 11..5=2 xc xb xa
sltu    31..25=0x75 14..12=0 11..5=3 xc xb xa
and     31..25=0x75 14..12=0 11..5=4 xc xb xa
or      31..25=0x75 14..12=0 11..5=5 xc xb xa
xor     31..25=0x75 14..12=0 11..5=6 xc xb xa
nor     31..25=0x75 14..12=0 11..5=7 xc xb xa
sll    31..25=0x75 14..12=7 11..6=1 5=0 xc xb xa
srl    31..25=0x75 14..12=7 11..6=2 5=0 xc xb xa
sra    31..25=0x75 14..12=7 11..6=3 5=0 xc xb xa

mul     31..25=0x75 14..12=1 11..5=0 xc xb xa
mulh    31..25=0x75 14..12=1 11..5=2 xc xb xa
mulhu   31..25=0x75 14..12=1 11..5=3 xc xb xa
div     31..25=0x75 14..12=1 11..5=4 xc xb xa
divu    31..25=0x75 14..12=1 11..5=5 xc xb xa
rem     31..25=0x75 14..12=1 11..5=6 xc xb xa
remu    31..25=0x75 14..12=1 11..5=7 xc xb xa



addiw   31..25=0x76 14..12=0 xa xb imm
slliw   31..25=0x76 14..12=7 11..6=1 5=0 xa xb shamtw
srliw   31..25=0x76 14..12=7 11..6=2 5=0 xa xb shamtw
sraiw   31..25=0x76 14..12=7 11..6=3 5=0 xa xb shamtw

addw    31..25=0x77 14..12=0 11..5=0 xc xb xa
subw    31..25=0x77 14..12=0 11..5=1 xc xb xa
sllw   31..25=0x77 14..12=7 11..6=1 5=0 xc xb xa
srlw   31..25=0x77 14..12=7 11..6=2 5=0 xc xb xa
sraw   31..25=0x77 14..12=7 11..6=3 5=0 xc xb xa

mulw    31..25=0x77 14..12=1 11..5=0 xc xb xa
mulhw   31..25=0x77 14..12=1 11..5=2 xc xb xa
mulhuw  31..25=0x77 14..12=1 11..5=3 xc xb xa
divw    31..25=0x77 14..12=1 11..5=4 xc xb xa
divuw   31..25=0x77 14..12=1 11..5=5 xc xb xa
remw    31..25=0x77 14..12=1 11..5=6 xc xb xa
remuw   31..25=0x77 14..12=1 11..5=7 xc xb xa

lb      31..25=0x78 14..12=0 xa xb imm
lh      31..25=0x78 14..12=1 xa xb imm
lw      31..25=0x78 14..12=2 xa xb imm
ld      31..25=0x78 14..12=3 xa xb imm
lbu     31..25=0x78 14..12=4 xa xb imm
lhu     31..25=0x78 14..12=5 xa xb imm
lwu     31..25=0x78 14..12=6 xa xb imm
synci   31..25=0x78 14..12=7 24..20=0 xb imm

sb      31..25=0x79 14..12=0 xa xb imm
sh      31..25=0x79 14..12=1 xa xb imm
sw      31..25=0x79 14..12=2 xa xb imm
sd      31..25=0x79 14..12=3 xa xb imm

amow.add    31..25=0x7A 14..12=2 11..5=0 xc xb xa
amow.swap   31..25=0x7A 14..12=2 11..5=1 xc xb xa
amow.and    31..25=0x7A 14..12=2 11..5=2 xc xb xa
amow.or     31..25=0x7A 14..12=2 11..5=3 xc xb xa
amow.min    31..25=0x7A 14..12=2 11..5=4 xc xb xa
amow.max    31..25=0x7A 14..12=2 11..5=5 xc xb xa
amow.minu   31..25=0x7A 14..12=2 11..5=6 xc xb xa
amow.maxu   31..25=0x7A 14..12=2 11..5=7 xc xb xa

amo.add     31..25=0x7A 14..12=3 11..5=0 xc xb xa
amo.swap    31..25=0x7A 14..12=3 11..5=1 xc xb xa
amo.and     31..25=0x7A 14..12=3 11..5=2 xc xb xa
amo.or      31..25=0x7A 14..12=3 11..5=3 xc xb xa
amo.min     31..25=0x7A 14..12=3 11..5=4 xc xb xa
amo.max     31..25=0x7A 14..12=3 11..5=5 xc xb xa
amo.minu    31..25=0x7A 14..12=3 11..5=6 xc xb xa
amo.maxu    31..25=0x7A 14..12=3 11..5=7 xc xb xa

jalr.c  31..25=0x7B 19..15=0 14..12=0 11..5=0 xc xa
jalr.r  31..25=0x7B 19..15=0 14..12=0 11..5=1 xc xa
jalr.j  31..25=0x7B 19..15=0 14..12=0 11..5=2 xc xa
rdnpc   31..25=0x7B 24..15=0 14..12=1 11..5=0 xc
mfcr    31..25=0x7B 24..20=0 14..12=2 11..5=0 xc xb
mtcr    31..25=0x7B          14..12=3 11..0=0 xa xb
sync    31..25=0x7B 24..15=0 14..12=4 11..0=0
syscall 31..25=0x7B 24..15=0 14..12=5 11..0=0
break   31..25=0x7B 24..15=0 14..12=6 11..0=0

ei      31..25=0x7E 14..12=0 24..15=0 11..5=0 xc
di      31..25=0x7E 14..12=1 24..15=0 11..5=0 xc
eret    31..25=0x7E 14..12=2 24..15=0 11..0=0
mfpcr   31..25=0x7E 14..12=4 24..20=0 11..5=0 xc xb
mtpcr   31..25=0x7E 14..12=5          11..0=0 xa xb

# 0x7F is reserved for 64-bit-long instructions

add.s       31..25=0x68 14..13=0 12..10=0 9..5=0 fc fb fa
sub.s       31..25=0x68 14..13=0 12..10=0 9..5=1 fc fb fa
mul.s       31..25=0x68 14..13=0 12..10=0 9..5=2 fc fb fa
div.s       31..25=0x68 14..13=0 12..10=0 9..5=3 fc fb fa
sqrt.s      31..25=0x68 14..13=0 12..10=0 9..5=4 19..15=0 fc fa
sgninj.s    31..25=0x68 14..13=0 12..10=0 9..5=5 fc fb fa
sgninjn.s   31..25=0x68 14..13=0 12..10=0 9..5=6 fc fb fa
sgnmul.s    31..25=0x68 14..13=0 12..10=0 9..5=7 fc fb fa

add.d       31..25=0x68 14..13=3 12..10=0 9..5=0 fc fb fa
sub.d       31..25=0x68 14..13=3 12..10=0 9..5=1 fc fb fa
mul.d       31..25=0x68 14..13=3 12..10=0 9..5=2 fc fb fa
div.d       31..25=0x68 14..13=3 12..10=0 9..5=3 fc fb fa
sqrt.d      31..25=0x68 14..13=3 12..10=0 9..5=4 19..15=0 fc fa
sgninj.d    31..25=0x68 14..13=3 12..10=0 9..5=5 fc fb fa
sgninjn.d   31..25=0x68 14..13=3 12..10=0 9..5=6 fc fb fa
sgnmul.d    31..25=0x68 14..13=3 12..10=0 9..5=7 fc fb fa

trunc.l.s   31..25=0x68 14..13=0 12..10=1 9..5=0 19..15=0 fc fa
truncu.l.s  31..25=0x68 14..13=0 12..10=1 9..5=1 19..15=0 fc fa
trunc.w.s   31..25=0x68 14..13=0 12..10=1 9..5=2 19..15=0 fc fa
truncu.w.s  31..25=0x68 14..13=0 12..10=1 9..5=3 19..15=0 fc fa

trunc.l.d   31..25=0x68 14..13=3 12..10=1 9..5=0 19..15=0 fc fa
truncu.l.d  31..25=0x68 14..13=3 12..10=1 9..5=1 19..15=0 fc fa
trunc.w.d   31..25=0x68 14..13=3 12..10=1 9..5=2 19..15=0 fc fa
truncu.w.d  31..25=0x68 14..13=3 12..10=1 9..5=3 19..15=0 fc fa

cvt.s.l     31..25=0x68 14..13=0 12..10=1 9..5=4 19..15=0 fc fa
cvtu.s.l    31..25=0x68 14..13=0 12..10=1 9..5=5 19..15=0 fc fa
cvt.s.w     31..25=0x68 14..13=0 12..10=1 9..5=6 19..15=0 fc fa
cvtu.s.w    31..25=0x68 14..13=0 12..10=1 9..5=7 19..15=0 fc fa

cvt.d.l     31..25=0x68 14..13=3 12..10=1 9..5=4 19..15=0 fc fa
cvtu.d.l    31..25=0x68 14..13=3 12..10=1 9..5=5 19..15=0 fc fa
cvt.d.w     31..25=0x68 14..13=3 12..10=1 9..5=6 19..15=0 fc fa
cvtu.d.w    31..25=0x68 14..13=3 12..10=1 9..5=7 19..15=0 fc fa

cvt.s.d     31..25=0x68 14..13=0 12..10=1 9..5=0x13 19..15=0 fc fa
cvt.d.s     31..25=0x68 14..13=3 12..10=1 9..5=0x10 19..15=0 fc fa

c.eq.s  31..25=0x68 14..13=0 12..10=2 9..5=1 xc fa fb
c.lt.s  31..25=0x68 14..13=0 12..10=2 9..5=2 xc fa fb
c.le.s  31..25=0x68 14..13=0 12..10=2 9..5=3 xc fa fb

c.eq.d  31..25=0x68 14..13=3 12..10=2 9..5=1 xc fa fb
c.lt.d  31..25=0x68 14..13=3 12..10=2 9..5=2 xc fa fb
c.le.d  31..25=0x68 14..13=3 12..10=2 9..5=3 xc fa fb

l.s     31..25=0x69 14..13=0 12=0 fa xb imm
l.d     31..25=0x69 14..13=3 12=0 fa xb imm
s.s     31..25=0x69 14..13=0 12=1 fa xb imm
s.d     31..25=0x69 14..13=3 12=1 fa xb imm

mff.s   31..25=0x6A 19..15=0 14..13=0 12..10=0 9..5=0 xc fa
mff.d   31..25=0x6A 19..15=0 14..13=3 12..10=0 9..5=0 xc fa
mffh.d  31..25=0x6A 19..15=0 14..13=3 12..10=1 9..5=0 xc fa
mtf.s   31..25=0x6A 19..15=0 14..13=0 12..10=2 9..5=0 fc xa
mtf.d   31..25=0x6A 19..15=0 14..13=3 12..10=2 9..5=0 fc xa
mtflh.d 31..25=0x6A 14..13=3 12..10=3 9..5=0 fc xa xb

madd.s  31..25=0x6B 14..13=0 12..10=0 fc fb fa fd
msub.s  31..25=0x6B 14..13=0 12..10=1 fc fb fa fd
nmadd.s 31..25=0x6B 14..13=0 12..10=2 fc fb fa fd
nmsub.s 31..25=0x6B 14..13=0 12..10=3 fc fb fa fd

madd.d  31..25=0x6B 14..13=3 12..10=0 fc fb fa fd
msub.d  31..25=0x6B 14..13=3 12..10=1 fc fb fa fd
nmadd.d 31..25=0x6B 14..13=3 12..10=2 fc fb fa fd
nmsub.d 31..25=0x6B 14..13=3 12..10=3 fc fb fa fd