[−][src]Struct riscy::RiscV
A struct to hold the state of a RiscV core.
Implementations
impl RiscV
[src]
pub fn new() -> Self
[src]
Create a new RiscV core with all of its registers zeroed out.
pub fn step<M: Memory>(&mut self, memory: &mut M) -> StepResult
[src]
Fetch, execute, and retire a single instruction.
When the core attempts to interact with memory, whether to fetch an instruction,
to perform a load or store operation, etc, it makes use of the supplied memory
.
pub fn step_with_retired<M: Memory>(
&mut self,
memory: &mut M
) -> (StepResult, Option<Instruction>)
[src]
&mut self,
memory: &mut M
) -> (StepResult, Option<Instruction>)
Same as step
, but returns the decoded instruction.
pub fn set_reg<R: Into<Reg>>(&mut self, reg: R, reg_val: RegVal)
[src]
Sets the given register to the given value.
// sets the the stack pointer, `sp`, (also known as `x2`) to the value `0x2000_0000`. riscv.set_reg(2, 0x2000_0000.into());
pub fn reg<R: Into<Reg>>(&self, reg: R) -> RegVal
[src]
Gets the value of the given register.
// gets the value of the return address register, `ra`, (also known as `x1`). riscv.reg(1);
pub fn set_pc(&mut self, addr: Addr)
[src]
Sets the value of the program counter to the given address.
This is useful for specifying the entry point to the program when first initializing the machine.
pub fn pc(&self) -> Addr
[src]
Gets the value of the program counter.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for RiscV
[src]
impl Send for RiscV
[src]
impl Sync for RiscV
[src]
impl Unpin for RiscV
[src]
impl UnwindSafe for RiscV
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,