CIRCT  20.0.0git
Classes | Macros | Functions
CalyxOps.cpp File Reference
#include "circt/Dialect/Calyx/CalyxOps.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/FSM/FSMOps.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWTypes.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PriorityQueue.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include "circt/Dialect/Calyx/CalyxInterfaces.cpp.inc"
#include "circt/Dialect/Calyx/Calyx.cpp.inc"
Include dependency graph for CalyxOps.cpp:

Go to the source code of this file.

Classes

struct  CollapseUnaryControl< CtrlOp >
 This pattern collapses a calyx.seq or calyx.par operation when it contains exactly one calyx.enable operation. More...
 
struct  EmptyIfBody
 This pattern checks for one of two cases that will lead to IfOp deletion: (1) Then and Else bodies are both empty. More...
 
struct  EmptyStaticIfBody
 This pattern checks for one of two cases that will lead to StaticIfOp deletion: (1) Then and Else bodies are both empty. More...
 

Macros

#define ImplBinPipeOpCellInterface(OpType, outName)
 
#define ImplUnaryOpCellInterface(OpType)
 
#define ImplBinOpCellInterface(OpType)
 
#define GET_OP_CLASSES
 

Functions

template<typename Op >
static LogicalResult verifyNotComplexSource (Op op)
 Verify that the value is not a "complex" value. More...
 
static std::string valueName (Operation *scopeOp, Value v)
 Convenience function for getting the SSA name of v under the scope of operation scopeOp. More...
 
static bool isPort (Value value)
 Returns whether this value is either (1) a port on a ComponentOp or (2) a port on a cell interface. More...
 
static bool hasControlRegion (Operation *op)
 Returns whether the given operation has a control region. More...
 
static bool isStaticControl (Operation *op)
 Returns whether the given operation is a static control operator. More...
 
static LogicalResult verifyControlBody (Operation *op)
 Verifies the body of a ControlLikeOp. More...
 
static ParseResult parseGroupPort (OpAsmParser &parser, OperationState &result)
 
template<typename GroupPortType >
static void printGroupPort (OpAsmPrinter &p, GroupPortType op)
 
template<typename OpTy >
static LogicalResult collapseControl (OpTy controlOp, PatternRewriter &rewriter)
 
template<typename OpTy >
static LogicalResult emptyControl (OpTy controlOp, PatternRewriter &rewriter)
 
template<typename OpTy >
static void eraseControlWithGroupAndConditional (OpTy op, PatternRewriter &rewriter)
 A helper function to check whether the conditional and group (if it exists) needs to be erased to maintain a valid state of a Calyx program. More...
 
template<typename OpTy >
static void eraseControlWithConditional (OpTy op, PatternRewriter &rewriter)
 A helper function to check whether the conditional needs to be erased to maintain a valid state of a Calyx program. More...
 
template<typename ComponentTy >
static void printComponentInterface (OpAsmPrinter &p, ComponentInterface comp)
 
static ParseResult parsePortDefList (OpAsmParser &parser, OperationState &result, SmallVectorImpl< OpAsmParser::Argument > &ports, SmallVectorImpl< Type > &portTypes, SmallVectorImpl< NamedAttrList > &portAttrs)
 Parses the ports of a Calyx component signature, and adds the corresponding port names to attrName. More...
 
static ParseResult parseComponentSignature (OpAsmParser &parser, OperationState &result, SmallVectorImpl< OpAsmParser::Argument > &ports, SmallVectorImpl< Type > &portTypes)
 Parses the signature of a Calyx component. More...
 
template<typename ComponentTy >
static ParseResult parseComponentInterface (OpAsmParser &parser, OperationState &result)
 
template<typename T >
static SmallVector< T > concat (const SmallVectorImpl< T > &a, const SmallVectorImpl< T > &b)
 Returns a new vector containing the concatenation of vectors a and b. More...
 
static void buildComponentLike (OpBuilder &builder, OperationState &result, StringAttr name, ArrayRef< PortInfo > ports, bool combinational)
 
template<typename Op >
static Op getControlOrWiresFrom (ComponentOp op)
 This is a helper function that should only be used to get the WiresOp or ControlOp of a ComponentOp, which are guaranteed to exist and generally at the end of a component's body. More...
 
static Value getBlockArgumentWithName (StringRef name, ComponentOp op)
 Returns the Block argument with the given name from a ComponentOp. More...
 
template<typename Pred >
static SmallVector< PortInfogetFilteredPorts (ComponentOp op, Pred p)
 A helper function to return a filtered subset of a component's ports. More...
 
static LogicalResult hasRequiredPorts (ComponentOp op)
 Determines whether the given ComponentOp has all the required ports. More...
 
template<typename Pred >
static SmallVector< PortInfogetFilteredPorts (CombComponentOp op, Pred p)
 A helper function to return a filtered subset of a comb component's ports. More...
 
static LogicalResult isCombinational (Value value, GroupInterface group)
 Verifies the defining operation of a value is combinational. More...
 
static bool portIsUsedInGroup (GroupInterface group, Value port, bool isDriven)
 Determines whether the given port is used in the group. More...
 
static LogicalResult portDrivenByGroup (GroupInterface groupOp, Value port)
 Checks whether port is driven from within groupOp. More...
 
static LogicalResult allPortsDrivenByGroup (GroupInterface group, ValueRange ports)
 Checks whether all ports are driven within the group. More...
 
static LogicalResult anyPortsDrivenByGroup (GroupInterface group, ValueRange ports)
 Checks whether any ports are driven within the group. More...
 
static LogicalResult anyPortsReadByGroup (GroupInterface group, ValueRange ports)
 Checks whether any ports are read within the group. More...
 
static LogicalResult verifyPrimitivePortDriving (AssignOp assign, GroupInterface group)
 Verifies that certain ports of primitives are either driven or read together. More...
 
static void getCellAsmResultNames (OpAsmSetValueNameFn setNameFn, Operation *op, ArrayRef< StringRef > portNames)
 Gives each result of the cell a meaningful name in the form: <instance-name>. More...
 
static LogicalResult verifyPortDirection (Operation *op, Value value, bool isDestination)
 Determines whether the given direction is valid with the given inputs. More...
 
static LogicalResult verifyAssignOpValue (AssignOp op, bool isDestination)
 Verifies the value of a given assignment operation. More...
 
static LogicalResult verifyInstanceOpType (InstanceOp instance, ComponentInterface referencedComponent)
 Verifies the port information in comparison with the referenced component of an instance. More...
 
static LogicalResult verifyPrimitiveOpType (PrimitiveOp instance, hw::HWModuleExternOp referencedPrimitive)
 Verifies the port information in comparison with the referenced component of an instance. More...
 
Direction convertHWDirectionToCalyx (hw::ModulePort::Direction direction)
 
static DictionaryAttr cleanCalyxPortAttrs (OpBuilder builder, DictionaryAttr dict)
 Returns a new DictionaryAttr containing only the calyx dialect attrs in the input DictionaryAttr. More...
 
static ParseResult parseParameterList (OpAsmParser &parser, SmallVector< Attribute > &parameters)
 Parse an parameter list if present. More...
 
static ParseResult parseParameterList (OpAsmParser &parser, ArrayAttr &parameters)
 Shim to also use this for the InstanceOp custom parser. More...
 
static void printParameterList (OpAsmPrinter &p, Operation *op, ArrayAttr parameters)
 Print a parameter list for a module or instance. Same format as HW dialect. More...
 
template<typename OpTy >
static std::optional< EnableOp > getLastEnableOp (OpTy parent)
 Returns the last EnableOp within the child tree of 'parentSeqOp' or parentStaticSeqOp. More...
 
template<typename OpTy >
static llvm::StringMap< EnableOp > getAllEnableOpsInImmediateBody (OpTy parent)
 Returns a mapping of {enabled Group name, EnableOp} for all EnableOps within the immediate ParOp's body. More...
 
template<typename IfOpTy , typename TailOpTy >
static bool hasCommonTailPatternPreConditions (IfOpTy op)
 Checks preconditions for the common tail pattern. More...
 
template<typename IfOpTy , typename SeqOpTy >
static LogicalResult commonTailPatternWithSeq (IfOpTy ifOp, PatternRewriter &rewriter)
 seq { if a with @G { if a with @G { seq { ... More...
 
template<typename OpTy , typename ParOpTy >
static LogicalResult commonTailPatternWithPar (OpTy controlOp, PatternRewriter &rewriter)
 if a with @G { par { par { if a with @G { ... More...
 
template<typename OpTy >
static LogicalResult zeroRepeat (OpTy op, PatternRewriter &rewriter)
 
static ParseResult parseParameterList (OpAsmParser &parser, OperationState &result, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &ports, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &inputs, SmallVectorImpl< Attribute > &portNames, SmallVectorImpl< Attribute > &inputNames, SmallVectorImpl< Type > &types)
 
static LogicalResult verifyInvokeOpValue (InvokeOp &op, Value &value, bool isDestination)
 
static LogicalResult verifyComplexLogic (InvokeOp &op, Value &value)
 
static size_t getHwModuleExtGoOrDonePortNumber (hw::HWModuleExternOp &moduleExternOp, bool isGo)
 
 ImplBinPipeOpCellInterface (MultPipeLibOp, "out") ImplBinPipeOpCellInterface(DivUPipeLibOp
 
out_quotient ImplBinPipeOpCellInterface (DivSPipeLibOp, "out_quotient") ImplBinPipeOpCellInterface(RemUPipeLibOp
 

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

◆ ImplBinOpCellInterface

#define ImplBinOpCellInterface (   OpType)
Value:
SmallVector<StringRef> OpType::portNames() { \
return {"left", "right", "out"}; \
} \
SmallVector<Direction> OpType::portDirections() { \
return {Input, Input, Output}; \
} \
getCellAsmResultNames(setNameFn, *this, this->portNames()); \
} \
bool OpType::isCombinational() { return true; } \
SmallVector<DictionaryAttr> OpType::portAttributes() { \
return {DictionaryAttr::get(getContext()), \
DictionaryAttr::get(getContext()), \
DictionaryAttr::get(getContext())}; \
}
static LogicalResult isCombinational(Value value, GroupInterface group)
Verifies the defining operation of a value is combinational.
Definition: CalyxOps.cpp:1056
@ Input
Definition: HW.h:35
@ Output
Definition: HW.h:35
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:55
void getAsmResultNames(OpAsmSetValueNameFn setNameFn, StringRef instanceName, ArrayAttr resultNames, ValueRange results)
Suggest a name for each result value based on the saved result names attribute.
function_ref< void(Value, StringRef)> OpAsmSetValueNameFn
Definition: LLVM.h:182

Definition at line 3014 of file CalyxOps.cpp.

◆ ImplBinPipeOpCellInterface

#define ImplBinPipeOpCellInterface (   OpType,
  outName 
)

Definition at line 2968 of file CalyxOps.cpp.

◆ ImplUnaryOpCellInterface

#define ImplUnaryOpCellInterface (   OpType)
Value:
SmallVector<StringRef> OpType::portNames() { return {"in", "out"}; } \
SmallVector<Direction> OpType::portDirections() { return {Input, Output}; } \
SmallVector<DictionaryAttr> OpType::portAttributes() { \
return {DictionaryAttr::get(getContext()), \
DictionaryAttr::get(getContext())}; \
} \
bool OpType::isCombinational() { return true; } \
getCellAsmResultNames(setNameFn, *this, this->portNames()); \
}

Definition at line 3002 of file CalyxOps.cpp.

Function Documentation

◆ allPortsDrivenByGroup()

static LogicalResult allPortsDrivenByGroup ( GroupInterface  group,
ValueRange  ports 
)
static

Checks whether all ports are driven within the group.

Definition at line 1257 of file CalyxOps.cpp.

References portIsUsedInGroup().

◆ anyPortsDrivenByGroup()

static LogicalResult anyPortsDrivenByGroup ( GroupInterface  group,
ValueRange  ports 
)
static

Checks whether any ports are driven within the group.

Definition at line 1277 of file CalyxOps.cpp.

References portIsUsedInGroup().

◆ anyPortsReadByGroup()

static LogicalResult anyPortsReadByGroup ( GroupInterface  group,
ValueRange  ports 
)
static

Checks whether any ports are read within the group.

Definition at line 1297 of file CalyxOps.cpp.

References portIsUsedInGroup().

◆ buildComponentLike()

static void buildComponentLike ( OpBuilder &  builder,
OperationState &  result,
StringAttr  name,
ArrayRef< PortInfo ports,
bool  combinational 
)
static

◆ cleanCalyxPortAttrs()

static DictionaryAttr cleanCalyxPortAttrs ( OpBuilder  builder,
DictionaryAttr  dict 
)
static

Returns a new DictionaryAttr containing only the calyx dialect attrs in the input DictionaryAttr.

Also strips the 'calyx.' prefix from these attrs.

Definition at line 1810 of file CalyxOps.cpp.

◆ collapseControl()

template<typename OpTy >
static LogicalResult collapseControl ( OpTy  controlOp,
PatternRewriter &  rewriter 
)
static

Definition at line 312 of file CalyxOps.cpp.

◆ commonTailPatternWithPar()

template<typename OpTy , typename ParOpTy >
static LogicalResult commonTailPatternWithPar ( OpTy  controlOp,
PatternRewriter &  rewriter 
)
static

if a with @G { par { par { if a with @G { ...

par { ... } calyx.enable @A } else { calyx.enable @B -> par { ... } } } } else { calyx.enable @A par { calyx.enable @B ... } calyx.enable @A calyx.enable @B } }

Definition at line 2426 of file CalyxOps.cpp.

References getAllEnableOpsInImmediateBody().

◆ commonTailPatternWithSeq()

template<typename IfOpTy , typename SeqOpTy >
static LogicalResult commonTailPatternWithSeq ( IfOpTy  ifOp,
PatternRewriter &  rewriter 
)
static

seq { if a with @G { if a with @G { seq { ...

calyx.enable @A } seq { ... } else { -> } else { seq { ... calyx.enable @A } seq { ... } } } calyx.enable @A }

Definition at line 2376 of file CalyxOps.cpp.

References getLastEnableOp().

◆ concat()

template<typename T >
static SmallVector<T> concat ( const SmallVectorImpl< T > &  a,
const SmallVectorImpl< T > &  b 
)
static

Returns a new vector containing the concatenation of vectors a and b.

Definition at line 540 of file CalyxOps.cpp.

Referenced by buildComponentLike(), getConcatOperands(), circt::FirRegLowering::initialize(), isZeroExtension(), lookupOrCreateStringGlobal(), and circt::Namespace::newName().

◆ convertHWDirectionToCalyx()

Direction convertHWDirectionToCalyx ( hw::ModulePort::Direction  direction)

Definition at line 1785 of file CalyxOps.cpp.

References InOut, Input, and Output.

◆ emptyControl()

template<typename OpTy >
static LogicalResult emptyControl ( OpTy  controlOp,
PatternRewriter &  rewriter 
)
static

Definition at line 330 of file CalyxOps.cpp.

◆ eraseControlWithConditional()

template<typename OpTy >
static void eraseControlWithConditional ( OpTy  op,
PatternRewriter &  rewriter 
)
static

A helper function to check whether the conditional needs to be erased to maintain a valid state of a Calyx program.

If these have no more uses, they will be erased.

Definition at line 369 of file CalyxOps.cpp.

Referenced by EmptyStaticIfBody::matchAndRewrite().

◆ eraseControlWithGroupAndConditional()

template<typename OpTy >
static void eraseControlWithGroupAndConditional ( OpTy  op,
PatternRewriter &  rewriter 
)
static

A helper function to check whether the conditional and group (if it exists) needs to be erased to maintain a valid state of a Calyx program.

If these have no more uses, they will be erased.

Definition at line 342 of file CalyxOps.cpp.

Referenced by EmptyIfBody::matchAndRewrite().

◆ getAllEnableOpsInImmediateBody()

template<typename OpTy >
static llvm::StringMap<EnableOp> getAllEnableOpsInImmediateBody ( OpTy  parent)
static

Returns a mapping of {enabled Group name, EnableOp} for all EnableOps within the immediate ParOp's body.

Definition at line 2332 of file CalyxOps.cpp.

Referenced by commonTailPatternWithPar().

◆ getBlockArgumentWithName()

static Value getBlockArgumentWithName ( StringRef  name,
ComponentOp  op 
)
static

Returns the Block argument with the given name from a ComponentOp.

If the name doesn't exist, returns an empty Value.

Definition at line 628 of file CalyxOps.cpp.

◆ getCellAsmResultNames()

static void getCellAsmResultNames ( OpAsmSetValueNameFn  setNameFn,
Operation *  op,
ArrayRef< StringRef >  portNames 
)
static

Gives each result of the cell a meaningful name in the form: <instance-name>.

<port-name>

Definition at line 1420 of file CalyxOps.cpp.

References assert().

◆ getControlOrWiresFrom()

template<typename Op >
static Op getControlOrWiresFrom ( ComponentOp  op)
static

This is a helper function that should only be used to get the WiresOp or ControlOp of a ComponentOp, which are guaranteed to exist and generally at the end of a component's body.

In the worst case, this will run in linear time with respect to the number of instances within the component.

Definition at line 618 of file CalyxOps.cpp.

◆ getFilteredPorts() [1/2]

template<typename Pred >
static SmallVector<PortInfo> getFilteredPorts ( CombComponentOp  op,
Pred  p 
)
static

A helper function to return a filtered subset of a comb component's ports.

Definition at line 812 of file CalyxOps.cpp.

◆ getFilteredPorts() [2/2]

template<typename Pred >
static SmallVector<PortInfo> getFilteredPorts ( ComponentOp  op,
Pred  p 
)
static

A helper function to return a filtered subset of a component's ports.

Definition at line 679 of file CalyxOps.cpp.

◆ getHwModuleExtGoOrDonePortNumber()

static size_t getHwModuleExtGoOrDonePortNumber ( hw::HWModuleExternOp moduleExternOp,
bool  isGo 
)
static

Definition at line 2842 of file CalyxOps.cpp.

◆ getLastEnableOp()

template<typename OpTy >
static std::optional<EnableOp> getLastEnableOp ( OpTy  parent)
static

Returns the last EnableOp within the child tree of 'parentSeqOp' or parentStaticSeqOp.

If no EnableOp was found (e.g. a "calyx.par" operation is present), returns None.

Definition at line 2313 of file CalyxOps.cpp.

Referenced by commonTailPatternWithSeq().

◆ hasCommonTailPatternPreConditions()

template<typename IfOpTy , typename TailOpTy >
static bool hasCommonTailPatternPreConditions ( IfOpTy  op)
static

Checks preconditions for the common tail pattern.

This canonicalization is stringent about not entering nested control operations, as this may cause unintentional changes in behavior. We only look for two cases: (1) both regions are ParOps, and (2) both regions are SeqOps. The case when these are different, e.g. ParOp and SeqOp, will only produce less optimal code, or even worse, change the behavior.

Definition at line 2352 of file CalyxOps.cpp.

◆ hasControlRegion()

static bool hasControlRegion ( Operation *  op)
static

Returns whether the given operation has a control region.

Definition at line 150 of file CalyxOps.cpp.

Referenced by verifyControlBody(), and circt::calyx::verifyControlLikeOp().

◆ hasRequiredPorts()

static LogicalResult hasRequiredPorts ( ComponentOp  op)
static

Determines whether the given ComponentOp has all the required ports.

Definition at line 704 of file CalyxOps.cpp.

References circt::calyx::clkPort, circt::calyx::donePort, circt::calyx::goPort, intersection(), and circt::calyx::resetPort.

◆ ImplBinPipeOpCellInterface() [1/2]

out_quotient ImplBinPipeOpCellInterface ( DivSPipeLibOp  ,
"out_quotient"   
)

◆ ImplBinPipeOpCellInterface() [2/2]

ImplBinPipeOpCellInterface ( MultPipeLibOp  ,
"out"   
)

◆ isCombinational()

static LogicalResult isCombinational ( Value  value,
GroupInterface  group 
)
static

Verifies the defining operation of a value is combinational.

Definition at line 1056 of file CalyxOps.cpp.

References valueName(), and writePorts.

Referenced by circt::ExportVerilog::isVerilogExpression().

◆ isPort()

static bool isPort ( Value  value)
static

Returns whether this value is either (1) a port on a ComponentOp or (2) a port on a cell interface.

Definition at line 135 of file CalyxOps.cpp.

Referenced by DiscoverLoops::dfsTraverse(), verifyAssignOpValue(), and verifyInvokeOpValue().

◆ isStaticControl()

static bool isStaticControl ( Operation *  op)
static

Returns whether the given operation is a static control operator.

Definition at line 156 of file CalyxOps.cpp.

◆ parseComponentInterface()

template<typename ComponentTy >
static ParseResult parseComponentInterface ( OpAsmParser &  parser,
OperationState &  result 
)
static

Definition at line 503 of file CalyxOps.cpp.

References circt::calyx::direction::get(), and parseComponentSignature().

◆ parseComponentSignature()

static ParseResult parseComponentSignature ( OpAsmParser &  parser,
OperationState &  result,
SmallVectorImpl< OpAsmParser::Argument > &  ports,
SmallVectorImpl< Type > &  portTypes 
)
static

Parses the signature of a Calyx component.

Definition at line 457 of file CalyxOps.cpp.

References circt::calyx::direction::get(), circt::calyx::direction::packAttribute(), and parsePortDefList().

Referenced by parseComponentInterface().

◆ parseGroupPort()

static ParseResult parseGroupPort ( OpAsmParser &  parser,
OperationState &  result 
)
static

Definition at line 269 of file CalyxOps.cpp.

◆ parseParameterList() [1/3]

static ParseResult parseParameterList ( OpAsmParser &  parser,
ArrayAttr &  parameters 
)
static

Shim to also use this for the InstanceOp custom parser.

Definition at line 1875 of file CalyxOps.cpp.

References circt::calyx::direction::get(), and parseParameterList().

◆ parseParameterList() [2/3]

static ParseResult parseParameterList ( OpAsmParser &  parser,
OperationState &  result,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  ports,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  inputs,
SmallVectorImpl< Attribute > &  portNames,
SmallVectorImpl< Attribute > &  inputNames,
SmallVectorImpl< Type > &  types 
)
static

Definition at line 2642 of file CalyxOps.cpp.

References circt::calyx::direction::get(), and parseType().

◆ parseParameterList() [3/3]

static ParseResult parseParameterList ( OpAsmParser &  parser,
SmallVector< Attribute > &  parameters 
)
static

Parse an parameter list if present.

Same format as HW dialect. module-parameter-list ::= < parameter-decl (, parameter-decl)* > parameter-decl ::= identifier : type parameter-decl ::= identifier : type = attribute

Definition at line 1849 of file CalyxOps.cpp.

References circt::calyx::direction::get().

Referenced by parseParameterList().

◆ parsePortDefList()

static ParseResult parsePortDefList ( OpAsmParser &  parser,
OperationState &  result,
SmallVectorImpl< OpAsmParser::Argument > &  ports,
SmallVectorImpl< Type > &  portTypes,
SmallVectorImpl< NamedAttrList > &  portAttrs 
)
static

Parses the ports of a Calyx component signature, and adds the corresponding port names to attrName.

Definition at line 429 of file CalyxOps.cpp.

References parsePort().

Referenced by parseComponentSignature().

◆ portDrivenByGroup()

static LogicalResult portDrivenByGroup ( GroupInterface  groupOp,
Value  port 
)
static

Checks whether port is driven from within groupOp.

Definition at line 1230 of file CalyxOps.cpp.

References Output, and portIsUsedInGroup().

◆ portIsUsedInGroup()

static bool portIsUsedInGroup ( GroupInterface  group,
Value  port,
bool  isDriven 
)
static

Determines whether the given port is used in the group.

Its use depends on the isDriven value; if true, then the port should be a destination in an AssignOp. Otherwise, it should be the source, i.e. a read.

Definition at line 1208 of file CalyxOps.cpp.

Referenced by allPortsDrivenByGroup(), anyPortsDrivenByGroup(), anyPortsReadByGroup(), and portDrivenByGroup().

◆ printComponentInterface()

template<typename ComponentTy >
static void printComponentInterface ( OpAsmPrinter &  p,
ComponentInterface  comp 
)
static

◆ printGroupPort()

template<typename GroupPortType >
static void printGroupPort ( OpAsmPrinter &  p,
GroupPortType  op 
)
static

Definition at line 297 of file CalyxOps.cpp.

◆ printParameterList()

static void printParameterList ( OpAsmPrinter &  p,
Operation *  op,
ArrayAttr  parameters 
)
static

Print a parameter list for a module or instance. Same format as HW dialect.

Definition at line 1887 of file CalyxOps.cpp.

◆ valueName()

static std::string valueName ( Operation *  scopeOp,
Value  v 
)
static

Convenience function for getting the SSA name of v under the scope of operation scopeOp.

Definition at line 121 of file CalyxOps.cpp.

Referenced by isCombinational().

◆ verifyAssignOpValue()

static LogicalResult verifyAssignOpValue ( AssignOp  op,
bool  isDestination 
)
static

Verifies the value of a given assignment operation.

The boolean isDestination is used to distinguish whether the destination or source of the AssignOp is to be verified.

Definition at line 1467 of file CalyxOps.cpp.

References isPort(), verifyNotComplexSource(), and verifyPortDirection().

◆ verifyComplexLogic()

static LogicalResult verifyComplexLogic ( InvokeOp &  op,
Value &  value 
)
static

Definition at line 2760 of file CalyxOps.cpp.

◆ verifyControlBody()

static LogicalResult verifyControlBody ( Operation *  op)
static

Verifies the body of a ControlLikeOp.

Definition at line 169 of file CalyxOps.cpp.

References hasControlRegion().

Referenced by circt::calyx::verifyControlLikeOp().

◆ verifyInstanceOpType()

static LogicalResult verifyInstanceOpType ( InstanceOp  instance,
ComponentInterface  referencedComponent 
)
static

Verifies the port information in comparison with the referenced component of an instance.

This helper function avoids conducting a lookup for the referenced component twice.

Definition at line 1567 of file CalyxOps.cpp.

◆ verifyInvokeOpValue()

static LogicalResult verifyInvokeOpValue ( InvokeOp &  op,
Value &  value,
bool  isDestination 
)
static

Definition at line 2752 of file CalyxOps.cpp.

References isPort(), and verifyPortDirection().

◆ verifyNotComplexSource()

template<typename Op >
static LogicalResult verifyNotComplexSource ( Op  op)
static

Verify that the value is not a "complex" value.

For example, the source of an AssignOp should be a constant or port, e.g. and = comb.and a, b : i1 calyx.assign port = c1_i1 ? and : i1 // Incorrect calyx.assign port = and ? c1_i1 : i1 // Correct TODO(Calyx): This is useful to verify current MLIR can be lowered to the native compiler. Remove this when Calyx supports wire declarations. See: https://github.com/llvm/circt/pull/1774 for context.

Definition at line 104 of file CalyxOps.cpp.

Referenced by verifyAssignOpValue().

◆ verifyPortDirection()

static LogicalResult verifyPortDirection ( Operation *  op,
Value  value,
bool  isDestination 
)
static

Determines whether the given direction is valid with the given inputs.

The isDestination boolean is used to distinguish whether the value is a source or a destination.

Definition at line 1437 of file CalyxOps.cpp.

References assert(), circt::calyx::PortInfo::direction, circt::calyx::getPortInfo(), Input, and Output.

Referenced by verifyAssignOpValue(), and verifyInvokeOpValue().

◆ verifyPrimitiveOpType()

static LogicalResult verifyPrimitiveOpType ( PrimitiveOp  instance,
hw::HWModuleExternOp  referencedPrimitive 
)
static

Verifies the port information in comparison with the referenced component of an instance.

This helper function avoids conducting a lookup for the referenced component twice.

Definition at line 1674 of file CalyxOps.cpp.

References circt::hw::evaluateParametricType().

◆ verifyPrimitivePortDriving()

static LogicalResult verifyPrimitivePortDriving ( AssignOp  assign,
GroupInterface  group 
)
static

Verifies that certain ports of primitives are either driven or read together.

Definition at line 1318 of file CalyxOps.cpp.

Referenced by circt::calyx::verifyGroupInterface().

◆ zeroRepeat()

template<typename OpTy >
static LogicalResult zeroRepeat ( OpTy  op,
PatternRewriter &  rewriter 
)
static

Definition at line 2606 of file CalyxOps.cpp.