Skip to main content

VectorRegisterFile

Struct VectorRegisterFile 

Source
pub struct VectorRegisterFile<const VLEN: Vlen>(/* private fields */);
Expand description

Alignment wrapper for vector registers

Implementations§

Source§

impl<const VLEN: Vlen> VectorRegisterFile<VLEN>

Source

pub const fn get(&self, index: VReg) -> &[u8; _]

Get reference to a vector register

Source

pub const fn get_mut(&mut self, index: VReg) -> &mut [u8; _]

Get mutable reference to a vector register

Source

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

Source

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

Source

pub const fn element_offset<W>(base_reg: VReg, elem_i: u16, eew: W) -> usize
where W: Into<Eew>,

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.

Source

pub const unsafe fn read_element<W>( &self, base_reg: VReg, elem_i: u16, eew: W, ) -> u64
where W: Into<Eew>,

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

Source

pub const unsafe fn write_element<W>( &mut self, base_reg: VReg, elem_i: u16, eew: W, value: u64, )
where W: Into<Eew>,

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

Source

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

Source

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>

Source§

fn clone(&self) -> VectorRegisterFile<VLEN>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const VLEN: Vlen> Copy for VectorRegisterFile<VLEN>

Source§

impl<const VLEN: Vlen> Debug for VectorRegisterFile<VLEN>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const VLEN: Vlen> Default for VectorRegisterFile<VLEN>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const VLEN: Vlen> Freeze for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: Freeze,

§

impl<const VLEN: Vlen> RefUnwindSafe for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: RefUnwindSafe,

§

impl<const VLEN: Vlen> Send for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: Send,

§

impl<const VLEN: Vlen> Sync for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: Sync,

§

impl<const VLEN: Vlen> Unpin for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: Unpin,

§

impl<const VLEN: Vlen> UnsafeUnpin for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: UnsafeUnpin,

§

impl<const VLEN: Vlen> UnwindSafe for VectorRegisterFile<VLEN>
where [[u8; _]; 32]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.