Skip to content

Extend ternary truth table operations to handle don't cares#144

Merged
costamag merged 3 commits intolsils:masterfrom
costamag:ternary-ops
May 19, 2025
Merged

Extend ternary truth table operations to handle don't cares#144
costamag merged 3 commits intolsils:masterfrom
costamag:ternary-ops

Conversation

@costamag
Copy link
Copy Markdown
Collaborator

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_var and min_base_inplace do 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 to true, 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.

@costamag costamag merged commit 5cd30be into lsils:master May 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant