2 * QEMU disassembler -- RISC-V specific header.
4 * SPDX-License-Identifier: GPL-2.0-or-later
10 #include "qemu/osdep.h"
11 #include "target/riscv/cpu_cfg.h"
15 typedef uint64_t rv_inst
;
16 typedef uint16_t rv_opcode
;
160 rv_codec_zcmp_cm_pushpop
,
168 rv_codec_r2_imm2_imm5
,
176 const rvc_constraint
*constraints
;
180 const char * const name
;
181 const rv_codec codec
;
182 const char * const format
;
183 const rv_comp_data
*pseudo
;
184 const short decomp_rv32
;
185 const short decomp_rv64
;
186 const short decomp_rv128
;
187 const short decomp_data
;
194 const rv_opcode_data
*opcode_data
;
223 /* instruction formats */
225 #define rv_fmt_none "O\t"
226 #define rv_fmt_rs1 "O\t1"
227 #define rv_fmt_offset "O\to"
228 #define rv_fmt_pred_succ "O\tp,s"
229 #define rv_fmt_rs1_rs2 "O\t1,2"
230 #define rv_fmt_rd_imm "O\t0,i"
231 #define rv_fmt_rd_uimm "O\t0,Ui"
232 #define rv_fmt_rd_offset "O\t0,o"
233 #define rv_fmt_rd_uoffset "O\t0,Uo"
234 #define rv_fmt_rd_rs1_rs2 "O\t0,1,2"
235 #define rv_fmt_frd_rs1 "O\t3,1"
236 #define rv_fmt_frd_rs1_rs2 "O\t3,1,2"
237 #define rv_fmt_frd_frs1 "O\t3,4"
238 #define rv_fmt_rd_frs1 "O\t0,4"
239 #define rv_fmt_rd_frs1_frs2 "O\t0,4,5"
240 #define rv_fmt_frd_frs1_frs2 "O\t3,4,5"
241 #define rv_fmt_rm_frd_frs1 "O\tr,3,4"
242 #define rv_fmt_rm_frd_rs1 "O\tr,3,1"
243 #define rv_fmt_rm_rd_frs1 "O\tr,0,4"
244 #define rv_fmt_rm_frd_frs1_frs2 "O\tr,3,4,5"
245 #define rv_fmt_rm_frd_frs1_frs2_frs3 "O\tr,3,4,5,6"
246 #define rv_fmt_rd_rs1_imm "O\t0,1,i"
247 #define rv_fmt_rd_rs1_offset "O\t0,1,i"
248 #define rv_fmt_rd_offset_rs1 "O\t0,i(1)"
249 #define rv_fmt_frd_offset_rs1 "O\t3,i(1)"
250 #define rv_fmt_rd_csr_rs1 "O\t0,c,1"
251 #define rv_fmt_rd_csr_zimm "O\t0,c,7"
252 #define rv_fmt_rs2_offset_rs1 "O\t2,i(1)"
253 #define rv_fmt_frs2_offset_rs1 "O\t5,i(1)"
254 #define rv_fmt_rs1_rs2_offset "O\t1,2,o"
255 #define rv_fmt_rs2_rs1_offset "O\t2,1,o"
256 #define rv_fmt_aqrl_rd_rs2_rs1 "OAR\t0,2,(1)"
257 #define rv_fmt_aqrl_rd_rs1 "OAR\t0,(1)"
258 #define rv_fmt_rd "O\t0"
259 #define rv_fmt_rd_zimm "O\t0,7"
260 #define rv_fmt_rd_rs1 "O\t0,1"
261 #define rv_fmt_rd_rs2 "O\t0,2"
262 #define rv_fmt_rs1_offset "O\t1,o"
263 #define rv_fmt_rs2_offset "O\t2,o"
264 #define rv_fmt_rs1_rs2_bs "O\t1,2,b"
265 #define rv_fmt_rd_rs1_rnum "O\t0,1,n"
266 #define rv_fmt_ldst_vd_rs1_vm "O\tD,(1)m"
267 #define rv_fmt_ldst_vd_rs1_rs2_vm "O\tD,(1),2m"
268 #define rv_fmt_ldst_vd_rs1_vs2_vm "O\tD,(1),Fm"
269 #define rv_fmt_vd_vs2_vs1 "O\tD,F,E"
270 #define rv_fmt_vd_vs2_vs1_vl "O\tD,F,El"
271 #define rv_fmt_vd_vs2_vs1_vm "O\tD,F,Em"
272 #define rv_fmt_vd_vs2_rs1_vl "O\tD,F,1l"
273 #define rv_fmt_vd_vs2_fs1_vl "O\tD,F,4l"
274 #define rv_fmt_vd_vs2_rs1_vm "O\tD,F,1m"
275 #define rv_fmt_vd_vs2_fs1_vm "O\tD,F,4m"
276 #define rv_fmt_vd_vs2_imm_vl "O\tD,F,il"
277 #define rv_fmt_vd_vs2_imm_vm "O\tD,F,im"
278 #define rv_fmt_vd_vs2_uimm "O\tD,F,u"
279 #define rv_fmt_vd_vs2_uimm_vm "O\tD,F,um"
280 #define rv_fmt_vd_vs1_vs2_vm "O\tD,E,Fm"
281 #define rv_fmt_vd_rs1_vs2_vm "O\tD,1,Fm"
282 #define rv_fmt_vd_fs1_vs2_vm "O\tD,4,Fm"
283 #define rv_fmt_vd_vs1 "O\tD,E"
284 #define rv_fmt_vd_rs1 "O\tD,1"
285 #define rv_fmt_vd_fs1 "O\tD,4"
286 #define rv_fmt_vd_imm "O\tD,i"
287 #define rv_fmt_vd_vs2 "O\tD,F"
288 #define rv_fmt_vd_vs2_vm "O\tD,Fm"
289 #define rv_fmt_rd_vs2_vm "O\t0,Fm"
290 #define rv_fmt_rd_vs2 "O\t0,F"
291 #define rv_fmt_fd_vs2 "O\t3,F"
292 #define rv_fmt_vd_vm "O\tDm"
293 #define rv_fmt_vsetvli "O\t0,1,v"
294 #define rv_fmt_vsetivli "O\t0,u,v"
295 #define rv_fmt_rs1_rs2_zce_ldst "O\t2,i(1)"
296 #define rv_fmt_push_rlist "O\tx,-i"
297 #define rv_fmt_pop_rlist "O\tx,i"
298 #define rv_fmt_zcmt_index "O\ti"
299 #define rv_fmt_rd_rs1_rs2_imm "O\t0,1,2,i"
300 #define rv_fmt_frd_rs1_rs2_imm "O\t3,1,2,i"
301 #define rv_fmt_rd_rs1_immh_imml "O\t0,1,i,j"
302 #define rv_fmt_rd_rs1_immh_imml_addr "O\t0,(1),i,j"
303 #define rv_fmt_rd2_imm "O\t0,2,(1),i"
304 #define rv_fmt_fli "O\t3,h"
306 #endif /* DISAS_RISCV_H */