BaseHart

Struct BaseHart 

Source
pub struct BaseHart<B, C> {
    pub bus: B,
    pub pc: u64,
    pub next: u64,
    pub gpr: [u64; 32],
    pub csr: C,
    /* private fields */
}
Expand description

A simple implementation of a processor that implements only machine mode.

Fields§

§bus: B

The system bus for reading and writing physical memory addresses.

§pc: u64

The address of the currently-executing instruction, if one is being executed.

§next: u64

The address of the next instruction.

§gpr: [u64; 32]

The general-purpose registers x0 through x31.

§csr: C

The state of all control and status registers.

Implementations§

Source§

impl<B, C> BaseHart<B, C>

Source

pub fn new(bus: B, csr: C) -> BaseHart<B, C>

Creates a new Hart that connects to bus for memory accesses.

Source

pub fn execute(&mut self) -> Result<(), Exception>
where B: Bus<u64, u64> + Bus<u64, u32> + Bus<u64, u16> + Bus<u64, u8>, C: Csr,

Executes one instruction at the given address, returning the offset that should be applied to the PC to execute the next instruction.

The address may have any alignment; only PC offsets are checked for alignment.

Auto Trait Implementations§

§

impl<B, C> Freeze for BaseHart<B, C>
where B: Freeze, C: Freeze,

§

impl<B, C> RefUnwindSafe for BaseHart<B, C>

§

impl<B, C> Send for BaseHart<B, C>
where B: Send, C: Send,

§

impl<B, C> Sync for BaseHart<B, C>
where B: Sync, C: Sync,

§

impl<B, C> Unpin for BaseHart<B, C>
where B: Unpin, C: Unpin,

§

impl<B, C> UnwindSafe for BaseHart<B, C>
where B: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.