11#include "mlir/IR/Value.h"
12#include "llvm/ADT/APInt.h"
13#include "llvm/ADT/DenseMapInfo.h"
14#include "llvm/ADT/SmallVector.h"
15#include "llvm/Support/raw_ostream.h"
57 operator bool()
const {
return static_cast<bool>(
value); }
91llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const DNFTerm &term);
92llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const DNF &dnf);
115 return llvm::countr_zero(
bits.getBitWidth());
125 assert(numTerms <= 16 &&
"excessive truth table");
126 return TruthTable{value ? APInt::getAllOnes(1 << numTerms)
127 : APInt::getZero(1 << numTerms)};
132 assert(numTerms <= 16 &&
"excessive truth table");
159 return APInt::getSplat(bitWidth,
160 APInt::getHighBitsSet(2 << term, 1 << term));
170llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const TruthTable &table);
187 return Value::getFromOpaquePointer((
void *)(1));
201 SmallVector<std::pair<TruthTable, ValueEntry>, 1>
entries;
205 :
entries({{condition, entry}}) {}
212llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const ValueEntry &entry);
213llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
214 const std::pair<TruthTable, ValueEntry> &pair);
215llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const ValueTable &table);
232 operator bool()
const {
return bool(
reset); }
248 operator bool()
const {
return bool(
clock); }
290 operator bool()
const {
return bool(
value); }
303 return llvm::hash_combine_range(arg.begin(), arg.end());
assert(baseType &&"element must be base type")
llvm::raw_ostream & operator<<(llvm::raw_ostream &os, const DNFTerm &term)
SmallVector< FixedValue, 2 > FixedValues
A list of i1 values that are fixed to a given value.
static llvm::hash_code hash_value(const FixedValue &arg)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
llvm::hash_code hash_value(const DenseSet< T > &set)
A single clock extracted from a process during trigger analysis.
Value clock
The value acting as the clock, causing the register to be set to a value in valueTable when triggered...
bool risingEdge
Whether the clock is sensitive to a rising or falling edge.
Value value
The value the register is set to when the clock is triggered.
Value enable
The optional value acting as an enable.
A single AND operation within a DNF.
uint32_t andTerms
A mask with two bits for each possible term that may be present.
bool operator==(DNFTerm other) const
bool operator!=(DNFTerm other) const
A boolean function expressed in canonical disjunctive normal form.
SmallVector< DNFTerm, 2 > orTerms
A drive op and the clock and reset that resulted from trigger analysis.
ClockInfo clock
The clock that triggers a change to the driven value.
ResetInfo reset
The optional reset that triggers a change of the driven value to a fixed reset value.
DriveOp op
The drive operation.
A single i1 value that is fixed to a given value in the past and the present.
bool present
The assigned value in the present.
bool past
The assigned value in the past, as transported into the presented via a destination operand of a proc...
bool operator==(const FixedValue &other) const
Value value
The IR value being fixed.
A single reset extracted from a process during trigger analysis.
Value value
The value the register is reset to.
Value reset
The value acting as the reset, causing the register to be set to value when triggered.
bool activeHigh
Whether the reset is active when high.
A boolean function expressed as a truth table.
static APInt getTermMask(unsigned bitWidth, unsigned term)
Return a mask that has a 1 in all truth table rows where term is 1, and a 0 otherwise.
bool operator!=(const TruthTable &other) const
DNF canonicalize() const
Convert the truth table into its canonical disjunctive normal form.
static TruthTable getTerm(unsigned numTerms, unsigned term)
Create a boolean expression consisting of a single term.
static TruthTable getPoison()
bool operator==(const TruthTable &other) const
APInt bits
The value of the boolean function for each possible combination of input term assignments.
TruthTable operator~() const
APInt getTermMask(unsigned term) const
unsigned getNumTerms() const
Get the number of terms in the truth table.
TruthTable operator&(const TruthTable &other) const
TruthTable operator^(const TruthTable &other) const
static TruthTable getConst(unsigned numTerms, bool value)
Create a boolean expression with a constant true or false value.
TruthTable operator|(const TruthTable &other) const
TruthTable & operator|=(const TruthTable &other)
TruthTable & operator&=(const TruthTable &other)
TruthTable & operator^=(const TruthTable &other)
A single entry in a value table.
static ValueEntry getUnknown()
bool operator!=(ValueEntry other) const
static ValueEntry getPoison()
void merge(ValueEntry other)
bool operator==(ValueEntry other) const
Identify a specific subfield (or the whole) of an SSA value using the HW field ID scheme.
uint64_t bitWidth
Width (in bits) of the final extracted slice.
Value value
The root SSA value being accessed (e.g. the full struct or array).
uint64_t fieldID
The HW field ID describing which subfield is referenced.
ValueField(Value value, uint64_t fieldID, Value projection={}, uint64_t bitID=0, uint64_t bitWidth=0)
uint64_t bitID
Optional bit/slice projection within the selected field.
Value projection
An optional SSA value that already materializes this specific subfield.
Value getProjected() const
bool operator!=(const ValueField &other) const
bool operator==(const ValueField &other) const
A table of SSA values and the conditions under which they appear.
SmallVector< std::pair< TruthTable, ValueEntry >, 1 > entries
void addCondition(TruthTable condition)
ValueTable(TruthTable condition, ValueEntry entry)
void merge(const ValueTable &other)
static FixedValue getTombstoneKey()
static FixedValue getEmptyKey()
static bool isEqual(const FixedValue &a, const FixedValue &b)
static unsigned getHashValue(const FixedValue &key)
static FixedValues getTombstoneKey()
static unsigned getHashValue(const FixedValues &key)
circt::llhd::deseq::FixedValues FixedValues
static FixedValues getEmptyKey()
static bool isEqual(const FixedValues &a, const FixedValues &b)
static VF getTombstoneKey()
static unsigned getHashValue(const VF &key)
static bool isEqual(const VF &a, const VF &b)