CIRCT 23.0.0git
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
CombToSynth.cpp File Reference
#include "circt/Conversion/CombToSynth.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/Datapath/DatapathOps.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/Synth/SynthDialect.h"
#include "circt/Dialect/Synth/SynthOps.h"
#include "circt/Support/Naming.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DivisionByConstantInfo.h"
#include <array>
#include "circt/Conversion/Passes.h.inc"
Include dependency graph for CombToSynth.cpp:

Go to the source code of this file.

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
 

Macros

#define DEBUG_TYPE   "comb-to-synth"
 
#define GEN_PASS_DEF_CONVERTCOMBTOSYNTH
 

Functions

static SmallVector< Value > extractBits (OpBuilder &builder, Value val)
 
template<bool isLeftShift>
static Value createShiftLogic (ConversionPatternRewriter &rewriter, Location loc, Value shiftAmount, int64_t maxShiftAmount, llvm::function_ref< Value(int64_t)> getPadding, llvm::function_ref< Value(int64_t)> getExtract)
 
static Value createMajorityFunction (OpBuilder &rewriter, Location loc, Value a, Value b, Value carry)
 
static Value extractMSB (OpBuilder &builder, Value val)
 
static Value extractOtherThanMSB (OpBuilder &builder, Value val)
 
static int64_t getNumUnknownBitsAndPopulateValues (Value value, llvm::SmallVectorImpl< ConstantOrValue > &values)
 
static APInt substitueMaskToValues (size_t width, llvm::SmallVectorImpl< ConstantOrValue > &constantOrValues, uint32_t mask)
 
static LogicalResult emulateBinaryOpForUnknownBits (ConversionPatternRewriter &rewriter, int64_t maxEmulationUnknownBits, Operation *op, llvm::function_ref< APInt(const APInt &, const APInt &)> emulate)
 
static Value createLShrByConstant (OpBuilder &builder, Location loc, Value value, unsigned amount)
 
static Value createAShrByConstant (OpBuilder &builder, Location loc, Value value, unsigned amount)
 
template<bool isSigned>
static Value createMulHigh (OpBuilder &builder, Location loc, Value lhs, const APInt &rhs)
 
static Value lowerUnsignedDivByConstant (OpBuilder &builder, Location loc, Value lhs, const APInt &divisor)
 
static Value lowerSignedDivByConstant (OpBuilder &builder, Location loc, Value lhs, const APInt &divisor)
 
static void populateCombToAIGConversionPatterns (RewritePatternSet &patterns, uint32_t maxEmulationUnknownBits, bool forceAIG)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "comb-to-synth"

Definition at line 39 of file CombToSynth.cpp.

◆ GEN_PASS_DEF_CONVERTCOMBTOSYNTH

#define GEN_PASS_DEF_CONVERTCOMBTOSYNTH

Definition at line 42 of file CombToSynth.cpp.

Function Documentation

◆ createAShrByConstant()

static Value createAShrByConstant ( OpBuilder &  builder,
Location  loc,
Value  value,
unsigned  amount 
)
static

Definition at line 284 of file CombToSynth.cpp.

References hw.ConstantOp::create().

Referenced by lowerSignedDivByConstant().

◆ createLShrByConstant()

static Value createLShrByConstant ( OpBuilder &  builder,
Location  loc,
Value  value,
unsigned  amount 
)
static

Definition at line 273 of file CombToSynth.cpp.

References hw.ConstantOp::create().

Referenced by lowerUnsignedDivByConstant().

◆ createMajorityFunction()

static Value createMajorityFunction ( OpBuilder &  rewriter,
Location  loc,
Value  a,
Value  b,
Value  carry 
)
static

Definition at line 116 of file CombToSynth.cpp.

◆ createMulHigh()

template<bool isSigned>
static Value createMulHigh ( OpBuilder &  builder,
Location  loc,
Value  lhs,
const APInt &  rhs 
)
static

Definition at line 296 of file CombToSynth.cpp.

References hw.ConstantOp::create().

◆ createShiftLogic()

template<bool isLeftShift>
static Value createShiftLogic ( ConversionPatternRewriter &  rewriter,
Location  loc,
Value  shiftAmount,
int64_t  maxShiftAmount,
llvm::function_ref< Value(int64_t)>  getPadding,
llvm::function_ref< Value(int64_t)>  getExtract 
)
static

Definition at line 68 of file CombToSynth.cpp.

References assert(), hw.ConstantOp::create(), and extractBits().

◆ emulateBinaryOpForUnknownBits()

static LogicalResult emulateBinaryOpForUnknownBits ( ConversionPatternRewriter &  rewriter,
int64_t  maxEmulationUnknownBits,
Operation *  op,
llvm::function_ref< APInt(const APInt &, const APInt &)>  emulate 
)
static

◆ extractBits()

static SmallVector< Value > extractBits ( OpBuilder &  builder,
Value  val 
)
static

Definition at line 54 of file CombToSynth.cpp.

Referenced by createShiftLogic(), and emulateBinaryOpForUnknownBits().

◆ extractMSB()

static Value extractMSB ( OpBuilder &  builder,
Value  val 
)
static

Definition at line 126 of file CombToSynth.cpp.

◆ extractOtherThanMSB()

static Value extractOtherThanMSB ( OpBuilder &  builder,
Value  val 
)
static

Definition at line 131 of file CombToSynth.cpp.

◆ getNumUnknownBitsAndPopulateValues()

static int64_t getNumUnknownBitsAndPopulateValues ( Value  value,
llvm::SmallVectorImpl< ConstantOrValue > &  values 
)
static

◆ lowerSignedDivByConstant()

static Value lowerSignedDivByConstant ( OpBuilder &  builder,
Location  loc,
Value  lhs,
const APInt &  divisor 
)
static

Definition at line 324 of file CombToSynth.cpp.

References createAShrByConstant().

◆ lowerUnsignedDivByConstant()

static Value lowerUnsignedDivByConstant ( OpBuilder &  builder,
Location  loc,
Value  lhs,
const APInt &  divisor 
)
static

Definition at line 311 of file CombToSynth.cpp.

References createLShrByConstant().

◆ populateCombToAIGConversionPatterns()

static void populateCombToAIGConversionPatterns ( RewritePatternSet &  patterns,
uint32_t  maxEmulationUnknownBits,
bool  forceAIG 
)
static

Definition at line 1539 of file CombToSynth.cpp.

◆ substitueMaskToValues()

static APInt substitueMaskToValues ( size_t  width,
llvm::SmallVectorImpl< ConstantOrValue > &  constantOrValues,
uint32_t  mask 
)
static

Definition at line 175 of file CombToSynth.cpp.

References assert().

Referenced by emulateBinaryOpForUnknownBits().