-
Notifications
You must be signed in to change notification settings - Fork 383
[Support] Add NPN class for Boolean function canonicalization #8747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit introduces NPNClass and BinaryTruthTable classes to the CIRCT Support library for Boolean function equivalence checking and canonicalization. NPNClass computes Negation-Permutation-Negation canonical forms for Boolean functions, enabling efficient detection of functionally equivalent circuits under input/output transformations. BinaryTruthTable provides compact representation using APInt with support for multi-input, multi-output functions. This infrastructure is essential for technology mapping and Boolean function optimization in synthesis flows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - few minor comments but nothing substantial - would it be worth adding some tests to make sure we can't touch certain elements e.g. trigger the asserts that setOutput(largeNumber) doesn't proceed?
22b9ecb to
42ca350
Compare
Thank you for the suggestion! Assertion is conditionally enabled via compiler option so it's a bit difficult to test assertion firing in the unit tests (in CI assertions are enabled but we don't enable assertions for the binary release). For this specific conditions, users of NPN/TruthTable are expected to provide APInt with correct bit width so I think CI should have good coverage for this specific asssertions. |
|
LGTM - thanks for making the changes - the updated comments also help where you've written !0, !1 - makes it a little easier to follow! |
This commit introduces NPNClass and BinaryTruthTable classes to the CIRCT Support library for Boolean function equivalence checking and canonicalization.
NPNClass computes Negation-Permutation-Negation canonical forms for Boolean functions, enabling efficient detection of functionally equivalent circuits under input/output transformations. BinaryTruthTable provides compact representation using APInt with support for multi-input, multi-output functions.
This infrastructure is essential for technology mapping and Boolean function optimization in synthesis flows.
computeNPNCanonicalForm. Other changes are for helper functions for TruthTable/NPNClass.