pub struct Cpu {
pub in_m: Signal16,
pub instruction: Signal16,
pub reset: Signal,
pub out_m: Signal16,
pub write_m: Signal,
pub address_m: Signal15,
pub pc: Signal16,
pub a_register: Register16,
pub d_register: Register16,
/* private fields */
}
Expand description
Fast Central Processing Unit able to execute a given instruction and to determine which instruction should be fetched and executed next
Fields
in_m: Signal16
instruction: Signal16
reset: Signal
out_m: Signal16
write_m: Signal
address_m: Signal15
pc: Signal16
a_register: Register16
d_register: Register16
Implementations
sourceimpl Cpu
impl Cpu
sourcepub fn sim(
&mut self,
in_m: Signal16,
instruction: Signal16,
reset: Signal
) -> (Signal, Signal16, Signal15, Signal16)
pub fn sim(
&mut self,
in_m: Signal16,
instruction: Signal16,
reset: Signal
) -> (Signal, Signal16, Signal15, Signal16)
Carries out the simulation, taking as input:
in_m
: data from memoryinstruction
: fetched from ROMreset
: whether to set the program counter to zero
It returns the following:
write_m
: whether to write to memoryout_m
: data going to memoryaddress_m
: memory addresspc
: program counter
pub fn get_pc(&self) -> Signal16
pub fn get_address_m(&self) -> Signal15
pub fn get_out_m(&self) -> Signal16
pub fn get_write_m(&self) -> Signal
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cpu
impl Send for Cpu
impl Sync for Cpu
impl Unpin for Cpu
impl UnwindSafe for Cpu
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