Logic function manipulation using truth tables (or lookup tables) that represent the value of the function for the 2n possible inputs.
The crate implements optimized truth table datastructures, either arbitrary-size truth tables
(Lut), or more efficient
fixed-size truth tables (Lut2 to Lut16).
They provide logical operators and utility functions for analysis, canonization and decomposition.
Some support is available for other standard representation, such as Sum-of-Products (SOP) and
Exclusive Sum-of-Products (ESOP).
Volute is used by the logic optimization and analysis library Quaigh. When applicable, API and documentation try to follow the same terminology as the C++ library Kitty.
Examples
Create a constant-one Lut with five variables and a constant-zero Lut with 4 variables.
let lut5 = one;
let lut4 = zero;
Create a Lut2 representing the first variable. Swap its inputs. Check the result.
let lut = nth_var;
assert_eq!;
Perform the logical and between two Lut4. Check its hexadecimal value.
let lut = nth_var & nth_var;
assert_eq!;
Create a Lut6 (6 variables) from its hexadecimal value. Display it.
let lut = from_hex_string.unwrap;
print!;
Small Luts (3 to 7 variables) can be converted to the integer type of the same size.
let lut5: u32 = random.into;
let lut6: u64 = random.into;
let lut7: u128 = random.into;
Create the parity function on three variables, and check that in can be decomposed as a Xor. Check its value in binary.
let lut = parity;
assert_eq!;
assert_eq!;
Sum of products and Exclusive sum of products
Volute provides Sum-of-Products (SOP) and Exclusive Sum-of-Products (ESOP) representations.
Create Sum of products and perform operations on them.
let var4 = nth_var;
let var2 = nth_var;
let var_and = var4 & var2;
Exact decomposition methods can be used with the features optim-mip (using a MILP solver)
or optim-sat (using a SAT solver).
let lut = threshold;
let esop = optimize_esop_mip;
Canonical representation
For boolean optimization, Luts have several canonical forms that allow to only store optimizations for a small subset of Luts. Methods are available to find the smallest Lut that is identical up to variable complementation (N), input permutation (P), or both (NPN).
let lut = threshold;
let = lut.n_canonization;
let = lut.p_canonization;
let = lut.npn_canonization;
assert_eq!;