Skip to content

Commit 08d5119

Browse files
committed
Relax mstatus.vs dependency on full V
1 parent a484f6e commit 08d5119

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

riscv/csrs.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ reg_t base_status_csr_t::compute_sstatus_write_mask() const noexcept {
412412
// If a configuration has FS bits, they will always be accessible no
413413
// matter the state of misa.
414414
const bool has_fs = (proc->extension_enabled('S') || proc->extension_enabled('F')) && !proc->extension_enabled(EXT_ZFINX);
415-
const bool has_vs = proc->extension_enabled('V');
415+
// Implementations w/o V may still have mstatus.vs,
416+
const bool has_vs = proc->any_vector_extensions();
416417
return 0
417418
| (proc->extension_enabled('S') ? (SSTATUS_SIE | SSTATUS_SPIE | SSTATUS_SPP) : 0)
418419
| (has_page ? (SSTATUS_SUM | SSTATUS_MXR) : 0)

riscv/processor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ class processor_t : public abstract_device_t
273273
bool any_custom_extensions() const {
274274
return !custom_extensions.empty();
275275
}
276+
bool any_vector_extensions() const {
277+
return VU.VLEN > 0;
278+
}
276279
bool extension_enabled(unsigned char ext) const {
277280
return extension_enabled(isa_extension_t(ext));
278281
}

0 commit comments

Comments
 (0)