pub struct Memory {
pub inp: Signal16,
pub load: Signal,
pub address: Signal15,
/* private fields */
}
Expand description
Package of three 16-bit chip parts: Ram16k
, Screen
, and Keyboard
Fields
inp: Signal16
load: Signal
address: Signal15
Implementations
sourceimpl Memory
impl Memory
sourcepub fn sim(&mut self, inp: Signal16, load: Signal, address: Signal15) -> Signal16
pub fn sim(&mut self, inp: Signal16, load: Signal, address: Signal15) -> Signal16
Carries out the simulation, taking as input:
inp
: data inputload
: whether to writeinp
into the RAMaddress
: which register to select- [0, 16383] results in accessing Ram16k
- [16384, 24575] results in accessing the Screen
- 24576 results in accessing the Keyboard
It returns the value stored at address. Furthermore, when
loadis
HI,
inpis written at location
address`, and the loaded value will
be emitted from the next time step onward.
pub fn out(&self) -> Signal16
pub fn get_screen(&self) -> &Screen
pub fn get_keyboard_mut(&mut self) -> &mut Keyboard
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
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