Skip to main content

VectorConfig

Struct VectorConfig 

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

Vector configuration: vtype together with vl, where vl never exceeds VLMAX of vtype.

Neither vtype nor vl can be written by Zicsr instructions, they only ever change together through vset{i}vl{i} and fault-only-first loads (which only shrink vl), so this is the architectural state as a single value. Constructors enforce the invariant, which unsafe code relies on to access vector register elements without bounds checks, so there must be no way to construct an instance that violates it.

vill is represented as None in Option<VectorConfig>, vl is zero then.

Implementations§

Source§

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

Source

pub const fn new(vtype: Vtype<Hart>, vl: Vl) -> Option<Self>

Create a new configuration.

Returns None if vl exceeds VLMAX of vtype.

Source

pub const fn from_avl(vtype: Vtype<Hart>, avl: Vl) -> Self

Create a new configuration the way vset{i}vl{i} does for application vector length avl, which is min(AVL, VLMAX).

This satisfies every constraint the specification places on vl, and with no choice left to the implementation, vl is the same on every implementation with the same VLEN.

Source

pub const fn from_raw<Reg>(vtype: Reg::Type, vl: Reg::Type) -> Option<Self>
where Reg: Register,

Decode from raw vtype and vl register values.

Returns None if vtype has vill set or is invalid otherwise, or if vl exceeds VLMAX of vtype. The latter is not a state the architecture can get into, it is treated as vill rather than corrected, so that whatever produced it does not go unnoticed.

Source

pub const fn vtype(self) -> Vtype<Hart>

vtype

Source

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

vl, which never exceeds Self::vlmax() and hence VLEN

Source

pub const fn vlmax(self) -> Vl

VLMAX of vtype

Source

pub const fn with_vl_at_most(self, vl: Vl) -> Self

The same configuration with vl reduced to vl if it is lower than the current one, which is what fault-only-first loads do

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> VectorConfig<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 VectorConfig<Hart>
where Hart: VectorHartConfig + Copy,

Source§

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

Source§

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

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

impl<Hart> Eq for VectorConfig<Hart>
where Hart: VectorHartConfig,

Source§

impl<Hart> PartialEq for VectorConfig<Hart>
where Hart: VectorHartConfig,

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<Hart> Freeze for VectorConfig<Hart>
where Vtype<Hart>: Freeze,

§

impl<Hart> RefUnwindSafe for VectorConfig<Hart>
where Vtype<Hart>: RefUnwindSafe,

§

impl<Hart> Send for VectorConfig<Hart>
where Vtype<Hart>: Send,

§

impl<Hart> Sync for VectorConfig<Hart>
where Vtype<Hart>: Sync,

§

impl<Hart> Unpin for VectorConfig<Hart>
where Vtype<Hart>: Unpin,

§

impl<Hart> UnsafeUnpin for VectorConfig<Hart>
where Vtype<Hart>: UnsafeUnpin,

§

impl<Hart> UnwindSafe for VectorConfig<Hart>
where Vtype<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.