Browse Source
Remove incorrect use of static variable
It prevents modeling mixed RV32/RV64 systems.
pull/2239/head
Andrew Waterman
1 month ago
Failed to extract signature
1 changed files with
2 additions and
3 deletions
-
riscv/csrs.cc
|
|
|
@ -455,12 +455,11 @@ reg_t base_status_csr_t::compute_sstatus_write_mask() const noexcept { |
|
|
|
} |
|
|
|
|
|
|
|
reg_t base_status_csr_t::adjust_sd(const reg_t val) const noexcept { |
|
|
|
// This uses get_const_xlen() instead of get_xlen() not only because
|
|
|
|
// the variable is static, so it's only called once, but also
|
|
|
|
// This uses get_const_xlen() instead of get_xlen()
|
|
|
|
// because the SD bit moves when XLEN changes, which means we would
|
|
|
|
// need to call adjust_sd() on every read, instead of on every
|
|
|
|
// write.
|
|
|
|
static const reg_t sd_bit = proc->get_const_xlen() == 64 ? SSTATUS64_SD : SSTATUS32_SD; |
|
|
|
const reg_t sd_bit = proc->get_const_xlen() == 64 ? SSTATUS64_SD : SSTATUS32_SD; |
|
|
|
if (((val & SSTATUS_FS) == SSTATUS_FS) || |
|
|
|
((val & SSTATUS_VS) == SSTATUS_VS) || |
|
|
|
((val & SSTATUS_XS) == SSTATUS_XS)) { |
|
|
|
|