[][src]Struct rvemu::cpu::Cpu

pub struct Cpu {
    pub xregs: XRegisters,
    pub fregs: FRegisters,
    pub pc: usize,
    pub state: State,
    pub mode: Mode,
    pub bus: Bus,
    pub enable_paging: bool,
    pub page_table: usize,
}

The CPU to contains registers, a program coutner, status, and a privileged mode.

Fields

xregs: XRegistersfregs: FRegisterspc: usizestate: Statemode: Modebus: Busenable_paging: boolpage_table: usize

Methods

impl Cpu[src]

pub fn new() -> Cpu[src]

Create a new Cpu object.

pub fn reset(&mut self)[src]

Reset CPU states.

pub fn fetch(&mut self) -> Result<u32, Exception>[src]

Fetch the next instruction from the memory at the current program counter.

pub fn translate(&mut self, addr: usize) -> Result<usize, Exception>[src]

Translate a virtual address to a physical address for the paged virtual-memory system.

pub fn execute(&mut self, data: u32) -> Result<(), Exception>[src]

Execute an instruction. Raises an exception if something is wrong, otherwise, returns nothings.

Auto Trait Implementations

impl !RefUnwindSafe for Cpu

impl Send for Cpu

impl Sync for Cpu

impl Unpin for Cpu

impl !UnwindSafe for Cpu

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.