volute
Implementation of logic function as lookup tables and sum of products
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.5%) to scientific vocabulary
Repository
Implementation of logic function as lookup tables and sum of products
Basic Info
- Host: GitHub
- Owner: Coloquinte
- License: apache-2.0
- Language: Rust
- Default Branch: main
- Homepage: https://docs.rs/volute/
- Size: 173 KB
Statistics
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
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.
rust
let lut5 = Lut::one(5);
let lut4 = Lut::zero(4);
Create a Lut2 representing the first variable. Swap its inputs. Check the result.
rust
let lut = Lut2::nth_var(0);
assert_eq!(lut.swap(0, 1), Lut2::nth_var(1));
Perform the logical and between two Lut4. Check its hexadecimal value.
rust
let lut = Lut4::nth_var(0) & Lut4::nth_var(2);
assert_eq!(lut.to_string(), "Lut4(a0a0)");
Create a Lut6 (6 variables) from its hexadecimal value. Display it.
rust
let lut = Lut6::from_hex_string("0123456789abcdef").unwrap();
print!("{lut}");
Small Luts (3 to 7 variables) can be converted to the integer type of the same size.
rust
let lut5: u32 = Lut5::random().into();
let lut6: u64 = Lut6::random().into();
let lut7: u128 = Lut7::random().into();
Create the parity function on three variables, and check that in can be decomposed as a Xor.
Check its value in binary.
rust
let lut = Lut::parity(3);
assert_eq!(lut.top_decomposition(0), DecompositionType::Xor);
assert_eq!(format!("{lut:b}"), "Lut3(10010110)");
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.
rust
let var4 = Sop::nth_var(10, 4);
let var2 = Sop::nth_var(10, 2);
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).
rust
let lut = Lut::threshold(4, 3);
let esop = sop::optim::optimize_esop_mip(&[lut], 1, 2);
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).
rust
let lut = Lut4::threshold(3);
let (canonical, flips) = lut.n_canonization();
let (canonical, perm) = lut.p_canonization();
let (canonical, perm, flips) = lut.npn_canonization();
assert_eq!(lut.permute(&perm).flip_n(flips), canonical);
Owner
- Name: Gabriel Gouvine
- Login: Coloquinte
- Kind: user
- Location: Edinburgh
- Company: AMD
- Repositories: 36
- Profile: https://github.com/Coloquinte
GitHub Events
Total
- Issues event: 2
- Delete event: 1
- Push event: 13
- Create event: 2
Last Year
- Issues event: 2
- Delete event: 1
- Push event: 13
- Create event: 2
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: about 1 hour
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Coloquinte (2)
- patelvyom (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cargo 18,564 total
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 18
- Total maintainers: 1
crates.io: volute
Boolean functions implementation, represented as lookup tables (LUT) or sum-of-products (SOP)
- Homepage: https://github.com/Coloquinte/volute
- Documentation: https://docs.rs/volute/
- License: MIT OR Apache-2.0
-
Latest release: 1.2.1
published 11 months ago
Rankings
Maintainers (1)
Dependencies
- actions-rs/cargo v1 composite
- actions-rs/clippy-check v1 composite
- actions-rs/toolchain v1 composite
- actions/checkout v4 composite