Expand description
MCircuit (pronounced mc-urkit) provides a series of types and traits for working with circuits. Specifically, arithmetic circuits on GF2 and Z64, the former of which are effectively boolean circuits. It is used by Reverie.
MCircuit includes:
- A circuit parsing library for BLIF files
- Code for evaluating circuits in its gate format
- Traits for constructing, translating, and iterating over gates
- Code to export circuits in the Bristol Fashion format
Re-exports§
pub use parsers::Parse;
Modules§
Structs§
Enums§
- Combine
Operation - Wraps
Operation
to define a field for each gate. Also supports conversions and metadata. - Operation
- Defines the individual logic gate operations we can support
Traits§
- Gate
- Conglomerate trait that wraps all the other useful traits defined in this module.
- HasConst
- HasIO
- Applies to all gates, allows access to the input and output wire IDs of the gates
- Identity
- Trait related to buffer gates. If the gate doesn’t change its input value (ie adding zero, multiplying by one), then we say this is an “identity” gate, eligible to be folded out. !
- Translatable
- Defines a number of helper methods for replacing the I/O wires on a gate with new ones
- Wire
Value - Implemented for acceptable types to use as wire values. It would be nice if this could just
be a set of required traits, but
num_traits::is_zero
isn’t implemented forbool
.
Functions§
- dump_
vcd - Copies most of the code from
evaluate_composite_program
, but takes aVcdDumper
and dumps the value of each destination wire after evaluating a gate. - evaluate_
composite_ program - Evaluates a composite program (in the clear). Uses assert! to check
AssertZero
gates - largest_
wires - Get the largest (arithmetic, boolean) wires in a program so we know how much memory to allocate. Respects size hints, if present at the start of the circuit
- smallest_
wires - Get the largest (arithmetic, boolean) wires in a program so we know how much memory to allocate. Does NOT respect size hints.