From b267752e9fcac47d986b67abeec535f5b59f996a Mon Sep 17 00:00:00 2001 From: Ved Shanbhogue Date: Sat, 23 Sep 2023 11:18:51 -0500 Subject: [PATCH] add zcmop extension instructions --- riscv/encoding.h | 155 +++++++++++++++++++++++++++++++++++++++++- riscv/insns/c_mop_N.h | 2 + riscv/isa_parser.h | 1 + riscv/riscv.mk.in | 4 ++ 4 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 riscv/insns/c_mop_N.h diff --git a/riscv/encoding.h b/riscv/encoding.h index a7e2d94512..a27433e419 100644 --- a/riscv/encoding.h +++ b/riscv/encoding.h @@ -4,7 +4,7 @@ /* * This file is auto-generated by running 'make' in - * https://github.com/riscv/riscv-opcodes (d752f19) + * https://github.com/riscv/riscv-opcodes (2a95ee7) */ #ifndef RISCV_CSR_ENCODING_H @@ -592,6 +592,24 @@ #define MASK_C_LW 0xe003 #define MATCH_C_LWSP 0x4002 #define MASK_C_LWSP 0xe003 +#define MATCH_C_MOP_0 0x6081 +#define MASK_C_MOP_0 0xffff +#define MATCH_C_MOP_1 0x6181 +#define MASK_C_MOP_1 0xffff +#define MATCH_C_MOP_2 0x6281 +#define MASK_C_MOP_2 0xffff +#define MATCH_C_MOP_3 0x6381 +#define MASK_C_MOP_3 0xffff +#define MATCH_C_MOP_4 0x6481 +#define MASK_C_MOP_4 0xffff +#define MATCH_C_MOP_5 0x6581 +#define MASK_C_MOP_5 0xffff +#define MATCH_C_MOP_6 0x6681 +#define MASK_C_MOP_6 0xffff +#define MATCH_C_MOP_7 0x6781 +#define MASK_C_MOP_7 0xffff +#define MATCH_C_MOP_N 0x6081 +#define MASK_C_MOP_N 0xf8ff #define MATCH_C_MUL 0x9c41 #define MASK_C_MUL 0xfc63 #define MATCH_C_MV 0x8002 @@ -1402,6 +1420,90 @@ #define MASK_MINU 0xfe00707f #define MATCH_MNRET 0x70200073 #define MASK_MNRET 0xffffffff +#define MATCH_MOP_R_0 0x81c04073 +#define MASK_MOP_R_0 0xfff0707f +#define MATCH_MOP_R_1 0x81d04073 +#define MASK_MOP_R_1 0xfff0707f +#define MATCH_MOP_R_10 0x89e04073 +#define MASK_MOP_R_10 0xfff0707f +#define MATCH_MOP_R_11 0x89f04073 +#define MASK_MOP_R_11 0xfff0707f +#define MATCH_MOP_R_12 0x8dc04073 +#define MASK_MOP_R_12 0xfff0707f +#define MATCH_MOP_R_13 0x8dd04073 +#define MASK_MOP_R_13 0xfff0707f +#define MATCH_MOP_R_14 0x8de04073 +#define MASK_MOP_R_14 0xfff0707f +#define MATCH_MOP_R_15 0x8df04073 +#define MASK_MOP_R_15 0xfff0707f +#define MATCH_MOP_R_16 0xc1c04073 +#define MASK_MOP_R_16 0xfff0707f +#define MATCH_MOP_R_17 0xc1d04073 +#define MASK_MOP_R_17 0xfff0707f +#define MATCH_MOP_R_18 0xc1e04073 +#define MASK_MOP_R_18 0xfff0707f +#define MATCH_MOP_R_19 0xc1f04073 +#define MASK_MOP_R_19 0xfff0707f +#define MATCH_MOP_R_2 0x81e04073 +#define MASK_MOP_R_2 0xfff0707f +#define MATCH_MOP_R_20 0xc5c04073 +#define MASK_MOP_R_20 0xfff0707f +#define MATCH_MOP_R_21 0xc5d04073 +#define MASK_MOP_R_21 0xfff0707f +#define MATCH_MOP_R_22 0xc5e04073 +#define MASK_MOP_R_22 0xfff0707f +#define MATCH_MOP_R_23 0xc5f04073 +#define MASK_MOP_R_23 0xfff0707f +#define MATCH_MOP_R_24 0xc9c04073 +#define MASK_MOP_R_24 0xfff0707f +#define MATCH_MOP_R_25 0xc9d04073 +#define MASK_MOP_R_25 0xfff0707f +#define MATCH_MOP_R_26 0xc9e04073 +#define MASK_MOP_R_26 0xfff0707f +#define MATCH_MOP_R_27 0xc9f04073 +#define MASK_MOP_R_27 0xfff0707f +#define MATCH_MOP_R_28 0xcdc04073 +#define MASK_MOP_R_28 0xfff0707f +#define MATCH_MOP_R_29 0xcdd04073 +#define MASK_MOP_R_29 0xfff0707f +#define MATCH_MOP_R_3 0x81f04073 +#define MASK_MOP_R_3 0xfff0707f +#define MATCH_MOP_R_30 0xcde04073 +#define MASK_MOP_R_30 0xfff0707f +#define MATCH_MOP_R_31 0xcdf04073 +#define MASK_MOP_R_31 0xfff0707f +#define MATCH_MOP_R_4 0x85c04073 +#define MASK_MOP_R_4 0xfff0707f +#define MATCH_MOP_R_5 0x85d04073 +#define MASK_MOP_R_5 0xfff0707f +#define MATCH_MOP_R_6 0x85e04073 +#define MASK_MOP_R_6 0xfff0707f +#define MATCH_MOP_R_7 0x85f04073 +#define MASK_MOP_R_7 0xfff0707f +#define MATCH_MOP_R_8 0x89c04073 +#define MASK_MOP_R_8 0xfff0707f +#define MATCH_MOP_R_9 0x89d04073 +#define MASK_MOP_R_9 0xfff0707f +#define MATCH_MOP_R_N 0x81c04073 +#define MASK_MOP_R_N 0xb3c0707f +#define MATCH_MOP_RR_0 0x82004073 +#define MASK_MOP_RR_0 0xfe00707f +#define MATCH_MOP_RR_1 0x86004073 +#define MASK_MOP_RR_1 0xfe00707f +#define MATCH_MOP_RR_2 0x8a004073 +#define MASK_MOP_RR_2 0xfe00707f +#define MATCH_MOP_RR_3 0x8e004073 +#define MASK_MOP_RR_3 0xfe00707f +#define MATCH_MOP_RR_4 0xc2004073 +#define MASK_MOP_RR_4 0xfe00707f +#define MATCH_MOP_RR_5 0xc6004073 +#define MASK_MOP_RR_5 0xfe00707f +#define MATCH_MOP_RR_6 0xca004073 +#define MASK_MOP_RR_6 0xfe00707f +#define MATCH_MOP_RR_7 0xce004073 +#define MASK_MOP_RR_7 0xfe00707f +#define MATCH_MOP_RR_N 0x82004073 +#define MASK_MOP_RR_N 0xb200707f #define MATCH_MRET 0x30200073 #define MASK_MRET 0xffffffff #define MATCH_MSUBR32 0xc6001077 @@ -3686,6 +3788,15 @@ DECLARE_INSN(c_lqsp, MATCH_C_LQSP, MASK_C_LQSP) DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI) DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW) DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP) +DECLARE_INSN(c_mop_0, MATCH_C_MOP_0, MASK_C_MOP_0) +DECLARE_INSN(c_mop_1, MATCH_C_MOP_1, MASK_C_MOP_1) +DECLARE_INSN(c_mop_2, MATCH_C_MOP_2, MASK_C_MOP_2) +DECLARE_INSN(c_mop_3, MATCH_C_MOP_3, MASK_C_MOP_3) +DECLARE_INSN(c_mop_4, MATCH_C_MOP_4, MASK_C_MOP_4) +DECLARE_INSN(c_mop_5, MATCH_C_MOP_5, MASK_C_MOP_5) +DECLARE_INSN(c_mop_6, MATCH_C_MOP_6, MASK_C_MOP_6) +DECLARE_INSN(c_mop_7, MATCH_C_MOP_7, MASK_C_MOP_7) +DECLARE_INSN(c_mop_N, MATCH_C_MOP_N, MASK_C_MOP_N) DECLARE_INSN(c_mul, MATCH_C_MUL, MASK_C_MUL) DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV) DECLARE_INSN(c_nop, MATCH_C_NOP, MASK_C_NOP) @@ -4091,6 +4202,48 @@ DECLARE_INSN(maxu, MATCH_MAXU, MASK_MAXU) DECLARE_INSN(min, MATCH_MIN, MASK_MIN) DECLARE_INSN(minu, MATCH_MINU, MASK_MINU) DECLARE_INSN(mnret, MATCH_MNRET, MASK_MNRET) +DECLARE_INSN(mop_r_0, MATCH_MOP_R_0, MASK_MOP_R_0) +DECLARE_INSN(mop_r_1, MATCH_MOP_R_1, MASK_MOP_R_1) +DECLARE_INSN(mop_r_10, MATCH_MOP_R_10, MASK_MOP_R_10) +DECLARE_INSN(mop_r_11, MATCH_MOP_R_11, MASK_MOP_R_11) +DECLARE_INSN(mop_r_12, MATCH_MOP_R_12, MASK_MOP_R_12) +DECLARE_INSN(mop_r_13, MATCH_MOP_R_13, MASK_MOP_R_13) +DECLARE_INSN(mop_r_14, MATCH_MOP_R_14, MASK_MOP_R_14) +DECLARE_INSN(mop_r_15, MATCH_MOP_R_15, MASK_MOP_R_15) +DECLARE_INSN(mop_r_16, MATCH_MOP_R_16, MASK_MOP_R_16) +DECLARE_INSN(mop_r_17, MATCH_MOP_R_17, MASK_MOP_R_17) +DECLARE_INSN(mop_r_18, MATCH_MOP_R_18, MASK_MOP_R_18) +DECLARE_INSN(mop_r_19, MATCH_MOP_R_19, MASK_MOP_R_19) +DECLARE_INSN(mop_r_2, MATCH_MOP_R_2, MASK_MOP_R_2) +DECLARE_INSN(mop_r_20, MATCH_MOP_R_20, MASK_MOP_R_20) +DECLARE_INSN(mop_r_21, MATCH_MOP_R_21, MASK_MOP_R_21) +DECLARE_INSN(mop_r_22, MATCH_MOP_R_22, MASK_MOP_R_22) +DECLARE_INSN(mop_r_23, MATCH_MOP_R_23, MASK_MOP_R_23) +DECLARE_INSN(mop_r_24, MATCH_MOP_R_24, MASK_MOP_R_24) +DECLARE_INSN(mop_r_25, MATCH_MOP_R_25, MASK_MOP_R_25) +DECLARE_INSN(mop_r_26, MATCH_MOP_R_26, MASK_MOP_R_26) +DECLARE_INSN(mop_r_27, MATCH_MOP_R_27, MASK_MOP_R_27) +DECLARE_INSN(mop_r_28, MATCH_MOP_R_28, MASK_MOP_R_28) +DECLARE_INSN(mop_r_29, MATCH_MOP_R_29, MASK_MOP_R_29) +DECLARE_INSN(mop_r_3, MATCH_MOP_R_3, MASK_MOP_R_3) +DECLARE_INSN(mop_r_30, MATCH_MOP_R_30, MASK_MOP_R_30) +DECLARE_INSN(mop_r_31, MATCH_MOP_R_31, MASK_MOP_R_31) +DECLARE_INSN(mop_r_4, MATCH_MOP_R_4, MASK_MOP_R_4) +DECLARE_INSN(mop_r_5, MATCH_MOP_R_5, MASK_MOP_R_5) +DECLARE_INSN(mop_r_6, MATCH_MOP_R_6, MASK_MOP_R_6) +DECLARE_INSN(mop_r_7, MATCH_MOP_R_7, MASK_MOP_R_7) +DECLARE_INSN(mop_r_8, MATCH_MOP_R_8, MASK_MOP_R_8) +DECLARE_INSN(mop_r_9, MATCH_MOP_R_9, MASK_MOP_R_9) +DECLARE_INSN(mop_r_N, MATCH_MOP_R_N, MASK_MOP_R_N) +DECLARE_INSN(mop_rr_0, MATCH_MOP_RR_0, MASK_MOP_RR_0) +DECLARE_INSN(mop_rr_1, MATCH_MOP_RR_1, MASK_MOP_RR_1) +DECLARE_INSN(mop_rr_2, MATCH_MOP_RR_2, MASK_MOP_RR_2) +DECLARE_INSN(mop_rr_3, MATCH_MOP_RR_3, MASK_MOP_RR_3) +DECLARE_INSN(mop_rr_4, MATCH_MOP_RR_4, MASK_MOP_RR_4) +DECLARE_INSN(mop_rr_5, MATCH_MOP_RR_5, MASK_MOP_RR_5) +DECLARE_INSN(mop_rr_6, MATCH_MOP_RR_6, MASK_MOP_RR_6) +DECLARE_INSN(mop_rr_7, MATCH_MOP_RR_7, MASK_MOP_RR_7) +DECLARE_INSN(mop_rr_N, MATCH_MOP_RR_N, MASK_MOP_RR_N) DECLARE_INSN(mret, MATCH_MRET, MASK_MRET) DECLARE_INSN(msubr32, MATCH_MSUBR32, MASK_MSUBR32) DECLARE_INSN(mul, MATCH_MUL, MASK_MUL) diff --git a/riscv/insns/c_mop_N.h b/riscv/insns/c_mop_N.h new file mode 100644 index 0000000000..78ec382293 --- /dev/null +++ b/riscv/insns/c_mop_N.h @@ -0,0 +1,2 @@ +require_extension(EXT_ZCA); +require_extension(EXT_ZCMOP); diff --git a/riscv/isa_parser.h b/riscv/isa_parser.h index f955e1613c..af4f9254fb 100644 --- a/riscv/isa_parser.h +++ b/riscv/isa_parser.h @@ -80,6 +80,7 @@ typedef enum { EXT_SMCSRIND, EXT_SSCSRIND, EXT_SMCNTRPMF, + EXT_ZCMOP, NUM_ISA_EXTENSIONS } isa_extension_t; diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in index 3a0333c544..d88c19764e 100644 --- a/riscv/riscv.mk.in +++ b/riscv/riscv.mk.in @@ -1395,6 +1395,9 @@ riscv_insn_ext_zvksh = \ vsm3c_vi \ vsm3me_vv \ +riscv_insn_ext_zcmop = \ + c_mop_N \ + riscv_insn_ext_zvk = \ $(riscv_insn_ext_zvbb) \ $(riscv_insn_ext_zvbc) \ @@ -1431,6 +1434,7 @@ riscv_insn_list = \ $(riscv_insn_priv) \ $(riscv_insn_smrnmi) \ $(riscv_insn_svinval) \ + $(riscv_insn_ext_zcmop) \ riscv_gen_srcs = $(addsuffix .cc,$(riscv_insn_list))