CIRCT 22.0.0git
|
Base class for cut rewriting patterns used in combinational logic optimization. More...
#include <CutRewriter.h>
Public Member Functions | |
CutRewritePattern (mlir::MLIRContext *context) | |
virtual | ~CutRewritePattern ()=default |
Virtual destructor for base class. | |
virtual bool | match (const Cut &cut) const =0 |
Check if a cut matches this pattern. | |
virtual bool | useTruthTableMatcher (SmallVectorImpl< NPNClass > &matchingNPNClasses) const |
Specify truth tables that this pattern can match. | |
virtual FailureOr< Operation * > | rewrite (mlir::OpBuilder &builder, Cut &cut) const =0 |
Return a new operation that replaces the matched cut. | |
virtual double | getArea () const =0 |
Get the area cost of this pattern. | |
virtual DelayType | getDelay (unsigned inputIndex, unsigned outputIndex) const =0 |
Get the delay between specific input and output. | |
virtual unsigned | getNumOutputs () const =0 |
Get the number of outputs this pattern produces. | |
virtual StringRef | getPatternName () const |
Get the name of this pattern. Used for debugging. | |
virtual LocationAttr | getLoc () const |
Get location for this pattern(optional). | |
mlir::MLIRContext * | getContext () const |
Private Attributes | |
mlir::MLIRContext * | context |
Base class for cut rewriting patterns used in combinational logic optimization.
A CutRewritePattern represents a library component or optimization pattern that can replace cuts in the combinational logic network. Each pattern defines:
Patterns can use truth table matching for efficient recognition or implement custom matching logic for more complex cases.
Definition at line 332 of file CutRewriter.h.
|
inline |
Definition at line 333 of file CutRewriter.h.
|
virtualdefault |
Virtual destructor for base class.
|
pure virtual |
Get the area cost of this pattern.
Implemented in GenericLUT, and TechLibraryPattern.
Referenced by circt::synth::MatchedPattern::getArea(), and circt::synth::CutRewriter::patternMatchCut().
|
inline |
Definition at line 384 of file CutRewriter.h.
References context.
|
pure virtual |
Get the delay between specific input and output.
NOTE: The input index is already permuted according to the pattern's input permutation, so it's not necessary to account for it here.
Implemented in GenericLUT, and TechLibraryPattern.
Referenced by circt::synth::MatchedPattern::getDelay().
|
inlinevirtual |
Get location for this pattern(optional).
Reimplemented in TechLibraryPattern.
Definition at line 382 of file CutRewriter.h.
References context.
|
pure virtual |
Get the number of outputs this pattern produces.
Implemented in GenericLUT, and TechLibraryPattern.
|
inlinevirtual |
Get the name of this pattern. Used for debugging.
Reimplemented in GenericLUT, and TechLibraryPattern.
Definition at line 379 of file CutRewriter.h.
|
pure virtual |
Check if a cut matches this pattern.
This method is called to determine if a cut can be replaced by this pattern. If useTruthTableMatcher() returns true, this method is only called for cuts with matching truth tables.
Implemented in GenericLUT, and TechLibraryPattern.
|
pure virtual |
Return a new operation that replaces the matched cut.
Unlike MLIR's RewritePattern framework which allows arbitrary in-place modifications, this method creates a new operation to replace the matched cut rather than modifying existing operations. This constraint exists because the cut enumerator maintains references to operations throughout the circuit, making it safe to only replace the root operation of each cut while preserving all other operations unchanged.
Implemented in TechLibraryPattern, and GenericLUT.
|
virtual |
Specify truth tables that this pattern can match.
If this method returns true, the pattern matcher will use truth table comparison for efficient pre-filtering. Only cuts with matching truth tables will be passed to the match() method. If it returns false, the pattern will be checked against all cuts regardless of their truth tables. This is useful for patterns that match regardless of their truth tables, such as LUT-based patterns.
Reimplemented in TechLibraryPattern.
Definition at line 619 of file CutRewriter.cpp.
|
private |
Definition at line 387 of file CutRewriter.h.
Referenced by getContext(), and getLoc().