pub struct Counter { /* private fields */ }
Expand description
Memory device which can increment its value in every time unit.
Implementations
sourceimpl Counter
impl Counter
sourcepub fn sim(
&mut self,
inp: Signal16,
reset: Signal,
load: Signal,
inc: Signal
) -> Signal16
pub fn sim(
&mut self,
inp: Signal16,
reset: Signal,
load: Signal,
inc: Signal
) -> Signal16
Carries out the simulation, taking as input:
inp
: data inputreset
: whether to reset tozero
or notload
: whether to writeinp
into the counter registerinc
: whether to increment the counter register
It returns the following:
if reset(t-1) { out(t) = 0 }
else if load(t-1) { out(t) = in(t-1) }
else if inc(t-1) { out(t) = out(t-1)+1 }
else { out(t) = out(t-1) }
pub fn out(&self) -> Signal16
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnwindSafe for Counter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more