Skip to main content

VRegGroup

Struct VRegGroup 

Source
pub struct VRegGroup<Hart>
where Hart: VectorHartConfig,
{ /* private fields */ }
Expand description

Register group of elements of width EEW that lies within the vector register file.

Created from a VectorConfig with EMUL = LMUL * EEW / SEW, it holds VLMAX elements, the first vl of which are the body. This makes the element accesses of VectorRegisterFile::read() and friends safe, since the group carries the bounds they check indices against.

Implementations§

Source§

impl<Hart> VRegGroup<Hart>
where Hart: VectorHartConfig,

Source

pub const fn new( config: VectorConfig<Hart>, base: VReg, eew: Eew, ) -> Option<Self>

Register group starting at base with elements of width eew under config.

Returns None if eew exceeds ELEN, EMUL = LMUL * EEW / SEW is outside [1/8, 8] or base is not aligned to EMUL, each of which makes an instruction illegal.

Source

pub const fn whole_registers( base: VReg, group_regs: VRegGroupSize, eew: Eew, ) -> Option<Self>

Register group of group_regs whole registers starting at base with elements of width eew, regardless of vtype, like the one of whole register loads, stores and moves.

Both vl and VLMAX are the number of elements the registers hold. Returns None if base is not aligned to group_regs or eew is wider than VLEN.

Source

pub const fn with_vl(self, vl: Vl) -> Option<Self>

The same group with vl reduced to vl, returns None if vl is above the current one

Source

pub const fn with_same_vl(self, vl: BoundedVl<Hart>) -> Option<Self>

The same group if its vl is vl, None otherwise.

The returned group carries vl itself, so that a check of an element index against it is trivially the same as a check against vl that loops over body elements do anyway, which is what makes groups of the same instruction interchangeable for the compiler.

Source

pub const fn base(self) -> VReg

First register of the group

Source

pub const fn emul(self) -> Vlmul

Effective multiplier EMUL of the group

Source

pub const fn group_regs(self) -> VRegGroupSize

Number of registers in the group, which is one for fractional EMUL too

Source

pub const fn eew(self) -> Eew

Element width

Source

pub const fn vl(self) -> BoundedVl<Hart>

Number of body elements, which is vl

Source

pub const fn contains(self, reg: VReg) -> bool

Whether reg is one of the registers of this group

Source

pub const fn overlaps(self, other: Self) -> bool

Whether the registers of this group and other overlap

Source

pub const fn vlmax(self) -> Vl

Number of elements the group holds, which is VLMAX and at least Self::vl()

Trait Implementations§

Source§

impl<Hart> Clone for VRegGroup<Hart>
where Hart: VectorHartConfig + Clone,

Source§

fn clone(&self) -> VRegGroup<Hart>

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<Hart> Copy for VRegGroup<Hart>
where Hart: VectorHartConfig + Copy,

Source§

impl<Hart> Debug for VRegGroup<Hart>
where Hart: VectorHartConfig + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Hart> Freeze for VRegGroup<Hart>
where BoundedVl<Hart>: Freeze,

§

impl<Hart> RefUnwindSafe for VRegGroup<Hart>
where BoundedVl<Hart>: RefUnwindSafe,

§

impl<Hart> Send for VRegGroup<Hart>
where BoundedVl<Hart>: Send,

§

impl<Hart> Sync for VRegGroup<Hart>
where BoundedVl<Hart>: Sync,

§

impl<Hart> Unpin for VRegGroup<Hart>
where BoundedVl<Hart>: Unpin,

§

impl<Hart> UnsafeUnpin for VRegGroup<Hart>
where BoundedVl<Hart>: UnsafeUnpin,

§

impl<Hart> UnwindSafe for VRegGroup<Hart>
where BoundedVl<Hart>: 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.