CIRCT 24.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
circt::hw::PortConverterImpl Class Reference

#include <PortConverter.h>

Inheritance diagram for circt::hw::PortConverterImpl:
Inheritance graph
[legend]
Collaboration diagram for circt::hw::PortConverterImpl:
Collaboration graph
[legend]

Public Member Functions

LogicalResult run ()
 Run port conversion.
 
Block * getBody () const
 
hw::HWMutableModuleLike getModule () const
 
Value createNewInput (hw::PortInfo origPort, const Twine &suffix, Type type, hw::PortInfo &newPort, PortAttrPolicy attrPolicy=PortAttrPolicy::Drop)
 These two methods take care of allocating new ports in the correct place based on the position of 'origPort'.
 
void createNewOutput (hw::PortInfo origPort, const Twine &suffix, Type type, Value output, hw::PortInfo &newPort, PortAttrPolicy attrPolicy=PortAttrPolicy::Drop)
 Same as above.
 

Protected Member Functions

 PortConverterImpl (igraph::InstanceGraphNode *moduleNode)
 

Protected Attributes

std::unique_ptr< PortConversionBuilderssb
 

Private Member Functions

void updateInstance (hw::InstanceOp)
 Updates an instance of the module.
 

Private Attributes

Block * body = nullptr
 
igraph::InstanceGraphNodemoduleNode
 
hw::HWMutableModuleLike mod
 
OpBuilder b
 
SmallVector< std::unique_ptr< PortConversion > > loweredInputs
 
SmallVector< std::unique_ptr< PortConversion > > loweredOutputs
 
SmallVector< std::pair< unsigned, hw::PortInfo >, 0 > newInputs
 
SmallVector< std::pair< unsigned, hw::PortInfo >, 0 > newOutputs
 
Operation * terminator = nullptr
 

Detailed Description

Definition at line 40 of file PortConverter.h.

Constructor & Destructor Documentation

◆ PortConverterImpl()

PortConverterImpl::PortConverterImpl ( igraph::InstanceGraphNode moduleNode)
protected

Member Function Documentation

◆ createNewInput()

Value PortConverterImpl::createNewInput ( hw::PortInfo  origPort,
const Twine &  suffix,
Type  type,
hw::PortInfo newPort,
PortAttrPolicy  attrPolicy = PortAttrPolicy::Drop 
)

These two methods take care of allocating new ports in the correct place based on the position of 'origPort'.

The new port is based on the original name and suffix. The specification for the new port is given by newPort and is recorded internally. attrPolicy controls whether the new port inherits the original port's attributes. Any changes to 'newPort' after calling this will not be reflected in the modules new port list. Will also add the new input to the block arguments of the body of the module.

Definition at line 87 of file PortConverter.cpp.

References append(), circt::hw::PortInfo::attrs, body, circt::hw::ModulePort::Input, circt::hw::PortInfo::loc, circt::hw::ModulePort::name, newInputs, and circt::hw::Preserve.

◆ createNewOutput()

void PortConverterImpl::createNewOutput ( hw::PortInfo  origPort,
const Twine &  suffix,
Type  type,
Value  output,
hw::PortInfo newPort,
PortAttrPolicy  attrPolicy = PortAttrPolicy::Drop 
)

Same as above.

'output' is the value fed into the new port and is required if 'body' is non-null. Important note: cannot be a backedge which gets replaced since this isn't attached to an op until later in the pass.

Definition at line 105 of file PortConverter.cpp.

References append(), circt::hw::PortInfo::attrs, b, body, circt::hw::PortInfo::loc, circt::hw::ModulePort::name, newOutputs, circt::hw::ModulePort::Output, circt::hw::Preserve, and terminator.

◆ getBody()

Block * circt::hw::PortConverterImpl::getBody ( ) const
inline

Definition at line 44 of file PortConverter.h.

References body.

◆ getModule()

hw::HWMutableModuleLike circt::hw::PortConverterImpl::getModule ( ) const
inline

Definition at line 45 of file PortConverter.h.

References mod.

Referenced by circt::hw::PortConversion::getModule().

◆ run()

LogicalResult PortConverterImpl::run ( )

◆ updateInstance()

void PortConverterImpl::updateInstance ( hw::InstanceOp  inst)
private

Updates an instance of the module.

This is called after the module has been updated. It will update the instance to match the new port

Definition at line 213 of file PortConverter.cpp.

References assert(), b, circt::BackedgeBuilder::get(), circt::hw::ModulePortInfo::getOutputs(), loweredInputs, loweredOutputs, mod, and circt::hw::ModulePortInfo::sizeInputs().

Referenced by run().

Member Data Documentation

◆ b

OpBuilder circt::hw::PortConverterImpl::b
private

Definition at line 80 of file PortConverter.h.

Referenced by createNewOutput(), and updateInstance().

◆ body

Block* circt::hw::PortConverterImpl::body = nullptr
private

◆ loweredInputs

SmallVector<std::unique_ptr<PortConversion> > circt::hw::PortConverterImpl::loweredInputs
private

Definition at line 85 of file PortConverter.h.

Referenced by run(), and updateInstance().

◆ loweredOutputs

SmallVector<std::unique_ptr<PortConversion> > circt::hw::PortConverterImpl::loweredOutputs
private

Definition at line 86 of file PortConverter.h.

Referenced by run(), and updateInstance().

◆ mod

hw::HWMutableModuleLike circt::hw::PortConverterImpl::mod
private

Definition at line 79 of file PortConverter.h.

Referenced by getModule(), PortConverterImpl(), run(), and updateInstance().

◆ moduleNode

igraph::InstanceGraphNode* circt::hw::PortConverterImpl::moduleNode
private

Definition at line 78 of file PortConverter.h.

Referenced by PortConverterImpl(), and run().

◆ newInputs

SmallVector<std::pair<unsigned, hw::PortInfo>, 0> circt::hw::PortConverterImpl::newInputs
private

Definition at line 92 of file PortConverter.h.

Referenced by createNewInput(), and run().

◆ newOutputs

SmallVector<std::pair<unsigned, hw::PortInfo>, 0> circt::hw::PortConverterImpl::newOutputs
private

Definition at line 93 of file PortConverter.h.

Referenced by createNewOutput(), and run().

◆ ssb

std::unique_ptr<PortConversionBuilder> circt::hw::PortConverterImpl::ssb
protected

◆ terminator

Operation* circt::hw::PortConverterImpl::terminator = nullptr
private

Definition at line 98 of file PortConverter.h.

Referenced by createNewOutput(), PortConverterImpl(), and run().


The documentation for this class was generated from the following files: