pub struct SimpleClock {
pub instret: u64,
}
Expand description
A simple implementation of the Clock
trait.
This implementation only counts instructions. The CSRs cycle
, time
, and instret
all
return the same counter to create a very basic simulation of time.
With the serialize
crate feature, this structure is serializable using Serde.
Fields§
§instret: u64
Instruction counter CSR.
Implementations§
Source§impl SimpleClock
impl SimpleClock
Trait Implementations§
Source§impl Clock for SimpleClock
impl Clock for SimpleClock
Source§fn read_cycle(&self) -> u64
fn read_cycle(&self) -> u64
Read the
cycle
CSR, which counts the number of CPU cycles executed.Source§fn read_instret(&self) -> u64
fn read_instret(&self) -> u64
Read the
instret
CSR, which counts the number of instructions executed.Source§fn progress(&mut self, _op: &Op)
fn progress(&mut self, _op: &Op)
Progress clocks, after the given instruction was executed. Read more
Source§fn check_quota(&self) -> bool
fn check_quota(&self) -> bool
Check execution quotas. Called at the very start of
Interp::step
. Read moreSource§impl Clone for SimpleClock
impl Clone for SimpleClock
Source§fn clone(&self) -> SimpleClock
fn clone(&self) -> SimpleClock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SimpleClock
impl Debug for SimpleClock
Source§impl<'de> Deserialize<'de> for SimpleClock
impl<'de> Deserialize<'de> for SimpleClock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SimpleClock
impl Serialize for SimpleClock
impl Copy for SimpleClock
Auto Trait Implementations§
impl Freeze for SimpleClock
impl RefUnwindSafe for SimpleClock
impl Send for SimpleClock
impl Sync for SimpleClock
impl Unpin for SimpleClock
impl UnwindSafe for SimpleClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more