Skip to main content

Vtype

Struct Vtype 

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

Decoded vtype register contents.

The vtype CSR controls the interpretation of the vector register file: element width, register grouping, and tail/mask agnostic policies.

The raw encoding is XLEN-dependent (vill is at bit XLEN-1), but this decoded form is XLEN-independent.

Implementations§

Source§

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

Source

pub const fn vma(&self) -> bool

Vector mask agnostic policy (bit 7)

Source

pub const fn vta(&self) -> bool

Vector tail agnostic policy (bit 6)

Source

pub const fn vsew(&self) -> Vsew

Selected element width (bits [5:3])

Source

pub const fn vlmul(&self) -> Vlmul

Vector length multiplier (bits [2:0])

Source

pub const fn eew_register_count(&self, eew: Eew) -> Option<VRegGroupSize>

Number of registers in a group of elements with effective element width eew, where EMUL = (EEW / SEW) * LMUL.

Returns None when EEW exceeds ELEN or EMUL falls outside the legal range [1/8, 8], both of which are reserved.

Source

pub const fn vlmax(&self) -> Vl

VLMAX = LMUL * VLEN / SEW, which is at least 1 for any valid vtype

Source

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

Decode from raw register value.

The XLEN is taken from Reg::XLEN and must be 32 for RV32 or 64 for RV64. The vill bit is placed at bit position Reg::XLEN - 1.

All bits in [Reg::XLEN-1:8] must be zero; non-zero bits indicate an unrecognized encoding and cause None to be returned (this includes vill).

Source

pub const fn to_raw<Reg>(self) -> Reg::Type
where Reg: Register,

Encode to a raw vtype register value of type Reg::Type.

The encoded value contains vlmul, vsew, vta, and vma in bits [7:0] with vill = 0. To construct a raw value with vill = 1 (illegal configuration), use Self::illegal_raw.

Source

pub const fn illegal_raw<Reg>() -> Reg::Type
where Reg: Register,

Construct a raw value for vtype with vill=1 (illegal configuration).

Per spec: when vill is set, the remaining bits are zero and vl is also set to zero. Any subsequent vector instruction that depends on vtype will raise an illegal-instruction exception.

Trait Implementations§

Source§

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

Source§

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

Source§

impl<Hart> Debug for Vtype<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 Vtype<Hart>
where Hart: VectorHartConfig,

Source§

impl<Hart> PartialEq for Vtype<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 Vtype<Hart>
where PhantomData<Hart>: Freeze,

§

impl<Hart> RefUnwindSafe for Vtype<Hart>

§

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

§

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

§

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

§

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

§

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