CIRCT  19.0.0git
Namespaces | Classes | Typedefs | Functions
circt::hw Namespace Reference

Namespaces

 detail
 
 FieldIdImpl
 
 
 

Classes

class  InstanceGraph
 HW-specific instance graph with a virtual entry node linking to all publicly visible modules. More...
 
struct  InnerRefNamespaceLike
 Classify operations that are InnerRefNamespace-like, until structure is in place to do this via Traits. More...
 
class  HWModulePortAccessor
 
struct  HWReducePatternDialectInterface
 A dialect interface to provide reduction patterns to a reducer tool. More...
 
class  HWSymbolCache
 This stores lookup tables to make manipulating and working with the IR more efficient. More...
 
struct  ModulePort
 
class  TypeVariant
 Utility type that wraps a type that may be one of several possible Types. More...
 
class  TypeAliasOr
 
class  TypeOpVisitor
 This helps visit TypeOp nodes. More...
 
class  StmtVisitor
 This helps visit TypeOp nodes. More...
 
struct  InnerSymbolNamespace
 
struct  InnerSymbolNamespaceCollection
 
class  InnerSymTarget
 The target of an inner symbol, the entity the symbol is a handle for. More...
 
class  InnerSymbolTable
 A table of inner symbols and their resolutions. More...
 
class  InnerSymbolTableCollection
 This class represents a collection of InnerSymbolTable's. More...
 
struct  InnerRefNamespace
 This class represents the namespace in which InnerRef's can be resolved. More...
 
class  PortConverterImpl
 
class  PortConversion
 Base class for the port conversion of a particular port. More...
 
class  PortConversionBuilder
 
class  PortConverter
 
struct  PortInfo
 This holds the name, type, direction of a module's ports. More...
 
struct  ModulePortInfo
 This holds a decoded list of input/inout and output ports for a module or instance. More...
 
struct  ModulePortLookupInfo
 

Typedefs

using HWModuleBuilder = llvm::function_ref< void(OpBuilder &, HWModulePortAccessor &)>
 

Functions

enum PEO uint32_t mlir::FailureOr< mlir::Type > evaluateParametricType (mlir::Location loc, mlir::ArrayAttr parameters, mlir::Type type, bool emitErrors=true)
 Returns a resolved version of 'type' wherein any parameter reference has been evaluated based on the set of provided 'parameters'. More...
 
mlir::FailureOr< mlir::TypedAttr > evaluateParametricAttr (mlir::Location loc, mlir::ArrayAttr parameters, mlir::Attribute paramAttr, bool emitErrors=true)
 Evaluates a parametric attribute (param.decl.ref/param.expr) based on a set of provided parameter values. More...
 
bool isParametricType (mlir::Type t)
 Returns true if any part of t is parametric. More...
 
void populateHWModuleLikeTypeConversionPattern (StringRef moduleLikeOpName, RewritePatternSet &patterns, TypeConverter &converter)
 
LogicalResult verifyInnerSymAttr (InnerSymbolOpInterface op)
 Verification hook for verifying InnerSym Attribute. More...
 
ModulePort::Direction flip (ModulePort::Direction direction)
 Flip a port direction. More...
 
bool isAnyModuleOrInstance (Operation *module)
 TODO: Move all these functions to a hw::ModuleLike interface. More...
 
FunctionType getModuleType (Operation *module)
 Return the signature for the specified module as a function type. More...
 
StringAttr getVerilogModuleNameAttr (Operation *module)
 Returns the verilog module name attribute or symbol name of any module-like operations. More...
 
StringRef getVerilogModuleName (Operation *module)
 
bool isValidIndexBitWidth (Value index, Value array)
 
bool isCombinational (Operation *op)
 Return true if the specified operation is a combinational logic op. More...
 
bool isValidParameterExpression (Attribute attr, Operation *module)
 Return true if the specified attribute tree is made up of nodes that are valid in a parameter expression. More...
 
LogicalResult checkParameterInContext (Attribute value, Operation *module, Operation *usingOp, bool disallowParamRefs=false)
 Check parameter specified by value to see if it is valid within the scope of the specified module module. More...
 
LogicalResult checkParameterInContext (Attribute value, ArrayAttr moduleParameters, const std::function< void(std::function< bool(InFlightDiagnostic &)>)> &instanceError, bool disallowParamRefs=false)
 Check parameter specified by value to see if it is valid according to the module's parameters. More...
 
bool isOffset (Value base, Value index, uint64_t offset)
 
std::unique_ptr< mlir::Pass > createPrintInstanceGraphPass ()
 
std::unique_ptr< mlir::Pass > createHWSpecializePass ()
 
std::unique_ptr< mlir::Pass > createPrintHWModuleGraphPass ()
 
std::unique_ptr< mlir::Pass > createFlattenIOPass (bool recursiveFlag=true, bool flattenExternFlag=false, char joinChar='.')
 
std::unique_ptr< mlir::Pass > createVerifyInnerRefNamespacePass ()
 
std::unique_ptr< mlir::Pass > createFlattenModulesPass ()
 
std::unique_ptr< mlir::Pass > createFooWiresPass ()
 
void registerReducePatternDialectInterface (mlir::DialectRegistry &registry)
 Register the HW Reduction pattern dialect interface to the given registry. More...
 
static bool operator== (const ModulePort &a, const ModulePort &b)
 
static llvm::hash_code hash_value (const ModulePort &port)
 
mlir::Type getCanonicalType (mlir::Type type)
 
bool isHWIntegerType (mlir::Type type)
 Return true if the specified type is a value HW Integer type. More...
 
bool isHWEnumType (mlir::Type type)
 Return true if the specified type is a HW Enum type. More...
 
bool isHWValueType (mlir::Type 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...
 
int64_t getBitWidth (mlir::Type type)
 Return the hardware bit width of a type. More...
 
bool hasHWInOutType (mlir::Type type)
 Return true if the specified type contains known marker types like InOutType. More...
 
template<typename... BaseTy>
bool type_isa (Type type)
 
template<typename... BaseTy>
bool type_isa_and_nonnull (Type type)
 
template<typename BaseTy >
BaseTy type_cast (Type type)
 
template<typename BaseTy >
BaseTy type_dyn_cast (Type type)
 
template<typename OS >
OS & operator<< (OS &os, const InnerSymTarget &target)
 Printing InnerSymTarget's. More...
 
raw_ostream & operator<< (raw_ostream &printer, PortInfo port)
 

Typedef Documentation

◆ HWModuleBuilder

using circt::hw::HWModuleBuilder = typedef llvm::function_ref<void(OpBuilder &, HWModulePortAccessor &)>

Definition at line 122 of file HWOps.h.

Function Documentation

◆ checkParameterInContext() [1/2]

LogicalResult circt::hw::checkParameterInContext ( Attribute  value,
ArrayAttr  moduleParameters,
const std::function< void(std::function< bool(InFlightDiagnostic &)>)> &  instanceError,
bool  disallowParamRefs = false 
)

Check parameter specified by value to see if it is valid according to the module's parameters.

If not, emit an error to the diagnostic provided as an argument to the lambda 'instanceError' and return failure, otherwise return success.

If disallowParamRefs is true, then parameter references are not allowed.

Definition at line 128 of file HWOps.cpp.

References checkParameterInContext().

◆ checkParameterInContext() [2/2]

LogicalResult circt::hw::checkParameterInContext ( Attribute  value,
Operation *  module,
Operation *  usingOp,
bool  disallowParamRefs = false 
)

Check parameter specified by value to see if it is valid within the scope of the specified module module.

If not, emit an error at the location of usingOp and return failure, otherwise return success.

If disallowParamRefs is true, then parameter references are not allowed.

If not, emit an error at the location of usingOp and return failure, otherwise return success. If usingOp is null, then no diagnostic is generated.

If disallowParamRefs is true, then parameter references are not allowed.

Definition at line 202 of file HWOps.cpp.

Referenced by checkParameterInContext(), isValidParameterExpression(), verifyModuleCommon(), and circt::hw::instance_like_impl::verifyParameterStructure().

◆ createFlattenIOPass()

std::unique_ptr< Pass > circt::hw::createFlattenIOPass ( bool  recursiveFlag = true,
bool  flattenExternFlag = false,
char  joinChar = '.' 
)

Definition at line 528 of file FlattenIO.cpp.

◆ createFlattenModulesPass()

std::unique_ptr< Pass > circt::hw::createFlattenModulesPass ( )

Definition at line 146 of file FlattenModules.cpp.

Referenced by circt::firtool::populateHWToBTOR2().

◆ createFooWiresPass()

std::unique_ptr< mlir::Pass > circt::hw::createFooWiresPass ( )

Definition at line 42 of file FooWires.cpp.

◆ createHWSpecializePass()

std::unique_ptr< Pass > circt::hw::createHWSpecializePass ( )

Definition at line 438 of file HWSpecialize.cpp.

◆ createPrintHWModuleGraphPass()

std::unique_ptr< mlir::Pass > circt::hw::createPrintHWModuleGraphPass ( )

Definition at line 48 of file PrintHWModuleGraph.cpp.

◆ createPrintInstanceGraphPass()

std::unique_ptr< mlir::Pass > circt::hw::createPrintInstanceGraphPass ( )

Definition at line 42 of file HWPrintInstanceGraph.cpp.

◆ createVerifyInnerRefNamespacePass()

std::unique_ptr< mlir::Pass > circt::hw::createVerifyInnerRefNamespacePass ( )

◆ evaluateParametricAttr()

mlir::FailureOr<mlir::TypedAttr> circt::hw::evaluateParametricAttr ( mlir::Location  loc,
mlir::ArrayAttr  parameters,
mlir::Attribute  paramAttr,
bool  emitErrors = true 
)

Evaluates a parametric attribute (param.decl.ref/param.expr) based on a set of provided parameter values.

◆ evaluateParametricType()

enum PEO uint32_t mlir::FailureOr<mlir::Type> circt::hw::evaluateParametricType ( mlir::Location  loc,
mlir::ArrayAttr  parameters,
mlir::Type  type,
bool  emitErrors = true 
)
strong

Returns a resolved version of 'type' wherein any parameter reference has been evaluated based on the set of provided 'parameters'.

Referenced by circt::hw::instance_like_impl::resolveParametricTypes(), and verifyPrimitiveOpType().

◆ flip()

ModulePort::Direction circt::hw::flip ( ModulePort::Direction  direction)

Flip a port direction.

Definition at line 36 of file HWOps.cpp.

References InOut, Input, and Output.

◆ getBitWidth()

int64_t circt::hw::getBitWidth ( mlir::Type  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 109 of file HWTypes.cpp.

Referenced by llvm::DOTGraphTraits< circt::hw::HWModuleOp >::getEdgeAttributes(), circt::esi::detail::getWidth(), hwGetBitWidth(), and circt::ExportVerilog::isZeroBitType().

◆ getCanonicalType()

mlir::Type circt::hw::getCanonicalType ( mlir::Type  type)

◆ getModuleType()

FunctionType circt::hw::getModuleType ( Operation *  module)

Return the signature for the specified module as a function type.

Return the signature for a module as a function type from the module itself or from an hw::InstanceOp.

Definition at line 515 of file HWOps.cpp.

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

Referenced by circt::hw::instance_like_impl::getPortList(), and circt::hw::instance_like_impl::verifyInstanceOfHWModule().

◆ getVerilogModuleName()

StringRef circt::hw::getVerilogModuleName ( Operation *  module)
inline

Definition at line 54 of file HWOps.h.

References getVerilogModuleNameAttr().

◆ getVerilogModuleNameAttr()

StringAttr circt::hw::getVerilogModuleNameAttr ( Operation *  module)

Returns the verilog module name attribute or symbol name of any module-like operations.

Return the name to use for the Verilog module that we're referencing here.

This is typically the symbol, but can be overridden with the verilogName attribute.

Definition at line 533 of file HWOps.cpp.

Referenced by createModuleForCut(), circt::ExportVerilog::getSymOpName(), getVerilogModuleName(), and circt::ExportVerilog::GlobalNameResolver::GlobalNameResolver().

◆ hash_value()

static llvm::hash_code circt::hw::hash_value ( const ModulePort port)
static

◆ hasHWInOutType()

bool circt::hw::hasHWInOutType ( mlir::Type  type)

Return true if the specified type contains known marker types like InOutType.

Unlike isHWValueType, this is not conservative, it only returns false on known InOut types, rather than any unknown types.

◆ isAnyModuleOrInstance()

bool circt::hw::isAnyModuleOrInstance ( Operation *  module)

TODO: Move all these functions to a hw::ModuleLike interface.

Return true if isAnyModule or instance.

Definition at line 509 of file HWOps.cpp.

◆ isCombinational()

bool circt::hw::isCombinational ( Operation *  op)

Return true if the specified operation is a combinational logic op.

Definition at line 59 of file HWOps.cpp.

References circt::hw::TypeOpVisitor< ConcreteType, ResultType, ExtraArgs >::dispatchTypeOpVisitor().

◆ isHWEnumType()

bool circt::hw::isHWEnumType ( mlir::Type  type)

Return true if the specified type is a HW Enum type.

Definition at line 72 of file HWTypes.cpp.

References getCanonicalType().

◆ isHWIntegerType()

bool circt::hw::isHWIntegerType ( mlir::Type  type)

Return true if the specified type is a value HW Integer type.

This checks that it is a signless standard dialect type.

This checks that it is a signless standard dialect type or a hw::IntType.

Definition at line 59 of file HWTypes.cpp.

References getCanonicalType().

Referenced by circt::seq::isClockOrI1Type(), simplifyCLog2(), simplifyDivS(), simplifyDivU(), simplifyModS(), simplifyModU(), simplifyShl(), simplifyShrS(), and simplifyShrU().

◆ isHWValueType()

bool circt::hw::isHWValueType ( mlir::Type  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.

Referenced by hwTypeIsAValueType().

◆ isOffset()

bool circt::hw::isOffset ( Value  base,
Value  index,
uint64_t  offset 
)

Definition at line 1828 of file HWOps.cpp.

References assert().

Referenced by foldCreateToSlice(), mergeConcatSlices(), and mergeNeiboringAssignments().

◆ isParametricType()

bool circt::hw::isParametricType ( mlir::Type  t)

Returns true if any part of t is parametric.

Definition at line 1076 of file HWAttributes.cpp.

◆ isValidIndexBitWidth()

bool circt::hw::isValidIndexBitWidth ( Value  index,
Value  array 
)

Definition at line 48 of file HWOps.cpp.

References assert(), and getCanonicalType().

◆ isValidParameterExpression()

bool circt::hw::isValidParameterExpression ( Attribute  attr,
Operation *  module 
)

Return true if the specified attribute tree is made up of nodes that are valid in a parameter expression.

Definition at line 221 of file HWOps.cpp.

References checkParameterInContext().

◆ operator<<() [1/2]

template<typename OS >
OS& circt::hw::operator<< ( OS &  os,
const InnerSymTarget target 
)

◆ operator<<() [2/2]

raw_ostream & circt::hw::operator<< ( raw_ostream &  printer,
PortInfo  port 
)

◆ operator==()

static bool circt::hw::operator== ( const ModulePort a,
const ModulePort b 
)
static

◆ populateHWModuleLikeTypeConversionPattern()

void circt::hw::populateHWModuleLikeTypeConversionPattern ( StringRef  moduleLikeOpName,
RewritePatternSet &  patterns,
TypeConverter &  converter 
)

Definition at line 85 of file HWModuleOpInterface.cpp.

Referenced by addSignatureConversion(), and populateOpConversion().

◆ registerReducePatternDialectInterface()

void circt::hw::registerReducePatternDialectInterface ( mlir::DialectRegistry &  registry)

Register the HW Reduction pattern dialect interface to the given registry.

Definition at line 156 of file HWReductions.cpp.

◆ type_cast()

template<typename BaseTy >
BaseTy circt::hw::type_cast ( Type  type)

Definition at line 162 of file HWTypes.h.

References assert().

◆ type_dyn_cast()

template<typename BaseTy >
BaseTy circt::hw::type_dyn_cast ( Type  type)

Definition at line 174 of file HWTypes.h.

◆ type_isa()

template<typename... BaseTy>
bool circt::hw::type_isa ( Type  type)

Definition at line 141 of file HWTypes.h.

Referenced by circt::hw::TypeVariant< Types >::classof(), and type_isa_and_nonnull().

◆ type_isa_and_nonnull()

template<typename... BaseTy>
bool circt::hw::type_isa_and_nonnull ( Type  type)

Definition at line 155 of file HWTypes.h.

References type_isa().

◆ verifyInnerSymAttr()

LogicalResult circt::hw::verifyInnerSymAttr ( InnerSymbolOpInterface  op)

Verification hook for verifying InnerSym Attribute.

Definition at line 53 of file HWOpInterfaces.cpp.

References circt::hw::FieldIdImpl::getMaxFieldID().