Skip to main content

Register

Trait Register 

Source
pub trait Register:
    Display
    + Debug
    + Default
    + Eq
    + Copy
    + Send
    + Sync
    + Sized
    + 'static {
    type Type: RegType;

    const ZERO: Self;
    const SP: Self;
    const RA: Self;
    const A0: Self;
    const A1: Self;
    const XLEN: u8 = <Self::Type>::BITS;

    // Required method
    fn from_bits(bits: u8) -> Option<Self>;
}
Expand description

GPR (General Purpose Register)

Required Associated Constants§

Source

const ZERO: Self

Zero register

Source

const SP: Self

Stack pointer register

Source

const RA: Self

Return address register

Source

const A0: Self

Function argument register a0

Source

const A1: Self

Function argument register a1

Provided Associated Constants§

Source

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

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

Required Associated Types§

Source

type Type: RegType

Register type.

u32 for RV32 and u64 for RV64.

Required Methods§

Source

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

Create a register from its bit representation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Register for EReg<u32>

Source§

const ZERO: Self = Self::Zero

Source§

const SP: Self = Self::Sp

Source§

const RA: Self = Self::Ra

Source§

const A0: Self = Self::A0

Source§

const A1: Self = Self::A1

Source§

type Type = u32

Source§

impl Register for EReg<u64>

Source§

const ZERO: Self = Self::Zero

Source§

const SP: Self = Self::Sp

Source§

const RA: Self = Self::Ra

Source§

const A0: Self = Self::A0

Source§

const A1: Self = Self::A1

Source§

type Type = u64

Source§

impl Register for Reg<u32>

Source§

const ZERO: Self = Self::Zero

Source§

const SP: Self = Self::Sp

Source§

const RA: Self = Self::Ra

Source§

const A0: Self = Self::A0

Source§

const A1: Self = Self::A1

Source§

type Type = u32

Source§

impl Register for Reg<u64>

Source§

const ZERO: Self = Self::Zero

Source§

const SP: Self = Self::Sp

Source§

const RA: Self = Self::Ra

Source§

const A0: Self = Self::A0

Source§

const A1: Self = Self::A1

Source§

type Type = u64