Enum CInstruction

Source
pub enum CInstruction {
Show 36 variants ADDI4SPN { dest: CIRegister, imm: CWideImmediate, }, FLD { dest: CFRegister, base: CIRegister, offset: CDImmediate, }, LW { dest: CIRegister, base: CIRegister, offset: CWImmediate, }, LD { dest: CIRegister, base: CIRegister, offset: CDImmediate, }, FSD { src: CFRegister, base: CIRegister, offset: CDImmediate, }, SW { src: CIRegister, base: CIRegister, offset: CWImmediate, }, SD { src: CIRegister, base: CIRegister, offset: CDImmediate, }, ADDI { dest: IRegister, imm: CIImmediate, }, ADDIW { dest: IRegister, imm: CIImmediate, }, LI { dest: IRegister, imm: CIImmediate, }, ADDI16SP { imm: C16SPImmediate, }, LUI { dest: IRegister, imm: CIImmediate, }, SRLI { dest: CIRegister, shamt: CShamt, }, SRAI { dest: CIRegister, shamt: CShamt, }, ANDI { dest: CIRegister, imm: CIImmediate, }, SUB { dest: CIRegister, src: CIRegister, }, XOR { dest: CIRegister, src: CIRegister, }, OR { dest: CIRegister, src: CIRegister, }, AND { dest: CIRegister, src: CIRegister, }, SUBW { dest: CIRegister, src: CIRegister, }, ADDW { dest: CIRegister, src: CIRegister, }, J { offset: CJImmediate, }, BEQZ { src: CIRegister, offset: CBImmediate, }, BNEZ { src: CIRegister, offset: CBImmediate, }, SLLI { dest: IRegister, shamt: CShamt, }, FLDSP { dest: FRegister, offset: CDSPImmediate, }, LWSP { dest: IRegister, offset: CWSPImmediate, }, LDSP { dest: IRegister, offset: CDSPImmediate, }, JR { src: IRegister, }, MV { dest: IRegister, src: IRegister, }, EBREAK, JALR { src: IRegister, }, ADD { dest: IRegister, src: IRegister, }, FSDSP { src: FRegister, offset: CSDSPImmediate, }, SWSP { src: IRegister, offset: CSWSPImmediate, }, SDSP { src: IRegister, offset: CSDSPImmediate, },
}

Variants§

§

ADDI4SPN

§

FLD

Fields

§

LW

Fields

§

LD

Fields

§

FSD

Fields

§

SW

Fields

§

SD

Fields

§

ADDI

Fields

§

ADDIW

Fields

§

LI

Fields

§

ADDI16SP

Fields

§

LUI

Fields

§

SRLI

Fields

§shamt: CShamt
§

SRAI

Fields

§shamt: CShamt
§

ANDI

Fields

§

SUB

Fields

§

XOR

Fields

§

OR

Fields

§

AND

Fields

§

SUBW

Fields

§

ADDW

Fields

§

J

Fields

§

BEQZ

Fields

§

BNEZ

Fields

§

SLLI

Fields

§shamt: CShamt
§

FLDSP

Fields

§

LWSP

Fields

§

LDSP

Fields

§

JR

Fields

§

MV

Fields

§

EBREAK

§

JALR

Fields

§

ADD

Fields

§

FSDSP

Fields

§

SWSP

Fields

§

SDSP

Fields

Implementations§

Source§

impl CInstruction

Source

pub fn decode(instruction: u16) -> Result<Self, String>

Decodes a u16 into a CInstruction.

Source

pub fn disassemble(instruction: &CInstruction) -> String

Source

pub fn expand(&self) -> Instruction

Converts a compressed instruction into the corresponding 32-bit Instruction.

Note that C.JALR does not have exactly the same effect as the corresponding JALR as described in the manual:

Strictly speaking, C.JALR does not expand exactly to a base RVI instruction as the value added to the PC to form the link address is 2 rather than 4 as in the base ISA, but supporting both offsets of 2 and 4 bytes is only a very minor change to the base microarchitecture.

Source

pub fn encode(instruction: &CInstruction) -> u16

Encodes a CInstruction into a u16.

Trait Implementations§

Source§

impl Debug for CInstruction

Source§

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

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

impl Display for CInstruction

Source§

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

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

impl PartialEq for CInstruction

Source§

fn eq(&self, other: &CInstruction) -> 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 StructuralPartialEq for CInstruction

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> 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> 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.