pub struct VectorRegisterFile<const VLEN: Vlen>(/* private fields */);Expand description
Alignment wrapper for vector registers
Implementations§
Source§impl<const VLEN: Vlen> VectorRegisterFile<VLEN>
impl<const VLEN: Vlen> VectorRegisterFile<VLEN>
Sourcepub const fn get_mut(&mut self, index: VReg) -> &mut [u8; _]
pub const fn get_mut(&mut self, index: VReg) -> &mut [u8; _]
Get mutable reference to a vector register
Sourcepub const fn as_bytes(&self) -> &[[u8; _]; 32]
pub const fn as_bytes(&self) -> &[[u8; _]; 32]
All vector registers as one contiguous array of bytes.
Register v occupies bytes [v * VLENB, (v + 1) * VLENB) of the flattened array, so a
register group is a contiguous range and its elements are at Self::element_offset().
Sourcepub const fn as_bytes_mut(&mut self) -> &mut [[u8; _]; 32]
pub const fn as_bytes_mut(&mut self) -> &mut [[u8; _]; 32]
All vector registers as one contiguous mutable array of bytes, see Self::as_bytes()
Sourcepub const fn element_offset<W>(base_reg: VReg, elem_i: u16, eew: W) -> usize
pub const fn element_offset<W>(base_reg: VReg, elem_i: u16, eew: W) -> usize
Byte offset within flattened Self::as_bytes() of element elem_i in the register
group starting at base_reg, with eew-wide elements.
Element widths divide VLENB, so elements never straddle registers and a register group
is one contiguous array of elements.
Sourcepub const unsafe fn read_element<W>(
&self,
base_reg: VReg,
elem_i: u16,
eew: W,
) -> u64
pub const unsafe fn read_element<W>( &self, base_reg: VReg, elem_i: u16, eew: W, ) -> u64
Read element elem_i of the register group starting at base_reg, with eew-wide
elements, zero-extended.
§Safety
The element must lie within the register file, which holds for any elem_i < vl of a
register group [base_reg, base_reg + group_regs) that ends within the register file,
since vl <= group_regs * VLENB / eew.bytes_width().
Sourcepub const unsafe fn write_element<W>(
&mut self,
base_reg: VReg,
elem_i: u16,
eew: W,
value: u64,
)
pub const unsafe fn write_element<W>( &mut self, base_reg: VReg, elem_i: u16, eew: W, value: u64, )
Write the low eew.bytes_width() bytes of value into element elem_i of the register
group starting at base_reg, with eew-wide elements.
§Safety
Same as Self::read_element()
Sourcepub const unsafe fn read_element_const<const EEW: Eew>(
&self,
base_reg: VReg,
elem_i: u16,
) -> u64
pub const unsafe fn read_element_const<const EEW: Eew>( &self, base_reg: VReg, elem_i: u16, ) -> u64
Self::read_element() with the element width known at compile time, which makes the
access a fixed-size load
§Safety
Same as Self::read_element()
Sourcepub const unsafe fn write_element_const<const EEW: Eew>(
&mut self,
base_reg: VReg,
elem_i: u16,
value: u64,
)
pub const unsafe fn write_element_const<const EEW: Eew>( &mut self, base_reg: VReg, elem_i: u16, value: u64, )
Self::write_element() with the element width known at compile time, which makes the
access a fixed-size store
§Safety
Same as Self::read_element()
Trait Implementations§
Source§impl<const VLEN: Vlen> Clone for VectorRegisterFile<VLEN>
impl<const VLEN: Vlen> Clone for VectorRegisterFile<VLEN>
Source§fn clone(&self) -> VectorRegisterFile<VLEN>
fn clone(&self) -> VectorRegisterFile<VLEN>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more