CIRCT 21.0.0git
|
An individual term of an AND expression in a DNF. More...
#include <DNF.h>
Public Types | |
enum | Use { Id = 0b00 , Past = 0b01 , Not = 0b10 , NotId = Not | Id , NotPast = Not | Past } |
An integer indicating one use of the value in this term. More... | |
using | Uses = std::bitset< 4 > |
The set of uses of this value as a bit mask. | |
Public Member Functions | |
AndTerm () | |
Create a null term. | |
AndTerm (Value value, Uses uses) | |
Create a term with a value and a set of uses. | |
bool | isFalse () const |
Check if this term is trivially false. | |
bool | isTrue () const |
Check if this term is trivially true. | |
std::optional< std::pair< Value, AndTerm::Use > > | getSingleTerm () const |
If this AND term has a single use, return it. | |
int | compare (const AndTerm other) const |
Compare against another term. | |
bool | operator== (const AndTerm other) const |
bool | operator!= (const AndTerm other) const |
bool | operator< (const AndTerm other) const |
bool | operator> (const AndTerm other) const |
bool | operator<= (const AndTerm other) const |
bool | operator>= (const AndTerm other) const |
unsigned | getNumUses () const |
Get the number of uses. | |
void | addUse (Use u) |
Add a single use. | |
void | addUses (Uses u) |
Add multiple uses. | |
void | removeUse (Use u) |
Remove a single use. | |
void | removeUses (Uses u) |
Remove multiple uses. | |
bool | hasUse (Use u) const |
Check if this term has a specific use of the term's value. | |
bool | hasAllUses (Uses u) const |
Check if this term has all of the specified uses of the term's value. | |
bool | hasAnyUses (Uses u) const |
Check if this term has any of the specified uses of the term's value. | |
bool | isSubsetOf (const AndTerm &other) const |
Check if this term is a subset of another term. | |
unsigned | isSubsetOfModuloSingleFlip (const AndTerm &other, Use &flippedUse) const |
Check if this term is a subset of another term modulo a single flipped term. | |
void | print (llvm::raw_ostream &os, llvm::function_ref< void(Value)> printValue={}) const |
Print this term to os , using the given callback to print the value. | |
Static Public Member Functions | |
static AndTerm | id (Value value) |
Create a term with a plain value. | |
static AndTerm | past (Value value) |
Create a term with a past value. | |
static AndTerm | posEdge (Value value) |
Create a term representing a posedge on a value. | |
static AndTerm | negEdge (Value value) |
Create a term representing a negedge on a value. | |
Public Attributes | |
Value | value |
The value. | |
Uses | uses |
The different uses of this value. | |
Static Public Attributes | |
static constexpr Uses | PosEdgeUses = (1 << Id) | (1 << NotPast) |
The set of uses that indicates a posedge. | |
static constexpr Uses | NegEdgeUses = (1 << NotId) | (1 << Past) |
The set of uses that indicates a negedge. | |
static constexpr Uses | IdUses = (1 << Id) | (1 << NotId) |
The set of present uses. | |
static constexpr Uses | PastUses = (1 << Past) | (1 << NotPast) |
The set of past uses. | |
An individual term of an AND expression in a DNF.
This struct represents all terms of the same Value
.
using circt::llhd::AndTerm::Uses = std::bitset<4> |
An integer indicating one use of the value in this term.
There are four different uses, which means there are a total of 2^4 different combinations each of which has its own bit in the uses
mask.
Enumerator | |
---|---|
Id | The plain value |
Past | The past value |
Not | The bit that indicates inversion. |
NotId | The inverted value |
NotPast | The inverted past value |
|
inline |
|
inline |
|
inline |
|
inline |
int AndTerm::compare | ( | const AndTerm | other | ) | const |
Compare against another term.
Definition at line 50 of file DNF.cpp.
Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
|
inline |
Get the number of uses.
Definition at line 89 of file DNF.h.
References uses.
Referenced by getSingleTerm().
|
inline |
If this AND term has a single use, return it.
Definition at line 73 of file DNF.h.
References getNumUses(), uses, and value.
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
bool AndTerm::isSubsetOf | ( | const AndTerm & | other | ) | const |
Check if this term is a subset of another term modulo a single flipped term.
Returns 0 if this term is a subset of the other without any flips; returns 1 if there is a single flip, with flippedUse
set to indicate the flipped term; or returns 2 if this term is no subset or there are more than one flips.
|
inline |
|
inlinestatic |
Create a term representing a negedge on a value.
Definition at line 64 of file DNF.h.
References AndTerm(), NegEdgeUses, and value.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
Create a term representing a posedge on a value.
Definition at line 62 of file DNF.h.
References AndTerm(), PosEdgeUses, and value.
void AndTerm::print | ( | llvm::raw_ostream & | os, |
llvm::function_ref< void(Value)> | printValue = {} |
||
) | const |
Print this term to os
, using the given callback to print the value.
Definition at line 98 of file DNF.cpp.
References NegEdgeUses, Not, NotPast, Past, PosEdgeUses, and value.
|
inline |
|
inline |
Uses circt::llhd::AndTerm::uses |
The different uses of this value.
Definition at line 51 of file DNF.h.
Referenced by circt::llhd::OrTerm::addTerm(), addUse(), addUses(), compare(), circt::llhd::OrTerm::flipInvariantHash(), getNumUses(), getSingleTerm(), hasAllUses(), hasAnyUses(), hasUse(), isFalse(), isSubsetOf(), isSubsetOfModuloSingleFlip(), isTrue(), removeUse(), and removeUses().
Value circt::llhd::AndTerm::value |
The value.
Definition at line 49 of file DNF.h.
Referenced by circt::llhd::OrTerm::addTerm(), compare(), compareValueOnly(), circt::llhd::OrTerm::flipInvariantHash(), getSingleTerm(), id(), isSubsetOf(), isSubsetOfModuloSingleFlip(), negEdge(), past(), posEdge(), print(), and Python.support.OpOperand::type().