[−][src]Enum lc3_isa::Instruction
Variants
Fields of AddImm
Fields of AndImm
Fields of Br
Fields of Jmp
base: Reg
Fields of Jsr
offset11: SignedWord
Fields of Jsrr
base: Reg
Fields of Ld
dr: Reg
offset9: SignedWord
Fields of Ldi
dr: Reg
offset9: SignedWord
Fields of Ldr
Fields of Lea
dr: Reg
offset9: SignedWord
Fields of St
sr: Reg
offset9: SignedWord
Fields of Sti
sr: Reg
offset9: SignedWord
Fields of Str
Implementations
impl Instruction
[src]
pub const fn new_add_reg(dr: Reg, sr1: Reg, sr2: Reg) -> Self
[src]
Creates a new ADD
instruction (Instruction::AddReg
) with two
register sources.
TODO!
println!("{:?}", Instruction::new_add_reg(R0, R1, R2));
pub const fn new_add_imm(dr: Reg, sr1: Reg, imm5: SignedWord) -> Self
[src]
Creates a new ADD
instruction (Instruction::AddImm
) with a
register source and a 5 bit signed immediate source ([-16, 16)
).
This function will panic at compile time if it is invoked with an immediate value that isn't in bounds (and if the invocation is in a const context and the resulting value is used). TODO!
println!("{:?}", Instruction::new_add_imm(R0, R1, -16)); println!("{:?}", Instruction::new_add_imm(R0, R1, 15));
println!("{:?}", Instruction::new_add_imm(R0, R1, 16));
println!("{:?}", Instruction::new_add_imm(R0, R1, -17));
pub const fn new_and_reg(dr: Reg, sr1: Reg, sr2: Reg) -> Self
[src]
Creates a new AND
instruction (Instruction::AndReg
) with two
register sources.
TODO!
println!("{:?}", Instruction::new_and_reg(R0, R1, R2));
pub const fn new_and_imm(dr: Reg, sr1: Reg, imm5: SignedWord) -> Self
[src]
Creates a new AND
instruction (Instruction::AndImm
) with a
register source and a 5 bit signed immediate source ([-16, 16)
).
This function will panic at compile time if it is invoked with an immediate value that isn't in bounds (and if the invocation is in a const context and the resulting value is used). TODO!
println!("{:?}", Instruction::new_and_imm(R0, R1, -16)); println!("{:?}", Instruction::new_and_imm(R0, R1, 15));
println!("{:?}", Instruction::new_and_imm(R0, R1, 16));
println!("{:?}", Instruction::new_and_imm(R0, R1, -17));
pub const fn new_br(n: bool, z: bool, p: bool, offset9: SignedWord) -> Self
[src]
Creates a new BR
instruction (Instruction::Br
) with the condition
codes to branch on and a 9 bit signed PC-relative offset
([-256, 256)
).
This function will panic at compile time if it is invoked with an offset value that isn't in bounds (and if the invocation is in a const context and the resulting value is used). TODO!
println!("{:?}", Instruction::new_br(true, true, true, 255)); println!("{:?}", Instruction::new_br(true, true, true, -256));
println!("{:?}", Instruction::new_br(true, true, true, 256));
println!("{:?}", Instruction::new_br(true, true, true, -257));
println!("{:?}", Instruction::new_br(false, false, false, -1));
pub const fn new_jmp(base: Reg) -> Self
[src]
Creates a new 'JMP' instruction ([Instruction::JMP
]) with the provided
base register.
TODO!
println!("{:?}", Instruction::new_jmp(R7));
pub const fn new_jsr(offset11: SignedWord) -> Self
[src]
Creates a new JSR
instruction ([Instruction::JSR
]) with the provided
11 bit signed PC-relative offset ([-1024, 1024)
).
TODO!
println!("{:?}", Instruction::new_jsr(1023)); println!("{:?}", Instruction::new_jsr(-1024));
println!("{:?}", Instruction::new_jsr(1024));
println!("{:?}", Instruction::new_jsr(-1025));
pub const fn new_jsrr(base: Reg) -> Self
[src]
Creates a new 'JSRR' instruction ([Instruction::JSRR
]) with the
provided base register.
TODO!
println!("{:?}", Instruction::new_jsrr(R6));
pub const fn new_ld(dr: Reg, offset9: SignedWord) -> Self
[src]
pub const fn new_ldi(dr: Reg, offset9: SignedWord) -> Self
[src]
pub const fn new_ldr(dr: Reg, base: Reg, offset6: SignedWord) -> Self
[src]
pub const fn new_lea(dr: Reg, offset9: SignedWord) -> Self
[src]
pub const fn new_not(dr: Reg, sr: Reg) -> Self
[src]
pub const fn new_ret() -> Self
[src]
Creates a new RET
instruction ([Instruction::RET
]) (equivalent to a
JMP
R7
).
TODO!
println!("{:?}", Instruction::new_ret());
pub const fn new_rti() -> Self
[src]
Creates a new RTI
instruction ([Instruction::RTI
]).
TODO!
println!("{:?}", Instruction::new_rti());
pub const fn new_st(sr: Reg, offset9: SignedWord) -> Self
[src]
pub const fn new_sti(sr: Reg, offset9: SignedWord) -> Self
[src]
pub const fn new_str(sr: Reg, base: Reg, offset6: SignedWord) -> Self
[src]
pub const fn new_trap(trapvec: u8) -> Self
[src]
impl Instruction
[src]
pub fn sets_condition_codes(&self) -> bool
[src]
impl Instruction
[src]
Trait Implementations
impl Clone for Instruction
[src]
fn clone(&self) -> Instruction
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Instruction
[src]
impl Debug for Instruction
[src]
impl<'de> Deserialize<'de> for Instruction
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Instruction
[src]
impl Eq for Instruction
[src]
impl From<Instruction> for Word
[src]
fn from(ins: Instruction) -> u16
[src]
impl Hash for Instruction
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Instruction> for Instruction
[src]
We use the bit representation of Instruction
for equality specifically
so that Jmp { base: R7 } == RET
. However, note that BR != BRnzp
.
fn eq(&self, rhs: &Instruction) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Instruction
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl TryFrom<u16> for Instruction
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,