aboutsummaryrefslogtreecommitdiff
path: root/riscv/decode.h
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-06-06 20:36:05 -0700
committerAndrew Waterman <andrew@sifive.com>2022-06-06 20:54:17 -0700
commit7d943d740afb6a42b50c979800608c6fb1614d0c (patch)
treee92f3f4934f50ad1f8957441dd026a275d8d75b9 /riscv/decode.h
parentd2020b3256cf9a832cbbfe7a32c5753abe75cb7d (diff)
downloadspike-7d943d740afb6a42b50c979800608c6fb1614d0c.zip
spike-7d943d740afb6a42b50c979800608c6fb1614d0c.tar.gz
spike-7d943d740afb6a42b50c979800608c6fb1614d0c.tar.bz2
Don't mask instruction bits
No longer needed, since they are no longer sign-extended. Fixes #1022 by eliminating undefined behavior (64-bit instructions resulted in a shift amount equal to the datatype width).
Diffstat (limited to 'riscv/decode.h')
-rw-r--r--riscv/decode.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index d56d496..72b4a6b 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -79,7 +79,7 @@ class insn_t
public:
insn_t() = default;
insn_t(insn_bits_t bits) : b(bits) {}
- insn_bits_t bits() { return b & ~((UINT64_MAX) << (length() * 8)); }
+ insn_bits_t bits() { return b; }
int length() { return insn_length(b); }
int64_t i_imm() { return xs(20, 12); }
int64_t shamt() { return x(20, 6); }