CIRCT 23.0.0git
Loading...
Searching...
No Matches
Macros | Functions
CutRewriter.cpp File Reference
#include "circt/Dialect/Synth/Transforms/CutRewriter.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/Synth/SynthOps.h"
#include "circt/Support/LLVM.h"
#include "circt/Support/TruthTable.h"
#include "circt/Support/UnusedOpPruner.h"
#include "mlir/Analysis/TopologicalSortUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/RegionKindInterface.h"
#include "mlir/IR/Value.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/Bitset.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LogicalResult.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <optional>
#include <string>
Include dependency graph for CutRewriter.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "synth-cut-rewriter"
 

Functions

static bool isAlwaysCutInput (const LogicNetwork &network, uint32_t index)
 
static bool compareDelayAndArea (OptimizationStrategy strategy, double newArea, ArrayRef< DelayType > newDelay, double oldArea, ArrayRef< DelayType > oldDelay)
 
static llvm::APInt applyGateSemantics (LogicNetworkGate::Kind kind, const llvm::APInt &a)
 Simulate a gate and return its truth table.
 
static llvm::APInt applyGateSemantics (LogicNetworkGate::Kind kind, const llvm::APInt &a, const llvm::APInt &b)
 
static llvm::APInt applyGateSemantics (LogicNetworkGate::Kind kind, const llvm::APInt &a, const llvm::APInt &b, const llvm::APInt &c)
 
static llvm::APInt simulateGate (const LogicNetwork &network, uint32_t index, llvm::DenseMap< uint32_t, llvm::APInt > &cache, unsigned numInputs)
 Simulate a gate and return its truth table.
 
static Cut getAsTrivialCut (uint32_t index, const LogicNetwork &network)
 
static void removeDuplicateAndNonMinimalCuts (SmallVectorImpl< Cut * > &cuts)
 
static StringRef getTestVariableName (Value value, DenseMap< OperationName, unsigned > &opCounter)
 Generate a human-readable name for a value used in test output.
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "synth-cut-rewriter"

Definition at line 56 of file CutRewriter.cpp.

Function Documentation

◆ applyGateSemantics() [1/3]

static llvm::APInt applyGateSemantics ( LogicNetworkGate::Kind  kind,
const llvm::APInt &  a 
)
inlinestatic

Simulate a gate and return its truth table.

Definition at line 466 of file CutRewriter.cpp.

References circt::synth::LogicNetworkGate::Identity.

Referenced by simulateGate().

◆ applyGateSemantics() [2/3]

static llvm::APInt applyGateSemantics ( LogicNetworkGate::Kind  kind,
const llvm::APInt &  a,
const llvm::APInt &  b 
)
inlinestatic

◆ applyGateSemantics() [3/3]

static llvm::APInt applyGateSemantics ( LogicNetworkGate::Kind  kind,
const llvm::APInt &  a,
const llvm::APInt &  b,
const llvm::APInt &  c 
)
inlinestatic

Definition at line 490 of file CutRewriter.cpp.

References circt::synth::LogicNetworkGate::Maj3.

◆ compareDelayAndArea()

static bool compareDelayAndArea ( OptimizationStrategy  strategy,
double  newArea,
ArrayRef< DelayType newDelay,
double  oldArea,
ArrayRef< DelayType oldDelay 
)
static

◆ getAsTrivialCut()

static Cut getAsTrivialCut ( uint32_t  index,
const LogicNetwork network 
)
static

◆ getTestVariableName()

static StringRef getTestVariableName ( Value  value,
DenseMap< OperationName, unsigned > &  opCounter 
)
static

Generate a human-readable name for a value used in test output.

This function creates meaningful names for values to make debug output and test results more readable and understandable.

Definition at line 1079 of file CutRewriter.cpp.

Referenced by circt::synth::CutEnumerator::dump().

◆ isAlwaysCutInput()

static bool isAlwaysCutInput ( const LogicNetwork network,
uint32_t  index 
)
static

◆ removeDuplicateAndNonMinimalCuts()

static void removeDuplicateAndNonMinimalCuts ( SmallVectorImpl< Cut * > &  cuts)
static

◆ simulateGate()

static llvm::APInt simulateGate ( const LogicNetwork network,
uint32_t  index,
llvm::DenseMap< uint32_t, llvm::APInt > &  cache,
unsigned  numInputs 
)
static