OpenASIP  2.0
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TTAMachine::Port Class Referenceabstract

#include <Port.hh>

Inheritance diagram for TTAMachine::Port:
Inheritance graph
Collaboration diagram for TTAMachine::Port:
Collaboration graph

Classes

struct  PairComparator
 

Public Member Functions

 Port (const std::string &name, Unit &parentUnit)
 
 Port (const ObjectState *state, Unit &parentUnit)
 
virtual ~Port ()
 
virtual std::string name () const
 
virtual void setName (const std::string &name)
 
virtual int width () const =0
 
virtual void attachSocket (Socket &socket)
 
virtual void detachSocket (Socket &socket)
 
virtual void detachAllSockets ()
 
UnitparentUnit () const
 
virtual SocketinputSocket () const
 
virtual SocketoutputSocket () const
 
virtual SocketunconnectedSocket (int index) const
 
virtual int socketCount () const
 
virtual bool isConnectedTo (const Socket &socket) const
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
virtual bool isOutput () const
 
virtual bool isInput () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_PORT = "port"
 ObjectState name for Port. More...
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the port. More...
 
static const std::string OSKEY_FIRST_SOCKET = "1_socket"
 ObjectState attribute key for the name of the connected socket. More...
 
static const std::string OSKEY_SECOND_SOCKET = "2_socket"
 ObjectState attribute key for the name of the other connected socket. More...
 

Protected Member Functions

 Port (const std::string &name, FunctionUnit &parentUnit)
 
- Protected Member Functions inherited from TTAMachine::SubComponent
 SubComponent ()
 
virtual ~SubComponent ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Private Member Functions

 Port (const Port &)
 Copying forbidden. More...
 
Portoperator= (const Port &)
 Assingment forbidden. More...
 
void loadStateWithoutReferences (const ObjectState *state)
 
void attachSocket (const std::string &socketName)
 

Private Attributes

std::string name_
 Name of the port. More...
 
UnitparentUnit_
 Parent unit. More...
 
Socketsocket1_
 Connection to the first socket. More...
 
Socketsocket2_
 Connection to the second socket. More...
 

Detailed Description

Represents a port between function units and sockets.

Definition at line 54 of file Port.hh.

Constructor & Destructor Documentation

◆ Port() [1/4]

TTAMachine::Port::Port ( const std::string &  name,
Unit parentUnit 
)

Constructor.

Parameters
nameName of the port.
parentUnitUnit to which the port is connected.
Exceptions
ComponentAlreadyExistsIf the parent unit already has another port by the same name.
InvalidNameIf the given name is not a valid name for a component.

Definition at line 67 of file Port.cc.

68  : SubComponent(),
69  name_(name),
70  parentUnit_(NULL),
71  socket1_(NULL),
72  socket2_(NULL) {
74  const string procName = "Port::Port";
75  throw InvalidName(__FILE__, __LINE__, procName);
76  }
77 
78  parentUnit.addPort(*this);
80 }

References TTAMachine::Unit::addPort(), MachineTester::isValidComponentName(), name(), parentUnit(), and parentUnit_.

Here is the call graph for this function:

◆ Port() [2/4]

TTAMachine::Port::Port ( const ObjectState state,
Unit parentUnit 
)

Constructor.

Loads its state from the given ObjectState instance but does not create connections to sockets.

Parameters
stateThe ObjectState instance.
parentUnitThe unit which contains the port.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 93 of file Port.cc.

94  : SubComponent(),
95  name_(""),
96  parentUnit_(NULL),
97  socket1_(NULL),
98  socket2_(NULL) {
100  try {
101  parentUnit.addPort(*this);
102  } catch (const ComponentAlreadyExists&) {
103  const string procName = "Port::Port";
104  MOMTextGenerator textGenerator;
105  format errorMsg = textGenerator.text(
107  errorMsg % name() % parentUnit.name();
109  __FILE__, __LINE__, procName, errorMsg.str());
110  }
112 }

References TTAMachine::Unit::addPort(), loadStateWithoutReferences(), name(), TTAMachine::Component::name(), parentUnit(), parentUnit_, Texts::TextGenerator::text(), and MOMTextGenerator::TXT_PORT_EXISTS_BY_NAME.

Here is the call graph for this function:

◆ ~Port()

TTAMachine::Port::~Port ( )
virtual

Destructor.

Definition at line 117 of file Port.cc.

117  {
118 
119  Unit* parent = parentUnit_;
120 
121  parentUnit_ = NULL;
122  assert(parent != NULL);
123  parent->removePort(*this);
124 
125  if (socket1_ != NULL) {
127  }
128 
129  if (socket2_ != NULL) {
131  }
132 }

References assert, detachSocket(), parentUnit_, TTAMachine::Unit::removePort(), socket1_, and socket2_.

Here is the call graph for this function:

◆ Port() [3/4]

TTAMachine::Port::Port ( const std::string &  name,
FunctionUnit parentUnit 
)
protected

◆ Port() [4/4]

TTAMachine::Port::Port ( const Port )
private

Copying forbidden.

Member Function Documentation

◆ attachSocket() [1/2]

void TTAMachine::Port::attachSocket ( const std::string &  socketName)
private

Attaches the socket by the given name to the port.

The given socket must be registered to the same machine as the parent unit.

Parameters
socketNameName of the socket to be attached.
Exceptions
InstanceNotFoundIf the given socket is not found from the machine.
IllegalRegistrationIf the parent unit is not registered to a machine.
ComponentAlreadyExistsIf a socket by the given name is already attached.
IllegalConnectivityIf the socket cannot be attached because of connectivity reasons.

Definition at line 516 of file Port.cc.

516  {
517  const string procName = "Socket::attachSocket";
518 
519  Machine* mach = parentUnit()->machine();
520  if (mach == NULL) {
521  throw IllegalRegistration(__FILE__, __LINE__, procName);
522  }
523 
524  Machine::SocketNavigator socketNav = mach->socketNavigator();
525  Socket* socket = socketNav.item(socketName);
526  attachSocket(*socket);
527 }

References attachSocket(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), parentUnit(), and TTAMachine::Machine::socketNavigator().

Here is the call graph for this function:

◆ attachSocket() [2/2]

void TTAMachine::Port::attachSocket ( Socket socket)
virtual

Attaches a socket to this port.

NOTE! If the parent unit is a register file, attaching a socket may affect to the maximum simultaneous reads of the register file.

Parameters
socketSocket to be attached.
Exceptions
IllegalRegistrationIf the port and socket are not in the same machine.
ComponentAlreadyExistsIf the given socket is already attached.
IllegalConnectivityIf the socket cannot be attached because of connectivity reasons.

Definition at line 191 of file Port.cc.

191  {
192  parentUnit()->ensureRegistration(socket);
193  string procName = "Port::attachSocket";
194 
195  MachineTester& tester = parentUnit()->machine()->machineTester();
196  if (!tester.canConnect(socket, *this)) {
197  if (tester.connectionExists()) {
198  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
199  } else {
200  string errorMsg = MachineTestReporter::
201  socketPortConnectionError(socket, *this, tester);
202  throw IllegalConnectivity(
203  __FILE__, __LINE__, procName, errorMsg);
204  }
205  }
206 
207  if (socket1_ == NULL) {
208  socket1_ = &socket;
209  } else if (socket2_ == NULL) {
210  socket2_ = &socket;
211  } else {
212  assert(false);
213  }
214 
215  // bookeeping of Socket internal state - private Socket operation
216  // reserved solely to Port class!
217  socket.attachPort(*this);
218 
219  // sanity check
220  if (socket2_ != NULL) {
223  }
224 }

References assert, TTAMachine::Socket::attachPort(), MachineTester::canConnect(), MachineTester::connectionExists(), TTAMachine::Socket::direction(), TTAMachine::Component::ensureRegistration(), TTAMachine::Component::machine(), TTAMachine::Machine::machineTester(), parentUnit(), socket1_, socket2_, MachineTestReporter::socketPortConnectionError(), and TTAMachine::Socket::UNKNOWN.

Referenced by attachSocket(), BlocksFU::BlocksFU(), RemoveUnconnectedComponents::checkFUPorts(), RemoveUnconnectedComponents::checkRFPorts(), FullyConnectedCheck::connectFUPort(), FullyConnectedCheck::connectIUPort(), ADFCombiner::connectPorts(), FullyConnectedCheck::connectRFPort(), FullyConnectedCheck::connectSpecialRegisterPort(), ADFCombiner::connectVectorLSU(), UniversalMachine::construct(), ADFCombiner::createPortsAndSockets(), SocketPortConnCmd::Do(), UniversalFunctionUnit::ensureInputPorts(), UniversalFunctionUnit::ensureOutputPorts(), VLIWConnectIC::explore(), and loadState().

Here is the call graph for this function:

◆ detachAllSockets()

void TTAMachine::Port::detachAllSockets ( )
virtual

Detaches all the sockets connected to the port.

NOTE! If the parent unit is a register file, detaching sockets may affect to the maximum simultaneous reads of the register file.

Definition at line 536 of file Port.cc.

536  {
537  if (socket1_ != NULL) {
538  socket1_->detachPort(*this);
539  socket1_ = NULL;
540  }
541  if (socket2_ != NULL) {
542  socket2_->detachPort(*this);
543  socket2_ = NULL;
544  }
545 }

References TTAMachine::Socket::detachPort(), socket1_, and socket2_.

Referenced by loadState(), and TTAMachine::Unit::unsetMachine().

Here is the call graph for this function:

◆ detachSocket()

void TTAMachine::Port::detachSocket ( Socket socket)
virtual

Detaches a socket from this port.

NOTE! If the parent unit is a register file, detaching a socket may affect to the maximum simultaneous reads of the register file.

Parameters
socketSocket to be detached.
Exceptions
InstanceNotFoundIf the given socket is not connected to the port.

Definition at line 237 of file Port.cc.

237  {
238  if (socket1_ == &socket) {
239  socket1_ = NULL;
240  } else if (socket2_ == &socket) {
241  socket2_ = NULL;
242  } else {
243  string procName = "Port::detachSocket";
244  throw InstanceNotFound(__FILE__, __LINE__, procName);
245  }
246 
247  // bookeeping of Socket internal state - private Socket operation
248  // reserved solely to Port class!
249  socket.detachPort(*this);
250 }

References TTAMachine::Socket::detachPort(), socket1_, and socket2_.

Referenced by SocketPortConnCmd::Do(), and ~Port().

Here is the call graph for this function:

◆ inputSocket()

Socket * TTAMachine::Port::inputSocket ( ) const
virtual

Returns the input socket of the port.

If the port does not have input socket (socket whose direction is Socket::INPUT), returns NULL.

Returns
Input socket of the port.

Definition at line 261 of file Port.cc.

261  {
262  if (socket1_ != NULL && socket1_->direction() == Socket::INPUT) {
263  return socket1_;
264  } else if (socket2_ != NULL && socket2_->direction() == Socket::INPUT) {
265  return socket2_;
266  } else {
267  return NULL;
268  }
269 }

References TTAMachine::Socket::direction(), TTAMachine::Socket::INPUT, socket1_, and socket2_.

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), MachineStateBuilder::addPortToFU(), InputPSocketBroker::allAvailableResources(), InputFUBroker::allAvailableResources(), BusBroker::allAvailableResources(), MachineConnectivityCheck::appendConnectedSourceBuses(), InputPSocketBroker::assign(), MachineConnectivityCheck::busConnectedToPort(), MachineTester::canConnect(), MachineConnectivityCheck::canWriteAllImmediates(), OperationBindingCheck::check(), POMValidator::checkConnectivity(), FullyConnectedCheck::connectFUPort(), ADFCombiner::connectPorts(), ProGe::RV32MicroCodeGenerator::connectRF(), UnitPortFactory::createEditPart(), OpsetDialog::createOperation(), ADFCombiner::createPortsAndSockets(), TTAProgram::Move::destinationSocket(), CodeCompressorPlugin::encodeFUTerminal(), CodeCompressorPlugin::encodeIUTerminal(), CodeCompressorPlugin::encodeRFTerminal(), UniversalFunctionUnit::ensureInputPorts(), ProgrammabilityValidator::findConnections(), TTAMachine::RegisterFile::firstWritePort(), FullyConnectedCheck::fix(), MachineConnectivityCheck::fromRfConnected(), InputPSocketBroker::isAlreadyAssigned(), BusBroker::isAvailable(), MachineConnectivityCheck::isConnected(), isInput(), MachineTester::legalPortConnections(), MachineAnalysis::MachineAnalysis(), MachineConnectivityCheck::needsRegisterCopiesDueImmediateOperands(), BlockImplementationDialog::onHDBSelection(), SmartHWOperation::port(), ProgrammabilityValidator::printConnection(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), ExecutionPipelineBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), MachineConnectivityCheck::toRfConnected(), InputPSocketBroker::unassign(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), DefaultDecoderGenerator::writeControlRulesOfRFReadPort(), DefaultDecoderGenerator::writeControlRulesOfRFWritePort(), DefaultDecoderGenerator::writeFUCntrlSignals(), and DefaultDecoderGenerator::writeRulesForDestinationControlSignals().

Here is the call graph for this function:

◆ isConnectedTo()

bool TTAMachine::Port::isConnectedTo ( const Socket socket) const
virtual

Checks whether the port is connected to the given socket.

Parameters
socketThe socket.
Returns
True if the port is connected to the socket, otherwise false.

Definition at line 393 of file Port.cc.

393  {
394  return (socket1_ == &socket || socket2_ == &socket);
395 }

References socket1_, and socket2_.

Referenced by MachineTester::canConnect(), ProDePortEditPolicy::canHandle(), ProDeSocketEditPolicy::canHandle(), ADFCombiner::connectVectorLSU(), SocketPortConnCmd::Do(), and ConnectTool::figure().

◆ isInput()

bool TTAMachine::Port::isInput ( ) const
virtual

◆ isOutput()

bool TTAMachine::Port::isOutput ( ) const
virtual

◆ loadState()

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

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the parent unit has a port by the same name as the coming name of this unit or if loading the references to sockets fails.

Implements Serializable.

Reimplemented in TTAMachine::FUPort, TTAMachine::SpecialRegisterPort, UniversalFUPort, TTAMachine::BaseFUPort, and TTAMachine::RFPort.

Definition at line 459 of file Port.cc.

459  {
460  const string procName = "Port::loadState";
463  string socketName = "";
464  MOMTextGenerator textGenerator;
465 
466  try {
467  if (state->hasAttribute(OSKEY_FIRST_SOCKET)) {
468  socketName = state->stringAttribute(OSKEY_FIRST_SOCKET);
469  attachSocket(socketName);
470  }
471  if (state->hasAttribute(OSKEY_SECOND_SOCKET)) {
472  socketName = state->stringAttribute(OSKEY_SECOND_SOCKET);
473  attachSocket(socketName);
474  }
475  } catch (const InstanceNotFound&) {
476  format errorMsg = textGenerator.text(
478  errorMsg % socketName % name() % parentUnit()->name();
480  __FILE__, __LINE__, procName, errorMsg.str());
481  } catch (const IllegalRegistration&) {
482  format errorMsg = textGenerator.text(
484  errorMsg % socketName % name() % parentUnit()->name();
486  __FILE__, __LINE__, procName, errorMsg.str());
487  } catch (const ComponentAlreadyExists&) {
488  format errorMsg = textGenerator.text(
490  errorMsg % name() % parentUnit()->name();
492  __FILE__, __LINE__, procName, errorMsg.str());
493  } catch (const IllegalConnectivity& exception) {
495  __FILE__, __LINE__, procName, exception.errorMessage());
496  }
497 }

References attachSocket(), detachAllSockets(), Exception::errorMessage(), ObjectState::hasAttribute(), loadStateWithoutReferences(), name(), TTAMachine::Component::name(), OSKEY_FIRST_SOCKET, OSKEY_SECOND_SOCKET, parentUnit(), ObjectState::stringAttribute(), Texts::TextGenerator::text(), MOMTextGenerator::TXT_PORT_EXISTS_BY_NAME, and MOMTextGenerator::TXT_PORT_REF_LOAD_ERR_SOCKET.

Referenced by TTAMachine::RFPort::loadState(), TTAMachine::BaseFUPort::loadState(), and TTAMachine::Unit::loadState().

Here is the call graph for this function:

◆ loadStateWithoutReferences()

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

Loads its state from the given ObjectState instance but does not create connections to sockets.

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

Definition at line 434 of file Port.cc.

434  {
435  const string procName = "Port::loadStateWithoutReferences";
436 
437  try {
438  string name = state->stringAttribute(OSKEY_NAME);
440  throw InvalidName(__FILE__, __LINE__, procName);
441  }
442  name_ = name;
443  } catch (const Exception& exception) {
445  __FILE__, __LINE__, procName, exception.errorMessage());
446  }
447 }

References Exception::errorMessage(), MachineTester::isValidComponentName(), name(), name_, OSKEY_NAME, and ObjectState::stringAttribute().

Referenced by loadState(), and Port().

Here is the call graph for this function:

◆ name()

std::string TTAMachine::Port::name ( ) const
virtual

Returns the name of the port.

Returns
Name of the port.

Definition at line 141 of file Port.cc.

141  {
142  return name_;
143 }

References name_.

Referenced by CodeCompressorPlugin::addBitsForGuardField(), BEMGenerator::addEncodings(), HDB::HDBManager::addFUArchitecture(), ProGe::NetlistGenerator::addGCUToNetlist(), TTAMachine::Unit::addPort(), BEMGenerator::addPortCodes(), MachineStateBuilder::addPortToFU(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), BusBroker::allAvailableResources(), MachineStateBuilder::bindPortsToOperands(), CostDatabase::buildFunctionUnits(), MachineStateBuilder::buildMachineState(), UtilizationStats::calculateForInstruction(), FullyConnectedCheck::check(), POMValidator::checkConnectivity(), BEMValidator::checkGuardField(), ExecutionPipelineResource::checkOperandAllowed(), BEMValidator::checkSocketCodeTable(), SimulatorFrontend::compareState(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::connectVectorLSU(), TTAProgram::ProgramWriter::createCodeSection(), UnitPortFactory::createEditPart(), POMDisassembler::createFUPort(), POMDisassembler::createGuard(), FUGen::createMandatoryPorts(), ADFCombiner::createPortsAndSockets(), FUGen::createShadowRegisters(), TTAMachine::Unit::deleteOtherPorts(), AddFUImplementationCmd::Do(), ProximFUDetailsCmd::Do(), ProximFUPortDetailsCmd::Do(), CodeCompressorPlugin::encodeFUTerminal(), InterpolatingRFEstimator::estimatePortReadDelay(), InterpolatingFUEstimator::estimatePortReadDelay(), InterpolatingRFEstimator::estimatePortWriteDelay(), InterpolatingFUEstimator::estimatePortWriteDelay(), InfoPortsCommand::execute(), BlocksConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), DefaultDecoderGenerator::findGuard(), SimulatorFrontend::findPort(), HDBToHtml::fuArchToHtml(), TTAProgram::TPEFResourceUpdater::functionUnitPort(), CostEstimator::Estimator::functionUnitPortReadDelay(), CostEstimator::Estimator::functionUnitPortWriteDelay(), CompiledSimCodeGenerator::generateAddFUResult(), ProximPortEditPolicy::getCommand(), ProDePortEditPolicy::getCommand(), getOutputPort(), DefaultDecoderGenerator::guardPortName(), TTAMachine::HWOperation::io(), BusBroker::isAvailable(), HDB::HDBManager::isMatchingArchitecture(), loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::FUPort::loadStateWithoutReferences(), loadStateWithoutReferences(), CostEstimator::Estimator::longestPath(), main(), ProGe::NetlistGenerator::netlistPort(), GCUDialog::onEditPort(), AddWatchDialog::onFUChoice(), FUGuardDialog::onFUChoice(), RFPortDialog::onOK(), IUPortDialog::onOK(), FUArchitectureDialog::onOK(), SRPortDialog::onOK(), FUPortDialog::onOK(), OperationDialog::onOperandSelection(), ExecutionPipelineResource::operandAllowedAtCycle(), operandBindingsString(), ExecutionPipelineResource::operandOverwritten(), HDB::FUArchitecture::operator==(), FUTestbenchGenerator::parseFuPorts(), FUGen::parseOperations(), Port(), TTAMachine::PortGuard::PortGuard(), CompiledSimSymbolGenerator::portSymbol(), BF2Scheduler::preAllocateFunctionUnits(), SimProgramBuilder::processBidirTerminal(), CostEstimator::Estimator::registerFilePortReadDelay(), CostEstimator::Estimator::registerFilePortWriteDelay(), BF2Scheduler::releasePortForOp(), HDB::HDBManager::resolveArchitecturePort(), MachineResourceManager::rFPortOrFUIndexReference(), saveState(), TTAMachine::PortGuard::saveState(), FUGen::scheduleOperations(), setName(), MachineTestReporter::socketDirectionSettingError(), MachineTestReporter::socketPortConnectionError(), MachineTestReporter::socketSegmentConnectionError(), SimulatorFrontend::state(), ProGe::RV32MicroCodeGenerator::throwInputPortError(), ProGe::RV32MicroCodeGenerator::throwOutputPortError(), ProGe::RV32MicroCodeGenerator::throwTriggeringPortError(), ProximPortWindow::update(), FUArchitectureDialog::update(), BusDialog::updateGuardLists(), GCUDialog::updatePortList(), FUDialog::updatePortList(), GCUDialog::updateRAPortChoice(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), DefaultDecoderGenerator::writeControlRulesOfFUOutputPort(), DefaultDecoderGenerator::writeControlRulesOfRFReadPort(), DefaultDecoderGenerator::writeControlRulesOfRFWritePort(), DefaultDecoderGenerator::writeFUCntrlSignals(), DefaultDecoderGenerator::writeRFCntrlSignals(), and DefaultDecoderGenerator::writeRFSRAMDecodingProcess().

◆ operator=()

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

Assingment forbidden.

◆ outputSocket()

Socket * TTAMachine::Port::outputSocket ( ) const
virtual

Returns the output socket of the port.

If the port does not have output socket (socket whose direction is Socket::OUTPUT), returns NULL.

Returns
Output socket of the port.

Definition at line 281 of file Port.cc.

281  {
282  if (socket1_ != NULL && socket1_->direction() == Socket::OUTPUT) {
283  return socket1_;
284  } else if (socket2_ != NULL &&
286  return socket2_;
287  } else {
288  return NULL;
289  }
290 }

References TTAMachine::Socket::direction(), TTAMachine::Socket::OUTPUT, socket1_, and socket2_.

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), MachineStateBuilder::addPortToFU(), OutputPSocketBroker::allAvailableResources(), BusBroker::allAvailableResources(), MachineConnectivityCheck::appendConnectedDestinationBuses(), OutputFUBroker::assign(), OutputPSocketBroker::assign(), MachineTester::canConnect(), OperationBindingCheck::check(), POMValidator::checkConnectivity(), FullyConnectedCheck::connectFUPort(), ADFCombiner::connectPorts(), ProGe::RV32MicroCodeGenerator::connectRF(), UnitPortFactory::createEditPart(), OpsetDialog::createOperation(), ADFCombiner::createPortsAndSockets(), CodeCompressorPlugin::encodeFUTerminal(), CodeCompressorPlugin::encodeIUTerminal(), CodeCompressorPlugin::encodeRFTerminal(), UniversalFunctionUnit::ensureOutputPorts(), VLIWConnectIC::explore(), ProgrammabilityValidator::findConnections(), TTAMachine::RegisterFile::firstReadPort(), FullyConnectedCheck::fix(), MachineConnectivityCheck::fromRfConnected(), MachineConnectivityCheck::immBits(), OutputPSocketBroker::isAlreadyAssigned(), OutputPSocketBroker::isAnyResourceAvailable(), BusBroker::isAvailable(), MachineConnectivityCheck::isConnected(), isOutput(), MachineTester::legalPortConnections(), MachineAnalysis::MachineAnalysis(), BlockImplementationDialog::onHDBSelection(), SmartHWOperation::port(), ProgrammabilityValidator::printConnection(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), ExecutionPipelineBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), TTAProgram::Move::sourceSocket(), MachineConnectivityCheck::toRfConnected(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeControlRulesOfFUOutputPort(), DefaultDecoderGenerator::writeControlRulesOfRFReadPort(), DefaultDecoderGenerator::writeRFCntrlSignals(), DefaultDecoderGenerator::writeRFSRAMDecodingProcess(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().

Here is the call graph for this function:

◆ parentUnit()

Unit* TTAMachine::Port::parentUnit ( ) const

Referenced by CodeCompressorPlugin::addBitsForGuardField(), RegisterCopyAdder::addConnectionRegisterCopies(), RegisterCopyAdder::addConnectionRegisterCopiesImmediate(), ProgrammabilityValidator::addConnectionToProgram(), ProgrammabilityValidator::addDirectConnection(), ProgrammabilityValidator::addGlobalRegisterConnection(), TTAMachine::Unit::addPort(), BEMGenerator::addPortCodes(), BusBroker::allAvailableResources(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), attachSocket(), MachineConnectivityCheck::busConnectedToDestination(), OutputPSocketResource::canAssign(), MachineTester::canConnect(), ProDeSocketEditPolicy::canHandle(), MachineConnectivityCheck::canWriteAllImmediates(), POMValidator::checkConnectivity(), BEMValidator::checkSocketCodeTable(), TTAMachine::FUPort::cleanupGuards(), TTAMachine::FUPort::cleanupOperandBindings(), TTAProgram::TPEFProgramFactory::createInstruction(), VLIWConnectIC::explore(), BlocksConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), MachineConnectivityCheck::findRoutes(), TTAProgram::TPEFResourceUpdater::functionUnitPort(), BF2Scheduler::getDstUnit(), ProgramOperation::hwopFromOutMove(), BusBroker::isAvailable(), MachineConnectivityCheck::isPortApplicableToWidths(), MachineTester::legalPortConnections(), loadState(), TTAMachine::FUPort::loadStateWithoutReferences(), CostEstimator::Estimator::longestPath(), main(), BEMValidator::needsSocketCodeTable(), ProGe::NetlistGenerator::netlistPort(), ProgramOperation::outputIndexFromGuard(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::RFPort::parentUnit(), ExecutionPipelineResource::poConflictsWithInputPort(), Port(), CompiledSimSymbolGenerator::portSymbol(), ProgrammabilityValidator::printConnection(), SimProgramBuilder::processBidirTerminal(), SimpleICOptimizer::removeAllConnections(), TTAMachine::Unit::removePort(), RegisterRenamer::renameLiveRange(), TTAProgram::TPEFProgramFactory::resolveSocketAllocations(), setName(), InputPSocketBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), MachineTestReporter::socketDirectionSettingError(), MachineTestReporter::socketPortConnectionError(), MachineTestReporter::socketSegmentConnectionError(), ConnectionSweeper::sweepBypasses(), ConnectionSweeper::sweepRFs(), and TTAProgram::ProgramWriter::terminalResource().

◆ saveState()

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

Saves the contents to an ObjectState tree.

Returns
The newly created ObjectState tree.

Implements Serializable.

Reimplemented in TTAMachine::FUPort, TTAMachine::SpecialRegisterPort, TTAMachine::BaseFUPort, and TTAMachine::RFPort.

Definition at line 404 of file Port.cc.

404  {
405 
406  ObjectState* port = new ObjectState(OSNAME_PORT);
407  port->setAttribute(OSKEY_NAME, name());
408 
409  // set first socket
410  if (socket1_ != NULL) {
412  } else if (socket2_ != NULL) {
414  }
415 
416  // set second socket
417  if (socket1_ != NULL && socket2_ != NULL) {
419  }
420 
421  return port;
422 }

References name(), TTAMachine::Component::name(), OSKEY_FIRST_SOCKET, OSKEY_NAME, OSKEY_SECOND_SOCKET, OSNAME_PORT, ObjectState::setAttribute(), socket1_, and socket2_.

Referenced by TTAMachine::RFPort::saveState(), TTAMachine::BaseFUPort::saveState(), and TTAMachine::Unit::saveState().

Here is the call graph for this function:

◆ setName()

void TTAMachine::Port::setName ( const std::string &  name)
virtual

Sets the name of the port.

Parameters
nameThe new name.
Exceptions
ComponentAlreadyExistsIf a port with the given name already exists in the same unit.
InvalidNameIf the given name is not a valid component name.

Reimplemented in UniversalFUPort.

Definition at line 155 of file Port.cc.

155  {
156  if (name == this->name()) {
157  return;
158  }
159 
160  const string procName = "Port::setName";
161 
163  throw InvalidName(__FILE__, __LINE__, procName);
164  }
165 
166  Unit* parent = this->parentUnit();
167  for (int i = 0; i < parent->portCount(); i++) {
168  Port* port = parent->port(i);
169  if (port->name() == name) {
170  throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
171  }
172  }
173 
174  name_ = name;
175 }

References MachineTester::isValidComponentName(), name(), name_, parentUnit(), TTAMachine::Unit::port(), and TTAMachine::Unit::portCount().

Referenced by AddFUFromHDBDialog::onAdd().

Here is the call graph for this function:

◆ socketCount()

int TTAMachine::Port::socketCount ( ) const
virtual

Returns the number of sockets attached to the port.

Returns
The number of sockets.

Definition at line 375 of file Port.cc.

375  {
376  if (socket1_ != NULL && socket2_ != NULL) {
377  return 2;
378  } else if (socket1_ != NULL || socket2_ != NULL) {
379  return 1;
380  } else {
381  return 0;
382  }
383 }

References socket1_, and socket2_.

Referenced by MachineTester::canConnect(), FullyConnectedCheck::check(), MachineValidator::checkFUConnections(), RemoveUnconnectedComponents::checkFUPorts(), RemoveUnconnectedComponents::checkRFPorts(), FullyConnectedCheck::connectControlUnit(), ADFCombiner::connectVectorLSU(), FullyConnectedCheck::fix(), RemoveUnconnectedComponents::removeUnconnectedFUs(), and unconnectedSocket().

◆ unconnectedSocket()

Socket * TTAMachine::Port::unconnectedSocket ( int  index) const
virtual

Returns the first or the second unconnected socket attached to this port. If there is no such socket, returns NULL.

Parameters
indexThe index which indicates which of the unconnected sockets is returned. If there is only one unconnected socket, the index value 0 returns it and value 1 returns NULL.
Returns
The unconnected socket by the given index.
Exceptions
OutOfRangeIf the given index is not 0 or 1.

Definition at line 323 of file Port.cc.

323  {
324  const string procName = "Port::unconnectedSocket";
325 
326  if (index < 0 || index > 1) {
327  throw OutOfRange(__FILE__, __LINE__, procName);
328  }
329 
330  if (socketCount() == 0) {
331  return NULL;
332  } else if (socketCount() == 1) {
333  if (index == 1) {
334  return NULL;
335  } else if (socket1_ != NULL && socket1_->segmentCount() == 0) {
336  return socket1_;
337  } else if (socket2_ != NULL && socket2_->segmentCount() == 0) {
338  return socket2_;
339  } else {
340  return NULL;
341  }
342  } else if (socketCount() == 2) {
343  if (index == 0) {
344  if (socket1_->segmentCount() == 0) {
345  return socket1_;
346  } else if (socket2_->segmentCount() == 0) {
347  return socket2_;
348  } else {
349  return NULL;
350  }
351  } else {
352  if (socket2_->segmentCount() == 0) {
353  return socket2_;
354  } else {
355  return NULL;
356  }
357  }
358  } else {
359  string errorMsg = "Too many sockets attached to a port.";
360  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
362 
363  // this return statement is just to avoid compilation warning in some
364  // environments.
365  return NULL;
366  }
367 }

References Application::abortProgram(), TTAMachine::Socket::segmentCount(), socket1_, socket2_, socketCount(), and Application::writeToErrorLog().

Referenced by MachineTester::canConnect(), ADFCombiner::connectPorts(), and UnitPortFactory::createEditPart().

Here is the call graph for this function:

◆ width()

virtual int TTAMachine::Port::width ( ) const
pure virtual

Member Data Documentation

◆ name_

std::string TTAMachine::Port::name_
private

Name of the port.

Definition at line 107 of file Port.hh.

Referenced by loadStateWithoutReferences(), name(), and setName().

◆ OSKEY_FIRST_SOCKET

const string TTAMachine::Port::OSKEY_FIRST_SOCKET = "1_socket"
static

ObjectState attribute key for the name of the connected socket.

Definition at line 84 of file Port.hh.

Referenced by loadState(), and saveState().

◆ OSKEY_NAME

const string TTAMachine::Port::OSKEY_NAME = "name"
static

◆ OSKEY_SECOND_SOCKET

const string TTAMachine::Port::OSKEY_SECOND_SOCKET = "2_socket"
static

ObjectState attribute key for the name of the other connected socket.

Definition at line 86 of file Port.hh.

Referenced by loadState(), and saveState().

◆ OSNAME_PORT

const string TTAMachine::Port::OSNAME_PORT = "port"
static

ObjectState name for Port.

Definition at line 80 of file Port.hh.

Referenced by saveState().

◆ parentUnit_

Unit* TTAMachine::Port::parentUnit_
private

Parent unit.

Definition at line 109 of file Port.hh.

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

◆ socket1_

Socket* TTAMachine::Port::socket1_
private

◆ socket2_

Socket* TTAMachine::Port::socket2_
private

The documentation for this class was generated from the following files:
MachineTester::canConnect
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
Definition: MachineTester.cc:86
ObjectState::hasAttribute
bool hasAttribute(const std::string &name) const
Definition: ObjectState.cc:205
TTAMachine::Port::Port
Port(const std::string &name, Unit &parentUnit)
Definition: Port.cc:67
TTAMachine::Port::inputSocket
virtual Socket * inputSocket() const
Definition: Port.cc:261
TTAMachine::Unit::addPort
void addPort(Port &port)
Definition: Unit.cc:213
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::Socket::OUTPUT
@ OUTPUT
Data goes from port to bus.
Definition: Socket.hh:60
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::Component::ensureRegistration
virtual void ensureRegistration(const Component &component) const
Definition: MachinePart.cc:163
Application::writeToErrorLog
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
Definition: Application.cc:224
OutOfRange
Definition: Exception.hh:320
TTAMachine::SubComponent::SubComponent
SubComponent()
Definition: MachinePart.cc:237
ObjectState
Definition: ObjectState.hh:59
TTAMachine::Port::OSKEY_SECOND_SOCKET
static const std::string OSKEY_SECOND_SOCKET
ObjectState attribute key for the name of the other connected socket.
Definition: Port.hh:86
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
TTAMachine::Socket::direction
Direction direction() const
TTAMachine::Port::OSNAME_PORT
static const std::string OSNAME_PORT
ObjectState name for Port.
Definition: Port.hh:80
MachineTestReporter::socketPortConnectionError
static std::string socketPortConnectionError(const TTAMachine::Socket &socket, const TTAMachine::Port &port, const MachineTester &tester)
Definition: MachineTestReporter.cc:150
TTAMachine::Port::socketCount
virtual int socketCount() const
Definition: Port.cc:375
TTAMachine::Port::name_
std::string name_
Name of the port.
Definition: Port.hh:107
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::Port::attachSocket
virtual void attachSocket(Socket &socket)
Definition: Port.cc:191
TTAMachine::Socket::detachPort
void detachPort(const Port &port)
Definition: Socket.cc:631
InvalidName
Definition: Exception.hh:827
TTAMachine::Machine::machineTester
MachineTester & machineTester() const
Definition: Machine.cc:671
TTAMachine::Port::detachSocket
virtual void detachSocket(Socket &socket)
Definition: Port.cc:237
TTAMachine::Port::parentUnit_
Unit * parentUnit_
Parent unit.
Definition: Port.hh:109
Exception
Definition: Exception.hh:54
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
IllegalRegistration
Definition: Exception.hh:532
MachineTester::connectionExists
bool connectionExists() const
Definition: MachineTester.cc:342
TTAMachine::Machine::SocketNavigator
Navigator< Socket > SocketNavigator
Navigator type for SocketNavigator.
Definition: Machine.hh:215
TTAMachine::Port::socket2_
Socket * socket2_
Connection to the second socket.
Definition: Port.hh:113
TTAMachine::Port::socket1_
Socket * socket1_
Connection to the first socket.
Definition: Port.hh:111
TTAMachine::Component::machine
virtual Machine * machine() const
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
MOMTextGenerator
Definition: MOMTextGenerator.hh:40
TTAMachine::Port::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the port.
Definition: Port.hh:82
TTAMachine::Port::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *state)
Definition: Port.cc:434
TTAMachine::Socket::UNKNOWN
@ UNKNOWN
Unknown direction.
Definition: Socket.hh:61
TTAMachine::Port::outputSocket
virtual Socket * outputSocket() const
Definition: Port.cc:281
ComponentAlreadyExists
Definition: Exception.hh:510
MOMTextGenerator::TXT_PORT_REF_LOAD_ERR_SOCKET
@ TXT_PORT_REF_LOAD_ERR_SOCKET
Definition: MOMTextGenerator.hh:74
IllegalConnectivity
Definition: Exception.hh:473
TTAMachine::Socket::segmentCount
int segmentCount() const
Application::abortProgram
static void abortProgram() __attribute__((noreturn))
Definition: Application.cc:266
MachineTester
Definition: MachineTester.hh:46
TTAMachine::Port::detachAllSockets
virtual void detachAllSockets()
Definition: Port.cc:536
MOMTextGenerator::TXT_PORT_EXISTS_BY_NAME
@ TXT_PORT_EXISTS_BY_NAME
Definition: MOMTextGenerator.hh:73
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
InstanceNotFound
Definition: Exception.hh:304
TTAMachine::Socket::INPUT
@ INPUT
Data goes from bus to port.
Definition: Socket.hh:59
TTAMachine::Port::OSKEY_FIRST_SOCKET
static const std::string OSKEY_FIRST_SOCKET
ObjectState attribute key for the name of the connected socket.
Definition: Port.hh:84
TTAMachine::Port::parentUnit
Unit * parentUnit() const