pub struct Aig { /* private fields */ }Expand description
An and-inverter graph with its inputs, latches, outputs, bad-state properties, invariant constraints and comments.
Implementations§
Source§impl Aig
impl Aig
pub fn add_input(&mut self, name: Option<String>) -> AigLit
Sourcepub fn add_latch(&mut self, name: Option<String>, init: Init) -> usize
pub fn add_latch(&mut self, name: Option<String>, init: Init) -> usize
A latch whose next state is false until Aig::set_next; returns its index.
pub fn set_next(&mut self, latch: usize, next: AigLit)
pub fn or(&mut self, a: AigLit, b: AigLit) -> AigLit
pub fn xor(&mut self, a: AigLit, b: AigLit) -> AigLit
pub fn xnor(&mut self, a: AigLit, b: AigLit) -> AigLit
pub fn add_output(&mut self, lit: AigLit, name: Option<String>)
pub fn add_bad(&mut self, lit: AigLit, name: Option<String>)
pub fn add_constraint(&mut self, lit: AigLit, name: Option<String>)
pub fn node(&self, n: u32) -> Node
pub fn num_nodes(&self) -> usize
pub fn num_ands(&self) -> usize
pub fn inputs(&self) -> &[Port]
pub fn latches(&self) -> &[Latch]
pub fn outputs(&self) -> &[Port]
pub fn bad(&self) -> &[Port]
pub fn constraints(&self) -> &[Port]
pub fn comments(&self) -> &[String]
pub fn input_index(&self, name: &str) -> Option<usize>
pub fn output_index(&self, name: &str) -> Option<usize>
Sourcepub fn eval(&self, inputs: &[bool], latches: &[bool]) -> Vec<bool>
pub fn eval(&self, inputs: &[bool], latches: &[bool]) -> Vec<bool>
The value of every node under one assignment of the inputs and the latches.
Sourcepub fn value(values: &[bool], lit: AigLit) -> bool
pub fn value(values: &[bool], lit: AigLit) -> bool
A literal’s value among Aig::eval’s node values.
Sourcepub fn simulate(
&self,
words: usize,
inputs: &[u64],
latches: &[u64],
) -> Vec<u64>
pub fn simulate( &self, words: usize, inputs: &[u64], latches: &[u64], ) -> Vec<u64>
Every node’s value under 64 · words assignments at once: input i’s words are
inputs[i·words .. (i+1)·words], likewise each latch’s. The result holds node n’s words at
n·words .. (n+1)·words.
Sourcepub fn word(sim: &[u64], words: usize, lit: AigLit, w: usize) -> u64
pub fn word(sim: &[u64], words: usize, lit: AigLit, w: usize) -> u64
Word w of a literal’s value in a Aig::simulate result.
Sourcepub fn cone(&self, roots: &[AigLit]) -> Vec<u32>
pub fn cone(&self, roots: &[AigLit]) -> Vec<u32>
The nodes the roots depend on, themselves included, in increasing order.
Sourcepub fn compact(&self) -> (Aig, Vec<Option<AigLit>>)
pub fn compact(&self) -> (Aig, Vec<Option<AigLit>>)
The graph with only the nodes something reads: every input and latch in order, the outputs, bad and
constraint properties and latches’ next states, and the nodes in their cones; with each node’s literal in the
result, None for one nothing reads.
Sourcepub fn compact_keeping(&self, keep: &[AigLit]) -> (Aig, Vec<Option<AigLit>>)
pub fn compact_keeping(&self, keep: &[AigLit]) -> (Aig, Vec<Option<AigLit>>)
Aig::compact, the cones of keep kept as well.
Sourcepub fn sequential_cone(&self, outputs: &[usize]) -> Aig
pub fn sequential_cone(&self, outputs: &[usize]) -> Aig
The graph the outputs outputs (by index) read through any number of clocks: those outputs, in the order given;
every latch whose value reaches one of them (a latch a kept latch’s next state reads, to a fixpoint), in order,
with its name and initial value; every input, in order; and the nodes their cones need.