Skip to main content

Vtype

Struct Vtype 

Source
pub struct Vtype<const ELEN: u32, const VLEN: u32> { /* 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<const ELEN: u32, const VLEN: u32> Vtype<ELEN, VLEN>

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 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<const ELEN: u32, const VLEN: u32> Clone for Vtype<ELEN, VLEN>

Source§

fn clone(&self) -> Vtype<ELEN, VLEN>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const ELEN: u32, const VLEN: u32> Debug for Vtype<ELEN, VLEN>

Source§

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

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

impl<const ELEN: u32, const VLEN: u32> PartialEq for Vtype<ELEN, VLEN>

Source§

fn eq(&self, other: &Vtype<ELEN, VLEN>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const ELEN: u32, const VLEN: u32> Copy for Vtype<ELEN, VLEN>

Source§

impl<const ELEN: u32, const VLEN: u32> Eq for Vtype<ELEN, VLEN>

Source§

impl<const ELEN: u32, const VLEN: u32> StructuralPartialEq for Vtype<ELEN, VLEN>

Auto Trait Implementations§

§

impl<const ELEN: u32, const VLEN: u32> Freeze for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> RefUnwindSafe for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> Send for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> Sync for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> Unpin for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> UnsafeUnpin for Vtype<ELEN, VLEN>

§

impl<const ELEN: u32, const VLEN: u32> UnwindSafe for Vtype<ELEN, VLEN>

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 = Infallible

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.