From b3e60c2c6e722bc181369d48642834422fa1082c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 28 Sep 2018 08:42:48 +0100 Subject: [PATCH] manually add svsetvl instruction --- riscv/encoding.h | 3 +++ riscv/insns/svsetvl.h | 4 ++++ riscv/riscv.mk.in | 1 + 3 files changed, 8 insertions(+) create mode 100644 riscv/insns/svsetvl.h diff --git a/riscv/encoding.h b/riscv/encoding.h index 9dcb0e6..12c7ce1 100644 --- a/riscv/encoding.h +++ b/riscv/encoding.h @@ -322,6 +322,8 @@ #define MASK_SW 0x707f #define MATCH_SD 0x3023 #define MASK_SD 0x707f +#define MATCH_SVSETVL 0x4023 +#define MASK_SVSETVL 0x707f #define MATCH_FENCE 0xf #define MASK_FENCE 0x707f #define MATCH_FENCE_I 0x100f @@ -1026,6 +1028,7 @@ DECLARE_INSN(sb, MATCH_SB, MASK_SB) DECLARE_INSN(sh, MATCH_SH, MASK_SH) DECLARE_INSN(sw, MATCH_SW, MASK_SW) DECLARE_INSN(sd, MATCH_SD, MASK_SD) +DECLARE_INSN(svsetvl, MATCH_SVSETVL, MASK_SVSETVL) DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE) DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I) DECLARE_INSN(mul, MATCH_MUL, MASK_MUL) diff --git a/riscv/insns/svsetvl.h b/riscv/insns/svsetvl.h new file mode 100644 index 0000000..9517f18 --- /dev/null +++ b/riscv/insns/svsetvl.h @@ -0,0 +1,4 @@ +p->get_state()->vl = std::min((uint64_t)63, + std::min((uint64_t)insn.i_imm(), + RS1)); +WRITE_RD(p->get_state()->vl); diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in index 045d58a..7e1a2a8 100644 --- a/riscv/riscv.mk.in +++ b/riscv/riscv.mk.in @@ -287,6 +287,7 @@ riscv_insn_list = \ srlw \ sub \ subw \ + svsetvl \ sw \ wfi \ xor \ -- 2.30.2