diff options
author | Andrew Waterman <andrew@sifive.com> | 2022-03-15 20:58:14 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2022-03-15 22:46:28 -0700 |
commit | f17413e22d35422e4430f7f6e190817b66cbd5e2 (patch) | |
tree | 0e9f7ef8410b1fa819ebe54de2e57c00e2be06d9 /riscv/csrs.h | |
parent | cb4bea96ddb175fb6b338db7c3e8ef17cb228025 (diff) | |
download | spike-f17413e22d35422e4430f7f6e190817b66cbd5e2.zip spike-f17413e22d35422e4430f7f6e190817b66cbd5e2.tar.gz spike-f17413e22d35422e4430f7f6e190817b66cbd5e2.tar.bz2 |
Rewrite sstatus_csr_t::enabled() for higher performance
Eliminate calls to base_status_csr_t::enabled() so that the various
read() calls can be inlined. Doing so also removes a redundant check of
sstatus_write_mask.
Schedule the most common exit path first.
Diffstat (limited to 'riscv/csrs.h')
-rw-r--r-- | riscv/csrs.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/riscv/csrs.h b/riscv/csrs.h index c0f5771..946d06c 100644 --- a/riscv/csrs.h +++ b/riscv/csrs.h @@ -185,8 +185,11 @@ class cause_csr_t: public basic_csr_t { class base_status_csr_t: public csr_t { public: base_status_csr_t(processor_t* const proc, const reg_t addr); - // Return true if the specified bits are not 00 (Off) - bool enabled(const reg_t which); + + bool field_exists(const reg_t which) { + return (sstatus_write_mask & which) != 0; + } + protected: reg_t adjust_sd(const reg_t val) const noexcept; void maybe_flush_tlb(const reg_t newval) noexcept; |