13 #ifndef CIRCT_DIALECT_CALYX_CALYXHELPERS_H
14 #define CIRCT_DIALECT_CALYX_CALYXHELPERS_H
20 #include "mlir/Dialect/Func/IR/FuncOps.h"
30 ComponentOp component,
size_t width,
35 ComponentOp component,
size_t width,
40 ComponentOp component,
41 SmallVectorImpl<Type> &resultTypes,
42 StringRef instanceName,
43 StringRef componentName);
59 SmallVectorImpl<calyx::PortInfo> &ports);
66 template <
typename Op>
69 group.walk([&](AssignOp assign) {
70 if (assign.getGuard())
74 group.getLoc(), assign.getGuard(), op,
false));
77 assign->insertOperands(2, {op});
static void updateGroupAssignmentGuards(OpBuilder &builder, GroupOp &group, Op &op)
Updates the guard of each assignment within a group with op.
void addMandatoryComponentPorts(PatternRewriter &rewriter, SmallVectorImpl< calyx::PortInfo > &ports)
bool isControlLeafNode(Operation *op)
unsigned handleZeroWidth(int64_t dim)
hw::ConstantOp createConstant(Location loc, OpBuilder &builder, ComponentOp component, size_t width, size_t value)
A helper function to create constants in the HW dialect.
DictionaryAttr getMandatoryPortAttr(MLIRContext *ctx, StringRef name)
calyx::RegisterOp createRegister(Location loc, OpBuilder &builder, ComponentOp component, size_t width, Twine prefix)
Creates a RegisterOp, with input and output port bit widths defined by width.
calyx::InstanceOp createInstance(Location loc, OpBuilder &builder, ComponentOp component, SmallVectorImpl< Type > &resultTypes, StringRef instanceName, StringRef componentName)
A helper function to create calyx.instance operation.
std::string getInstanceName(mlir::func::CallOp callOp)
A helper function to get the instance name.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.