Skip to main content

VectorRegisters

Trait VectorRegisters 

Source
pub trait VectorRegisters {
    type Hart: VectorHartConfig;

    // Required methods
    fn read_vregs(&self) -> &VectorRegisterFile<Self::Hart>;
    fn write_vregs(&mut self) -> &mut VectorRegisterFile<Self::Hart>;
    fn vector_instructions_allowed(&self) -> bool;
    fn mark_vs_dirty(&mut self);
}
Expand description

Vector register state.

This trait contains only methods that implementations genuinely need to provide. Derived accessors for simpler CSRs are in VectorRegistersExt.

Note that due to Rust type system limitations, you should use VectorRegistersExt in trait bounds instead of this trait directly or else the solver will fail.

Required Associated Types§

Source

type Hart: VectorHartConfig

Hart configuration, which determines vector lengths

Required Methods§

Source

fn read_vregs(&self) -> &VectorRegisterFile<Self::Hart>

Read the vector register file

Source

fn write_vregs(&mut self) -> &mut VectorRegisterFile<Self::Hart>

Mutable access to the vector register file

Source

fn vector_instructions_allowed(&self) -> bool

Check whether vector instructions are currently permitted.

Returns false when mstatus.VS == Off (or equivalent like sstatus/vstatus). In environments without these status registers, returns true always.

Source

fn mark_vs_dirty(&mut self)

Mark the vector state as dirty.

Must set VS to Dirty in mstatus (and sstatus/vsstatus shadows) when those registers exist. No-op otherwise.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> VectorRegisters for &mut T
where T: VectorRegisters,

Implementors§