|
CIRCT 24.0.0git
|
#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/LLVM.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/ADT/STLExtras.h"#include "llvm/Support/Debug.h"#include "llvm/Support/DivisionByConstantInfo.h"#include <array>#include <utility>#include "circt/Conversion/Passes.h.inc"
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 std::pair< Value, Value > | lowerUnsignedDivRem (OpBuilder &builder, Location loc, Value lhs, Value rhs) |
| Lower an unsigned division with a non-constant divisor to a combinational restoring array divider. | |
| static std::pair< Value, Value > | lowerSignedDivRem (OpBuilder &builder, Location loc, Value lhs, Value rhs) |
| Lower a signed division with a non-constant divisor to a restoring array divider operating on the magnitudes of the operands. | |
| static void | populateCombToAIGConversionPatterns (RewritePatternSet &patterns, uint32_t maxEmulationUnknownBits, bool forceAIG) |
| #define DEBUG_TYPE "comb-to-synth" |
Definition at line 42 of file CombToSynth.cpp.
| #define GEN_PASS_DEF_CONVERTCOMBTOSYNTH |
Definition at line 45 of file CombToSynth.cpp.
|
static |
Definition at line 287 of file CombToSynth.cpp.
References hw.ConstantOp::create().
Referenced by lowerSignedDivByConstant().
|
static |
Definition at line 276 of file CombToSynth.cpp.
References hw.ConstantOp::create().
Referenced by lowerUnsignedDivByConstant().
|
static |
Definition at line 119 of file CombToSynth.cpp.
|
static |
Definition at line 299 of file CombToSynth.cpp.
References hw.ConstantOp::create().
Referenced by lowerSignedDivByConstant(), and lowerUnsignedDivByConstant().
|
static |
Definition at line 71 of file CombToSynth.cpp.
References assert(), hw.ConstantOp::create(), and extractBits().
|
static |
Definition at line 206 of file CombToSynth.cpp.
References assert(), hw.ConstantOp::create(), extractBits(), failure(), getConstant(), getNumUnknownBitsAndPopulateValues(), circt::replaceOpAndCopyNamehint(), substitueMaskToValues(), and success().
|
static |
Definition at line 57 of file CombToSynth.cpp.
Referenced by createShiftLogic(), emulateBinaryOpForUnknownBits(), and lowerUnsignedDivRem().
|
static |
Definition at line 129 of file CombToSynth.cpp.
|
static |
Definition at line 134 of file CombToSynth.cpp.
|
static |
Definition at line 145 of file CombToSynth.cpp.
References concat(), circt::hw::getBitWidth(), and getNumUnknownBitsAndPopulateValues().
Referenced by emulateBinaryOpForUnknownBits(), and getNumUnknownBitsAndPopulateValues().
|
static |
Definition at line 327 of file CombToSynth.cpp.
References createAShrByConstant(), and createMulHigh().
|
static |
Lower a signed division with a non-constant divisor to a restoring array divider operating on the magnitudes of the operands.
Returns the quotient and the remainder, rounded towards zero like comb.divs / comb.mods: the quotient is negative iff the signs of the operands differ, and the remainder takes the sign of the dividend.
Definition at line 397 of file CombToSynth.cpp.
References hw.ConstantOp::create(), and lowerUnsignedDivRem().
|
static |
Definition at line 314 of file CombToSynth.cpp.
References createLShrByConstant(), and createMulHigh().
|
static |
Lower an unsigned division with a non-constant divisor to a combinational restoring array divider.
Returns the quotient and the remainder.
The divider processes the dividend from MSB to LSB. In every step the partial remainder is shifted left by one, the next dividend bit is shifted in, and the divisor is trially subtracted. If the subtraction does not borrow, the quotient bit is one and the difference becomes the new partial remainder; otherwise the quotient bit is zero and the partial remainder is restored. The partial remainder is kept width + 1 bits wide so the borrow can be read off the MSB of the difference.
Division by zero yields an all-ones quotient and the dividend as remainder.
Definition at line 359 of file CombToSynth.cpp.
References hw.ConstantOp::create(), and extractBits().
Referenced by lowerSignedDivRem().
|
static |
Definition at line 1696 of file CombToSynth.cpp.
References circt::synth::populateVariadicAndInverterLoweringPatterns(), and circt::synth::populateVariadicXorInverterLoweringPatterns().
|
static |
Definition at line 178 of file CombToSynth.cpp.
References assert(), and circt::hw::getBitWidth().
Referenced by emulateBinaryOpForUnknownBits().