Extend ternary truth table operations to handle don't cares#144
Merged
costamag merged 3 commits intolsils:masterfrom May 19, 2025
Merged
Extend ternary truth table operations to handle don't cares#144costamag merged 3 commits intolsils:masterfrom
costamag merged 3 commits intolsils:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enhances the handling of ternary truth tables, which are used to represent incompletely specified Boolean functions (i.e., functions with don't cares). The current implementations of key operations such as
has_varandmin_base_inplacedo not take advantage of don't care conditions.To address this limitation, this PR introduces new versions of these operations that exploit don't cares where applicable. To maintain backward compatibility, a template parameter
UseDCs(default:false) is added. When set totrue, the updated implementations are used; otherwise, the behavior falls back to the existing logic.New Functionality (when
UseDCs = true):has_var<TT, true>(tt, i): Determines whether the function is independent of the i-th variable under some assignment of don't cares.has_var_inplace<TT, true>(tt, i): Same as has_var, but additionally performs the don't care assignment directly in tt.min_base_inplace<TT, true>(tt): Attempts to minimize the function’s support, reassigning don't cares as needed to enforce independence from certain variables.Reassigning don't cares is crucial to ensure consistency across multiple variable checks and to avoid contradictions arising from incompatible don't care assignments.