pub struct Alu { /* private fields */ }Expand description
Arithmetic Logic Unit
Implementations
sourceimpl Alu
impl Alu
sourcepub fn sim(
&mut self,
x: Signal16,
y: Signal16,
zx: Signal,
nx: Signal,
zy: Signal,
ny: Signal,
f: Signal,
no: Signal
) -> (Signal16, Signal, Signal)
pub fn sim(
&mut self,
x: Signal16,
y: Signal16,
zx: Signal,
nx: Signal,
zy: Signal,
ny: Signal,
f: Signal,
no: Signal
) -> (Signal16, Signal, Signal)
Carries out the ALU simulation.
It takes as input two main signals: x and y. Then the following:
zx: Setxto zero.nx: Negatex.zy: Setyto zero.ny: Negatey.f:LOselects the&functionHIselects the+function
no: Negateoutsignal.
It can return one of the following:
0, 1, -1, x, y, !x, !y, -x, -y,
x+1, y+1, x-1, y-1, x+y, x-y, y-x, x&y, x|y,
And two more signals which tell whether the result is zero or negative in this exact order.
pub fn set_x(&mut self, x: Signal16)
pub fn set_y(&mut self, y: Signal16)
pub fn out(&self) -> Signal16
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Alu
impl Send for Alu
impl Sync for Alu
impl Unpin for Alu
impl UnwindSafe for Alu
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