Compressed

Enum Compressed 

Source
pub enum Compressed {
Show 47 variants UNIMP, C_LWSP { rd: u32, offset: i32, }, C_LDSP { rd: u32, offset: i32, }, C_LQSP { rd: u32, offset: i32, }, C_FLWSP { frd: u32, offset: i32, }, C_FLDSP { frd: u32, offset: i32, }, C_SWSP { rs2: u32, offset: i32, }, C_SDSP { rs2: u32, offset: i32, }, C_SQSP { rs2: u32, offset: i32, }, C_FSWSP { frs2: u32, offset: i32, }, C_FSDSP { frs2: u32, offset: i32, }, C_LW { rd: u32, rs1: u32, offset: i32, }, C_LD { rd: u32, rs1: u32, offset: i32, }, C_LQ { rd: u32, rs1: u32, offset: i32, }, C_FLW { frd: u32, rs1: u32, offset: i32, }, C_FLD { frd: u32, rs1: u32, offset: i32, }, C_SW { rs1: u32, rs2: u32, offset: i32, }, C_SD { rs1: u32, rs2: u32, offset: i32, }, C_SQ { rs1: u32, rs2: u32, offset: i32, }, C_FSW { rs1: u32, frs2: u32, offset: i32, }, C_FSD { rs1: u32, frs2: u32, offset: i32, }, C_J { offset: i32, }, C_JAL { offset: i32, }, C_JR { rs1: u32, }, C_JALR { rs1: u32, }, C_BEQZ { rs1: u32, offset: i32, }, C_BNEZ { rs1: u32, offset: i32, }, C_LI { rd: u32, imm: i32, }, C_LUI { rd: u32, imm: u32, }, C_ADDI { rd: u32, imm: i32, }, C_ADDIW { rd: u32, imm: i32, }, C_ADDI16SP { imm: i32, }, C_ADDI4SPN { rd: u32, imm: i32, }, C_SLLI { rd: u32, shamt: u32, }, C_SRLI { rd: u32, shamt: u32, }, C_SRAI { rd: u32, shamt: u32, }, C_ANDI { rd: u32, imm: i32, }, C_MV { rd: u32, rs2: u32, }, C_ADD { rd: u32, rs2: u32, }, C_AND { rd: u32, rs2: u32, }, C_OR { rd: u32, rs2: u32, }, C_XOR { rd: u32, rs2: u32, }, C_SUB { rd: u32, rs2: u32, }, C_ADDW { rd: u32, rs2: u32, }, C_SUBW { rd: u32, rs2: u32, }, C_NOP, C_EBREAK,
}
Expand description

Compressed RISC-V instruction.

Compressed instructions can be decompressed using Instruction::from.

Instruction arguments are all in their decoded forms, meaning correctly scaled and sign extended. Registers are normalised. Their names are as they appear in specifications (for the most part), and include:

  • rd, rs1, `rs2``: destination and source registers.
  • frd, frs2: destination and source floating point registers.
  • offset, imm, shamt: numerical offsets, immediates, and shift amounts.
  • pred, succ: predecessor and successor IORW (input, output, read, write) flags.
  • rm: floating point rounding mode.
  • rl, aq: atomic release and acquire flags.

Assumed and redundant flags are not repeated, i.e. rd is not stored for c.swsp as it’s always sp (x2) and only rd is stored for c.addi as rs1 is always the same.

Variants§

§

UNIMP

§

C_LWSP

Fields

§rd: u32
§offset: i32
§

C_LDSP

Fields

§rd: u32
§offset: i32
§

C_LQSP

Fields

§rd: u32
§offset: i32
§

C_FLWSP

Fields

§frd: u32
§offset: i32
§

C_FLDSP

Fields

§frd: u32
§offset: i32
§

C_SWSP

Fields

§rs2: u32
§offset: i32
§

C_SDSP

Fields

§rs2: u32
§offset: i32
§

C_SQSP

Fields

§rs2: u32
§offset: i32
§

C_FSWSP

Fields

§frs2: u32
§offset: i32
§

C_FSDSP

Fields

§frs2: u32
§offset: i32
§

C_LW

Fields

§rd: u32
§rs1: u32
§offset: i32
§

C_LD

Fields

§rd: u32
§rs1: u32
§offset: i32
§

C_LQ

Fields

§rd: u32
§rs1: u32
§offset: i32
§

C_FLW

Fields

§frd: u32
§rs1: u32
§offset: i32
§

C_FLD

Fields

§frd: u32
§rs1: u32
§offset: i32
§

C_SW

Fields

§rs1: u32
§rs2: u32
§offset: i32
§

C_SD

Fields

§rs1: u32
§rs2: u32
§offset: i32
§

C_SQ

Fields

§rs1: u32
§rs2: u32
§offset: i32
§

C_FSW

Fields

§rs1: u32
§frs2: u32
§offset: i32
§

C_FSD

Fields

§rs1: u32
§frs2: u32
§offset: i32
§

C_J

Fields

§offset: i32
§

C_JAL

Fields

§offset: i32
§

C_JR

Fields

§rs1: u32
§

C_JALR

Fields

§rs1: u32
§

C_BEQZ

Fields

§rs1: u32
§offset: i32
§

C_BNEZ

Fields

§rs1: u32
§offset: i32
§

C_LI

Fields

§rd: u32
§imm: i32
§

C_LUI

Fields

§rd: u32
§imm: u32
§

C_ADDI

Fields

§rd: u32
§imm: i32
§

C_ADDIW

Fields

§rd: u32
§imm: i32
§

C_ADDI16SP

Fields

§imm: i32
§

C_ADDI4SPN

Fields

§rd: u32
§imm: i32
§

C_SLLI

Fields

§rd: u32
§shamt: u32
§

C_SRLI

Fields

§rd: u32
§shamt: u32
§

C_SRAI

Fields

§rd: u32
§shamt: u32
§

C_ANDI

Fields

§rd: u32
§imm: i32
§

C_MV

Fields

§rd: u32
§rs2: u32
§

C_ADD

Fields

§rd: u32
§rs2: u32
§

C_AND

Fields

§rd: u32
§rs2: u32
§

C_OR

Fields

§rd: u32
§rs2: u32
§

C_XOR

Fields

§rd: u32
§rs2: u32
§

C_SUB

Fields

§rd: u32
§rs2: u32
§

C_ADDW

Fields

§rd: u32
§rs2: u32
§

C_SUBW

Fields

§rd: u32
§rs2: u32
§

C_NOP

§

C_EBREAK

Implementations§

Source§

impl Compressed

Source

pub fn branch(&self) -> bool

Check whether an instruction could branch or jump.

Trait Implementations§

Source§

impl Clone for Compressed

Source§

fn clone(&self) -> Compressed

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 Debug for Compressed

Source§

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

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

impl Display for Compressed

Source§

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

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

impl From<Compressed> for Instruction

Source§

fn from(compressed: Compressed) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Compressed

Source§

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

Source§

impl Eq for Compressed

Source§

impl StructuralPartialEq for Compressed

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