Implementation of logic functions as truth tables (also called lookup tables, or Luts).
The crate implements truth table datastructures, either arbitrary-size Luts (Lut), or more efficient fixed-size Luts (Lut2 to Lut12).
They provide logical operators and utility functions for analysis, canonization and decomposition.
API and documentation try to follow the same terminology as the C++ library Kitty.
Usage
Add this to your Cargo.toml:
[]
= "1"
See the documentation for more information.
Examples
Create a constant-one Lut with five variables. Check its hexadecimal value.
let lut = one;
assert_eq!;
Create a random Lut6 (six variables). Display its hexadecimal value.
let lut = random;
print!;
Create a Lut4 (four variables) which is the logical and of the 1st and 3rd. Check its hexadecimal value.
let lut = nth_var & nth_var;
assert_eq!;
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!;