xref: /freebsd/sys/riscv/include/encoding.h (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1 /*-
2  * This file is in the public domain.
3  */
4 /* $FreeBSD$ */
5 
6 /* Automatically generated by parse-opcodes.  */
7 #ifndef RISCV_ENCODING_H
8 #define RISCV_ENCODING_H
9 #define MATCH_BEQ 0x63
10 #define MASK_BEQ  0x707f
11 #define MATCH_BNE 0x1063
12 #define MASK_BNE  0x707f
13 #define MATCH_BLT 0x4063
14 #define MASK_BLT  0x707f
15 #define MATCH_BGE 0x5063
16 #define MASK_BGE  0x707f
17 #define MATCH_BLTU 0x6063
18 #define MASK_BLTU  0x707f
19 #define MATCH_BGEU 0x7063
20 #define MASK_BGEU  0x707f
21 #define MATCH_JALR 0x67
22 #define MASK_JALR  0x707f
23 #define MATCH_JAL 0x6f
24 #define MASK_JAL  0x7f
25 #define MATCH_LUI 0x37
26 #define MASK_LUI  0x7f
27 #define MATCH_AUIPC 0x17
28 #define MASK_AUIPC  0x7f
29 #define MATCH_ADDI 0x13
30 #define MASK_ADDI  0x707f
31 #define MATCH_SLLI 0x1013
32 #define MASK_SLLI  0xfc00707f
33 #define MATCH_SLTI 0x2013
34 #define MASK_SLTI  0x707f
35 #define MATCH_SLTIU 0x3013
36 #define MASK_SLTIU  0x707f
37 #define MATCH_XORI 0x4013
38 #define MASK_XORI  0x707f
39 #define MATCH_SRLI 0x5013
40 #define MASK_SRLI  0xfc00707f
41 #define MATCH_SRAI 0x40005013
42 #define MASK_SRAI  0xfc00707f
43 #define MATCH_ORI 0x6013
44 #define MASK_ORI  0x707f
45 #define MATCH_ANDI 0x7013
46 #define MASK_ANDI  0x707f
47 #define MATCH_ADD 0x33
48 #define MASK_ADD  0xfe00707f
49 #define MATCH_SUB 0x40000033
50 #define MASK_SUB  0xfe00707f
51 #define MATCH_SLL 0x1033
52 #define MASK_SLL  0xfe00707f
53 #define MATCH_SLT 0x2033
54 #define MASK_SLT  0xfe00707f
55 #define MATCH_SLTU 0x3033
56 #define MASK_SLTU  0xfe00707f
57 #define MATCH_XOR 0x4033
58 #define MASK_XOR  0xfe00707f
59 #define MATCH_SRL 0x5033
60 #define MASK_SRL  0xfe00707f
61 #define MATCH_SRA 0x40005033
62 #define MASK_SRA  0xfe00707f
63 #define MATCH_OR 0x6033
64 #define MASK_OR  0xfe00707f
65 #define MATCH_AND 0x7033
66 #define MASK_AND  0xfe00707f
67 #define MATCH_ADDIW 0x1b
68 #define MASK_ADDIW  0x707f
69 #define MATCH_SLLIW 0x101b
70 #define MASK_SLLIW  0xfe00707f
71 #define MATCH_SRLIW 0x501b
72 #define MASK_SRLIW  0xfe00707f
73 #define MATCH_SRAIW 0x4000501b
74 #define MASK_SRAIW  0xfe00707f
75 #define MATCH_ADDW 0x3b
76 #define MASK_ADDW  0xfe00707f
77 #define MATCH_SUBW 0x4000003b
78 #define MASK_SUBW  0xfe00707f
79 #define MATCH_SLLW 0x103b
80 #define MASK_SLLW  0xfe00707f
81 #define MATCH_SRLW 0x503b
82 #define MASK_SRLW  0xfe00707f
83 #define MATCH_SRAW 0x4000503b
84 #define MASK_SRAW  0xfe00707f
85 #define MATCH_LB 0x3
86 #define MASK_LB  0x707f
87 #define MATCH_LH 0x1003
88 #define MASK_LH  0x707f
89 #define MATCH_LW 0x2003
90 #define MASK_LW  0x707f
91 #define MATCH_LD 0x3003
92 #define MASK_LD  0x707f
93 #define MATCH_LBU 0x4003
94 #define MASK_LBU  0x707f
95 #define MATCH_LHU 0x5003
96 #define MASK_LHU  0x707f
97 #define MATCH_LWU 0x6003
98 #define MASK_LWU  0x707f
99 #define MATCH_SB 0x23
100 #define MASK_SB  0x707f
101 #define MATCH_SH 0x1023
102 #define MASK_SH  0x707f
103 #define MATCH_SW 0x2023
104 #define MASK_SW  0x707f
105 #define MATCH_SD 0x3023
106 #define MASK_SD  0x707f
107 #define MATCH_FENCE 0xf
108 #define MASK_FENCE  0x707f
109 #define MATCH_FENCE_I 0x100f
110 #define MASK_FENCE_I  0x707f
111 #define MATCH_MUL 0x2000033
112 #define MASK_MUL  0xfe00707f
113 #define MATCH_MULH 0x2001033
114 #define MASK_MULH  0xfe00707f
115 #define MATCH_MULHSU 0x2002033
116 #define MASK_MULHSU  0xfe00707f
117 #define MATCH_MULHU 0x2003033
118 #define MASK_MULHU  0xfe00707f
119 #define MATCH_DIV 0x2004033
120 #define MASK_DIV  0xfe00707f
121 #define MATCH_DIVU 0x2005033
122 #define MASK_DIVU  0xfe00707f
123 #define MATCH_REM 0x2006033
124 #define MASK_REM  0xfe00707f
125 #define MATCH_REMU 0x2007033
126 #define MASK_REMU  0xfe00707f
127 #define MATCH_MULW 0x200003b
128 #define MASK_MULW  0xfe00707f
129 #define MATCH_DIVW 0x200403b
130 #define MASK_DIVW  0xfe00707f
131 #define MATCH_DIVUW 0x200503b
132 #define MASK_DIVUW  0xfe00707f
133 #define MATCH_REMW 0x200603b
134 #define MASK_REMW  0xfe00707f
135 #define MATCH_REMUW 0x200703b
136 #define MASK_REMUW  0xfe00707f
137 #define MATCH_AMOADD_W 0x202f
138 #define MASK_AMOADD_W  0xf800707f
139 #define MATCH_AMOXOR_W 0x2000202f
140 #define MASK_AMOXOR_W  0xf800707f
141 #define MATCH_AMOOR_W 0x4000202f
142 #define MASK_AMOOR_W  0xf800707f
143 #define MATCH_AMOAND_W 0x6000202f
144 #define MASK_AMOAND_W  0xf800707f
145 #define MATCH_AMOMIN_W 0x8000202f
146 #define MASK_AMOMIN_W  0xf800707f
147 #define MATCH_AMOMAX_W 0xa000202f
148 #define MASK_AMOMAX_W  0xf800707f
149 #define MATCH_AMOMINU_W 0xc000202f
150 #define MASK_AMOMINU_W  0xf800707f
151 #define MATCH_AMOMAXU_W 0xe000202f
152 #define MASK_AMOMAXU_W  0xf800707f
153 #define MATCH_AMOSWAP_W 0x800202f
154 #define MASK_AMOSWAP_W  0xf800707f
155 #define MATCH_LR_W 0x1000202f
156 #define MASK_LR_W  0xf9f0707f
157 #define MATCH_SC_W 0x1800202f
158 #define MASK_SC_W  0xf800707f
159 #define MATCH_AMOADD_D 0x302f
160 #define MASK_AMOADD_D  0xf800707f
161 #define MATCH_AMOXOR_D 0x2000302f
162 #define MASK_AMOXOR_D  0xf800707f
163 #define MATCH_AMOOR_D 0x4000302f
164 #define MASK_AMOOR_D  0xf800707f
165 #define MATCH_AMOAND_D 0x6000302f
166 #define MASK_AMOAND_D  0xf800707f
167 #define MATCH_AMOMIN_D 0x8000302f
168 #define MASK_AMOMIN_D  0xf800707f
169 #define MATCH_AMOMAX_D 0xa000302f
170 #define MASK_AMOMAX_D  0xf800707f
171 #define MATCH_AMOMINU_D 0xc000302f
172 #define MASK_AMOMINU_D  0xf800707f
173 #define MATCH_AMOMAXU_D 0xe000302f
174 #define MASK_AMOMAXU_D  0xf800707f
175 #define MATCH_AMOSWAP_D 0x800302f
176 #define MASK_AMOSWAP_D  0xf800707f
177 #define MATCH_LR_D 0x1000302f
178 #define MASK_LR_D  0xf9f0707f
179 #define MATCH_SC_D 0x1800302f
180 #define MASK_SC_D  0xf800707f
181 #define MATCH_ECALL 0x73
182 #define MASK_ECALL  0xffffffff
183 #define MATCH_EBREAK 0x100073
184 #define MASK_EBREAK  0xffffffff
185 #define MATCH_URET 0x200073
186 #define MASK_URET  0xffffffff
187 #define MATCH_SRET 0x10200073
188 #define MASK_SRET  0xffffffff
189 #define MATCH_MRET 0x30200073
190 #define MASK_MRET  0xffffffff
191 #define MATCH_DRET 0x7b200073
192 #define MASK_DRET  0xffffffff
193 #define MATCH_SFENCE_VMA 0x12000073
194 #define MASK_SFENCE_VMA  0xfe007fff
195 #define MATCH_WFI 0x10500073
196 #define MASK_WFI  0xffffffff
197 #define MATCH_CSRRW 0x1073
198 #define MASK_CSRRW  0x707f
199 #define MATCH_CSRRS 0x2073
200 #define MASK_CSRRS  0x707f
201 #define MATCH_CSRRC 0x3073
202 #define MASK_CSRRC  0x707f
203 #define MATCH_CSRRWI 0x5073
204 #define MASK_CSRRWI  0x707f
205 #define MATCH_CSRRSI 0x6073
206 #define MASK_CSRRSI  0x707f
207 #define MATCH_CSRRCI 0x7073
208 #define MASK_CSRRCI  0x707f
209 #define MATCH_FADD_S 0x53
210 #define MASK_FADD_S  0xfe00007f
211 #define MATCH_FSUB_S 0x8000053
212 #define MASK_FSUB_S  0xfe00007f
213 #define MATCH_FMUL_S 0x10000053
214 #define MASK_FMUL_S  0xfe00007f
215 #define MATCH_FDIV_S 0x18000053
216 #define MASK_FDIV_S  0xfe00007f
217 #define MATCH_FSGNJ_S 0x20000053
218 #define MASK_FSGNJ_S  0xfe00707f
219 #define MATCH_FSGNJN_S 0x20001053
220 #define MASK_FSGNJN_S  0xfe00707f
221 #define MATCH_FSGNJX_S 0x20002053
222 #define MASK_FSGNJX_S  0xfe00707f
223 #define MATCH_FMIN_S 0x28000053
224 #define MASK_FMIN_S  0xfe00707f
225 #define MATCH_FMAX_S 0x28001053
226 #define MASK_FMAX_S  0xfe00707f
227 #define MATCH_FSQRT_S 0x58000053
228 #define MASK_FSQRT_S  0xfff0007f
229 #define MATCH_FADD_D 0x2000053
230 #define MASK_FADD_D  0xfe00007f
231 #define MATCH_FSUB_D 0xa000053
232 #define MASK_FSUB_D  0xfe00007f
233 #define MATCH_FMUL_D 0x12000053
234 #define MASK_FMUL_D  0xfe00007f
235 #define MATCH_FDIV_D 0x1a000053
236 #define MASK_FDIV_D  0xfe00007f
237 #define MATCH_FSGNJ_D 0x22000053
238 #define MASK_FSGNJ_D  0xfe00707f
239 #define MATCH_FSGNJN_D 0x22001053
240 #define MASK_FSGNJN_D  0xfe00707f
241 #define MATCH_FSGNJX_D 0x22002053
242 #define MASK_FSGNJX_D  0xfe00707f
243 #define MATCH_FMIN_D 0x2a000053
244 #define MASK_FMIN_D  0xfe00707f
245 #define MATCH_FMAX_D 0x2a001053
246 #define MASK_FMAX_D  0xfe00707f
247 #define MATCH_FCVT_S_D 0x40100053
248 #define MASK_FCVT_S_D  0xfff0007f
249 #define MATCH_FCVT_D_S 0x42000053
250 #define MASK_FCVT_D_S  0xfff0007f
251 #define MATCH_FSQRT_D 0x5a000053
252 #define MASK_FSQRT_D  0xfff0007f
253 #define MATCH_FADD_Q 0x6000053
254 #define MASK_FADD_Q  0xfe00007f
255 #define MATCH_FSUB_Q 0xe000053
256 #define MASK_FSUB_Q  0xfe00007f
257 #define MATCH_FMUL_Q 0x16000053
258 #define MASK_FMUL_Q  0xfe00007f
259 #define MATCH_FDIV_Q 0x1e000053
260 #define MASK_FDIV_Q  0xfe00007f
261 #define MATCH_FSGNJ_Q 0x26000053
262 #define MASK_FSGNJ_Q  0xfe00707f
263 #define MATCH_FSGNJN_Q 0x26001053
264 #define MASK_FSGNJN_Q  0xfe00707f
265 #define MATCH_FSGNJX_Q 0x26002053
266 #define MASK_FSGNJX_Q  0xfe00707f
267 #define MATCH_FMIN_Q 0x2e000053
268 #define MASK_FMIN_Q  0xfe00707f
269 #define MATCH_FMAX_Q 0x2e001053
270 #define MASK_FMAX_Q  0xfe00707f
271 #define MATCH_FCVT_S_Q 0x40300053
272 #define MASK_FCVT_S_Q  0xfff0007f
273 #define MATCH_FCVT_Q_S 0x46000053
274 #define MASK_FCVT_Q_S  0xfff0007f
275 #define MATCH_FCVT_D_Q 0x42300053
276 #define MASK_FCVT_D_Q  0xfff0007f
277 #define MATCH_FCVT_Q_D 0x46100053
278 #define MASK_FCVT_Q_D  0xfff0007f
279 #define MATCH_FSQRT_Q 0x5e000053
280 #define MASK_FSQRT_Q  0xfff0007f
281 #define MATCH_FLE_S 0xa0000053
282 #define MASK_FLE_S  0xfe00707f
283 #define MATCH_FLT_S 0xa0001053
284 #define MASK_FLT_S  0xfe00707f
285 #define MATCH_FEQ_S 0xa0002053
286 #define MASK_FEQ_S  0xfe00707f
287 #define MATCH_FLE_D 0xa2000053
288 #define MASK_FLE_D  0xfe00707f
289 #define MATCH_FLT_D 0xa2001053
290 #define MASK_FLT_D  0xfe00707f
291 #define MATCH_FEQ_D 0xa2002053
292 #define MASK_FEQ_D  0xfe00707f
293 #define MATCH_FLE_Q 0xa6000053
294 #define MASK_FLE_Q  0xfe00707f
295 #define MATCH_FLT_Q 0xa6001053
296 #define MASK_FLT_Q  0xfe00707f
297 #define MATCH_FEQ_Q 0xa6002053
298 #define MASK_FEQ_Q  0xfe00707f
299 #define MATCH_FCVT_W_S 0xc0000053
300 #define MASK_FCVT_W_S  0xfff0007f
301 #define MATCH_FCVT_WU_S 0xc0100053
302 #define MASK_FCVT_WU_S  0xfff0007f
303 #define MATCH_FCVT_L_S 0xc0200053
304 #define MASK_FCVT_L_S  0xfff0007f
305 #define MATCH_FCVT_LU_S 0xc0300053
306 #define MASK_FCVT_LU_S  0xfff0007f
307 #define MATCH_FMV_X_W 0xe0000053
308 #define MASK_FMV_X_W  0xfff0707f
309 #define MATCH_FCLASS_S 0xe0001053
310 #define MASK_FCLASS_S  0xfff0707f
311 #define MATCH_FCVT_W_D 0xc2000053
312 #define MASK_FCVT_W_D  0xfff0007f
313 #define MATCH_FCVT_WU_D 0xc2100053
314 #define MASK_FCVT_WU_D  0xfff0007f
315 #define MATCH_FCVT_L_D 0xc2200053
316 #define MASK_FCVT_L_D  0xfff0007f
317 #define MATCH_FCVT_LU_D 0xc2300053
318 #define MASK_FCVT_LU_D  0xfff0007f
319 #define MATCH_FMV_X_D 0xe2000053
320 #define MASK_FMV_X_D  0xfff0707f
321 #define MATCH_FCLASS_D 0xe2001053
322 #define MASK_FCLASS_D  0xfff0707f
323 #define MATCH_FCVT_W_Q 0xc6000053
324 #define MASK_FCVT_W_Q  0xfff0007f
325 #define MATCH_FCVT_WU_Q 0xc6100053
326 #define MASK_FCVT_WU_Q  0xfff0007f
327 #define MATCH_FCVT_L_Q 0xc6200053
328 #define MASK_FCVT_L_Q  0xfff0007f
329 #define MATCH_FCVT_LU_Q 0xc6300053
330 #define MASK_FCVT_LU_Q  0xfff0007f
331 #define MATCH_FMV_X_Q 0xe6000053
332 #define MASK_FMV_X_Q  0xfff0707f
333 #define MATCH_FCLASS_Q 0xe6001053
334 #define MASK_FCLASS_Q  0xfff0707f
335 #define MATCH_FCVT_S_W 0xd0000053
336 #define MASK_FCVT_S_W  0xfff0007f
337 #define MATCH_FCVT_S_WU 0xd0100053
338 #define MASK_FCVT_S_WU  0xfff0007f
339 #define MATCH_FCVT_S_L 0xd0200053
340 #define MASK_FCVT_S_L  0xfff0007f
341 #define MATCH_FCVT_S_LU 0xd0300053
342 #define MASK_FCVT_S_LU  0xfff0007f
343 #define MATCH_FMV_W_X 0xf0000053
344 #define MASK_FMV_W_X  0xfff0707f
345 #define MATCH_FCVT_D_W 0xd2000053
346 #define MASK_FCVT_D_W  0xfff0007f
347 #define MATCH_FCVT_D_WU 0xd2100053
348 #define MASK_FCVT_D_WU  0xfff0007f
349 #define MATCH_FCVT_D_L 0xd2200053
350 #define MASK_FCVT_D_L  0xfff0007f
351 #define MATCH_FCVT_D_LU 0xd2300053
352 #define MASK_FCVT_D_LU  0xfff0007f
353 #define MATCH_FMV_D_X 0xf2000053
354 #define MASK_FMV_D_X  0xfff0707f
355 #define MATCH_FCVT_Q_W 0xd6000053
356 #define MASK_FCVT_Q_W  0xfff0007f
357 #define MATCH_FCVT_Q_WU 0xd6100053
358 #define MASK_FCVT_Q_WU  0xfff0007f
359 #define MATCH_FCVT_Q_L 0xd6200053
360 #define MASK_FCVT_Q_L  0xfff0007f
361 #define MATCH_FCVT_Q_LU 0xd6300053
362 #define MASK_FCVT_Q_LU  0xfff0007f
363 #define MATCH_FMV_Q_X 0xf6000053
364 #define MASK_FMV_Q_X  0xfff0707f
365 #define MATCH_FLW 0x2007
366 #define MASK_FLW  0x707f
367 #define MATCH_FLD 0x3007
368 #define MASK_FLD  0x707f
369 #define MATCH_FLQ 0x4007
370 #define MASK_FLQ  0x707f
371 #define MATCH_FSW 0x2027
372 #define MASK_FSW  0x707f
373 #define MATCH_FSD 0x3027
374 #define MASK_FSD  0x707f
375 #define MATCH_FSQ 0x4027
376 #define MASK_FSQ  0x707f
377 #define MATCH_FMADD_S 0x43
378 #define MASK_FMADD_S  0x600007f
379 #define MATCH_FMSUB_S 0x47
380 #define MASK_FMSUB_S  0x600007f
381 #define MATCH_FNMSUB_S 0x4b
382 #define MASK_FNMSUB_S  0x600007f
383 #define MATCH_FNMADD_S 0x4f
384 #define MASK_FNMADD_S  0x600007f
385 #define MATCH_FMADD_D 0x2000043
386 #define MASK_FMADD_D  0x600007f
387 #define MATCH_FMSUB_D 0x2000047
388 #define MASK_FMSUB_D  0x600007f
389 #define MATCH_FNMSUB_D 0x200004b
390 #define MASK_FNMSUB_D  0x600007f
391 #define MATCH_FNMADD_D 0x200004f
392 #define MASK_FNMADD_D  0x600007f
393 #define MATCH_FMADD_Q 0x6000043
394 #define MASK_FMADD_Q  0x600007f
395 #define MATCH_FMSUB_Q 0x6000047
396 #define MASK_FMSUB_Q  0x600007f
397 #define MATCH_FNMSUB_Q 0x600004b
398 #define MASK_FNMSUB_Q  0x600007f
399 #define MATCH_FNMADD_Q 0x600004f
400 #define MASK_FNMADD_Q  0x600007f
401 #define MATCH_C_NOP 0x1
402 #define MASK_C_NOP  0xffff
403 #define MATCH_C_ADDI16SP 0x6101
404 #define MASK_C_ADDI16SP  0xef83
405 #define MATCH_C_JR 0x8002
406 #define MASK_C_JR  0xf07f
407 #define MATCH_C_JALR 0x9002
408 #define MASK_C_JALR  0xf07f
409 #define MATCH_C_EBREAK 0x9002
410 #define MASK_C_EBREAK  0xffff
411 #define MATCH_C_LD 0x6000
412 #define MASK_C_LD  0xe003
413 #define MATCH_C_SD 0xe000
414 #define MASK_C_SD  0xe003
415 #define MATCH_C_ADDIW 0x2001
416 #define MASK_C_ADDIW  0xe003
417 #define MATCH_C_LDSP 0x6002
418 #define MASK_C_LDSP  0xe003
419 #define MATCH_C_SDSP 0xe002
420 #define MASK_C_SDSP  0xe003
421 #define MATCH_C_ADDI4SPN 0x0
422 #define MASK_C_ADDI4SPN  0xe003
423 #define MATCH_C_FLD 0x2000
424 #define MASK_C_FLD  0xe003
425 #define MATCH_C_LW 0x4000
426 #define MASK_C_LW  0xe003
427 #define MATCH_C_FLW 0x6000
428 #define MASK_C_FLW  0xe003
429 #define MATCH_C_FSD 0xa000
430 #define MASK_C_FSD  0xe003
431 #define MATCH_C_SW 0xc000
432 #define MASK_C_SW  0xe003
433 #define MATCH_C_FSW 0xe000
434 #define MASK_C_FSW  0xe003
435 #define MATCH_C_ADDI 0x1
436 #define MASK_C_ADDI  0xe003
437 #define MATCH_C_JAL 0x2001
438 #define MASK_C_JAL  0xe003
439 #define MATCH_C_LI 0x4001
440 #define MASK_C_LI  0xe003
441 #define MATCH_C_LUI 0x6001
442 #define MASK_C_LUI  0xe003
443 #define MATCH_C_SRLI 0x8001
444 #define MASK_C_SRLI  0xec03
445 #define MATCH_C_SRAI 0x8401
446 #define MASK_C_SRAI  0xec03
447 #define MATCH_C_ANDI 0x8801
448 #define MASK_C_ANDI  0xec03
449 #define MATCH_C_SUB 0x8c01
450 #define MASK_C_SUB  0xfc63
451 #define MATCH_C_XOR 0x8c21
452 #define MASK_C_XOR  0xfc63
453 #define MATCH_C_OR 0x8c41
454 #define MASK_C_OR  0xfc63
455 #define MATCH_C_AND 0x8c61
456 #define MASK_C_AND  0xfc63
457 #define MATCH_C_SUBW 0x9c01
458 #define MASK_C_SUBW  0xfc63
459 #define MATCH_C_ADDW 0x9c21
460 #define MASK_C_ADDW  0xfc63
461 #define MATCH_C_J 0xa001
462 #define MASK_C_J  0xe003
463 #define MATCH_C_BEQZ 0xc001
464 #define MASK_C_BEQZ  0xe003
465 #define MATCH_C_BNEZ 0xe001
466 #define MASK_C_BNEZ  0xe003
467 #define MATCH_C_SLLI 0x2
468 #define MASK_C_SLLI  0xe003
469 #define MATCH_C_FLDSP 0x2002
470 #define MASK_C_FLDSP  0xe003
471 #define MATCH_C_LWSP 0x4002
472 #define MASK_C_LWSP  0xe003
473 #define MATCH_C_FLWSP 0x6002
474 #define MASK_C_FLWSP  0xe003
475 #define MATCH_C_MV 0x8002
476 #define MASK_C_MV  0xf003
477 #define MATCH_C_ADD 0x9002
478 #define MASK_C_ADD  0xf003
479 #define MATCH_C_FSDSP 0xa002
480 #define MASK_C_FSDSP  0xe003
481 #define MATCH_C_SWSP 0xc002
482 #define MASK_C_SWSP  0xe003
483 #define MATCH_C_FSWSP 0xe002
484 #define MASK_C_FSWSP  0xe003
485 #define MATCH_CUSTOM0 0xb
486 #define MASK_CUSTOM0  0x707f
487 #define MATCH_CUSTOM0_RS1 0x200b
488 #define MASK_CUSTOM0_RS1  0x707f
489 #define MATCH_CUSTOM0_RS1_RS2 0x300b
490 #define MASK_CUSTOM0_RS1_RS2  0x707f
491 #define MATCH_CUSTOM0_RD 0x400b
492 #define MASK_CUSTOM0_RD  0x707f
493 #define MATCH_CUSTOM0_RD_RS1 0x600b
494 #define MASK_CUSTOM0_RD_RS1  0x707f
495 #define MATCH_CUSTOM0_RD_RS1_RS2 0x700b
496 #define MASK_CUSTOM0_RD_RS1_RS2  0x707f
497 #define MATCH_CUSTOM1 0x2b
498 #define MASK_CUSTOM1  0x707f
499 #define MATCH_CUSTOM1_RS1 0x202b
500 #define MASK_CUSTOM1_RS1  0x707f
501 #define MATCH_CUSTOM1_RS1_RS2 0x302b
502 #define MASK_CUSTOM1_RS1_RS2  0x707f
503 #define MATCH_CUSTOM1_RD 0x402b
504 #define MASK_CUSTOM1_RD  0x707f
505 #define MATCH_CUSTOM1_RD_RS1 0x602b
506 #define MASK_CUSTOM1_RD_RS1  0x707f
507 #define MATCH_CUSTOM1_RD_RS1_RS2 0x702b
508 #define MASK_CUSTOM1_RD_RS1_RS2  0x707f
509 #define MATCH_CUSTOM2 0x5b
510 #define MASK_CUSTOM2  0x707f
511 #define MATCH_CUSTOM2_RS1 0x205b
512 #define MASK_CUSTOM2_RS1  0x707f
513 #define MATCH_CUSTOM2_RS1_RS2 0x305b
514 #define MASK_CUSTOM2_RS1_RS2  0x707f
515 #define MATCH_CUSTOM2_RD 0x405b
516 #define MASK_CUSTOM2_RD  0x707f
517 #define MATCH_CUSTOM2_RD_RS1 0x605b
518 #define MASK_CUSTOM2_RD_RS1  0x707f
519 #define MATCH_CUSTOM2_RD_RS1_RS2 0x705b
520 #define MASK_CUSTOM2_RD_RS1_RS2  0x707f
521 #define MATCH_CUSTOM3 0x7b
522 #define MASK_CUSTOM3  0x707f
523 #define MATCH_CUSTOM3_RS1 0x207b
524 #define MASK_CUSTOM3_RS1  0x707f
525 #define MATCH_CUSTOM3_RS1_RS2 0x307b
526 #define MASK_CUSTOM3_RS1_RS2  0x707f
527 #define MATCH_CUSTOM3_RD 0x407b
528 #define MASK_CUSTOM3_RD  0x707f
529 #define MATCH_CUSTOM3_RD_RS1 0x607b
530 #define MASK_CUSTOM3_RD_RS1  0x707f
531 #define MATCH_CUSTOM3_RD_RS1_RS2 0x707b
532 #define MASK_CUSTOM3_RD_RS1_RS2  0x707f
533 #define CSR_FFLAGS 0x1
534 #define CSR_FRM 0x2
535 #define CSR_FCSR 0x3
536 #define CSR_CYCLE 0xc00
537 #define CSR_TIME 0xc01
538 #define CSR_INSTRET 0xc02
539 #define CSR_HPMCOUNTER3 0xc03
540 #define CSR_HPMCOUNTER4 0xc04
541 #define CSR_HPMCOUNTER5 0xc05
542 #define CSR_HPMCOUNTER6 0xc06
543 #define CSR_HPMCOUNTER7 0xc07
544 #define CSR_HPMCOUNTER8 0xc08
545 #define CSR_HPMCOUNTER9 0xc09
546 #define CSR_HPMCOUNTER10 0xc0a
547 #define CSR_HPMCOUNTER11 0xc0b
548 #define CSR_HPMCOUNTER12 0xc0c
549 #define CSR_HPMCOUNTER13 0xc0d
550 #define CSR_HPMCOUNTER14 0xc0e
551 #define CSR_HPMCOUNTER15 0xc0f
552 #define CSR_HPMCOUNTER16 0xc10
553 #define CSR_HPMCOUNTER17 0xc11
554 #define CSR_HPMCOUNTER18 0xc12
555 #define CSR_HPMCOUNTER19 0xc13
556 #define CSR_HPMCOUNTER20 0xc14
557 #define CSR_HPMCOUNTER21 0xc15
558 #define CSR_HPMCOUNTER22 0xc16
559 #define CSR_HPMCOUNTER23 0xc17
560 #define CSR_HPMCOUNTER24 0xc18
561 #define CSR_HPMCOUNTER25 0xc19
562 #define CSR_HPMCOUNTER26 0xc1a
563 #define CSR_HPMCOUNTER27 0xc1b
564 #define CSR_HPMCOUNTER28 0xc1c
565 #define CSR_HPMCOUNTER29 0xc1d
566 #define CSR_HPMCOUNTER30 0xc1e
567 #define CSR_HPMCOUNTER31 0xc1f
568 #define CSR_SSTATUS 0x100
569 #define CSR_SIE 0x104
570 #define CSR_STVEC 0x105
571 #define CSR_SCOUNTEREN 0x106
572 #define CSR_SSCRATCH 0x140
573 #define CSR_SEPC 0x141
574 #define CSR_SCAUSE 0x142
575 #define CSR_STVAL 0x143
576 #define CSR_SIP 0x144
577 #define CSR_SATP 0x180
578 #define CSR_MSTATUS 0x300
579 #define CSR_MISA 0x301
580 #define CSR_MEDELEG 0x302
581 #define CSR_MIDELEG 0x303
582 #define CSR_MIE 0x304
583 #define CSR_MTVEC 0x305
584 #define CSR_MCOUNTEREN 0x306
585 #define CSR_MSCRATCH 0x340
586 #define CSR_MEPC 0x341
587 #define CSR_MCAUSE 0x342
588 #define CSR_MTVAL 0x343
589 #define CSR_MIP 0x344
590 #define CSR_PMPCFG0 0x3a0
591 #define CSR_PMPCFG1 0x3a1
592 #define CSR_PMPCFG2 0x3a2
593 #define CSR_PMPCFG3 0x3a3
594 #define CSR_PMPADDR0 0x3b0
595 #define CSR_PMPADDR1 0x3b1
596 #define CSR_PMPADDR2 0x3b2
597 #define CSR_PMPADDR3 0x3b3
598 #define CSR_PMPADDR4 0x3b4
599 #define CSR_PMPADDR5 0x3b5
600 #define CSR_PMPADDR6 0x3b6
601 #define CSR_PMPADDR7 0x3b7
602 #define CSR_PMPADDR8 0x3b8
603 #define CSR_PMPADDR9 0x3b9
604 #define CSR_PMPADDR10 0x3ba
605 #define CSR_PMPADDR11 0x3bb
606 #define CSR_PMPADDR12 0x3bc
607 #define CSR_PMPADDR13 0x3bd
608 #define CSR_PMPADDR14 0x3be
609 #define CSR_PMPADDR15 0x3bf
610 #define CSR_TSELECT 0x7a0
611 #define CSR_TDATA1 0x7a1
612 #define CSR_TDATA2 0x7a2
613 #define CSR_TDATA3 0x7a3
614 #define CSR_DCSR 0x7b0
615 #define CSR_DPC 0x7b1
616 #define CSR_DSCRATCH 0x7b2
617 #define CSR_MCYCLE 0xb00
618 #define CSR_MINSTRET 0xb02
619 #define CSR_MHPMCOUNTER3 0xb03
620 #define CSR_MHPMCOUNTER4 0xb04
621 #define CSR_MHPMCOUNTER5 0xb05
622 #define CSR_MHPMCOUNTER6 0xb06
623 #define CSR_MHPMCOUNTER7 0xb07
624 #define CSR_MHPMCOUNTER8 0xb08
625 #define CSR_MHPMCOUNTER9 0xb09
626 #define CSR_MHPMCOUNTER10 0xb0a
627 #define CSR_MHPMCOUNTER11 0xb0b
628 #define CSR_MHPMCOUNTER12 0xb0c
629 #define CSR_MHPMCOUNTER13 0xb0d
630 #define CSR_MHPMCOUNTER14 0xb0e
631 #define CSR_MHPMCOUNTER15 0xb0f
632 #define CSR_MHPMCOUNTER16 0xb10
633 #define CSR_MHPMCOUNTER17 0xb11
634 #define CSR_MHPMCOUNTER18 0xb12
635 #define CSR_MHPMCOUNTER19 0xb13
636 #define CSR_MHPMCOUNTER20 0xb14
637 #define CSR_MHPMCOUNTER21 0xb15
638 #define CSR_MHPMCOUNTER22 0xb16
639 #define CSR_MHPMCOUNTER23 0xb17
640 #define CSR_MHPMCOUNTER24 0xb18
641 #define CSR_MHPMCOUNTER25 0xb19
642 #define CSR_MHPMCOUNTER26 0xb1a
643 #define CSR_MHPMCOUNTER27 0xb1b
644 #define CSR_MHPMCOUNTER28 0xb1c
645 #define CSR_MHPMCOUNTER29 0xb1d
646 #define CSR_MHPMCOUNTER30 0xb1e
647 #define CSR_MHPMCOUNTER31 0xb1f
648 #define CSR_MHPMEVENT3 0x323
649 #define CSR_MHPMEVENT4 0x324
650 #define CSR_MHPMEVENT5 0x325
651 #define CSR_MHPMEVENT6 0x326
652 #define CSR_MHPMEVENT7 0x327
653 #define CSR_MHPMEVENT8 0x328
654 #define CSR_MHPMEVENT9 0x329
655 #define CSR_MHPMEVENT10 0x32a
656 #define CSR_MHPMEVENT11 0x32b
657 #define CSR_MHPMEVENT12 0x32c
658 #define CSR_MHPMEVENT13 0x32d
659 #define CSR_MHPMEVENT14 0x32e
660 #define CSR_MHPMEVENT15 0x32f
661 #define CSR_MHPMEVENT16 0x330
662 #define CSR_MHPMEVENT17 0x331
663 #define CSR_MHPMEVENT18 0x332
664 #define CSR_MHPMEVENT19 0x333
665 #define CSR_MHPMEVENT20 0x334
666 #define CSR_MHPMEVENT21 0x335
667 #define CSR_MHPMEVENT22 0x336
668 #define CSR_MHPMEVENT23 0x337
669 #define CSR_MHPMEVENT24 0x338
670 #define CSR_MHPMEVENT25 0x339
671 #define CSR_MHPMEVENT26 0x33a
672 #define CSR_MHPMEVENT27 0x33b
673 #define CSR_MHPMEVENT28 0x33c
674 #define CSR_MHPMEVENT29 0x33d
675 #define CSR_MHPMEVENT30 0x33e
676 #define CSR_MHPMEVENT31 0x33f
677 #define CSR_MVENDORID 0xf11
678 #define CSR_MARCHID 0xf12
679 #define CSR_MIMPID 0xf13
680 #define CSR_MHARTID 0xf14
681 #define CSR_CYCLEH 0xc80
682 #define CSR_TIMEH 0xc81
683 #define CSR_INSTRETH 0xc82
684 #define CSR_HPMCOUNTER3H 0xc83
685 #define CSR_HPMCOUNTER4H 0xc84
686 #define CSR_HPMCOUNTER5H 0xc85
687 #define CSR_HPMCOUNTER6H 0xc86
688 #define CSR_HPMCOUNTER7H 0xc87
689 #define CSR_HPMCOUNTER8H 0xc88
690 #define CSR_HPMCOUNTER9H 0xc89
691 #define CSR_HPMCOUNTER10H 0xc8a
692 #define CSR_HPMCOUNTER11H 0xc8b
693 #define CSR_HPMCOUNTER12H 0xc8c
694 #define CSR_HPMCOUNTER13H 0xc8d
695 #define CSR_HPMCOUNTER14H 0xc8e
696 #define CSR_HPMCOUNTER15H 0xc8f
697 #define CSR_HPMCOUNTER16H 0xc90
698 #define CSR_HPMCOUNTER17H 0xc91
699 #define CSR_HPMCOUNTER18H 0xc92
700 #define CSR_HPMCOUNTER19H 0xc93
701 #define CSR_HPMCOUNTER20H 0xc94
702 #define CSR_HPMCOUNTER21H 0xc95
703 #define CSR_HPMCOUNTER22H 0xc96
704 #define CSR_HPMCOUNTER23H 0xc97
705 #define CSR_HPMCOUNTER24H 0xc98
706 #define CSR_HPMCOUNTER25H 0xc99
707 #define CSR_HPMCOUNTER26H 0xc9a
708 #define CSR_HPMCOUNTER27H 0xc9b
709 #define CSR_HPMCOUNTER28H 0xc9c
710 #define CSR_HPMCOUNTER29H 0xc9d
711 #define CSR_HPMCOUNTER30H 0xc9e
712 #define CSR_HPMCOUNTER31H 0xc9f
713 #define CSR_MCYCLEH 0xb80
714 #define CSR_MINSTRETH 0xb82
715 #define CSR_MHPMCOUNTER3H 0xb83
716 #define CSR_MHPMCOUNTER4H 0xb84
717 #define CSR_MHPMCOUNTER5H 0xb85
718 #define CSR_MHPMCOUNTER6H 0xb86
719 #define CSR_MHPMCOUNTER7H 0xb87
720 #define CSR_MHPMCOUNTER8H 0xb88
721 #define CSR_MHPMCOUNTER9H 0xb89
722 #define CSR_MHPMCOUNTER10H 0xb8a
723 #define CSR_MHPMCOUNTER11H 0xb8b
724 #define CSR_MHPMCOUNTER12H 0xb8c
725 #define CSR_MHPMCOUNTER13H 0xb8d
726 #define CSR_MHPMCOUNTER14H 0xb8e
727 #define CSR_MHPMCOUNTER15H 0xb8f
728 #define CSR_MHPMCOUNTER16H 0xb90
729 #define CSR_MHPMCOUNTER17H 0xb91
730 #define CSR_MHPMCOUNTER18H 0xb92
731 #define CSR_MHPMCOUNTER19H 0xb93
732 #define CSR_MHPMCOUNTER20H 0xb94
733 #define CSR_MHPMCOUNTER21H 0xb95
734 #define CSR_MHPMCOUNTER22H 0xb96
735 #define CSR_MHPMCOUNTER23H 0xb97
736 #define CSR_MHPMCOUNTER24H 0xb98
737 #define CSR_MHPMCOUNTER25H 0xb99
738 #define CSR_MHPMCOUNTER26H 0xb9a
739 #define CSR_MHPMCOUNTER27H 0xb9b
740 #define CSR_MHPMCOUNTER28H 0xb9c
741 #define CSR_MHPMCOUNTER29H 0xb9d
742 #define CSR_MHPMCOUNTER30H 0xb9e
743 #define CSR_MHPMCOUNTER31H 0xb9f
744 #define CAUSE_MISALIGNED_FETCH 0x0
745 #define CAUSE_FETCH_ACCESS 0x1
746 #define CAUSE_ILLEGAL_INSTRUCTION 0x2
747 #define CAUSE_BREAKPOINT 0x3
748 #define CAUSE_MISALIGNED_LOAD 0x4
749 #define CAUSE_LOAD_ACCESS 0x5
750 #define CAUSE_MISALIGNED_STORE 0x6
751 #define CAUSE_STORE_ACCESS 0x7
752 #define CAUSE_USER_ECALL 0x8
753 #define CAUSE_SUPERVISOR_ECALL 0x9
754 #define CAUSE_HYPERVISOR_ECALL 0xa
755 #define CAUSE_MACHINE_ECALL 0xb
756 #define CAUSE_FETCH_PAGE_FAULT 0xc
757 #define CAUSE_LOAD_PAGE_FAULT 0xd
758 #define CAUSE_STORE_PAGE_FAULT 0xf
759 #endif
760 #ifdef DECLARE_INSN
761 DECLARE_INSN(beq, MATCH_BEQ, MASK_BEQ)
762 DECLARE_INSN(bne, MATCH_BNE, MASK_BNE)
763 DECLARE_INSN(blt, MATCH_BLT, MASK_BLT)
764 DECLARE_INSN(bge, MATCH_BGE, MASK_BGE)
765 DECLARE_INSN(bltu, MATCH_BLTU, MASK_BLTU)
766 DECLARE_INSN(bgeu, MATCH_BGEU, MASK_BGEU)
767 DECLARE_INSN(jalr, MATCH_JALR, MASK_JALR)
768 DECLARE_INSN(jal, MATCH_JAL, MASK_JAL)
769 DECLARE_INSN(lui, MATCH_LUI, MASK_LUI)
770 DECLARE_INSN(auipc, MATCH_AUIPC, MASK_AUIPC)
771 DECLARE_INSN(addi, MATCH_ADDI, MASK_ADDI)
772 DECLARE_INSN(slli, MATCH_SLLI, MASK_SLLI)
773 DECLARE_INSN(slti, MATCH_SLTI, MASK_SLTI)
774 DECLARE_INSN(sltiu, MATCH_SLTIU, MASK_SLTIU)
775 DECLARE_INSN(xori, MATCH_XORI, MASK_XORI)
776 DECLARE_INSN(srli, MATCH_SRLI, MASK_SRLI)
777 DECLARE_INSN(srai, MATCH_SRAI, MASK_SRAI)
778 DECLARE_INSN(ori, MATCH_ORI, MASK_ORI)
779 DECLARE_INSN(andi, MATCH_ANDI, MASK_ANDI)
780 DECLARE_INSN(add, MATCH_ADD, MASK_ADD)
781 DECLARE_INSN(sub, MATCH_SUB, MASK_SUB)
782 DECLARE_INSN(sll, MATCH_SLL, MASK_SLL)
783 DECLARE_INSN(slt, MATCH_SLT, MASK_SLT)
784 DECLARE_INSN(sltu, MATCH_SLTU, MASK_SLTU)
785 DECLARE_INSN(xor, MATCH_XOR, MASK_XOR)
786 DECLARE_INSN(srl, MATCH_SRL, MASK_SRL)
787 DECLARE_INSN(sra, MATCH_SRA, MASK_SRA)
788 DECLARE_INSN(or, MATCH_OR, MASK_OR)
789 DECLARE_INSN(and, MATCH_AND, MASK_AND)
790 DECLARE_INSN(addiw, MATCH_ADDIW, MASK_ADDIW)
791 DECLARE_INSN(slliw, MATCH_SLLIW, MASK_SLLIW)
792 DECLARE_INSN(srliw, MATCH_SRLIW, MASK_SRLIW)
793 DECLARE_INSN(sraiw, MATCH_SRAIW, MASK_SRAIW)
794 DECLARE_INSN(addw, MATCH_ADDW, MASK_ADDW)
795 DECLARE_INSN(subw, MATCH_SUBW, MASK_SUBW)
796 DECLARE_INSN(sllw, MATCH_SLLW, MASK_SLLW)
797 DECLARE_INSN(srlw, MATCH_SRLW, MASK_SRLW)
798 DECLARE_INSN(sraw, MATCH_SRAW, MASK_SRAW)
799 DECLARE_INSN(lb, MATCH_LB, MASK_LB)
800 DECLARE_INSN(lh, MATCH_LH, MASK_LH)
801 DECLARE_INSN(lw, MATCH_LW, MASK_LW)
802 DECLARE_INSN(ld, MATCH_LD, MASK_LD)
803 DECLARE_INSN(lbu, MATCH_LBU, MASK_LBU)
804 DECLARE_INSN(lhu, MATCH_LHU, MASK_LHU)
805 DECLARE_INSN(lwu, MATCH_LWU, MASK_LWU)
806 DECLARE_INSN(sb, MATCH_SB, MASK_SB)
807 DECLARE_INSN(sh, MATCH_SH, MASK_SH)
808 DECLARE_INSN(sw, MATCH_SW, MASK_SW)
809 DECLARE_INSN(sd, MATCH_SD, MASK_SD)
810 DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE)
811 DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I)
812 DECLARE_INSN(mul, MATCH_MUL, MASK_MUL)
813 DECLARE_INSN(mulh, MATCH_MULH, MASK_MULH)
814 DECLARE_INSN(mulhsu, MATCH_MULHSU, MASK_MULHSU)
815 DECLARE_INSN(mulhu, MATCH_MULHU, MASK_MULHU)
816 DECLARE_INSN(div, MATCH_DIV, MASK_DIV)
817 DECLARE_INSN(divu, MATCH_DIVU, MASK_DIVU)
818 DECLARE_INSN(rem, MATCH_REM, MASK_REM)
819 DECLARE_INSN(remu, MATCH_REMU, MASK_REMU)
820 DECLARE_INSN(mulw, MATCH_MULW, MASK_MULW)
821 DECLARE_INSN(divw, MATCH_DIVW, MASK_DIVW)
822 DECLARE_INSN(divuw, MATCH_DIVUW, MASK_DIVUW)
823 DECLARE_INSN(remw, MATCH_REMW, MASK_REMW)
824 DECLARE_INSN(remuw, MATCH_REMUW, MASK_REMUW)
825 DECLARE_INSN(amoadd_w, MATCH_AMOADD_W, MASK_AMOADD_W)
826 DECLARE_INSN(amoxor_w, MATCH_AMOXOR_W, MASK_AMOXOR_W)
827 DECLARE_INSN(amoor_w, MATCH_AMOOR_W, MASK_AMOOR_W)
828 DECLARE_INSN(amoand_w, MATCH_AMOAND_W, MASK_AMOAND_W)
829 DECLARE_INSN(amomin_w, MATCH_AMOMIN_W, MASK_AMOMIN_W)
830 DECLARE_INSN(amomax_w, MATCH_AMOMAX_W, MASK_AMOMAX_W)
831 DECLARE_INSN(amominu_w, MATCH_AMOMINU_W, MASK_AMOMINU_W)
832 DECLARE_INSN(amomaxu_w, MATCH_AMOMAXU_W, MASK_AMOMAXU_W)
833 DECLARE_INSN(amoswap_w, MATCH_AMOSWAP_W, MASK_AMOSWAP_W)
834 DECLARE_INSN(lr_w, MATCH_LR_W, MASK_LR_W)
835 DECLARE_INSN(sc_w, MATCH_SC_W, MASK_SC_W)
836 DECLARE_INSN(amoadd_d, MATCH_AMOADD_D, MASK_AMOADD_D)
837 DECLARE_INSN(amoxor_d, MATCH_AMOXOR_D, MASK_AMOXOR_D)
838 DECLARE_INSN(amoor_d, MATCH_AMOOR_D, MASK_AMOOR_D)
839 DECLARE_INSN(amoand_d, MATCH_AMOAND_D, MASK_AMOAND_D)
840 DECLARE_INSN(amomin_d, MATCH_AMOMIN_D, MASK_AMOMIN_D)
841 DECLARE_INSN(amomax_d, MATCH_AMOMAX_D, MASK_AMOMAX_D)
842 DECLARE_INSN(amominu_d, MATCH_AMOMINU_D, MASK_AMOMINU_D)
843 DECLARE_INSN(amomaxu_d, MATCH_AMOMAXU_D, MASK_AMOMAXU_D)
844 DECLARE_INSN(amoswap_d, MATCH_AMOSWAP_D, MASK_AMOSWAP_D)
845 DECLARE_INSN(lr_d, MATCH_LR_D, MASK_LR_D)
846 DECLARE_INSN(sc_d, MATCH_SC_D, MASK_SC_D)
847 DECLARE_INSN(ecall, MATCH_ECALL, MASK_ECALL)
848 DECLARE_INSN(ebreak, MATCH_EBREAK, MASK_EBREAK)
849 DECLARE_INSN(uret, MATCH_URET, MASK_URET)
850 DECLARE_INSN(sret, MATCH_SRET, MASK_SRET)
851 DECLARE_INSN(mret, MATCH_MRET, MASK_MRET)
852 DECLARE_INSN(dret, MATCH_DRET, MASK_DRET)
853 DECLARE_INSN(sfence_vma, MATCH_SFENCE_VMA, MASK_SFENCE_VMA)
854 DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI)
855 DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW)
856 DECLARE_INSN(csrrs, MATCH_CSRRS, MASK_CSRRS)
857 DECLARE_INSN(csrrc, MATCH_CSRRC, MASK_CSRRC)
858 DECLARE_INSN(csrrwi, MATCH_CSRRWI, MASK_CSRRWI)
859 DECLARE_INSN(csrrsi, MATCH_CSRRSI, MASK_CSRRSI)
860 DECLARE_INSN(csrrci, MATCH_CSRRCI, MASK_CSRRCI)
861 DECLARE_INSN(fadd_s, MATCH_FADD_S, MASK_FADD_S)
862 DECLARE_INSN(fsub_s, MATCH_FSUB_S, MASK_FSUB_S)
863 DECLARE_INSN(fmul_s, MATCH_FMUL_S, MASK_FMUL_S)
864 DECLARE_INSN(fdiv_s, MATCH_FDIV_S, MASK_FDIV_S)
865 DECLARE_INSN(fsgnj_s, MATCH_FSGNJ_S, MASK_FSGNJ_S)
866 DECLARE_INSN(fsgnjn_s, MATCH_FSGNJN_S, MASK_FSGNJN_S)
867 DECLARE_INSN(fsgnjx_s, MATCH_FSGNJX_S, MASK_FSGNJX_S)
868 DECLARE_INSN(fmin_s, MATCH_FMIN_S, MASK_FMIN_S)
869 DECLARE_INSN(fmax_s, MATCH_FMAX_S, MASK_FMAX_S)
870 DECLARE_INSN(fsqrt_s, MATCH_FSQRT_S, MASK_FSQRT_S)
871 DECLARE_INSN(fadd_d, MATCH_FADD_D, MASK_FADD_D)
872 DECLARE_INSN(fsub_d, MATCH_FSUB_D, MASK_FSUB_D)
873 DECLARE_INSN(fmul_d, MATCH_FMUL_D, MASK_FMUL_D)
874 DECLARE_INSN(fdiv_d, MATCH_FDIV_D, MASK_FDIV_D)
875 DECLARE_INSN(fsgnj_d, MATCH_FSGNJ_D, MASK_FSGNJ_D)
876 DECLARE_INSN(fsgnjn_d, MATCH_FSGNJN_D, MASK_FSGNJN_D)
877 DECLARE_INSN(fsgnjx_d, MATCH_FSGNJX_D, MASK_FSGNJX_D)
878 DECLARE_INSN(fmin_d, MATCH_FMIN_D, MASK_FMIN_D)
879 DECLARE_INSN(fmax_d, MATCH_FMAX_D, MASK_FMAX_D)
880 DECLARE_INSN(fcvt_s_d, MATCH_FCVT_S_D, MASK_FCVT_S_D)
881 DECLARE_INSN(fcvt_d_s, MATCH_FCVT_D_S, MASK_FCVT_D_S)
882 DECLARE_INSN(fsqrt_d, MATCH_FSQRT_D, MASK_FSQRT_D)
883 DECLARE_INSN(fadd_q, MATCH_FADD_Q, MASK_FADD_Q)
884 DECLARE_INSN(fsub_q, MATCH_FSUB_Q, MASK_FSUB_Q)
885 DECLARE_INSN(fmul_q, MATCH_FMUL_Q, MASK_FMUL_Q)
886 DECLARE_INSN(fdiv_q, MATCH_FDIV_Q, MASK_FDIV_Q)
887 DECLARE_INSN(fsgnj_q, MATCH_FSGNJ_Q, MASK_FSGNJ_Q)
888 DECLARE_INSN(fsgnjn_q, MATCH_FSGNJN_Q, MASK_FSGNJN_Q)
889 DECLARE_INSN(fsgnjx_q, MATCH_FSGNJX_Q, MASK_FSGNJX_Q)
890 DECLARE_INSN(fmin_q, MATCH_FMIN_Q, MASK_FMIN_Q)
891 DECLARE_INSN(fmax_q, MATCH_FMAX_Q, MASK_FMAX_Q)
892 DECLARE_INSN(fcvt_s_q, MATCH_FCVT_S_Q, MASK_FCVT_S_Q)
893 DECLARE_INSN(fcvt_q_s, MATCH_FCVT_Q_S, MASK_FCVT_Q_S)
894 DECLARE_INSN(fcvt_d_q, MATCH_FCVT_D_Q, MASK_FCVT_D_Q)
895 DECLARE_INSN(fcvt_q_d, MATCH_FCVT_Q_D, MASK_FCVT_Q_D)
896 DECLARE_INSN(fsqrt_q, MATCH_FSQRT_Q, MASK_FSQRT_Q)
897 DECLARE_INSN(fle_s, MATCH_FLE_S, MASK_FLE_S)
898 DECLARE_INSN(flt_s, MATCH_FLT_S, MASK_FLT_S)
899 DECLARE_INSN(feq_s, MATCH_FEQ_S, MASK_FEQ_S)
900 DECLARE_INSN(fle_d, MATCH_FLE_D, MASK_FLE_D)
901 DECLARE_INSN(flt_d, MATCH_FLT_D, MASK_FLT_D)
902 DECLARE_INSN(feq_d, MATCH_FEQ_D, MASK_FEQ_D)
903 DECLARE_INSN(fle_q, MATCH_FLE_Q, MASK_FLE_Q)
904 DECLARE_INSN(flt_q, MATCH_FLT_Q, MASK_FLT_Q)
905 DECLARE_INSN(feq_q, MATCH_FEQ_Q, MASK_FEQ_Q)
906 DECLARE_INSN(fcvt_w_s, MATCH_FCVT_W_S, MASK_FCVT_W_S)
907 DECLARE_INSN(fcvt_wu_s, MATCH_FCVT_WU_S, MASK_FCVT_WU_S)
908 DECLARE_INSN(fcvt_l_s, MATCH_FCVT_L_S, MASK_FCVT_L_S)
909 DECLARE_INSN(fcvt_lu_s, MATCH_FCVT_LU_S, MASK_FCVT_LU_S)
910 DECLARE_INSN(fmv_x_w, MATCH_FMV_X_W, MASK_FMV_X_W)
911 DECLARE_INSN(fclass_s, MATCH_FCLASS_S, MASK_FCLASS_S)
912 DECLARE_INSN(fcvt_w_d, MATCH_FCVT_W_D, MASK_FCVT_W_D)
913 DECLARE_INSN(fcvt_wu_d, MATCH_FCVT_WU_D, MASK_FCVT_WU_D)
914 DECLARE_INSN(fcvt_l_d, MATCH_FCVT_L_D, MASK_FCVT_L_D)
915 DECLARE_INSN(fcvt_lu_d, MATCH_FCVT_LU_D, MASK_FCVT_LU_D)
916 DECLARE_INSN(fmv_x_d, MATCH_FMV_X_D, MASK_FMV_X_D)
917 DECLARE_INSN(fclass_d, MATCH_FCLASS_D, MASK_FCLASS_D)
918 DECLARE_INSN(fcvt_w_q, MATCH_FCVT_W_Q, MASK_FCVT_W_Q)
919 DECLARE_INSN(fcvt_wu_q, MATCH_FCVT_WU_Q, MASK_FCVT_WU_Q)
920 DECLARE_INSN(fcvt_l_q, MATCH_FCVT_L_Q, MASK_FCVT_L_Q)
921 DECLARE_INSN(fcvt_lu_q, MATCH_FCVT_LU_Q, MASK_FCVT_LU_Q)
922 DECLARE_INSN(fmv_x_q, MATCH_FMV_X_Q, MASK_FMV_X_Q)
923 DECLARE_INSN(fclass_q, MATCH_FCLASS_Q, MASK_FCLASS_Q)
924 DECLARE_INSN(fcvt_s_w, MATCH_FCVT_S_W, MASK_FCVT_S_W)
925 DECLARE_INSN(fcvt_s_wu, MATCH_FCVT_S_WU, MASK_FCVT_S_WU)
926 DECLARE_INSN(fcvt_s_l, MATCH_FCVT_S_L, MASK_FCVT_S_L)
927 DECLARE_INSN(fcvt_s_lu, MATCH_FCVT_S_LU, MASK_FCVT_S_LU)
928 DECLARE_INSN(fmv_w_x, MATCH_FMV_W_X, MASK_FMV_W_X)
929 DECLARE_INSN(fcvt_d_w, MATCH_FCVT_D_W, MASK_FCVT_D_W)
930 DECLARE_INSN(fcvt_d_wu, MATCH_FCVT_D_WU, MASK_FCVT_D_WU)
931 DECLARE_INSN(fcvt_d_l, MATCH_FCVT_D_L, MASK_FCVT_D_L)
932 DECLARE_INSN(fcvt_d_lu, MATCH_FCVT_D_LU, MASK_FCVT_D_LU)
933 DECLARE_INSN(fmv_d_x, MATCH_FMV_D_X, MASK_FMV_D_X)
934 DECLARE_INSN(fcvt_q_w, MATCH_FCVT_Q_W, MASK_FCVT_Q_W)
935 DECLARE_INSN(fcvt_q_wu, MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU)
936 DECLARE_INSN(fcvt_q_l, MATCH_FCVT_Q_L, MASK_FCVT_Q_L)
937 DECLARE_INSN(fcvt_q_lu, MATCH_FCVT_Q_LU, MASK_FCVT_Q_LU)
938 DECLARE_INSN(fmv_q_x, MATCH_FMV_Q_X, MASK_FMV_Q_X)
939 DECLARE_INSN(flw, MATCH_FLW, MASK_FLW)
940 DECLARE_INSN(fld, MATCH_FLD, MASK_FLD)
941 DECLARE_INSN(flq, MATCH_FLQ, MASK_FLQ)
942 DECLARE_INSN(fsw, MATCH_FSW, MASK_FSW)
943 DECLARE_INSN(fsd, MATCH_FSD, MASK_FSD)
944 DECLARE_INSN(fsq, MATCH_FSQ, MASK_FSQ)
945 DECLARE_INSN(fmadd_s, MATCH_FMADD_S, MASK_FMADD_S)
946 DECLARE_INSN(fmsub_s, MATCH_FMSUB_S, MASK_FMSUB_S)
947 DECLARE_INSN(fnmsub_s, MATCH_FNMSUB_S, MASK_FNMSUB_S)
948 DECLARE_INSN(fnmadd_s, MATCH_FNMADD_S, MASK_FNMADD_S)
949 DECLARE_INSN(fmadd_d, MATCH_FMADD_D, MASK_FMADD_D)
950 DECLARE_INSN(fmsub_d, MATCH_FMSUB_D, MASK_FMSUB_D)
951 DECLARE_INSN(fnmsub_d, MATCH_FNMSUB_D, MASK_FNMSUB_D)
952 DECLARE_INSN(fnmadd_d, MATCH_FNMADD_D, MASK_FNMADD_D)
953 DECLARE_INSN(fmadd_q, MATCH_FMADD_Q, MASK_FMADD_Q)
954 DECLARE_INSN(fmsub_q, MATCH_FMSUB_Q, MASK_FMSUB_Q)
955 DECLARE_INSN(fnmsub_q, MATCH_FNMSUB_Q, MASK_FNMSUB_Q)
956 DECLARE_INSN(fnmadd_q, MATCH_FNMADD_Q, MASK_FNMADD_Q)
957 DECLARE_INSN(c_nop, MATCH_C_NOP, MASK_C_NOP)
958 DECLARE_INSN(c_addi16sp, MATCH_C_ADDI16SP, MASK_C_ADDI16SP)
959 DECLARE_INSN(c_jr, MATCH_C_JR, MASK_C_JR)
960 DECLARE_INSN(c_jalr, MATCH_C_JALR, MASK_C_JALR)
961 DECLARE_INSN(c_ebreak, MATCH_C_EBREAK, MASK_C_EBREAK)
962 DECLARE_INSN(c_ld, MATCH_C_LD, MASK_C_LD)
963 DECLARE_INSN(c_sd, MATCH_C_SD, MASK_C_SD)
964 DECLARE_INSN(c_addiw, MATCH_C_ADDIW, MASK_C_ADDIW)
965 DECLARE_INSN(c_ldsp, MATCH_C_LDSP, MASK_C_LDSP)
966 DECLARE_INSN(c_sdsp, MATCH_C_SDSP, MASK_C_SDSP)
967 DECLARE_INSN(c_addi4spn, MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN)
968 DECLARE_INSN(c_fld, MATCH_C_FLD, MASK_C_FLD)
969 DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW)
970 DECLARE_INSN(c_flw, MATCH_C_FLW, MASK_C_FLW)
971 DECLARE_INSN(c_fsd, MATCH_C_FSD, MASK_C_FSD)
972 DECLARE_INSN(c_sw, MATCH_C_SW, MASK_C_SW)
973 DECLARE_INSN(c_fsw, MATCH_C_FSW, MASK_C_FSW)
974 DECLARE_INSN(c_addi, MATCH_C_ADDI, MASK_C_ADDI)
975 DECLARE_INSN(c_jal, MATCH_C_JAL, MASK_C_JAL)
976 DECLARE_INSN(c_li, MATCH_C_LI, MASK_C_LI)
977 DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI)
978 DECLARE_INSN(c_srli, MATCH_C_SRLI, MASK_C_SRLI)
979 DECLARE_INSN(c_srai, MATCH_C_SRAI, MASK_C_SRAI)
980 DECLARE_INSN(c_andi, MATCH_C_ANDI, MASK_C_ANDI)
981 DECLARE_INSN(c_sub, MATCH_C_SUB, MASK_C_SUB)
982 DECLARE_INSN(c_xor, MATCH_C_XOR, MASK_C_XOR)
983 DECLARE_INSN(c_or, MATCH_C_OR, MASK_C_OR)
984 DECLARE_INSN(c_and, MATCH_C_AND, MASK_C_AND)
985 DECLARE_INSN(c_subw, MATCH_C_SUBW, MASK_C_SUBW)
986 DECLARE_INSN(c_addw, MATCH_C_ADDW, MASK_C_ADDW)
987 DECLARE_INSN(c_j, MATCH_C_J, MASK_C_J)
988 DECLARE_INSN(c_beqz, MATCH_C_BEQZ, MASK_C_BEQZ)
989 DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ)
990 DECLARE_INSN(c_slli, MATCH_C_SLLI, MASK_C_SLLI)
991 DECLARE_INSN(c_fldsp, MATCH_C_FLDSP, MASK_C_FLDSP)
992 DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP)
993 DECLARE_INSN(c_flwsp, MATCH_C_FLWSP, MASK_C_FLWSP)
994 DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV)
995 DECLARE_INSN(c_add, MATCH_C_ADD, MASK_C_ADD)
996 DECLARE_INSN(c_fsdsp, MATCH_C_FSDSP, MASK_C_FSDSP)
997 DECLARE_INSN(c_swsp, MATCH_C_SWSP, MASK_C_SWSP)
998 DECLARE_INSN(c_fswsp, MATCH_C_FSWSP, MASK_C_FSWSP)
999 DECLARE_INSN(custom0, MATCH_CUSTOM0, MASK_CUSTOM0)
1000 DECLARE_INSN(custom0_rs1, MATCH_CUSTOM0_RS1, MASK_CUSTOM0_RS1)
1001 DECLARE_INSN(custom0_rs1_rs2, MATCH_CUSTOM0_RS1_RS2, MASK_CUSTOM0_RS1_RS2)
1002 DECLARE_INSN(custom0_rd, MATCH_CUSTOM0_RD, MASK_CUSTOM0_RD)
1003 DECLARE_INSN(custom0_rd_rs1, MATCH_CUSTOM0_RD_RS1, MASK_CUSTOM0_RD_RS1)
1004 DECLARE_INSN(custom0_rd_rs1_rs2, MATCH_CUSTOM0_RD_RS1_RS2, MASK_CUSTOM0_RD_RS1_RS2)
1005 DECLARE_INSN(custom1, MATCH_CUSTOM1, MASK_CUSTOM1)
1006 DECLARE_INSN(custom1_rs1, MATCH_CUSTOM1_RS1, MASK_CUSTOM1_RS1)
1007 DECLARE_INSN(custom1_rs1_rs2, MATCH_CUSTOM1_RS1_RS2, MASK_CUSTOM1_RS1_RS2)
1008 DECLARE_INSN(custom1_rd, MATCH_CUSTOM1_RD, MASK_CUSTOM1_RD)
1009 DECLARE_INSN(custom1_rd_rs1, MATCH_CUSTOM1_RD_RS1, MASK_CUSTOM1_RD_RS1)
1010 DECLARE_INSN(custom1_rd_rs1_rs2, MATCH_CUSTOM1_RD_RS1_RS2, MASK_CUSTOM1_RD_RS1_RS2)
1011 DECLARE_INSN(custom2, MATCH_CUSTOM2, MASK_CUSTOM2)
1012 DECLARE_INSN(custom2_rs1, MATCH_CUSTOM2_RS1, MASK_CUSTOM2_RS1)
1013 DECLARE_INSN(custom2_rs1_rs2, MATCH_CUSTOM2_RS1_RS2, MASK_CUSTOM2_RS1_RS2)
1014 DECLARE_INSN(custom2_rd, MATCH_CUSTOM2_RD, MASK_CUSTOM2_RD)
1015 DECLARE_INSN(custom2_rd_rs1, MATCH_CUSTOM2_RD_RS1, MASK_CUSTOM2_RD_RS1)
1016 DECLARE_INSN(custom2_rd_rs1_rs2, MATCH_CUSTOM2_RD_RS1_RS2, MASK_CUSTOM2_RD_RS1_RS2)
1017 DECLARE_INSN(custom3, MATCH_CUSTOM3, MASK_CUSTOM3)
1018 DECLARE_INSN(custom3_rs1, MATCH_CUSTOM3_RS1, MASK_CUSTOM3_RS1)
1019 DECLARE_INSN(custom3_rs1_rs2, MATCH_CUSTOM3_RS1_RS2, MASK_CUSTOM3_RS1_RS2)
1020 DECLARE_INSN(custom3_rd, MATCH_CUSTOM3_RD, MASK_CUSTOM3_RD)
1021 DECLARE_INSN(custom3_rd_rs1, MATCH_CUSTOM3_RD_RS1, MASK_CUSTOM3_RD_RS1)
1022 DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2)
1023 #endif
1024 #ifdef DECLARE_CSR
1025 DECLARE_CSR(fflags, CSR_FFLAGS)
1026 DECLARE_CSR(frm, CSR_FRM)
1027 DECLARE_CSR(fcsr, CSR_FCSR)
1028 DECLARE_CSR(cycle, CSR_CYCLE)
1029 DECLARE_CSR(time, CSR_TIME)
1030 DECLARE_CSR(instret, CSR_INSTRET)
1031 DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3)
1032 DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4)
1033 DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5)
1034 DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6)
1035 DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7)
1036 DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8)
1037 DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9)
1038 DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10)
1039 DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11)
1040 DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12)
1041 DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13)
1042 DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14)
1043 DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15)
1044 DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16)
1045 DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17)
1046 DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18)
1047 DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19)
1048 DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20)
1049 DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21)
1050 DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22)
1051 DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23)
1052 DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24)
1053 DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25)
1054 DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26)
1055 DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27)
1056 DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28)
1057 DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29)
1058 DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30)
1059 DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31)
1060 DECLARE_CSR(sstatus, CSR_SSTATUS)
1061 DECLARE_CSR(sie, CSR_SIE)
1062 DECLARE_CSR(stvec, CSR_STVEC)
1063 DECLARE_CSR(scounteren, CSR_SCOUNTEREN)
1064 DECLARE_CSR(sscratch, CSR_SSCRATCH)
1065 DECLARE_CSR(sepc, CSR_SEPC)
1066 DECLARE_CSR(scause, CSR_SCAUSE)
1067 DECLARE_CSR(stval, CSR_STVAL)
1068 DECLARE_CSR(sip, CSR_SIP)
1069 DECLARE_CSR(satp, CSR_SATP)
1070 DECLARE_CSR(mstatus, CSR_MSTATUS)
1071 DECLARE_CSR(misa, CSR_MISA)
1072 DECLARE_CSR(medeleg, CSR_MEDELEG)
1073 DECLARE_CSR(mideleg, CSR_MIDELEG)
1074 DECLARE_CSR(mie, CSR_MIE)
1075 DECLARE_CSR(mtvec, CSR_MTVEC)
1076 DECLARE_CSR(mcounteren, CSR_MCOUNTEREN)
1077 DECLARE_CSR(mscratch, CSR_MSCRATCH)
1078 DECLARE_CSR(mepc, CSR_MEPC)
1079 DECLARE_CSR(mcause, CSR_MCAUSE)
1080 DECLARE_CSR(mtval, CSR_MTVAL)
1081 DECLARE_CSR(mip, CSR_MIP)
1082 DECLARE_CSR(pmpcfg0, CSR_PMPCFG0)
1083 DECLARE_CSR(pmpcfg1, CSR_PMPCFG1)
1084 DECLARE_CSR(pmpcfg2, CSR_PMPCFG2)
1085 DECLARE_CSR(pmpcfg3, CSR_PMPCFG3)
1086 DECLARE_CSR(pmpaddr0, CSR_PMPADDR0)
1087 DECLARE_CSR(pmpaddr1, CSR_PMPADDR1)
1088 DECLARE_CSR(pmpaddr2, CSR_PMPADDR2)
1089 DECLARE_CSR(pmpaddr3, CSR_PMPADDR3)
1090 DECLARE_CSR(pmpaddr4, CSR_PMPADDR4)
1091 DECLARE_CSR(pmpaddr5, CSR_PMPADDR5)
1092 DECLARE_CSR(pmpaddr6, CSR_PMPADDR6)
1093 DECLARE_CSR(pmpaddr7, CSR_PMPADDR7)
1094 DECLARE_CSR(pmpaddr8, CSR_PMPADDR8)
1095 DECLARE_CSR(pmpaddr9, CSR_PMPADDR9)
1096 DECLARE_CSR(pmpaddr10, CSR_PMPADDR10)
1097 DECLARE_CSR(pmpaddr11, CSR_PMPADDR11)
1098 DECLARE_CSR(pmpaddr12, CSR_PMPADDR12)
1099 DECLARE_CSR(pmpaddr13, CSR_PMPADDR13)
1100 DECLARE_CSR(pmpaddr14, CSR_PMPADDR14)
1101 DECLARE_CSR(pmpaddr15, CSR_PMPADDR15)
1102 DECLARE_CSR(tselect, CSR_TSELECT)
1103 DECLARE_CSR(tdata1, CSR_TDATA1)
1104 DECLARE_CSR(tdata2, CSR_TDATA2)
1105 DECLARE_CSR(tdata3, CSR_TDATA3)
1106 DECLARE_CSR(dcsr, CSR_DCSR)
1107 DECLARE_CSR(dpc, CSR_DPC)
1108 DECLARE_CSR(dscratch, CSR_DSCRATCH)
1109 DECLARE_CSR(mcycle, CSR_MCYCLE)
1110 DECLARE_CSR(minstret, CSR_MINSTRET)
1111 DECLARE_CSR(mhpmcounter3, CSR_MHPMCOUNTER3)
1112 DECLARE_CSR(mhpmcounter4, CSR_MHPMCOUNTER4)
1113 DECLARE_CSR(mhpmcounter5, CSR_MHPMCOUNTER5)
1114 DECLARE_CSR(mhpmcounter6, CSR_MHPMCOUNTER6)
1115 DECLARE_CSR(mhpmcounter7, CSR_MHPMCOUNTER7)
1116 DECLARE_CSR(mhpmcounter8, CSR_MHPMCOUNTER8)
1117 DECLARE_CSR(mhpmcounter9, CSR_MHPMCOUNTER9)
1118 DECLARE_CSR(mhpmcounter10, CSR_MHPMCOUNTER10)
1119 DECLARE_CSR(mhpmcounter11, CSR_MHPMCOUNTER11)
1120 DECLARE_CSR(mhpmcounter12, CSR_MHPMCOUNTER12)
1121 DECLARE_CSR(mhpmcounter13, CSR_MHPMCOUNTER13)
1122 DECLARE_CSR(mhpmcounter14, CSR_MHPMCOUNTER14)
1123 DECLARE_CSR(mhpmcounter15, CSR_MHPMCOUNTER15)
1124 DECLARE_CSR(mhpmcounter16, CSR_MHPMCOUNTER16)
1125 DECLARE_CSR(mhpmcounter17, CSR_MHPMCOUNTER17)
1126 DECLARE_CSR(mhpmcounter18, CSR_MHPMCOUNTER18)
1127 DECLARE_CSR(mhpmcounter19, CSR_MHPMCOUNTER19)
1128 DECLARE_CSR(mhpmcounter20, CSR_MHPMCOUNTER20)
1129 DECLARE_CSR(mhpmcounter21, CSR_MHPMCOUNTER21)
1130 DECLARE_CSR(mhpmcounter22, CSR_MHPMCOUNTER22)
1131 DECLARE_CSR(mhpmcounter23, CSR_MHPMCOUNTER23)
1132 DECLARE_CSR(mhpmcounter24, CSR_MHPMCOUNTER24)
1133 DECLARE_CSR(mhpmcounter25, CSR_MHPMCOUNTER25)
1134 DECLARE_CSR(mhpmcounter26, CSR_MHPMCOUNTER26)
1135 DECLARE_CSR(mhpmcounter27, CSR_MHPMCOUNTER27)
1136 DECLARE_CSR(mhpmcounter28, CSR_MHPMCOUNTER28)
1137 DECLARE_CSR(mhpmcounter29, CSR_MHPMCOUNTER29)
1138 DECLARE_CSR(mhpmcounter30, CSR_MHPMCOUNTER30)
1139 DECLARE_CSR(mhpmcounter31, CSR_MHPMCOUNTER31)
1140 DECLARE_CSR(mhpmevent3, CSR_MHPMEVENT3)
1141 DECLARE_CSR(mhpmevent4, CSR_MHPMEVENT4)
1142 DECLARE_CSR(mhpmevent5, CSR_MHPMEVENT5)
1143 DECLARE_CSR(mhpmevent6, CSR_MHPMEVENT6)
1144 DECLARE_CSR(mhpmevent7, CSR_MHPMEVENT7)
1145 DECLARE_CSR(mhpmevent8, CSR_MHPMEVENT8)
1146 DECLARE_CSR(mhpmevent9, CSR_MHPMEVENT9)
1147 DECLARE_CSR(mhpmevent10, CSR_MHPMEVENT10)
1148 DECLARE_CSR(mhpmevent11, CSR_MHPMEVENT11)
1149 DECLARE_CSR(mhpmevent12, CSR_MHPMEVENT12)
1150 DECLARE_CSR(mhpmevent13, CSR_MHPMEVENT13)
1151 DECLARE_CSR(mhpmevent14, CSR_MHPMEVENT14)
1152 DECLARE_CSR(mhpmevent15, CSR_MHPMEVENT15)
1153 DECLARE_CSR(mhpmevent16, CSR_MHPMEVENT16)
1154 DECLARE_CSR(mhpmevent17, CSR_MHPMEVENT17)
1155 DECLARE_CSR(mhpmevent18, CSR_MHPMEVENT18)
1156 DECLARE_CSR(mhpmevent19, CSR_MHPMEVENT19)
1157 DECLARE_CSR(mhpmevent20, CSR_MHPMEVENT20)
1158 DECLARE_CSR(mhpmevent21, CSR_MHPMEVENT21)
1159 DECLARE_CSR(mhpmevent22, CSR_MHPMEVENT22)
1160 DECLARE_CSR(mhpmevent23, CSR_MHPMEVENT23)
1161 DECLARE_CSR(mhpmevent24, CSR_MHPMEVENT24)
1162 DECLARE_CSR(mhpmevent25, CSR_MHPMEVENT25)
1163 DECLARE_CSR(mhpmevent26, CSR_MHPMEVENT26)
1164 DECLARE_CSR(mhpmevent27, CSR_MHPMEVENT27)
1165 DECLARE_CSR(mhpmevent28, CSR_MHPMEVENT28)
1166 DECLARE_CSR(mhpmevent29, CSR_MHPMEVENT29)
1167 DECLARE_CSR(mhpmevent30, CSR_MHPMEVENT30)
1168 DECLARE_CSR(mhpmevent31, CSR_MHPMEVENT31)
1169 DECLARE_CSR(mvendorid, CSR_MVENDORID)
1170 DECLARE_CSR(marchid, CSR_MARCHID)
1171 DECLARE_CSR(mimpid, CSR_MIMPID)
1172 DECLARE_CSR(mhartid, CSR_MHARTID)
1173 DECLARE_CSR(cycleh, CSR_CYCLEH)
1174 DECLARE_CSR(timeh, CSR_TIMEH)
1175 DECLARE_CSR(instreth, CSR_INSTRETH)
1176 DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H)
1177 DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H)
1178 DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H)
1179 DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H)
1180 DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H)
1181 DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H)
1182 DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H)
1183 DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H)
1184 DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H)
1185 DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H)
1186 DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H)
1187 DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H)
1188 DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H)
1189 DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H)
1190 DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H)
1191 DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H)
1192 DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H)
1193 DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H)
1194 DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H)
1195 DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H)
1196 DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H)
1197 DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H)
1198 DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H)
1199 DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H)
1200 DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H)
1201 DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H)
1202 DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H)
1203 DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H)
1204 DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H)
1205 DECLARE_CSR(mcycleh, CSR_MCYCLEH)
1206 DECLARE_CSR(minstreth, CSR_MINSTRETH)
1207 DECLARE_CSR(mhpmcounter3h, CSR_MHPMCOUNTER3H)
1208 DECLARE_CSR(mhpmcounter4h, CSR_MHPMCOUNTER4H)
1209 DECLARE_CSR(mhpmcounter5h, CSR_MHPMCOUNTER5H)
1210 DECLARE_CSR(mhpmcounter6h, CSR_MHPMCOUNTER6H)
1211 DECLARE_CSR(mhpmcounter7h, CSR_MHPMCOUNTER7H)
1212 DECLARE_CSR(mhpmcounter8h, CSR_MHPMCOUNTER8H)
1213 DECLARE_CSR(mhpmcounter9h, CSR_MHPMCOUNTER9H)
1214 DECLARE_CSR(mhpmcounter10h, CSR_MHPMCOUNTER10H)
1215 DECLARE_CSR(mhpmcounter11h, CSR_MHPMCOUNTER11H)
1216 DECLARE_CSR(mhpmcounter12h, CSR_MHPMCOUNTER12H)
1217 DECLARE_CSR(mhpmcounter13h, CSR_MHPMCOUNTER13H)
1218 DECLARE_CSR(mhpmcounter14h, CSR_MHPMCOUNTER14H)
1219 DECLARE_CSR(mhpmcounter15h, CSR_MHPMCOUNTER15H)
1220 DECLARE_CSR(mhpmcounter16h, CSR_MHPMCOUNTER16H)
1221 DECLARE_CSR(mhpmcounter17h, CSR_MHPMCOUNTER17H)
1222 DECLARE_CSR(mhpmcounter18h, CSR_MHPMCOUNTER18H)
1223 DECLARE_CSR(mhpmcounter19h, CSR_MHPMCOUNTER19H)
1224 DECLARE_CSR(mhpmcounter20h, CSR_MHPMCOUNTER20H)
1225 DECLARE_CSR(mhpmcounter21h, CSR_MHPMCOUNTER21H)
1226 DECLARE_CSR(mhpmcounter22h, CSR_MHPMCOUNTER22H)
1227 DECLARE_CSR(mhpmcounter23h, CSR_MHPMCOUNTER23H)
1228 DECLARE_CSR(mhpmcounter24h, CSR_MHPMCOUNTER24H)
1229 DECLARE_CSR(mhpmcounter25h, CSR_MHPMCOUNTER25H)
1230 DECLARE_CSR(mhpmcounter26h, CSR_MHPMCOUNTER26H)
1231 DECLARE_CSR(mhpmcounter27h, CSR_MHPMCOUNTER27H)
1232 DECLARE_CSR(mhpmcounter28h, CSR_MHPMCOUNTER28H)
1233 DECLARE_CSR(mhpmcounter29h, CSR_MHPMCOUNTER29H)
1234 DECLARE_CSR(mhpmcounter30h, CSR_MHPMCOUNTER30H)
1235 DECLARE_CSR(mhpmcounter31h, CSR_MHPMCOUNTER31H)
1236 #endif
1237 #ifdef DECLARE_CAUSE
1238 DECLARE_CAUSE("misaligned fetch", CAUSE_MISALIGNED_FETCH)
1239 DECLARE_CAUSE("fetch access", CAUSE_FETCH_ACCESS)
1240 DECLARE_CAUSE("illegal instruction", CAUSE_ILLEGAL_INSTRUCTION)
1241 DECLARE_CAUSE("breakpoint", CAUSE_BREAKPOINT)
1242 DECLARE_CAUSE("misaligned load", CAUSE_MISALIGNED_LOAD)
1243 DECLARE_CAUSE("load access", CAUSE_LOAD_ACCESS)
1244 DECLARE_CAUSE("misaligned store", CAUSE_MISALIGNED_STORE)
1245 DECLARE_CAUSE("store access", CAUSE_STORE_ACCESS)
1246 DECLARE_CAUSE("user_ecall", CAUSE_USER_ECALL)
1247 DECLARE_CAUSE("supervisor_ecall", CAUSE_SUPERVISOR_ECALL)
1248 DECLARE_CAUSE("hypervisor_ecall", CAUSE_HYPERVISOR_ECALL)
1249 DECLARE_CAUSE("machine_ecall", CAUSE_MACHINE_ECALL)
1250 DECLARE_CAUSE("fetch page fault", CAUSE_FETCH_PAGE_FAULT)
1251 DECLARE_CAUSE("load page fault", CAUSE_LOAD_PAGE_FAULT)
1252 DECLARE_CAUSE("store page fault", CAUSE_STORE_PAGE_FAULT)
1253 #endif
1254