Skip to main content

Extensions

Struct Extensions 

Source
pub struct Extensions(/* private fields */);
Expand description

A set of Extensions.

Adding an extension also adds the extensions it implies (D implies F), and removing one also removes the extensions that imply it (removing F removes D).

use disc_v::{Extension, Extensions};

let exts = Extensions::GC.with(Extension::Zba).without(Extension::D);
assert!(exts.contains(Extension::F));
assert!(!exts.contains(Extension::Q));

Implementations§

Source§

impl Extensions

Source

pub const EMPTY: Extensions

No extensions: only the base integer ISA.

Source

pub const DEFAULT: Extensions

Every supported standard extension that does not conflict with another. Vendor extensions are left out: they use the custom opcode spaces, which each vendor’s cores use differently. This is what decode and the other free functions use.

Source

pub const GC: Extensions

G and C: IMAFD, Zicsr, Zifencei and C, as in RV32GC and RV64GC.

Source

pub const RVA23U64: Extensions

The extensions of the RVA23U64 profile that define instructions.

Source

pub const RVA23S64: Extensions

The extensions of the RVA23S64 profile that define instructions: RVA23U64, Zifencei, Svinval and H.

Source

pub const XTHEAD: Extensions

Every T-Head vendor extension (XThead*), as in T-Head’s C9xx cores.

Source

pub const XCV: Extensions

Every CORE-V vendor extension (XCV*), as in the OpenHW Group’s CV32E40P core.

Source

pub const fn of(exts: &[Extension]) -> Extensions

The extensions in exts, and the extensions they imply.

Source

pub const fn contains(self, ext: Extension) -> bool

Whether the set contains ext.

Source

pub const fn with(self, ext: Extension) -> Extensions

The set with ext and the extensions it implies added.

Source

pub const fn without(self, ext: Extension) -> Extensions

The set with ext and the extensions that imply it removed.

C is a bundle of Zca and (with F and D) Zcf and Zcd: removing C removes every compressed instruction, and removing Zcf or Zcd removes C but keeps Zca.

Source

pub const fn union(self, other: Extensions) -> Extensions

The extensions in either set (and the extensions they imply together, such as Zcd for C and D).

Source

pub fn iter(self) -> impl Iterator<Item = Extension>

The extensions in the set, in declaration order.

Trait Implementations§

Source§

impl BitOr for Extensions

Source§

type Output = Extensions

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Extensions) -> Extensions

Performs the | operation. Read more
Source§

impl Clone for Extensions

Source§

fn clone(&self) -> Self

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 Copy for Extensions

Source§

impl Debug for Extensions

Source§

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

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

impl Default for Extensions

Source§

impl Eq for Extensions

Source§

impl From<&[Extension]> for Extensions

Source§

fn from(exts: &[Extension]) -> Self

Converts to this type from the input type.
Source§

impl From<Extension> for Extensions

Source§

fn from(ext: Extension) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[Extension; N]> for Extensions

Source§

fn from(exts: [Extension; N]) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Extension> for Extensions

Source§

fn from_iter<I: IntoIterator<Item = Extension>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for Extensions

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Extensions

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
Source§

impl StructuralPartialEq for Extensions

Auto Trait Implementations§

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, 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, !>

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.