pub struct Network { /* private fields */ }
Expand description
Representation of a logic network as a gate-inverter-graph, used as the main representation for all logic manipulations
Implementations§
source§impl Network
impl Network
sourcepub fn nb_outputs(&self) -> usize
pub fn nb_outputs(&self) -> usize
Return the number of primary outputs
sourcepub fn add_inputs(&mut self, nb: usize)
pub fn add_inputs(&mut self, nb: usize)
Add multiple primary inputs
sourcepub fn add_output(&mut self, l: Signal)
pub fn add_output(&mut self, l: Signal)
Add a new primary output based on an existing literal
sourcepub fn dff(&mut self, data: Signal, enable: Signal, reset: Signal) -> Signal
pub fn dff(&mut self, data: Signal, enable: Signal, reset: Signal) -> Signal
Create a Dff gate (flip flop)
sourcepub fn add_canonical(&mut self, gate: Gate) -> Signal
pub fn add_canonical(&mut self, gate: Gate) -> Signal
Add a new gate, and make it canonical. The gate may be simplified immediately
sourcepub fn shuffle(&mut self, seed: u64) -> Box<[Signal]>
pub fn shuffle(&mut self, seed: u64) -> Box<[Signal]>
Shuffle the network randomly; this will invalidate all signals
Returns the mapping of old variable indices to signals, if needed.
sourcepub fn cleanup(&mut self) -> Box<[Signal]>
pub fn cleanup(&mut self) -> Box<[Signal]>
Remove unused logic; this will invalidate all signals
Returns the mapping of old variable indices to signals, if needed. Removed signals are mapped to zero.
sourcepub fn make_canonical(&mut self) -> Box<[Signal]>
pub fn make_canonical(&mut self) -> Box<[Signal]>
Remove duplicate logic and make all gates canonical; this will invalidate all signals
Canonical gates are And, Xor, Mux, Maj and Lut. Everything else will be simplified. Returns the mapping of old variable indices to signals, if needed.
sourcepub fn deduplicate(&mut self) -> Box<[Signal]>
pub fn deduplicate(&mut self) -> Box<[Signal]>
Remove duplicate logic; this will invalidate all signals
Returns the mapping of old variable indices to signals, if needed.