CIRCT 22.0.0git
|
Main cut-based rewriting algorithm for combinational logic optimization. More...
#include <CutRewriter.h>
Public Member Functions | |
CutRewriter (const CutRewriterOptions &options, CutRewritePatternSet &patterns) | |
Constructor for the cut rewriter. | |
LogicalResult | run (Operation *topOp) |
Execute the complete cut-based rewriting algorithm. | |
Private Member Functions | |
LogicalResult | enumerateCuts (Operation *topOp) |
Enumerate cuts for all nodes in the given module. | |
ArrayRef< std::pair< NPNClass, const CutRewritePattern * > > | getMatchingPatternsFromTruthTable (const Cut &cut) const |
Find patterns that match a cut's truth table. | |
std::optional< MatchedPattern > | patternMatchCut (const Cut &cut) |
Match a cut against available patterns and compute arrival time. | |
LogicalResult | runBottomUpRewrite (Operation *topOp) |
Perform the actual circuit rewriting using selected patterns. | |
Private Attributes | |
const CutRewriterOptions & | options |
Configuration options. | |
const CutRewritePatternSet & | patterns |
Available rewriting patterns. | |
CutEnumerator | cutEnumerator |
Main cut-based rewriting algorithm for combinational logic optimization.
The CutRewriter implements a cut-based rewriting algorithm that:
The algorithm processes the network in topological order, building up cut sets for each node and selecting the best implementation based on the specified optimization strategy.
Usage example:
Definition at line 456 of file CutRewriter.h.
|
inline |
Constructor for the cut rewriter.
Definition at line 459 of file CutRewriter.h.
|
private |
Enumerate cuts for all nodes in the given module.
Note: This preserves module boundaries and does not perform rewriting across the hierarchy.
Definition at line 906 of file CutRewriter.cpp.
References cutEnumerator, circt::synth::CutEnumerator::enumerateCuts(), and patternMatchCut().
Referenced by run().
|
private |
Find patterns that match a cut's truth table.
Definition at line 917 of file CutRewriter.cpp.
References circt::synth::Cut::getNPNClass().
Referenced by patternMatchCut().
|
private |
Match a cut against available patterns and compute arrival time.
Definition at line 929 of file CutRewriter.cpp.
References assert(), compareDelayAndArea(), cutEnumerator, circt::synth::Cut::dump(), circt::synth::CutRewritePattern::getArea(), circt::synth::CutEnumerator::getCutSet(), circt::NPNClass::getInputPermutation(), circt::synth::Cut::getInputSize(), getMatchingPatternsFromTruthTable(), circt::synth::Cut::getNPNClass(), circt::synth::Cut::getOutputSize(), circt::synth::Cut::inputs, isAlwaysCutInput(), circt::synth::Cut::isTrivialCut(), options, pattern, and circt::synth::CutRewriterOptions::strategy.
Referenced by enumerateCuts().
LogicalResult CutRewriter::run | ( | Operation * | topOp | ) |
Execute the complete cut-based rewriting algorithm.
This method orchestrates the entire rewriting process:
Definition at line 861 of file CutRewriter.cpp.
References cutEnumerator, circt::synth::CutEnumerator::dump(), enumerateCuts(), circt::synth::CutRewriterOptions::maxCutInputSize, circt::synth::CutRewriterOptions::maxCutSizePerRoot, circt::synth::OptimizationStrategyArea, options, pattern, runBottomUpRewrite(), circt::synth::CutRewriterOptions::strategy, circt::synth::CutRewriterOptions::testPriorityCuts, and circt::synth::topologicallySortLogicNetwork().
Referenced by GenericLUTMapperPass::runOnOperation().
|
private |
Perform the actual circuit rewriting using selected patterns.
Definition at line 1042 of file CutRewriter.cpp.
References circt::synth::CutRewriterOptions::allowNoMatch, circt::synth::CutRewriterOptions::attachDebugTiming, circt::synth::CutEnumerator::clear(), cutEnumerator, circt::UnusedOpPruner::eraseNow(), isAlwaysCutInput(), options, and circt::synth::CutEnumerator::takeVector().
Referenced by run().
|
private |
Definition at line 493 of file CutRewriter.h.
Referenced by enumerateCuts(), patternMatchCut(), run(), and runBottomUpRewrite().
|
private |
Configuration options.
Definition at line 488 of file CutRewriter.h.
Referenced by patternMatchCut(), run(), and runBottomUpRewrite().
|
private |
Available rewriting patterns.
Definition at line 491 of file CutRewriter.h.