CIRCT  19.0.0git
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. More...
 
Block * getBody () const
 
hw::HWMutableModuleLike getModule () const
 
Value createNewInput (hw::PortInfo origPort, const Twine &suffix, Type type, hw::PortInfo &newPort)
 These two methods take care of allocating new ports in the correct place based on the position of 'origPort'. More...
 
void createNewOutput (hw::PortInfo origPort, const Twine &suffix, Type type, Value output, hw::PortInfo &newPort)
 Same as above. More...
 

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. More...
 

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

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. 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 86 of file PortConverter.cpp.

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

◆ createNewOutput()

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

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 100 of file PortConverter.cpp.

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

◆ getBody()

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

Definition at line 40 of file PortConverter.h.

References body.

◆ getModule()

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

Definition at line 41 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 204 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 73 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 78 of file PortConverter.h.

Referenced by run(), and updateInstance().

◆ loweredOutputs

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

Definition at line 79 of file PortConverter.h.

Referenced by run(), and updateInstance().

◆ mod

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

Definition at line 72 of file PortConverter.h.

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

◆ moduleNode

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

Definition at line 71 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 85 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 86 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 91 of file PortConverter.h.

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


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