Skip to main content

ContractRegister

Enum ContractRegister 

Source
#[repr(u8)]
pub enum ContractRegister {
Show 30 variants Zero = 0, Ra = 1, Sp = 2, T0 = 5, T1 = 6, T2 = 7, S0 = 8, S1 = 9, A0 = 10, A1 = 11, A2 = 12, A3 = 13, A4 = 14, A5 = 15, A6 = 16, A7 = 17, S2 = 18, S3 = 19, S4 = 20, S5 = 21, S6 = 22, S7 = 23, S8 = 24, S9 = 25, S10 = 26, S11 = 27, T3 = 28, T4 = 29, T5 = 30, T6 = 31,
}
Expand description

A register type used by contracts.

gp and tp registers are excluded because they are not present in contracts.

Variants§

§

Zero = 0

Always zero: x0

§

Ra = 1

Return address: x1

§

Sp = 2

Stack pointer: x2

§

T0 = 5

Temporary/alternate return address: x5

§

T1 = 6

Temporary: x6

§

T2 = 7

Temporary: x7

§

S0 = 8

Saved register/frame pointer: x8

§

S1 = 9

Saved register: x9

§

A0 = 10

Function argument/return value: x10

§

A1 = 11

Function argument/return value: x11

§

A2 = 12

Function argument: x12

§

A3 = 13

Function argument: x13

§

A4 = 14

Function argument: x14

§

A5 = 15

Function argument: x15

§

A6 = 16

Function argument: x16

§

A7 = 17

Function argument: x17

§

S2 = 18

Saved register: x18

§

S3 = 19

Saved register: x19

§

S4 = 20

Saved register: x20

§

S5 = 21

Saved register: x21

§

S6 = 22

Saved register: x22

§

S7 = 23

Saved register: x23

§

S8 = 24

Saved register: x24

§

S9 = 25

Saved register: x25

§

S10 = 26

Saved register: x26

§

S11 = 27

Saved register: x27

§

T3 = 28

Temporary: x28

§

T4 = 29

Temporary: x29

§

T5 = 30

Temporary: x30

§

T6 = 31

Temporary: x31

Trait Implementations§

Source§

impl Clone for ContractRegister

Source§

fn clone(&self) -> ContractRegister

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 ContractRegister

Source§

impl Debug for ContractRegister

Source§

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

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

impl Default for ContractRegister

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ContractRegister

Source§

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

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

impl Eq for ContractRegister

Source§

impl PartialEq for ContractRegister

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 Register for ContractRegister

Source§

const ZERO: Self = Self::Zero

Zero register
Source§

const SP: Self = Self::Sp

Stack pointer register
Source§

const RA: Self = Self::Ra

Return address register
Source§

const A0: Self = Self::A0

Function argument register a0
Source§

const A1: Self = Self::A1

Function argument register a1
Source§

type Type = u64

Register type. Read more
Source§

fn from_bits(bits: u8) -> Option<Self>

Create a register from its bit representation
§

const XLEN: u8 = <Self::Type>::BITS

Whether this is RVE variant with the number of general purpose registers reduced to 16 XLEN
Source§

impl RegisterFile<ContractRegister> for ContractRegisters

Source§

fn read(&self, reg: ContractRegister) -> u64

Read register value
Source§

fn write(&mut self, reg: ContractRegister, value: u64)

Write register value
Source§

impl ZcmpRegister for ContractRegister

SAFETY: Self::from_bits() returns Some() for 1, 8, 9 and 18..=27

Source§

const RVE: bool = false

Whether this is RVE variant with the number of general purpose registers reduced to 16

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more