Struct rvsim::Interp[][src]

pub struct Interp<'s, 'm, 'c, M: 'm + Memory, C: 'c + Clock> {
    pub state: &'s mut CpuState,
    pub mem: &'m mut M,
    pub clock: &'c mut C,
    // some fields omitted
}

The interpeter.

This struct simply combines a CpuState, Memory and Clock. An Interp instance can be fleeting, and doesn’t need to be kept around if the virtual CPU is paused, for example.

Fields

state: &'s mut CpuState

The CPU state.

mem: &'m mut M

The memory implementation.

clock: &'c mut C

The clock implementation.

Implementations

impl<'s, 'm, 'c, M: 'm + Memory, C: 'c + Clock> Interp<'s, 'm, 'c, M, C>[src]

pub fn new(state: &'s mut CpuState, mem: &'m mut M, clock: &'c mut C) -> Self[src]

Create a new interpreter.

pub fn run(&mut self) -> (CpuError, Option<Op>)[src]

Run continuously until execution stops, starting at the current PC address.

Returns the stop reason and the instruction that caused the virtual CPU to stop. The instruction may be None if it failed to load or parse.

pub fn step(&mut self) -> Result<Op, (CpuError, Option<Op>)>[src]

Step a single instruction, fetching it from the current PC address.

Returns the parsed instruction that was executed. When the instruction stops the virtual CPU, additionally returns the stop reason. In the latter case, the instruction may be None if it failed to load or parse.

Auto Trait Implementations

impl<'s, 'm, 'c, M, C> RefUnwindSafe for Interp<'s, 'm, 'c, M, C> where
    C: RefUnwindSafe,
    M: RefUnwindSafe

impl<'s, 'm, 'c, M, C> Send for Interp<'s, 'm, 'c, M, C> where
    C: Send,
    M: Send

impl<'s, 'm, 'c, M, C> Sync for Interp<'s, 'm, 'c, M, C> where
    C: Sync,
    M: Sync

impl<'s, 'm, 'c, M, C> Unpin for Interp<'s, 'm, 'c, M, C>

impl<'s, 'm, 'c, M, C> !UnwindSafe for Interp<'s, 'm, 'c, M, C>

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