[][src]Struct rysk_core::system::Core

pub struct Core<R: Register> {
    pub pc: R,
    // some fields omitted
}

A single RISCV core Includes a single program counter and 32 registers Const generics will allow support of the E extensions for 16 registers

Fields

pc: R

The program counter

Implementations

impl<R: Register + Default + Copy + Clone> Core<R>[src]

pub fn new(address: R::Unsigned, hart: R::Unsigned) -> Self[src]

Creates a new core starting execution at the given address with the given hart ID Hart ID's must be unique to ensure correct program behaviour. There must be a hart with ID 0 on a given system address must be aligned to 4 bytes else a panic will occur during execution

pub fn step(&mut self)[src]

Increments the program counter by the instruction size of 4 bytes

pub fn get(&self, index: usize) -> R[src]

Get the register x{index}

Safety

A panic will occur if index is larger than 31

pub fn set(&mut self, index: usize, register: R)[src]

Set register x{index} to be equal to register

Safety

A panic will occur if index is larger than 31

pub fn get_csr(&self, index: usize) -> Result<R, Exception>[src]

Get a value from a CSR. May have side-effects

pub fn set_csr(&mut self, index: usize, value: R)[src]

Set a CSR to the specified value with program-defined access. May have side-effects

pub fn execute(&mut self, mmu: &mut dyn Mmu<R>) -> Result<(), Exception>[src]

Decode and execute an instruction

Auto Trait Implementations

impl<R> RefUnwindSafe for Core<R> where
    R: RefUnwindSafe

impl<R> Send for Core<R> where
    R: Send

impl<R> Sync for Core<R> where
    R: Sync

impl<R> Unpin for Core<R> where
    R: Unpin

impl<R> UnwindSafe for Core<R> where
    R: UnwindSafe

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.