Skip to content

Commit 587cf70

Browse files
authored
Merge pull request #1989 from tianrui-wei/tianrui/decode_opcode
chore: add more decoding support
2 parents 75e97c6 + d6d0804 commit 587cf70

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

riscv/decode.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class insn_t
7979
insn_t(insn_bits_t bits) : b(bits) {}
8080
insn_bits_t bits() { return b; }
8181
int length() { return insn_length(b); }
82+
[[maybe_unused]] int64_t opcode() { return x(0, 7); }
83+
[[maybe_unused]] int64_t funct7() { return x(25, 7); }
84+
[[maybe_unused]] int64_t funct3() { return x(12, 3); }
85+
[[maybe_unused]] int64_t funct2() { return x(25, 2); }
8286
int64_t i_imm() { return xs(20, 12); }
8387
int64_t shamt() { return x(20, 6); }
8488
int64_t s_imm() { return x(7, 5) + (xs(25, 7) << 5); }
@@ -95,6 +99,7 @@ class insn_t
9599
uint64_t bs() { return x(30, 2); } // Crypto ISE - SM4/AES32 byte select.
96100
uint64_t rcon() { return x(20, 4); } // Crypto ISE - AES64 round const.
97101

102+
[[maybe_unused]] int64_t rvc_opcode() { return x(0, 2); }
98103
int64_t rvc_imm() { return x(2, 5) + (xs(12, 1) << 5); }
99104
int64_t rvc_zimm() { return x(2, 5) + (x(12, 1) << 5); }
100105
int64_t rvc_addi4spn_imm() { return (x(6, 1) << 2) + (x(5, 1) << 3) + (x(11, 2) << 4) + (x(7, 4) << 6); }

0 commit comments

Comments
 (0)