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,
34 ComponentOp component, Type type,
39 ComponentOp component,
size_t width,
44 ComponentOp component,
45 SmallVectorImpl<Type> &resultTypes,
46 StringRef instanceName,
47 StringRef componentName);
63 SmallVectorImpl<calyx::PortInfo> &ports);
70 template <
typename Op>
73 group.walk([&](AssignOp assign) {
74 if (assign.getGuard())
78 group.getLoc(), assign.getGuard(), op,
false));
81 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.