pub trait FancyBinary: Fancy {
// Required methods
fn xor(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item;
fn and(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>;
fn negate(&mut self, x: &Self::Item) -> Self::Item;
// Provided methods
fn or(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item> { ... }
fn adder(
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(Self::Item, Self::Item)> { ... }
fn and_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item> { ... }
fn or_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item> { ... }
fn xor_many(&mut self, args: &[Self::Item]) -> Self::Item { ... }
fn mux_constant_bits(
&mut self,
x: &Self::Item,
b1: bool,
b2: bool,
channel: &mut Channel<'_>,
) -> Result<Self::Item> { ... }
fn mux(
&mut self,
b: &Self::Item,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item> { ... }
}Expand description
Fancy DSL providing binary operations
Required Methods§
Provided Methods§
Sourcefn or(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn or( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Uses Demorgan’s Rule implemented with an and gate and negation.
Sourcefn adder(
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(Self::Item, Self::Item)>
fn adder( &mut self, x: &Self::Item, y: &Self::Item, carry_in: Option<&Self::Item>, channel: &mut Channel<'_>, ) -> Result<(Self::Item, Self::Item)>
Binary adder. Returns the result and the carry.