CIRCT  18.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  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
 
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
 

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)
 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)
 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)
 
raw_ostream & operator<< (raw_ostream &printer, PortInfo port)
 
LogicalResult verifyInnerSymAttr (InnerSymbolOpInterface op)
 Verification hook for verifying InnerSym Attribute. More...
 
ModulePort::Direction flip (ModulePort::Direction direction)
 Flip a port direction. More...
 
void modifyModulePorts (Operation *op, ArrayRef< std::pair< unsigned, PortInfo >> insertInputs, ArrayRef< std::pair< unsigned, PortInfo >> insertOutputs, ArrayRef< unsigned > removeInputs, ArrayRef< unsigned > removeOutputs, Block *body=nullptr)
 TODO: Move all these functions to a hw::ModuleLike interface. More...
 
bool isAnyModuleOrInstance (Operation *module)
 Return true if isAnyModule or instance. 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 ()
 
std::unique_ptr< mlir::Pass > createVerifyInnerRefNamespacePass ()
 
void registerReducePatternDialectInterface (mlir::DialectRegistry &registry)
 Register the HW Reduction pattern dialect interface to the given registry. More...
 
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...
 
static bool operator== (const ModulePort &a, const ModulePort &b)
 
static llvm::hash_code hash_value (const ModulePort &port)
 

Typedef Documentation

◆ HWModuleBuilder

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

Definition at line 132 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 130 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 204 of file HWOps.cpp.

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

◆ createFlattenIOPass()

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

Definition at line 433 of file FlattenIO.cpp.

◆ createHWSpecializePass()

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

Definition at line 430 of file HWSpecialize.cpp.

◆ createPrintHWModuleGraphPass()

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

Definition at line 40 of file PrintHWModuleGraph.cpp.

References lec::errs().

◆ createPrintInstanceGraphPass()

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

Definition at line 34 of file HWPrintInstanceGraph.cpp.

References lec::errs().

◆ 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 
)

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 
)
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 35 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 100 of file HWTypes.cpp.

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

◆ 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 505 of file HWOps.cpp.

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

Referenced by circt::hw::instance_like_impl::verifyInstanceOfHWModule().

◆ getVerilogModuleName()

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

◆ 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 526 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

Definition at line 993 of file HWTypes.cpp.

◆ 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)

Return true if isAnyModule or instance.

Definition at line 499 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 58 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 63 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 50 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 1785 of file HWOps.cpp.

References assert(), and bits().

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 1070 of file HWAttributes.cpp.

◆ isValidIndexBitWidth()

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

Definition at line 47 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 223 of file HWOps.cpp.

References checkParameterInContext().

◆ modifyModulePorts()

void circt::hw::modifyModulePorts ( Operation *  op,
ArrayRef< std::pair< unsigned, PortInfo >>  insertInputs,
ArrayRef< std::pair< unsigned, PortInfo >>  insertOutputs,
ArrayRef< unsigned >  removeInputs,
ArrayRef< unsigned >  removeOutputs,
Block *  body = nullptr 
)

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

Insert and remove ports of a module.

Insert and remove ports of a module. The insertion and removal indices must be in ascending order. The indices refer to the port positions before any insertion or removal occurs. Ports inserted at the same index will appear in the module in the same order as they were listed in the insert* array. If 'body' is provided, additionally inserts/removes the corresponding block arguments.

The insertion and removal indices must be in ascending order. The indices refer to the port positions before any insertion or removal occurs. Ports inserted at the same index will appear in the module in the same order as they were listed in the insert* array.

The operation must be any of the module-like operations.

Definition at line 696 of file HWOps.cpp.

References circt::hw::detail::fnToMod(), circt::calyx::direction::get(), and modifyModuleArgs().

◆ 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

Definition at line 990 of file HWTypes.cpp.

◆ populateHWModuleLikeTypeConversionPattern()

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

Definition at line 85 of file HWModuleOpInterface.cpp.

Referenced by addSignatureConversion().

◆ registerReducePatternDialectInterface()

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

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

Definition at line 152 of file HWReductions.cpp.

◆ type_cast()

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

Definition at line 118 of file HWTypes.h.

References assert().

◆ type_dyn_cast()

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

Definition at line 130 of file HWTypes.h.

◆ type_isa()

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

Definition at line 97 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 111 of file HWTypes.h.

References type_isa().

◆ verifyInnerSymAttr()

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

Verification hook for verifying InnerSym Attribute.

Definition at line 25 of file HWOpInterfaces.cpp.

References getMaxFieldID().