pub struct VectorRegisterFile<Hart>(/* private fields */)
where
Hart: VectorHartConfig;Expand description
Vector register file container.
ELEN of the hart configuration must be 32 or 64 bits as required by Zve* extensions, which is
checked at compile time.
Implementations§
Source§impl<Hart> VectorRegisterFile<Hart>where
Hart: VectorHartConfig,
impl<Hart> VectorRegisterFile<Hart>where
Hart: VectorHartConfig,
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 fn read(&self, group: VRegGroup<Hart>, elem_i: u16) -> Option<u64>
pub const fn read(&self, group: VRegGroup<Hart>, elem_i: u16) -> Option<u64>
Read body element elem_i of group, zero-extended.
Returns None if elem_i is not below VRegGroup::vl().
Sourcepub const fn write(
&mut self,
group: VRegGroup<Hart>,
elem_i: u16,
value: u64,
) -> Option<()>
pub const fn write( &mut self, group: VRegGroup<Hart>, elem_i: u16, value: u64, ) -> Option<()>
Write the low bits of value into body element elem_i of group.
Returns None if elem_i is not below VRegGroup::vl().
Sourcepub const fn read_up_to_vlmax(
&self,
group: VRegGroup<Hart>,
elem_i: u16,
) -> Option<u64>
pub const fn read_up_to_vlmax( &self, group: VRegGroup<Hart>, elem_i: u16, ) -> Option<u64>
Read any element elem_i of group, including those past vl, zero-extended.
This is for instructions that index a source by data, like vrgather. Returns None if
elem_i is not below VRegGroup::vlmax().
Sourcepub fn copy_elements(
&mut self,
dst: VRegGroup<Hart>,
dst_first: u16,
src: VRegGroup<Hart>,
src_first: u16,
count: u32,
) -> bool
pub fn copy_elements( &mut self, dst: VRegGroup<Hart>, dst_first: u16, src: VRegGroup<Hart>, src_first: u16, count: u32, ) -> bool
Copy count elements starting at src_first of src to elements starting at dst_first
of dst, like memmove, so the two ranges may overlap.
Destination elements must be body elements, source elements may be any elements below
VRegGroup::vlmax(), like for vslidedown. Returns false without writing anything if
either range is out of bounds or the groups have different element widths.
Sourcepub fn elements_bytes(
&self,
group: VRegGroup<Hart>,
first: u16,
count: u32,
) -> Option<&[u8]>
pub fn elements_bytes( &self, group: VRegGroup<Hart>, first: u16, count: u32, ) -> Option<&[u8]>
Bytes of count body elements starting at first of group.
Returns None if the range is not within VRegGroup::vl().
Sourcepub fn elements_bytes_mut(
&mut self,
group: VRegGroup<Hart>,
first: u16,
count: u32,
) -> Option<&mut [u8]>
pub fn elements_bytes_mut( &mut self, group: VRegGroup<Hart>, first: u16, count: u32, ) -> Option<&mut [u8]>
Mutable bytes of count body elements starting at first of group.
Returns None if the range is not within VRegGroup::vl().
Sourcepub const fn read_first(&self, reg: VReg, eew: Eew) -> Option<u64>
pub const fn read_first(&self, reg: VReg, eew: Eew) -> Option<u64>
Read element 0 of register reg with width eew, zero-extended.
This is the scalar operand of reductions and scalar moves, which is a single register
regardless of LMUL. Returns None if eew is wider than VLEN, which never happens for
an element width that doesn’t exceed ELEN.
Sourcepub const fn write_first(
&mut self,
reg: VReg,
eew: Eew,
value: u64,
) -> Option<()>
pub const fn write_first( &mut self, reg: VReg, eew: Eew, value: u64, ) -> Option<()>
Write the low bits of value into element 0 of register reg with width eew.
Returns None if eew is wider than VLEN, see Self::read_first().
Sourcepub const fn read_const<const EEW: Eew>(
&self,
group: VRegGroup<Hart>,
elem_i: u16,
) -> Option<u64>
pub const fn read_const<const EEW: Eew>( &self, group: VRegGroup<Hart>, elem_i: u16, ) -> Option<u64>
Self::read() with the element width known at compile time, which makes the access a
fixed-size load.
Returns None if EEW is not the element width of group or elem_i is not below
VRegGroup::vl().
Sourcepub const fn write_const<const EEW: Eew>(
&mut self,
group: VRegGroup<Hart>,
elem_i: u16,
value: u64,
) -> Option<()>
pub const fn write_const<const EEW: Eew>( &mut self, group: VRegGroup<Hart>, elem_i: u16, value: u64, ) -> Option<()>
Self::write() with the element width known at compile time, which makes the access a
fixed-size store.
Returns None if EEW is not the element width of group or elem_i is not below
VRegGroup::vl().
Trait Implementations§
Source§impl<Hart> Clone for VectorRegisterFile<Hart>where
Hart: VectorHartConfig + Clone,
impl<Hart> Clone for VectorRegisterFile<Hart>where
Hart: VectorHartConfig + Clone,
Source§fn clone(&self) -> VectorRegisterFile<Hart>
fn clone(&self) -> VectorRegisterFile<Hart>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more