CIRCT  19.0.0git
Typedefs | Functions
circt::hw::instance_like_impl Namespace Reference

Typedefs

using EmitErrorFn = std::function< void(std::function< bool(InFlightDiagnostic &)>)>
 Whenever the nested function returns true, a note referring to the referenced module is attached to the error. More...
 

Functions

LogicalResult verifyReferencedModule (Operation *instanceOp, SymbolTableCollection &symbolTable, mlir::FlatSymbolRefAttr moduleName, Operation *&module)
 Verify that the instance refers to a valid HW module. More...
 
LogicalResult resolveParametricTypes (Location loc, ArrayAttr parameters, ArrayRef< Type > types, SmallVectorImpl< Type > &resolvedTypes, const EmitErrorFn &emitError)
 Stores a resolved version of each type in. More...
 
LogicalResult verifyInputs (ArrayAttr argNames, ArrayAttr moduleArgNames, TypeRange inputTypes, ArrayRef< Type > moduleInputTypes, const EmitErrorFn &emitError)
 Verify that the list of inputs of the instance and the module match in terms of length, names, and types. More...
 
LogicalResult verifyOutputs (ArrayAttr resultNames, ArrayAttr moduleResultNames, TypeRange resultTypes, ArrayRef< Type > moduleResultTypes, const EmitErrorFn &emitError)
 Verify that the list of outputs of the instance and the module match in terms of length, names, and types. More...
 
LogicalResult verifyParameters (ArrayAttr parameters, ArrayAttr moduleParameters, const EmitErrorFn &emitError)
 Verify that the parameter lists of the instance and the module match in terms of length, names, and types. More...
 
LogicalResult verifyInstanceOfHWModule (Operation *instance, FlatSymbolRefAttr moduleRef, OperandRange inputs, TypeRange results, ArrayAttr argNames, ArrayAttr resultNames, ArrayAttr parameters, SymbolTableCollection &symbolTable)
 Combines verifyReferencedModule, verifyInputs, verifyOutputs, and verifyParameters. More...
 
LogicalResult verifyParameterStructure (ArrayAttr parameters, ArrayAttr moduleParameters, const EmitErrorFn &emitError)
 Check that all the parameter values specified to the instance are structurally valid. More...
 
StringAttr getName (ArrayAttr names, size_t idx)
 Return the name at the specified index of the ArrayAttr or null if it cannot be determined. More...
 
ArrayAttr updateName (ArrayAttr oldNames, size_t i, StringAttr name)
 Change the name at the specified index of the. More...
 
void getAsmResultNames (OpAsmSetValueNameFn setNameFn, StringRef instanceName, ArrayAttr resultNames, ValueRange results)
 Suggest a name for each result value based on the saved result names attribute. More...
 
SmallVector< PortInfogetPortList (Operation *instanceOp)
 Return the port list of an instance, based on the name, type and location attributes present on the instance. More...
 

Typedef Documentation

◆ EmitErrorFn

using circt::hw::instance_like_impl::EmitErrorFn = typedef std::function<void(std::function<bool(InFlightDiagnostic &)>)>

Whenever the nested function returns true, a note referring to the referenced module is attached to the error.

Definition at line 31 of file HWInstanceImplementation.h.

Function Documentation

◆ getAsmResultNames()

void circt::hw::instance_like_impl::getAsmResultNames ( OpAsmSetValueNameFn  setNameFn,
StringRef  instanceName,
ArrayAttr  resultNames,
ValueRange  results 
)

Suggest a name for each result value based on the saved result names attribute.

Definition at line 324 of file HWInstanceImplementation.cpp.

References getName().

◆ getName()

StringAttr circt::hw::instance_like_impl::getName ( ArrayAttr  names,
size_t  idx 
)

◆ getPortList()

SmallVector< PortInfo > circt::hw::instance_like_impl::getPortList ( Operation *  instanceOp)

Return the port list of an instance, based on the name, type and location attributes present on the instance.

Definition at line 343 of file HWInstanceImplementation.cpp.

References circt::calyx::direction::get(), circt::hw::getModuleType(), InOut, Input, and Output.

◆ resolveParametricTypes()

LogicalResult circt::hw::instance_like_impl::resolveParametricTypes ( Location  loc,
ArrayAttr  parameters,
ArrayRef< Type >  types,
SmallVectorImpl< Type > &  resolvedTypes,
const EmitErrorFn emitError 
)

Stores a resolved version of each type in.

Parameters
typeswherein any parameter reference has been evaluated based on the set of provided
parametersin
resolvedTypes

Definition at line 32 of file HWInstanceImplementation.cpp.

References circt::hw::evaluateParametricType().

Referenced by verifyInstanceOfHWModule().

◆ updateName()

ArrayAttr circt::hw::instance_like_impl::updateName ( ArrayAttr  oldNames,
size_t  i,
StringAttr  name 
)

Change the name at the specified index of the.

Parameters
oldNamesArrayAttr to
name

Definition at line 315 of file HWInstanceImplementation.cpp.

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

◆ verifyInputs()

LogicalResult circt::hw::instance_like_impl::verifyInputs ( ArrayAttr  argNames,
ArrayAttr  moduleArgNames,
TypeRange  inputTypes,
ArrayRef< Type >  moduleInputTypes,
const EmitErrorFn emitError 
)

Verify that the list of inputs of the instance and the module match in terms of length, names, and types.

Definition at line 51 of file HWInstanceImplementation.cpp.

Referenced by verifyInstanceOfHWModule().

◆ verifyInstanceOfHWModule()

LogicalResult circt::hw::instance_like_impl::verifyInstanceOfHWModule ( Operation *  instance,
FlatSymbolRefAttr  moduleRef,
OperandRange  inputs,
TypeRange  results,
ArrayAttr  argNames,
ArrayAttr  resultNames,
ArrayAttr  parameters,
SymbolTableCollection &  symbolTable 
)

Combines verifyReferencedModule, verifyInputs, verifyOutputs, and verifyParameters.

It is only allowed to call this function when the instance refers to a HW module. The

Parameters
parametersattribute may be null in which case not parameters are verified.

Definition at line 201 of file HWInstanceImplementation.cpp.

References circt::calyx::direction::get(), circt::hw::getModuleType(), inputs, resolveParametricTypes(), verifyInputs(), verifyOutputs(), verifyParameters(), and verifyReferencedModule().

◆ verifyOutputs()

LogicalResult circt::hw::instance_like_impl::verifyOutputs ( ArrayAttr  resultNames,
ArrayAttr  moduleResultNames,
TypeRange  resultTypes,
ArrayRef< Type >  moduleResultTypes,
const EmitErrorFn emitError 
)

Verify that the list of outputs of the instance and the module match in terms of length, names, and types.

Definition at line 101 of file HWInstanceImplementation.cpp.

Referenced by verifyInstanceOfHWModule().

◆ verifyParameters()

LogicalResult circt::hw::instance_like_impl::verifyParameters ( ArrayAttr  parameters,
ArrayAttr  moduleParameters,
const EmitErrorFn emitError 
)

Verify that the parameter lists of the instance and the module match in terms of length, names, and types.

Definition at line 150 of file HWInstanceImplementation.cpp.

Referenced by verifyInstanceOfHWModule().

◆ verifyParameterStructure()

LogicalResult circt::hw::instance_like_impl::verifyParameterStructure ( ArrayAttr  parameters,
ArrayAttr  moduleParameters,
const EmitErrorFn emitError 
)

Check that all the parameter values specified to the instance are structurally valid.

Definition at line 270 of file HWInstanceImplementation.cpp.

References circt::hw::checkParameterInContext().

◆ verifyReferencedModule()

LogicalResult circt::hw::instance_like_impl::verifyReferencedModule ( Operation *  instanceOp,
SymbolTableCollection &  symbolTable,
mlir::FlatSymbolRefAttr  moduleName,
Operation *&  module 
)

Verify that the instance refers to a valid HW module.

Definition at line 16 of file HWInstanceImplementation.cpp.

Referenced by verifyInstanceOfHWModule().