CIRCT  20.0.0git
Functions
HW.cpp File Reference
#include "circt-c/Dialect/HW.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWInstanceGraph.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWPasses.h"
#include "circt/Dialect/HW/HWTypes.h"
#include "circt/Support/LLVM.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/CAPI/Support.h"
#include "llvm/ADT/PostOrderIterator.h"
Include dependency graph for HW.cpp:

Go to the source code of this file.

Functions

void registerHWPasses ()
 
int64_t hwGetBitWidth (MlirType type)
 Return the hardware bit width of a type. More...
 
bool hwTypeIsAValueType (MlirType type)
 Return true if the specified type can be used as an HW value type, that is the set of types that can be composed together to represent synthesized, hardware but not marker types like InOutType or unknown types from other dialects. More...
 
bool hwTypeIsAArrayType (MlirType type)
 If the type is an HW array. More...
 
MlirType hwArrayTypeGet (MlirType element, size_t size)
 Creates a fixed-size HW array type in the context associated with element. More...
 
MlirType hwArrayTypeGetElementType (MlirType type)
 returns the element type of an array type More...
 
intptr_t hwArrayTypeGetSize (MlirType type)
 returns the size of an array type More...
 
bool hwTypeIsAIntType (MlirType type)
 If the type is an HW int. More...
 
MlirType hwParamIntTypeGet (MlirAttribute parameter)
 
MlirAttribute hwParamIntTypeGetWidthAttr (MlirType type)
 
MlirType hwInOutTypeGet (MlirType element)
 Creates an HW inout type in the context associated with element. More...
 
MlirType hwInOutTypeGetElementType (MlirType type)
 Returns the element type of an inout type. More...
 
bool hwTypeIsAInOut (MlirType type)
 If the type is an HW inout. More...
 
bool hwTypeIsAModuleType (MlirType type)
 If the type is an HW module type. More...
 
MlirType hwModuleTypeGet (MlirContext ctx, intptr_t numPorts, HWModulePort const *ports)
 Creates an HW module type. More...
 
intptr_t hwModuleTypeGetNumInputs (MlirType type)
 Get an HW module type's number of inputs. More...
 
MlirType hwModuleTypeGetInputType (MlirType type, intptr_t index)
 Get an HW module type's input type at a specific index. More...
 
MlirStringRef hwModuleTypeGetInputName (MlirType type, intptr_t index)
 Get an HW module type's input name at a specific index. More...
 
intptr_t hwModuleTypeGetNumOutputs (MlirType type)
 Get an HW module type's number of outputs. More...
 
MlirType hwModuleTypeGetOutputType (MlirType type, intptr_t index)
 Get an HW module type's output type at a specific index. More...
 
MlirStringRef hwModuleTypeGetOutputName (MlirType type, intptr_t index)
 Get an HW module type's output name at a specific index. More...
 
bool hwTypeIsAStructType (MlirType type)
 If the type is an HW struct. More...
 
MlirType hwStructTypeGet (MlirContext ctx, intptr_t numElements, HWStructFieldInfo const *elements)
 Creates an HW struct type in the context associated with the elements. More...
 
MlirType hwStructTypeGetField (MlirType structType, MlirStringRef fieldName)
 
MlirAttribute hwStructTypeGetFieldIndex (MlirType structType, MlirStringRef fieldName)
 
intptr_t hwStructTypeGetNumFields (MlirType structType)
 
HWStructFieldInfo hwStructTypeGetFieldNum (MlirType structType, unsigned idx)
 
bool hwTypeIsATypeAliasType (MlirType type)
 If the type is an HW type alias. More...
 
MlirType hwTypeAliasTypeGet (MlirStringRef cScope, MlirStringRef cName, MlirType cInnerType)
 
MlirType hwTypeAliasTypeGetCanonicalType (MlirType typeAlias)
 
MlirType hwTypeAliasTypeGetInnerType (MlirType typeAlias)
 
MlirStringRef hwTypeAliasTypeGetName (MlirType typeAlias)
 
MlirStringRef hwTypeAliasTypeGetScope (MlirType typeAlias)
 
bool hwAttrIsAInnerSymAttr (MlirAttribute attr)
 
MlirAttribute hwInnerSymAttrGet (MlirAttribute symName)
 
MlirAttribute hwInnerSymAttrGetEmpty (MlirContext ctx)
 
MlirAttribute hwInnerSymAttrGetSymName (MlirAttribute innerSymAttr)
 
bool hwAttrIsAInnerRefAttr (MlirAttribute attr)
 
MlirAttribute hwInnerRefAttrGet (MlirAttribute moduleName, MlirAttribute innerSym)
 
MlirAttribute hwInnerRefAttrGetName (MlirAttribute innerRefAttr)
 
MlirAttribute hwInnerRefAttrGetModule (MlirAttribute innerRefAttr)
 
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr (MlirAttribute attr)
 
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet (MlirStringRef cName, MlirType cType, MlirAttribute cValue)
 
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName (MlirAttribute decl)
 
MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType (MlirAttribute decl)
 
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue (MlirAttribute decl)
 
MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr (MlirAttribute attr)
 
MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet (MlirContext ctx, MlirStringRef cName)
 
MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName (MlirAttribute decl)
 
MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType (MlirAttribute decl)
 
MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr (MlirAttribute attr)
 
MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet (MlirAttribute text)
 
MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr (MlirAttribute attr)
 
MLIR_CAPI_EXPORTED MlirAttribute hwOutputFileGetFromFileName (MlirAttribute fileName, bool excludeFromFileList, bool includeReplicatedOp)
 
MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet (MlirOperation operation)
 
MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy (HWInstanceGraph instanceGraph)
 
MLIR_CAPI_EXPORTED HWInstanceGraphNode hwInstanceGraphGetTopLevelNode (HWInstanceGraph instanceGraph)
 
MLIR_CAPI_EXPORTED void hwInstanceGraphForEachNode (HWInstanceGraph instanceGraph, HWInstanceGraphNodeCallback callback, void *userData)
 
MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual (HWInstanceGraphNode lhs, HWInstanceGraphNode rhs)
 
MLIR_CAPI_EXPORTED MlirModule hwInstanceGraphNodeGetModule (HWInstanceGraphNode node)
 
MLIR_CAPI_EXPORTED MlirOperation hwInstanceGraphNodeGetModuleOp (HWInstanceGraphNode node)
 

Function Documentation

◆ hwArrayTypeGet()

MlirType hwArrayTypeGet ( MlirType  element,
size_t  size 
)

Creates a fixed-size HW array type in the context associated with element.

Definition at line 44 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwArrayTypeGetElementType()

MlirType hwArrayTypeGetElementType ( MlirType  type)

returns the element type of an array type

Definition at line 48 of file HW.cpp.

References unwrap(), and wrap().

◆ hwArrayTypeGetSize()

intptr_t hwArrayTypeGetSize ( MlirType  type)

returns the size of an array type

Definition at line 52 of file HW.cpp.

References unwrap().

◆ hwAttrIsAInnerRefAttr()

bool hwAttrIsAInnerRefAttr ( MlirAttribute  attr)

Definition at line 230 of file HW.cpp.

References unwrap().

◆ hwAttrIsAInnerSymAttr()

bool hwAttrIsAInnerSymAttr ( MlirAttribute  attr)

Definition at line 214 of file HW.cpp.

References unwrap().

◆ hwAttrIsAOutputFileAttr()

MLIR_CAPI_EXPORTED bool hwAttrIsAOutputFileAttr ( MlirAttribute  attr)

Definition at line 298 of file HW.cpp.

References unwrap().

◆ hwAttrIsAParamDeclAttr()

MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclAttr ( MlirAttribute  attr)

Definition at line 249 of file HW.cpp.

References unwrap().

◆ hwAttrIsAParamDeclRefAttr()

MLIR_CAPI_EXPORTED bool hwAttrIsAParamDeclRefAttr ( MlirAttribute  attr)

Definition at line 270 of file HW.cpp.

References unwrap().

◆ hwAttrIsAParamVerbatimAttr()

MLIR_CAPI_EXPORTED bool hwAttrIsAParamVerbatimAttr ( MlirAttribute  attr)

Definition at line 288 of file HW.cpp.

References unwrap().

◆ hwGetBitWidth()

int64_t hwGetBitWidth ( MlirType  type)

Return the hardware bit width of a type.

Does not reflect any encoding, padding, or storage scheme, just the bit (and wire width) of a statically-size type. Reflects the number of wires needed to transmit a value of this type. Returns -1 if the type is not known or cannot be statically computed.

Definition at line 38 of file HW.cpp.

References circt::hw::getBitWidth(), and unwrap().

◆ hwInnerRefAttrGet()

MlirAttribute hwInnerRefAttrGet ( MlirAttribute  moduleName,
MlirAttribute  innerSym 
)

Definition at line 234 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwInnerRefAttrGetModule()

MlirAttribute hwInnerRefAttrGetModule ( MlirAttribute  innerRefAttr)

Definition at line 245 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInnerRefAttrGetName()

MlirAttribute hwInnerRefAttrGetName ( MlirAttribute  innerRefAttr)

Definition at line 241 of file HW.cpp.

References circt::hw::instance_like_impl::getName(), unwrap(), and wrap().

◆ hwInnerSymAttrGet()

MlirAttribute hwInnerSymAttrGet ( MlirAttribute  symName)

Definition at line 218 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwInnerSymAttrGetEmpty()

MlirAttribute hwInnerSymAttrGetEmpty ( MlirContext  ctx)

Definition at line 222 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwInnerSymAttrGetSymName()

MlirAttribute hwInnerSymAttrGetSymName ( MlirAttribute  innerSymAttr)

Definition at line 226 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInOutTypeGet()

MlirType hwInOutTypeGet ( MlirType  element)

Creates an HW inout type in the context associated with element.

Definition at line 66 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwInOutTypeGetElementType()

MlirType hwInOutTypeGetElementType ( MlirType  type)

Returns the element type of an inout type.

Definition at line 70 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInstanceGraphDestroy()

MLIR_CAPI_EXPORTED void hwInstanceGraphDestroy ( HWInstanceGraph  instanceGraph)

Definition at line 314 of file HW.cpp.

References unwrap().

◆ hwInstanceGraphForEachNode()

MLIR_CAPI_EXPORTED void hwInstanceGraphForEachNode ( HWInstanceGraph  instanceGraph,
HWInstanceGraphNodeCallback  callback,
void *  userData 
)

Definition at line 324 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInstanceGraphGet()

MLIR_CAPI_EXPORTED HWInstanceGraph hwInstanceGraphGet ( MlirOperation  operation)

Definition at line 310 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInstanceGraphGetTopLevelNode()

MLIR_CAPI_EXPORTED HWInstanceGraphNode hwInstanceGraphGetTopLevelNode ( HWInstanceGraph  instanceGraph)

Definition at line 319 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInstanceGraphNodeEqual()

MLIR_CAPI_EXPORTED bool hwInstanceGraphNodeEqual ( HWInstanceGraphNode  lhs,
HWInstanceGraphNode  rhs 
)

Definition at line 333 of file HW.cpp.

References unwrap().

◆ hwInstanceGraphNodeGetModule()

MLIR_CAPI_EXPORTED MlirModule hwInstanceGraphNodeGetModule ( HWInstanceGraphNode  node)

Definition at line 339 of file HW.cpp.

References unwrap(), and wrap().

◆ hwInstanceGraphNodeGetModuleOp()

MLIR_CAPI_EXPORTED MlirOperation hwInstanceGraphNodeGetModuleOp ( HWInstanceGraphNode  node)

Definition at line 344 of file HW.cpp.

References unwrap(), and wrap().

◆ hwModuleTypeGet()

MlirType hwModuleTypeGet ( MlirContext  ctx,
intptr_t  numPorts,
HWModulePort const *  ports 
)

Creates an HW module type.

Definition at line 80 of file HW.cpp.

References HWModulePort::dir, circt::calyx::direction::get(), InOut, Input, HWModulePort::name, Output, HWModulePort::type, unwrap(), and wrap().

◆ hwModuleTypeGetInputName()

MlirStringRef hwModuleTypeGetInputName ( MlirType  type,
intptr_t  index 
)

Get an HW module type's input name at a specific index.

Definition at line 116 of file HW.cpp.

References unwrap(), and wrap().

◆ hwModuleTypeGetInputType()

MlirType hwModuleTypeGetInputType ( MlirType  type,
intptr_t  index 
)

Get an HW module type's input type at a specific index.

Definition at line 112 of file HW.cpp.

References unwrap(), and wrap().

◆ hwModuleTypeGetNumInputs()

intptr_t hwModuleTypeGetNumInputs ( MlirType  type)

Get an HW module type's number of inputs.

Definition at line 108 of file HW.cpp.

References unwrap().

◆ hwModuleTypeGetNumOutputs()

intptr_t hwModuleTypeGetNumOutputs ( MlirType  type)

Get an HW module type's number of outputs.

Definition at line 120 of file HW.cpp.

References unwrap().

◆ hwModuleTypeGetOutputName()

MlirStringRef hwModuleTypeGetOutputName ( MlirType  type,
intptr_t  index 
)

Get an HW module type's output name at a specific index.

Definition at line 128 of file HW.cpp.

References unwrap(), and wrap().

◆ hwModuleTypeGetOutputType()

MlirType hwModuleTypeGetOutputType ( MlirType  type,
intptr_t  index 
)

Get an HW module type's output type at a specific index.

Definition at line 124 of file HW.cpp.

References unwrap(), and wrap().

◆ hwOutputFileGetFromFileName()

MLIR_CAPI_EXPORTED MlirAttribute hwOutputFileGetFromFileName ( MlirAttribute  fileName,
bool  excludeFromFileList,
bool  includeReplicatedOp 
)

Definition at line 302 of file HW.cpp.

References unwrap(), and wrap().

◆ hwParamDeclAttrGet()

MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGet ( MlirStringRef  cName,
MlirType  cType,
MlirAttribute  cValue 
)

Definition at line 252 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwParamDeclAttrGetName()

MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclAttrGetName ( MlirAttribute  decl)

Definition at line 260 of file HW.cpp.

References circt::hw::instance_like_impl::getName(), unwrap(), and wrap().

◆ hwParamDeclAttrGetType()

MLIR_CAPI_EXPORTED MlirType hwParamDeclAttrGetType ( MlirAttribute  decl)

Definition at line 263 of file HW.cpp.

References unwrap(), and wrap().

◆ hwParamDeclAttrGetValue()

MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclAttrGetValue ( MlirAttribute  decl)

Definition at line 266 of file HW.cpp.

References unwrap(), and wrap().

◆ hwParamDeclRefAttrGet()

MLIR_CAPI_EXPORTED MlirAttribute hwParamDeclRefAttrGet ( MlirContext  ctx,
MlirStringRef  cName 
)

Definition at line 274 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwParamDeclRefAttrGetName()

MLIR_CAPI_EXPORTED MlirStringRef hwParamDeclRefAttrGetName ( MlirAttribute  decl)

Definition at line 281 of file HW.cpp.

References circt::hw::instance_like_impl::getName(), unwrap(), and wrap().

◆ hwParamDeclRefAttrGetType()

MLIR_CAPI_EXPORTED MlirType hwParamDeclRefAttrGetType ( MlirAttribute  decl)

Definition at line 284 of file HW.cpp.

References unwrap(), and wrap().

◆ hwParamIntTypeGet()

MlirType hwParamIntTypeGet ( MlirAttribute  parameter)

Definition at line 58 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwParamIntTypeGetWidthAttr()

MlirAttribute hwParamIntTypeGetWidthAttr ( MlirType  type)

Definition at line 62 of file HW.cpp.

References circt::esi::detail::getWidth(), unwrap(), and wrap().

◆ hwParamVerbatimAttrGet()

MLIR_CAPI_EXPORTED MlirAttribute hwParamVerbatimAttrGet ( MlirAttribute  text)

Definition at line 291 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwStructTypeGet()

MlirType hwStructTypeGet ( MlirContext  ctx,
intptr_t  numElements,
HWStructFieldInfo const *  elements 
)

Creates an HW struct type in the context associated with the elements.

Definition at line 136 of file HW.cpp.

References circt::calyx::direction::get(), numElements, unwrap(), and wrap().

◆ hwStructTypeGetField()

MlirType hwStructTypeGetField ( MlirType  structType,
MlirStringRef  fieldName 
)

Definition at line 147 of file HW.cpp.

References unwrap(), and wrap().

◆ hwStructTypeGetFieldIndex()

MlirAttribute hwStructTypeGetFieldIndex ( MlirType  structType,
MlirStringRef  fieldName 
)

Definition at line 152 of file HW.cpp.

References circt::calyx::direction::get(), unwrap(), and wrap().

◆ hwStructTypeGetFieldNum()

HWStructFieldInfo hwStructTypeGetFieldNum ( MlirType  structType,
unsigned  idx 
)

Definition at line 165 of file HW.cpp.

References HWStructFieldInfo::name, HWStructFieldInfo::type, unwrap(), and wrap().

◆ hwStructTypeGetNumFields()

intptr_t hwStructTypeGetNumFields ( MlirType  structType)

Definition at line 160 of file HW.cpp.

References unwrap().

◆ hwTypeAliasTypeGet()

MlirType hwTypeAliasTypeGet ( MlirStringRef  cScope,
MlirStringRef  cName,
MlirType  cInnerType 
)

Definition at line 178 of file HW.cpp.

References circt::calyx::direction::get(), circt::esi::innerType(), unwrap(), and wrap().

◆ hwTypeAliasTypeGetCanonicalType()

MlirType hwTypeAliasTypeGetCanonicalType ( MlirType  typeAlias)

Definition at line 190 of file HW.cpp.

References unwrap(), and wrap().

◆ hwTypeAliasTypeGetInnerType()

MlirType hwTypeAliasTypeGetInnerType ( MlirType  typeAlias)

Definition at line 195 of file HW.cpp.

References unwrap(), and wrap().

◆ hwTypeAliasTypeGetName()

MlirStringRef hwTypeAliasTypeGetName ( MlirType  typeAlias)

Definition at line 200 of file HW.cpp.

References unwrap(), and wrap().

◆ hwTypeAliasTypeGetScope()

MlirStringRef hwTypeAliasTypeGetScope ( MlirType  typeAlias)

Definition at line 205 of file HW.cpp.

References unwrap(), and wrap().

◆ hwTypeIsAArrayType()

bool hwTypeIsAArrayType ( MlirType  type)

If the type is an HW array.

Definition at line 42 of file HW.cpp.

References unwrap().

◆ hwTypeIsAInOut()

bool hwTypeIsAInOut ( MlirType  type)

If the type is an HW inout.

Definition at line 74 of file HW.cpp.

References unwrap().

◆ hwTypeIsAIntType()

bool hwTypeIsAIntType ( MlirType  type)

If the type is an HW int.

Definition at line 56 of file HW.cpp.

References unwrap().

◆ hwTypeIsAModuleType()

bool hwTypeIsAModuleType ( MlirType  type)

If the type is an HW module type.

Definition at line 76 of file HW.cpp.

References unwrap().

◆ hwTypeIsAStructType()

bool hwTypeIsAStructType ( MlirType  type)

If the type is an HW struct.

Definition at line 132 of file HW.cpp.

References unwrap().

◆ hwTypeIsATypeAliasType()

bool hwTypeIsATypeAliasType ( MlirType  type)

If the type is an HW type alias.

Definition at line 174 of file HW.cpp.

References unwrap().

◆ hwTypeIsAValueType()

bool hwTypeIsAValueType ( MlirType  type)

Return true if the specified type can be used as an HW value type, that is the set of types that can be composed together to represent synthesized, hardware but not marker types like InOutType or unknown types from other dialects.

Definition at line 40 of file HW.cpp.

References circt::hw::isHWValueType(), and unwrap().

◆ registerHWPasses()

void registerHWPasses ( void  )

Definition at line 32 of file HW.cpp.

References registerPasses().

Referenced by registerPasses().