pub trait VectorRegistersExt<Reg, CustomError = CustomErrorPlaceholder>where
Self: Csrs<Reg, CustomError> + VectorRegisters<CustomError>,
[(); ab_riscv_primitives::prelude::SUPPORTED_ELEN_VLEN::<<Self as v::vector_registers::VectorRegistersBase>::ELEN, <Self as v::vector_registers::VectorRegistersBase>::VLEN>]:,
Reg: Register,
CustomError: Debug,{
// Provided methods
fn initialize_vector_state(&mut self) { ... }
fn vstart(&self) -> Vstart { ... }
fn set_vstart(&mut self, vstart: Vstart) { ... }
fn reset_vstart(&mut self) { ... }
fn vxsat(&self) -> bool { ... }
fn set_vxsat(&mut self, vxsat: bool) { ... }
fn vxrm(&self) -> Vxrm { ... }
fn set_vxrm(&mut self, vxrm: Vxrm) { ... }
fn vl(&self) -> Vl { ... }
fn set_vl(&mut self, vl: Vl) { ... }
fn vtype(&self) -> Option<Vtype<ELEN, VLEN>> { ... }
fn set_vtype(&mut self, vtype: Option<Vtype<ELEN, VLEN>>) { ... }
}Expand description
Derived convenience accessors for vector CSRs that are simple read/write fields (vstart, vxrm, vxsat, vcsr).
Intended for types that implement both VectorRegisters and Csrs.
NOTE: While the default methods implemented via the Csrs trait are correct, custom
higher-performance implementations are often possible by overriding them and, for example,
caching various CSRs as separate pre-decoded values rather than going through a generic code
path with XLEN-sized raw CSR values during reads.
Provided Methods§
Sourcefn initialize_vector_state(&mut self)
fn initialize_vector_state(&mut self)
Initialize the vector state to the recommended default configuration.
Per spec: vtype.vill = 1, remaining vtype bits = 0, vl = 0.
vstart, vxrm, vxsat may have arbitrary values at reset but are zeroed here for
deterministic behavior.
Sourcefn set_vstart(&mut self, vstart: Vstart)
fn set_vstart(&mut self, vstart: Vstart)
Set vstart.
The default implementation ignores writes to uninitialized CSR in release mode and panics in debug.
Sourcefn reset_vstart(&mut self)
fn reset_vstart(&mut self)
Reset vstart to zero.
Per spec, all vector instructions reset vstart to zero at the end of execution.
Sourcefn set_vxsat(&mut self, vxsat: bool)
fn set_vxsat(&mut self, vxsat: bool)
Set vxsat.
The default implementation ignores writes to uninitialized CSR in release mode and panics in debug.
Sourcefn set_vxrm(&mut self, vxrm: Vxrm)
fn set_vxrm(&mut self, vxrm: Vxrm)
Set vxrm.
The default implementation ignores writes to uninitialized CSR in release mode and panics in debug.
Sourcefn set_vl(&mut self, vl: Vl)
fn set_vl(&mut self, vl: Vl)
Set vl.
The implementation must update both its internal decoded cache and the raw CSR value (for reads via Zicsr, writes via Zicsr are not allowed).
The default implementation ignores writes to uninitialized CSR in release mode and panics in debug.
Sourcefn set_vtype(&mut self, vtype: Option<Vtype<ELEN, VLEN>>)
fn set_vtype(&mut self, vtype: Option<Vtype<ELEN, VLEN>>)
Set the vtype register from a decoded Vtype.
The implementation must update both its internal decoded cache and the raw CSR value (for reads via Zicsr, writes via Zicsr are not allowed).
The default implementation ignores writes to uninitialized CSR in release mode and panics in debug.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".