Skip to main content

VectorRegistersExt

Trait VectorRegistersExt 

Source
pub trait VectorRegistersExt<Reg, CustomError = CustomErrorPlaceholder>
where Self: Csrs<Reg, CustomError> + VectorRegisters<CustomError>, [(); { _ }]:, Reg: Register, CustomError: Debug,
{ // Provided methods fn initialize_vector_state(&mut self) { ... } fn vstart(&self) -> u16 { ... } fn set_vstart(&mut self, vstart: u16) { ... } 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) -> u32 { ... } fn set_vl(&mut self, vl: u32) { ... } fn vtype(&self) -> Option<Vtype<{ Self::ELEN }, { Self::VLEN }>> { ... } fn set_vtype( &mut self, vtype: Option<Vtype<{ Self::ELEN }, { Self::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§

Source

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.

Source

fn vstart(&self) -> u16

Get current vstart

Source

fn set_vstart(&mut self, vstart: u16)

Set vstart

Source

fn reset_vstart(&mut self)

Reset vstart to zero.

Per spec, all vector instructions reset vstart to zero at the end of execution.

Source

fn vxsat(&self) -> bool

Get vxsat (single bit)

Source

fn set_vxsat(&mut self, vxsat: bool)

Set vxsat

Source

fn vxrm(&self) -> Vxrm

Get vxrm

Source

fn set_vxrm(&mut self, vxrm: Vxrm)

Set vxrm

Source

fn vl(&self) -> u32

Get the current vl

Source

fn set_vl(&mut self, vl: u32)

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).

Source

fn vtype(&self) -> Option<Vtype<{ Self::ELEN }, { Self::VLEN }>>

Get the current decoded vtype

Source

fn set_vtype(&mut self, vtype: Option<Vtype<{ Self::ELEN }, { Self::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).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§