Skip to main content

Aig

Struct Aig 

Source
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

Source

pub fn new() -> Aig

A graph holding only the constant node.

Source

pub fn add_input(&mut self, name: Option<String>) -> AigLit

Source

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.

Source

pub fn latch_lit(&self, latch: usize) -> AigLit

The latch’s current-state literal.

Source

pub fn set_next(&mut self, latch: usize, next: AigLit)

Source

pub fn and(&mut self, a: AigLit, b: AigLit) -> AigLit

a ∧ b, folded and structurally hashed.

Source

pub fn or(&mut self, a: AigLit, b: AigLit) -> AigLit

Source

pub fn xor(&mut self, a: AigLit, b: AigLit) -> AigLit

Source

pub fn xnor(&mut self, a: AigLit, b: AigLit) -> AigLit

Source

pub fn mux(&mut self, s: AigLit, t: AigLit, e: AigLit) -> AigLit

s ? t : e.

Source

pub fn add_output(&mut self, lit: AigLit, name: Option<String>)

Source

pub fn add_bad(&mut self, lit: AigLit, name: Option<String>)

Source

pub fn add_constraint(&mut self, lit: AigLit, name: Option<String>)

Source

pub fn node(&self, n: u32) -> Node

Source

pub fn num_nodes(&self) -> usize

Source

pub fn num_ands(&self) -> usize

Source

pub fn inputs(&self) -> &[Port]

Source

pub fn latches(&self) -> &[Latch]

Source

pub fn outputs(&self) -> &[Port]

Source

pub fn bad(&self) -> &[Port]

Source

pub fn constraints(&self) -> &[Port]

Source

pub fn comments(&self) -> &[String]

Source

pub fn input_index(&self, name: &str) -> Option<usize>

Source

pub fn output_index(&self, name: &str) -> Option<usize>

Source

pub fn eval(&self, inputs: &[bool], latches: &[bool]) -> Vec<bool>

The value of every node under one assignment of the inputs and the latches.

Source

pub fn value(values: &[bool], lit: AigLit) -> bool

A literal’s value among Aig::eval’s node values.

Source

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.

Source

pub fn word(sim: &[u64], words: usize, lit: AigLit, w: usize) -> u64

Word w of a literal’s value in a Aig::simulate result.

Source

pub fn cone(&self, roots: &[AigLit]) -> Vec<u32>

The nodes the roots depend on, themselves included, in increasing order.

Source

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.

Source

pub fn compact_keeping(&self, keep: &[AigLit]) -> (Aig, Vec<Option<AigLit>>)

Aig::compact, the cones of keep kept as well.

Source

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.

Source

pub fn import( &mut self, other: &Aig, leaves: &mut dyn FnMut(Leaf) -> AigLit, ) -> Vec<AigLit>

Copy every node of other into this graph, each leaf replaced by the literal leaves gives it. Returns the literal each of other’s nodes became, indexed by node.

Source

pub fn to_ascii(&self) -> String

The canonical ASCII AIGER text.

Source

pub fn to_binary(&self) -> Vec<u8> ⓘ

The canonical binary AIGER bytes.

Source

pub fn parse(bytes: &[u8]) -> Result<Aig, AigerError>

Read an ASCII (aag) or binary (aig) AIGER file.

Trait Implementations§

Source§

impl Clone for Aig

Source§

fn clone(&self) -> Aig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Aig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Aig

Source§

fn default() -> Aig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Aig

§

impl RefUnwindSafe for Aig

§

impl Send for Aig

§

impl Sync for Aig

§

impl Unpin for Aig

§

impl UnsafeUnpin for Aig

§

impl UnwindSafe for Aig

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.