OpenASIP  2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
TTAMachine::Unit Class Reference

#include <Unit.hh>

Inheritance diagram for TTAMachine::Unit:
Inheritance graph
Collaboration diagram for TTAMachine::Unit:
Collaboration graph

Public Member Functions

virtual ~Unit ()
 
virtual bool hasPort (const std::string &name) const
 
virtual Portport (const std::string &name) const
 
virtual Portport (int index) const
 
virtual int portCount () const
 
virtual int outputPortCount (bool countBidir=false) const
 
virtual int inputPortCount (bool countBidir=false) const
 
virtual int bidirPortCount () const
 
virtual void setMachine (Machine &mach)
 
virtual void unsetMachine ()
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
- Public Member Functions inherited from TTAMachine::Component
virtual ~Component ()
 
virtual TCEString name () const
 
virtual void setName (const std::string &name)
 
virtual Machinemachine () const
 
virtual void ensureRegistration (const Component &component) const
 
virtual bool isRegistered () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_UNIT = "unit"
 ObjectState name for Unit. More...
 
- Static Public Attributes inherited from TTAMachine::Component
static const std::string OSNAME_COMPONENT = "component"
 ObjectState name for component. More...
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the component. More...
 

Protected Member Functions

 Unit (const std::string &name)
 
 Unit (const ObjectState *state)
 
virtual void removePort (Port &port)
 
- Protected Member Functions inherited from TTAMachine::Component
 Component (const std::string &name)
 
 Component (const ObjectState *state)
 
void internalSetMachine (Machine &machine)
 
void internalUnsetMachine ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Private Types

typedef std::vector< Port * > PortTable
 Container for ports. More...
 
typedef std::set< std::string > NameSet
 Set type for strings. More...
 

Private Member Functions

 Unit (const Unit &)
 Copying forbidden. More...
 
Unitoperator= (const Unit &)
 Assingment forbidden. More...
 
void addPort (Port &port)
 
void deleteAllPorts ()
 
void deleteOtherPorts (const NameSet &portsToLeave)
 
void loadStateWithoutReferences (const ObjectState *state)
 

Static Private Member Functions

static NameSet portNames (const ObjectState *state)
 

Private Attributes

PortTable ports_
 Contains all the ports of the unit. More...
 

Friends

class Port
 

Detailed Description

An Abstract base class for the different units in the machine.

Definition at line 51 of file Unit.hh.

Member Typedef Documentation

◆ NameSet

typedef std::set<std::string> TTAMachine::Unit::NameSet
private

Set type for strings.

Definition at line 82 of file Unit.hh.

◆ PortTable

typedef std::vector<Port*> TTAMachine::Unit::PortTable
private

Container for ports.

Definition at line 80 of file Unit.hh.

Constructor & Destructor Documentation

◆ ~Unit()

TTAMachine::Unit::~Unit ( )
virtual

Destructor.

Definition at line 84 of file Unit.cc.

84  {
86 }

References deleteAllPorts().

Here is the call graph for this function:

◆ Unit() [1/3]

TTAMachine::Unit::Unit ( const std::string &  name)
protected

Constructor.

Parameters
nameThe name of the unit.
Exceptions
InvalidNameIf the given name is not a valid component name.

Definition at line 59 of file Unit.cc.

59 : Component(name) {}

◆ Unit() [2/3]

TTAMachine::Unit::Unit ( const ObjectState state)
protected

Constructor.

Loads the state of the unit from the given ObjectState instance. Does not load connections to other components.

Parameters
stateThe ObjectState instance from which the name is taken.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 71 of file Unit.cc.

71  : Component(state) {
72  try {
74  } catch (const Exception&) {
75  // delete the ports that were loaded
77  throw;
78  }
79 }

References deleteAllPorts(), and loadStateWithoutReferences().

Here is the call graph for this function:

◆ Unit() [3/3]

TTAMachine::Unit::Unit ( const Unit )
private

Copying forbidden.

Member Function Documentation

◆ addPort()

void TTAMachine::Unit::addPort ( Port port)
private

Adds a port to the unit.

This method can be called from Port constructor only.

Parameters
portPort to be added.
Exceptions
ComponentAlreadyExistsIf another port with the same name exists.

Definition at line 213 of file Unit.cc.

213  {
214  // check that this method is called from Port constructor only
215  assert(port.parentUnit() == NULL);
216 
217  // check that a port with same name does not exist
218  if (!hasPort(port.name())) {
219  ports_.push_back(&port);
220  return;
221  }
222 
223  string procName = "Unit::addPort";
224  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
225 }

References assert, hasPort(), TTAMachine::Port::name(), TTAMachine::Port::parentUnit(), port(), and ports_.

Referenced by TTAMachine::Port::Port().

Here is the call graph for this function:

◆ bidirPortCount()

int TTAMachine::Unit::bidirPortCount ( ) const
virtual
Returns
The number of bidirectional ports in the unit.

Definition at line 174 of file Unit.cc.

174  {
175  unsigned count = 0;
176  for (auto &port : ports_) {
177  if (port->isInput() && port->isOutput())
178  count++;
179  }
180  return count;
181 }

References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.

Referenced by Automagic::checkForSelectableRF(), and ProGeTools::checkForSelectableRF().

Here is the call graph for this function:

◆ deleteAllPorts()

void TTAMachine::Unit::deleteAllPorts ( )
private

Deletes all the ports from the unit.

Definition at line 373 of file Unit.cc.

373  {
374  while (ports_.size() > 0) {
375  // the size of the vector is decreased when the code of Port
376  // destructor is executed
377  delete ports_[0];
378  }
379 }

References ports_.

Referenced by Unit(), and ~Unit().

◆ deleteOtherPorts()

void TTAMachine::Unit::deleteOtherPorts ( const NameSet portsToLeave)
private

Deletes all the ports which has a name that does not appear in the given name set.

Parameters
portsToLeaveA set of names of ports to leave.

Definition at line 389 of file Unit.cc.

389  {
390  for (int i = 0; i < portCount();) {
391  Port* port = this->port(i);
392  if (!AssocTools::containsKey(portsToLeave, port->name())) {
393  delete port;
394  } else {
395  i++;
396  }
397  }
398 }

References AssocTools::containsKey(), TTAMachine::Port::name(), port(), and portCount().

Referenced by loadStateWithoutReferences().

Here is the call graph for this function:

◆ hasPort()

bool TTAMachine::Unit::hasPort ( const std::string &  name) const
virtual

Returns true if the requested port is found, otherwise false.

Parameters
nameName of the port.
Returns
Tru if the port is found, otherwise false.

Reimplemented in TTAMachine::NullRegisterFile.

Definition at line 96 of file Unit.cc.

96  {
97  PortTable::const_iterator iter = ports_.begin();
98  while (iter != ports_.end()) {
99  if ((*iter)->name() == name) {
100  return true;
101  }
102  iter++;
103  }
104  return false;
105 }

References TTAMachine::Component::name(), and ports_.

Referenced by addPort(), TTAProgram::TPEFProgramFactory::findGuard(), TTAProgram::TPEFProgramFactory::findPort(), MachineResourceManager::functionUnitPortResource(), TTAMachine::FunctionUnit::hasOperationPort(), TTAMachine::ControlUnit::hasSpecialRegisterPort(), TTAProgram::TPEFResourceUpdater::initCache(), loadStateWithoutReferences(), TTAMachine::FunctionUnit::port(), and TTAMachine::ControlUnit::specialRegisterPort().

Here is the call graph for this function:

◆ inputPortCount()

int TTAMachine::Unit::inputPortCount ( bool  countBidir = false) const
virtual
Parameters
countBidirTrue if we should count bidirectional ports
Returns
The number of input ports in the unit.

Definition at line 160 of file Unit.cc.

160  {
161  unsigned count = 0;
162  for (auto &port : ports_) {
163  if (port->isInput() && (!port->isOutput() || countBidir))
164  count++;
165  }
166  return count;
167 }

References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.

Referenced by Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), and ProGe::RV32MicroCodeGenerator::findRF().

Here is the call graph for this function:

◆ loadState()

void TTAMachine::Unit::loadState ( const ObjectState state)
virtual

Loads the state of the unit from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid or if references to sockets cannot be made.

Reimplemented from TTAMachine::Component.

Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, TTAMachine::ControlUnit, TTAMachine::ImmediateUnit, TTAMachine::BaseRegisterFile, UnboundedRegisterFile, and UniversalFunctionUnit.

Definition at line 309 of file Unit.cc.

309  {
311 
312  // create port-socket connections
313  for (int i = 0; i < state->childCount(); i++) {
314  ObjectState* child = state->child(i);
315  if (child->name() == FUPort::OSNAME_FUPORT ||
316  child->name() == RFPort::OSNAME_RFPORT ||
318  string portName = child->stringAttribute(Port::OSKEY_NAME);
319  Port* port = this->port(portName);
320  port->loadState(child);
321  }
322  }
323 }

References ObjectState::child(), ObjectState::childCount(), TTAMachine::Port::loadState(), loadStateWithoutReferences(), ObjectState::name(), TTAMachine::Port::OSKEY_NAME, TTAMachine::FUPort::OSNAME_FUPORT, TTAMachine::RFPort::OSNAME_RFPORT, TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT, port(), and ObjectState::stringAttribute().

Referenced by TTAMachine::BaseRegisterFile::loadState(), and TTAMachine::FunctionUnit::loadState().

Here is the call graph for this function:

◆ loadStateWithoutReferences()

void TTAMachine::Unit::loadStateWithoutReferences ( const ObjectState state)
private

Loads its state from the given ObjectState instance without references to other components.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 334 of file Unit.cc.

334  {
335  const string procName = "Unit::loadStateWithoutReferences";
336 
337  // load ports
338  try {
339  // cannot delete all the ports because there might be guards
340  // referencing to them
341  NameSet newPortNames = portNames(state);
342  deleteOtherPorts(newPortNames);
343 
344  for (int i = 0; i < state->childCount(); i++) {
345  ObjectState* child = state->child(i);
346  string portName = child->stringAttribute(Port::OSKEY_NAME);
347 
348  if (!hasPort(portName)) {
349  if (child->name() == RFPort::OSNAME_RFPORT) {
350  // port is attached automatically
351  new RFPort(child, *this);
352  } else if (child->name() == FUPort::OSNAME_FUPORT) {
353  // port is attached automatically
354  new FUPort(child, *this);
355  } else if (child->name() ==
357  // port is attached automatically
358  new SpecialRegisterPort(child, *this);
359  }
360  }
361  }
362 
363  } catch (const Exception& exception) {
365  __FILE__, __LINE__, procName, exception.errorMessage());
366  }
367 }

References ObjectState::child(), ObjectState::childCount(), deleteOtherPorts(), Exception::errorMessage(), hasPort(), ObjectState::name(), TTAMachine::Port::OSKEY_NAME, TTAMachine::FUPort::OSNAME_FUPORT, TTAMachine::RFPort::OSNAME_RFPORT, TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT, portNames(), and ObjectState::stringAttribute().

Referenced by loadState(), and Unit().

Here is the call graph for this function:

◆ operator=()

Unit& TTAMachine::Unit::operator= ( const Unit )
private

Assingment forbidden.

◆ outputPortCount()

int TTAMachine::Unit::outputPortCount ( bool  countBidir = false) const
virtual
Parameters
countBidirTrue if we should count bidirectional ports
Returns
The number of output ports in the unit.

Definition at line 145 of file Unit.cc.

145  {
146  unsigned count = 0;
147  for (auto &port : ports_) {
148  if (port->isOutput() && (!port->isInput() || countBidir))
149  count++;
150  }
151  return count;
152 }

References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.

Referenced by Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), ProGe::RV32MicroCodeGenerator::findRF(), and DefaultDecoderGenerator::verifyCompatibility().

Here is the call graph for this function:

◆ port() [1/2]

Port * TTAMachine::Unit::port ( const std::string &  name) const
virtual

Returns the requested port.

Parameters
nameName of the port.
Returns
The requested port.
Exceptions
InstanceNotFoundIf a port is not found by the given name.

Reimplemented in TTAMachine::FunctionUnit, and TTAMachine::BaseRegisterFile.

Definition at line 116 of file Unit.cc.

116  {
117  PortTable::const_iterator iter = ports_.begin();
118  while (iter != ports_.end()) {
119  if ((*iter)->name() == name) {
120  return *iter;
121  }
122  iter++;
123  }
124 
125  string procName = "Unit::port";
126  throw InstanceNotFound(__FILE__, __LINE__, procName);
127 }

References TTAMachine::Component::name(), and ports_.

Referenced by addPort(), MachineConnectivityCheck::appendConnectedDestinationBuses(), MachineConnectivityCheck::appendConnectedSourceBuses(), bidirPortCount(), MachineConnectivityCheck::busConnectedToRF(), ADFCombiner::connectPorts(), deleteOtherPorts(), MachineConnectivityCheck::findReadPorts(), MachineConnectivityCheck::findWritePorts(), inputPortCount(), loadState(), RFPortDialog::onOK(), IUPortDialog::onOK(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), outputPortCount(), TTAMachine::BaseRegisterFile::port(), TTAMachine::FunctionUnit::port(), removePort(), saveState(), TTAMachine::Port::setName(), and unsetMachine().

Here is the call graph for this function:

◆ port() [2/2]

Port * TTAMachine::Unit::port ( int  index) const
virtual

Returns a port by the given index.

The index must be greater or equal to 0 and smaller than the number of ports in the unit.

Parameters
indexIndex.
Returns
The port by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Reimplemented in TTAMachine::FunctionUnit, and TTAMachine::BaseRegisterFile.

Definition at line 195 of file Unit.cc.

195  {
196  if (index < 0 || index >= portCount()) {
197  string procName = "Unit::port";
198  throw OutOfRange(__FILE__, __LINE__, procName);
199  }
200  return ports_[index];
201 }

References portCount(), and ports_.

Here is the call graph for this function:

◆ portCount()

int TTAMachine::Unit::portCount ( ) const
virtual

Returns the number of ports in the unit.

Returns
The number of ports in the unit.

Reimplemented in TTAMachine::NullRegisterFile.

Definition at line 135 of file Unit.cc.

135  {
136  return ports_.size();
137 }

References ports_.

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), RegisterCopyAdder::addConnectionRegisterCopies(), RegisterCopyAdder::addConnectionRegisterCopiesImmediate(), ProGe::NetlistGenerator::addGCUToNetlist(), ProGe::NetlistGenerator::addGeneratableFUsToNetlist(), DefaultDecoderGenerator::addGlockPortToDecoder(), DefaultDecoderGenerator::addLockReqPortToDecoder(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), InputPSocketBroker::allAvailableResources(), OutputPSocketBroker::allAvailableResources(), TDGen::analyzeMachineRegisters(), TDGen::analyzeRegisters(), MachineConnectivityCheck::appendConnectedDestinationBuses(), MachineConnectivityCheck::appendConnectedSourceBuses(), CostDatabase::buildFunctionUnits(), MachineStateBuilder::buildMachineState(), MachineConnectivityCheck::busConnectedToRF(), MachineTester::canConnect(), RFPortCheck::check(), FullyConnectedCheck::check(), SimulatorFrontend::compareState(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::connectPorts(), ProGe::RV32MicroCodeGenerator::connectRF(), ADFCombiner::copyGuards(), RegisterCopyAdder::countAndAddConnectionRegisterCopiesToRR(), FUFactory::createEditPart(), RFFactory::createEditPart(), IUFactory::createEditPart(), ADFCombiner::createPortsAndSockets(), TTAProgram::CodeGenerator::createTerminalRegister(), llvm::LLVMTCEBuilder::createTerminalRegister(), deleteOtherPorts(), AddFUImplementationCmd::Do(), ProximFUDetailsCmd::Do(), llvm::LLVMTCEBuilder::emitMove(), llvm::LLVMTCEBuilder::emitSPInitialization(), UniversalFunctionUnit::ensureInputPorts(), InfoPortsCommand::execute(), ProgrammabilityValidator::findConnections(), MachineConnectivityCheck::findPossibleSourcePorts(), MachineConnectivityCheck::findReadPorts(), ProgramOperation::findTriggerFromUnit(), BasicBlockScheduler::findTriggerFromUnit(), MachineConnectivityCheck::findWritePorts(), TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), FullyConnectedCheck::fix(), MachineConnectivityCheck::fromRfConnected(), HDBToHtml::fuArchToHtml(), CompiledSimCodeGenerator::fuOutputPorts(), TTAMachine::FUPort::FUPort(), DefaultDecoderGenerator::glockPortWidth(), DefaultDecoderGenerator::glockRequestWidth(), MachineConnectivityCheck::immBits(), OutputPSocketBroker::isAnyResourceAvailable(), TTAMachine::RegisterFile::isArchitectureEqual(), ExecutionPipelineResource::isAvailable(), MachineConnectivityCheck::isConnected(), DefaultICGenerator::isGcuPort(), ComponentImplementationSelector::iuImplementations(), TTAMachine::FUPort::loadStateWithoutReferences(), MachineAnalysis::MachineAnalysis(), AddFUFromHDBDialog::onAdd(), AddWatchDialog::onFUChoice(), FUGuardDialog::onFUChoice(), BlockImplementationDialog::onHDBSelection(), RFPortDialog::onOK(), IUPortDialog::onOK(), FUArchitectureDialog::onOK(), SRPortDialog::onOK(), FUPortDialog::onOK(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), port(), UniversalFunctionUnit::portWithWidth(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), saveState(), TTAMachine::Port::setName(), TTAMachine::FUPort::setTriggering(), ExecutionPipelineBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), TTAMachine::ControlUnit::specialRegisterPort(), TTAMachine::ControlUnit::specialRegisterPortCount(), MachineConnectivityCheck::toRfConnected(), TTAMachine::FunctionUnit::triggerPort(), unsetMachine(), FUArchitectureDialog::update(), ProximPortWindow::update(), TTAMachine::RegisterFile::updateMaxReadsAndWrites(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeFUCntrlSignals(), DefaultDecoderGenerator::writeRFCntrlSignals(), DefaultDecoderGenerator::writeRFSRAMDecodingProcess(), DefaultDecoderGenerator::writeRulesForDestinationControlSignals(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().

◆ portNames()

Unit::NameSet TTAMachine::Unit::portNames ( const ObjectState state)
staticprivate

Creates a set of port names that exists in the given ObjectState tree.

Parameters
stateAn ObjectState instance representing an unit.
Returns
Set of port names.
Exceptions
KeyNotFoundIf the given ObjectState instance is invalid.

Definition at line 409 of file Unit.cc.

409  {
410  NameSet names;
411  for (int i = 0; i < state->childCount(); i++) {
412  ObjectState* child = state->child(i);
413  names.insert(child->stringAttribute(Port::OSKEY_NAME));
414  }
415 
416  return names;
417 }

References ObjectState::child(), ObjectState::childCount(), TTAMachine::Port::OSKEY_NAME, and ObjectState::stringAttribute().

Referenced by loadStateWithoutReferences().

Here is the call graph for this function:

◆ removePort()

void TTAMachine::Unit::removePort ( Port port)
protectedvirtual

Removes the given port.

This method should only be called by Port destructor.

Parameters
portPort to be removed.

Reimplemented in TTAMachine::ControlUnit.

Definition at line 235 of file Unit.cc.

235  {
236 
237  // sanity check to verify that this is called from Port's destructor
238  // only
239  assert(port.parentUnit() == NULL);
241  assert(removed);
242 }

References assert, TTAMachine::Port::parentUnit(), port(), ports_, and ContainerTools::removeValueIfExists().

Referenced by TTAMachine::ControlUnit::removePort(), and TTAMachine::Port::~Port().

Here is the call graph for this function:

◆ saveState()

ObjectState * TTAMachine::Unit::saveState ( ) const
virtual

Saves the state of the object to an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from TTAMachine::Component.

Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, TTAMachine::ControlUnit, TTAMachine::ImmediateUnit, and TTAMachine::BaseRegisterFile.

Definition at line 285 of file Unit.cc.

285  {
286 
288  state->setName(OSNAME_UNIT);
289 
290  // add ports
291  for (int i = 0; i < portCount(); i++) {
292  Port* port = this->port(i);
293  state->addChild(port->saveState());
294  }
295 
296  return state;
297 }

References ObjectState::addChild(), OSNAME_UNIT, port(), portCount(), TTAMachine::Port::saveState(), TTAMachine::Component::saveState(), and ObjectState::setName().

Referenced by TTAMachine::BaseRegisterFile::saveState(), and TTAMachine::FunctionUnit::saveState().

Here is the call graph for this function:

◆ setMachine()

void TTAMachine::Unit::setMachine ( Machine mach)
virtual

Registers the unit to a machine.

Parameters
machMachine to which the unit is to be registered.
Exceptions
ComponentAlreadyExistsIf there is another unit by the same name and type in the machine.

Implements TTAMachine::Component.

Reimplemented in TTAMachine::ControlUnit, and TTAMachine::NullRegisterFile.

Definition at line 253 of file Unit.cc.

253  {
254  internalSetMachine(mach);
255  mach.addUnit(*this);
256 }

References TTAMachine::Machine::addUnit(), and TTAMachine::Component::internalSetMachine().

Referenced by AddFUCmd::Do(), AddRFCmd::Do(), and AddIUCmd::Do().

Here is the call graph for this function:

◆ unsetMachine()

void TTAMachine::Unit::unsetMachine ( )
virtual

Removes registration of the unit from its current machine.

Implements TTAMachine::Component.

Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::ImmediateUnit, TTAMachine::ControlUnit, and TTAMachine::NullRegisterFile.

Definition at line 262 of file Unit.cc.

262  {
263 
264  if (machine() == NULL) {
265  return;
266  }
267 
269 
270  // detach all ports from sockets
271  int ports = portCount();
272  for (int i = 0; i < ports; i++) {
273  Port* unitPort = port(i);
274  unitPort->detachAllSockets();
275  }
276 }

References TTAMachine::Port::detachAllSockets(), TTAMachine::Component::internalUnsetMachine(), TTAMachine::Component::machine(), port(), and portCount().

Referenced by TTAMachine::ImmediateUnit::unsetMachine(), TTAMachine::RegisterFile::unsetMachine(), and TTAMachine::FunctionUnit::unsetMachineDerived().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ Port

friend class Port
friend

Definition at line 99 of file Unit.hh.

Member Data Documentation

◆ OSNAME_UNIT

const string TTAMachine::Unit::OSNAME_UNIT = "unit"
static

ObjectState name for Unit.

Definition at line 70 of file Unit.hh.

Referenced by saveState().

◆ ports_

PortTable TTAMachine::Unit::ports_
private

Contains all the ports of the unit.

Definition at line 96 of file Unit.hh.

Referenced by addPort(), bidirPortCount(), deleteAllPorts(), hasPort(), inputPortCount(), outputPortCount(), port(), portCount(), and removePort().


The documentation for this class was generated from the following files:
TTAMachine::RFPort::OSNAME_RFPORT
static const std::string OSNAME_RFPORT
ObjectState name for register file port.
Definition: RFPort.hh:58
TTAMachine::Component::internalUnsetMachine
void internalUnsetMachine()
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
TTAMachine::Port::saveState
virtual ObjectState * saveState() const
Definition: Port.cc:404
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::Unit::deleteOtherPorts
void deleteOtherPorts(const NameSet &portsToLeave)
Definition: Unit.cc:389
AssocTools::containsKey
static bool containsKey(const ContainerType &aContainer, const KeyType &aKey)
OutOfRange
Definition: Exception.hh:320
TTAMachine::Component::saveState
virtual ObjectState * saveState() const
Definition: MachinePart.cc:189
TTAMachine::Unit::deleteAllPorts
void deleteAllPorts()
Definition: Unit.cc:373
ObjectState
Definition: ObjectState.hh:59
ObjectState::setName
void setName(const std::string &name)
TTAMachine::Component::internalSetMachine
void internalSetMachine(Machine &machine)
TTAMachine::Port::loadState
virtual void loadState(const ObjectState *state)
Definition: Port.cc:459
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::Unit::ports_
PortTable ports_
Contains all the ports of the unit.
Definition: Unit.hh:96
TTAMachine::Unit::NameSet
std::set< std::string > NameSet
Set type for strings.
Definition: Unit.hh:82
TTAMachine::Component::Component
Component(const std::string &name)
Definition: MachinePart.cc:82
ContainerTools::removeValueIfExists
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
TTAMachine::FUPort::OSNAME_FUPORT
static const std::string OSNAME_FUPORT
ObjectState name for FUPort.
Definition: FUPort.hh:71
TTAMachine::Unit::port
virtual Port * port(const std::string &name) const
Definition: Unit.cc:116
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
TTAMachine::Unit::hasPort
virtual bool hasPort(const std::string &name) const
Definition: Unit.cc:96
ObjectState::childCount
int childCount() const
Exception
Definition: Exception.hh:54
TTAMachine::Unit::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *state)
Definition: Unit.cc:334
ObjectState::name
std::string name() const
TTAMachine::Port::isOutput
virtual bool isOutput() const
Definition: Port.cc:308
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAMachine::Unit::Port
friend class Port
Definition: Unit.hh:99
TTAMachine::Unit::portNames
static NameSet portNames(const ObjectState *state)
Definition: Unit.cc:409
TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT
static const std::string OSNAME_SPECIAL_REG_PORT
ObjectState name for special register port.
Definition: SpecialRegisterPort.hh:62
TTAMachine::Component::machine
virtual Machine * machine() const
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TTAMachine::Port::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the port.
Definition: Port.hh:82
ComponentAlreadyExists
Definition: Exception.hh:510
TTAMachine::Port::isInput
virtual bool isInput() const
Definition: Port.cc:298
TTAMachine::Unit::OSNAME_UNIT
static const std::string OSNAME_UNIT
ObjectState name for Unit.
Definition: Unit.hh:70
InstanceNotFound
Definition: Exception.hh:304
TTAMachine::Port::parentUnit
Unit * parentUnit() const