[][src]Enum lc3::instruction::Instruction

pub enum Instruction {
    ADD {
        dst: i16,
        src1: i16,
        src2: i16,
    },
    ADDi {
        dst: i16,
        src: i16,
        immd: i16,
    },
    AND {
        dst: i16,
        src1: i16,
        src2: i16,
    },
    ANDi {
        dst: i16,
        src: i16,
        immd: i16,
    },
    BR {
        cond: Condition,
        offset: i16,
    },
    JMP {
        base: i16,
    },
    JSR {
        offset: i16,
    },
    JSRR {
        base: i16,
    },
    LD {
        dst: i16,
        offset: i16,
    },
    LDI {
        dst: i16,
        offset: i16,
    },
    LDR {
        dst: i16,
        base: i16,
        offset: i16,
    },
    LEA {
        dst: i16,
        offset: i16,
    },
    NOT {
        dst: i16,
        src: i16,
    },
    RTI,
    ST {
        src: i16,
        offset: i16,
    },
    STI {
        src: i16,
        offset: i16,
    },
    STR {
        src: i16,
        base: i16,
        offset: i16,
    },
    RESERVED,
    TRAP {
        vect: i16,
    },
}

A single LC-3 instruction. Except condition codes and is_immd values, all fields are set to i16 type for convenience.

Variants

ADD

Fields of ADD

dst: i16src1: i16src2: i16
ADDi

Fields of ADDi

dst: i16src: i16immd: i16
AND

Fields of AND

dst: i16src1: i16src2: i16
ANDi

Fields of ANDi

dst: i16src: i16immd: i16
BR

Fields of BR

cond: Conditionoffset: i16
JMP

Fields of JMP

base: i16
JSR

Fields of JSR

offset: i16
JSRR

Fields of JSRR

base: i16
LD

Fields of LD

dst: i16offset: i16
LDI

Fields of LDI

dst: i16offset: i16
LDR

Fields of LDR

dst: i16base: i16offset: i16
LEA

Fields of LEA

dst: i16offset: i16
NOT

Fields of NOT

dst: i16src: i16
RTI
ST

Fields of ST

src: i16offset: i16
STI

Fields of STI

src: i16offset: i16
STR

Fields of STR

src: i16base: i16offset: i16
RESERVED
TRAP

Fields of TRAP

vect: i16

Implementations

impl Instruction[src]

pub fn from_u16(data: u16) -> Instruction[src]

Converts a single u16 value to LC-3 instruction. Note that for some instructions that can be interpreted in multiple types (e.g. JSR/JSRR), every field will be initialized to defined bit array slice values even if it won't be used.

Trait Implementations

impl Debug for Instruction[src]

impl Display for Instruction[src]

impl Eq for Instruction[src]

impl PartialEq<Instruction> for Instruction[src]

impl StructuralPartialEq for Instruction[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.