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,
impl<Hart> VRegGroup<Hart>where
Hart: VectorHartConfig,
Sourcepub const fn new(
config: VectorConfig<Hart>,
base: VReg,
eew: Eew,
) -> Option<Self>
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.
Sourcepub const fn whole_registers(
base: VReg,
group_regs: VRegGroupSize,
eew: Eew,
) -> Option<Self>
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.
Sourcepub const fn with_vl(self, vl: Vl) -> Option<Self>
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
Sourcepub const fn with_same_vl(self, vl: BoundedVl<Hart>) -> Option<Self>
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.
Sourcepub const fn group_regs(self) -> VRegGroupSize
pub const fn group_regs(self) -> VRegGroupSize
Number of registers in the group, which is one for fractional EMUL too
Sourcepub const fn contains(self, reg: VReg) -> bool
pub const fn contains(self, reg: VReg) -> bool
Whether reg is one of the registers of this group
Sourcepub const fn overlaps(self, other: Self) -> bool
pub const fn overlaps(self, other: Self) -> bool
Whether the registers of this group and other overlap
Sourcepub const fn vlmax(self) -> Vl
pub const fn vlmax(self) -> Vl
Number of elements the group holds, which is VLMAX and at least Self::vl()