OpenASIP  2.0
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ProGe::NetlistPortGroup Class Reference

#include <NetlistPortGroup.hh>

Inheritance diagram for ProGe::NetlistPortGroup:
Inheritance graph
Collaboration diagram for ProGe::NetlistPortGroup:
Collaboration graph

Public Types

typedef std::vector< NetlistPort * > PortContainerType
 
typedef PortContainerType::iterator iterator
 
typedef PortContainerType::const_iterator const_iterator
 
typedef PortContainerType::reverse_iterator reverse_iterator
 
typedef PortContainerType::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 NetlistPortGroup (SignalGroup signalGroup=SignalGroup())
 
template<typename... PortType>
 NetlistPortGroup (SignalGroup groupType, PortType... ts)
 
virtual ~NetlistPortGroup ()
 
size_t portCount () const
 
const NetlistPortportAt (size_t index) const
 
NetlistPortportAt (size_t index)
 
void addPort (NetlistPort &port)
 
bool hasPortBySignal (SignalType type) const
 
const NetlistPortportBySignal (SignalType type) const
 
void clear ()
 
bool hasParent () const
 
const BaseNetlistBlockparent () const
 
BaseNetlistBlockparent ()
 
void assignSignalGroup (SignalGroup signalGroup)
 
SignalGroup assignedSignalGroup () const
 
virtual NetlistPortGroupclone (bool asMirrored=false) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 

Protected Member Functions

 NetlistPortGroup (const NetlistPortGroup &, bool asMirrored=false)
 

Private Member Functions

 NetlistPortGroup ()
 
NetlistPortGroupoperator= (const NetlistPortGroup &)
 
void setParent (BaseNetlistBlock *newParent)
 

Private Attributes

BaseNetlistBlockparent_
 The parent block where the group belongs to. More...
 
PortContainerType ports_
 The ports belonging to this group by reference. More...
 
SignalGroup signalGroup_
 The usage/implemented interface of the group. More...
 

Friends

class BaseNetlistBlock
 

Detailed Description

Definition at line 53 of file NetlistPortGroup.hh.

Member Typedef Documentation

◆ const_iterator

typedef PortContainerType::const_iterator ProGe::NetlistPortGroup::const_iterator

Definition at line 86 of file NetlistPortGroup.hh.

◆ const_reverse_iterator

typedef PortContainerType::const_reverse_iterator ProGe::NetlistPortGroup::const_reverse_iterator

Definition at line 88 of file NetlistPortGroup.hh.

◆ iterator

typedef PortContainerType::iterator ProGe::NetlistPortGroup::iterator

Definition at line 85 of file NetlistPortGroup.hh.

◆ PortContainerType

Definition at line 58 of file NetlistPortGroup.hh.

◆ reverse_iterator

typedef PortContainerType::reverse_iterator ProGe::NetlistPortGroup::reverse_iterator

Definition at line 87 of file NetlistPortGroup.hh.

Constructor & Destructor Documentation

◆ NetlistPortGroup() [1/4]

ProGe::NetlistPortGroup::NetlistPortGroup ( SignalGroup  signalGroup = SignalGroup())

Constructs empty port group with given SignalGroup.

Definition at line 65 of file NetlistPortGroup.cc.

66  : parent_(nullptr), ports_(), signalGroup_(signalGroup) {}

◆ NetlistPortGroup() [2/4]

template<typename... PortType>
ProGe::NetlistPortGroup::NetlistPortGroup ( SignalGroup  groupType,
PortType...  ts 
)

◆ ~NetlistPortGroup()

ProGe::NetlistPortGroup::~NetlistPortGroup ( )
virtual

Definition at line 68 of file NetlistPortGroup.cc.

68  {
69  if (!hasParent()) {
71  }
72 }

References SequenceTools::deleteAllItems(), hasParent(), and ports_.

Here is the call graph for this function:

◆ NetlistPortGroup() [3/4]

ProGe::NetlistPortGroup::NetlistPortGroup ( const NetlistPortGroup other,
bool  asMirrored = false 
)
protected

Copy constructor. Copies everything except parent block reference.

Definition at line 52 of file NetlistPortGroup.cc.

54  : parent_(nullptr), ports_(), signalGroup_(other.signalGroup_) {
55  std::insert_iterator<PortContainerType> portInserter(
56  ports_, ports_.begin());
57  for (size_t i = 0; i < other.portCount(); i++) {
58  portInserter = other.portAt(i).clone(asMirrored);
59  }
60 }

References ProGe::NetlistPort::clone(), portAt(), portCount(), and ports_.

Here is the call graph for this function:

◆ NetlistPortGroup() [4/4]

ProGe::NetlistPortGroup::NetlistPortGroup ( )
private

Definition at line 46 of file NetlistPortGroup.cc.

47  : parent_(nullptr), ports_(), signalGroup_() {}

Referenced by clone().

Member Function Documentation

◆ addPort()

void ProGe::NetlistPortGroup::addPort ( NetlistPort port)

◆ assignedSignalGroup()

SignalGroup ProGe::NetlistPortGroup::assignedSignalGroup ( ) const

◆ assignSignalGroup()

void ProGe::NetlistPortGroup::assignSignalGroup ( SignalGroup  signalGroup)

Definition at line 155 of file NetlistPortGroup.cc.

155  {
156  signalGroup_ = signalGroup;
157 }

References signalGroup_.

◆ begin() [1/2]

NetlistPortGroup::const_iterator ProGe::NetlistPortGroup::begin ( )

Definition at line 181 of file NetlistPortGroup.cc.

181  {
182  return ports_.begin();
183 }

References ports_.

◆ begin() [2/2]

const_iterator ProGe::NetlistPortGroup::begin ( ) const

◆ clear()

void ProGe::NetlistPortGroup::clear ( )

Clears all ports associated to the port group.

The Ports are deleted and detached from the parent block.

Definition at line 128 of file NetlistPortGroup.cc.

128  {
130 }

References SequenceTools::deleteAllItems(), and ports_.

Referenced by ProGe::NetlistBlock::shallowCopy(), and ProGe::BaseNetlistBlock::shallowCopy().

Here is the call graph for this function:

◆ clone()

NetlistPortGroup * ProGe::NetlistPortGroup::clone ( bool  asMirrored = false) const
virtual

Clones the NetlistPort and and its ports without parent block reference since it would break unique port name constraint.

Reimplemented in ProGe::MemoryBusInterface.

Definition at line 169 of file NetlistPortGroup.cc.

169  {
170  NetlistPortGroup* newGroup = new NetlistPortGroup(*this, asMirrored);
171  assert(this->portCount() == newGroup->portCount());
172  for (size_t i = 0; i < portCount(); i++) {
173  assert(
174  this->portAt(i).assignedSignal().type() ==
175  newGroup->portAt(i).assignedSignal().type());
176  }
177  return newGroup;
178 }

References assert, ProGe::NetlistPort::assignedSignal(), NetlistPortGroup(), portAt(), portCount(), and ProGe::Signal::type().

Referenced by AlmaIFIntegrator::initAlmaifBlock(), ProGe::NetlistBlock::shallowCopy(), and ProGe::BaseNetlistBlock::shallowCopy().

Here is the call graph for this function:

◆ end() [1/2]

NetlistPortGroup::const_iterator ProGe::NetlistPortGroup::end ( )

Definition at line 186 of file NetlistPortGroup.cc.

186  {
187  return ports_.end();
188 }

References ports_.

◆ end() [2/2]

const_iterator ProGe::NetlistPortGroup::end ( ) const

◆ hasParent()

bool ProGe::NetlistPortGroup::hasParent ( ) const

Definition at line 133 of file NetlistPortGroup.cc.

133  {
134  return parent_ != nullptr;
135 }

References parent_.

Referenced by parent(), and ~NetlistPortGroup().

◆ hasPortBySignal()

bool ProGe::NetlistPortGroup::hasPortBySignal ( SignalType  type) const

Definition at line 98 of file NetlistPortGroup.cc.

98  {
99  for (const NetlistPort* p : *this) {
100  if (p->assignedSignal() == type) {
101  return true;
102  }
103  }
104  return false;
105 }

References ProGe::NetlistPort::assignedSignal().

Referenced by ProGe::Netlist::connectBy().

Here is the call graph for this function:

◆ operator=()

NetlistPortGroup& ProGe::NetlistPortGroup::operator= ( const NetlistPortGroup )
private

◆ parent() [1/2]

BaseNetlistBlock& ProGe::NetlistPortGroup::parent ( )

◆ parent() [2/2]

BaseNetlistBlock & ProGe::NetlistPortGroup::parent ( ) const

Definition at line 138 of file NetlistPortGroup.cc.

138  {
139  assert(hasParent());
140  return *parent_;
141 }

References assert, hasParent(), and parent_.

Here is the call graph for this function:

◆ portAt() [1/2]

NetlistPort & ProGe::NetlistPortGroup::portAt ( size_t  index)

Definition at line 88 of file NetlistPortGroup.cc.

88  {
89  return *ports_.at(index);
90 }

References ports_.

◆ portAt() [2/2]

const NetlistPort & ProGe::NetlistPortGroup::portAt ( size_t  index) const

Definition at line 83 of file NetlistPortGroup.cc.

83  {
84  return *ports_.at(index);
85 }

References ports_.

Referenced by ProGe::BaseNetlistBlock::addPortGroup(), clone(), and NetlistPortGroup().

◆ portBySignal()

const NetlistPort & ProGe::NetlistPortGroup::portBySignal ( SignalType  type) const

Returns first found port by given signal type.

Definition at line 111 of file NetlistPortGroup.cc.

111  {
112  for (const NetlistPort* p : *this) {
113  if (p->assignedSignal() == type) {
114  return *p;
115  }
116  }
119  "The port group does not have port by given signal type.");
120 }

References ProGe::NetlistPort::assignedSignal(), and THROW_EXCEPTION.

Referenced by ProGe::ProcessorWrapperBlock::addDataMemory(), ProGe::ProcessorWrapperBlock::addDataMemory2(), ProGe::ProcessorWrapperBlock::addInstructionMemory(), ProGe::Netlist::connect(), and ProGe::Netlist::connectBy().

Here is the call graph for this function:

◆ portCount()

size_t ProGe::NetlistPortGroup::portCount ( ) const

Returns number of ports in the group.

Definition at line 78 of file NetlistPortGroup.cc.

78  {
79  return ports_.size();
80 }

References ports_.

Referenced by ProGe::BaseNetlistBlock::addPortGroup(), clone(), ProGe::Netlist::connect(), ProGe::Netlist::connectGroupByName(), and NetlistPortGroup().

◆ rbegin() [1/2]

NetlistPortGroup::const_reverse_iterator ProGe::NetlistPortGroup::rbegin ( )

Definition at line 201 of file NetlistPortGroup.cc.

201  {
202  return ports_.rbegin();
203 }

References ports_.

◆ rbegin() [2/2]

const_reverse_iterator ProGe::NetlistPortGroup::rbegin ( ) const

◆ rend() [1/2]

NetlistPortGroup::const_reverse_iterator ProGe::NetlistPortGroup::rend ( )

Definition at line 206 of file NetlistPortGroup.cc.

206  {
207  return ports_.rend();
208 }

References ports_.

◆ rend() [2/2]

const_reverse_iterator ProGe::NetlistPortGroup::rend ( ) const

◆ setParent()

void ProGe::NetlistPortGroup::setParent ( BaseNetlistBlock newParent)
private

Definition at line 150 of file NetlistPortGroup.cc.

150  {
151  parent_ = newParent;
152 }

References parent_.

Referenced by ProGe::BaseNetlistBlock::addPortGroup().

Friends And Related Function Documentation

◆ BaseNetlistBlock

friend class BaseNetlistBlock
friend

Definition at line 56 of file NetlistPortGroup.hh.

Member Data Documentation

◆ parent_

BaseNetlistBlock* ProGe::NetlistPortGroup::parent_
private

The parent block where the group belongs to.

Definition at line 110 of file NetlistPortGroup.hh.

Referenced by hasParent(), parent(), and setParent().

◆ ports_

PortContainerType ProGe::NetlistPortGroup::ports_
private

The ports belonging to this group by reference.

Definition at line 112 of file NetlistPortGroup.hh.

Referenced by addPort(), begin(), clear(), end(), NetlistPortGroup(), portAt(), portCount(), rbegin(), rend(), and ~NetlistPortGroup().

◆ signalGroup_

SignalGroup ProGe::NetlistPortGroup::signalGroup_
private

The usage/implemented interface of the group.

Definition at line 114 of file NetlistPortGroup.hh.

Referenced by assignedSignalGroup(), and assignSignalGroup().


The documentation for this class was generated from the following files:
ProGe::NetlistPortGroup::parent_
BaseNetlistBlock * parent_
The parent block where the group belongs to.
Definition: NetlistPortGroup.hh:110
ProGe::NetlistPortGroup::portAt
const NetlistPort & portAt(size_t index) const
Definition: NetlistPortGroup.cc:83
ProGe::NetlistPortGroup::hasParent
bool hasParent() const
Definition: NetlistPortGroup.cc:133
assert
#define assert(condition)
Definition: Application.hh:86
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
THROW_EXCEPTION
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition: Exception.hh:39
ProGe::NetlistPortGroup::NetlistPortGroup
NetlistPortGroup()
Definition: NetlistPortGroup.cc:46
ProGe::NetlistPortGroup::signalGroup_
SignalGroup signalGroup_
The usage/implemented interface of the group.
Definition: NetlistPortGroup.hh:114
ProGe::Signal::type
SignalType type() const
Definition: Signal.cc:55
ProGe::NetlistPortGroup::portCount
size_t portCount() const
Definition: NetlistPortGroup.cc:78
ProGe::NetlistPort::assignedSignal
Signal assignedSignal() const
Definition: NetlistPort.cc:455
InstanceNotFound
Definition: Exception.hh:304
ProGe::NetlistPortGroup::ports_
PortContainerType ports_
The ports belonging to this group by reference.
Definition: NetlistPortGroup.hh:112