Instruction

Struct Instruction 

Source
pub struct Instruction(/* private fields */);

Implementations§

Source§

impl Instruction

Source

pub fn new(raw: u32) -> Self

Source

pub fn raw(&self) -> u32

Source

pub fn opcode(&self) -> u8

The instruction’s primary opcode.

Source

pub fn funct(&self) -> u8

For SPECIAL (00), opcode instructions (R-Type), this returns the function code, or secondary opcode.

Source

pub fn rs(&self) -> usize

The index of the rs (source) register.Like forrtandrd`, it is not always a source register.

Source

pub fn rt(&self) -> usize

The index of the rt (target) register.

Source

pub fn rd(&self) -> usize

The index of the rd (destination) register.

Source

pub fn shamt(&self) -> usize

The numerical value of the shift amount. 0 to 31.

Source

pub fn simm16(&self) -> i32

The value of the 16-bit immediate value, sign-extended to 32 bits.

Source

pub fn imm16(&self) -> u32

The value of the 16-bit immediate value, zero-extended to 32 bits.

Source

pub fn jump_target(&self) -> u32

The value of the 26-bit jump target field, zero-extended to 32 bits. You must shift this value left by 2 bits to get the actual address.

Source

pub fn cop_execute(&self) -> bool

This bit is set if the instruction must be executed by a coprocessor.

Source

pub fn cop_funct(&self) -> u8

For non cop-execute instructions, this is the secondary opcode, to distinguish between mfc, mtc, etc…

Source

pub fn cop_instruction(&self) -> u32

The raw coprocessor instruction code, which is the lower 25 bits. The meaning is coprocessor-specific.

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