pub struct Instruction {
pub pc: u32,
pub opcode: Opcode,
pub instruction: u32,
/* private fields */
}
Expand description
MIPS Instruction representation.
Do note that the fields may not always make sense as there are fields used by some instructions and some not used.
For example, the instruction Lw
may have the value for rd
set to
RegisterType::A1
, or RegisterType::T1
and it shouldn’t matter
since that instruction only uses rs
and rt
. So keep that in mind when
accessing the fields.
Fields§
§pc: u32
§opcode: Opcode
§instruction: u32
Implementations§
Source§impl Instruction
impl Instruction
pub fn from_u32(instruction: u32, pc: u32) -> Self
pub fn is_branch(&self) -> bool
pub fn rd(&self) -> RegisterType
pub fn rt(&self) -> RegisterType
pub fn rs(&self) -> RegisterType
pub const fn imm5(&self) -> u8
pub const fn imm16(&self) -> u16
pub const fn imm25(&self) -> u32
pub const fn imm26(&self) -> u32
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more