OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the port.
 
static const std::string OSKEY_FIRST_SOCKET = "1_socket"
 ObjectState attribute key for the name of the connected socket.
 
static const std::string OSKEY_SECOND_SOCKET = "2_socket"
 ObjectState attribute key for the name of the other connected socket.
 

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.
 
Portoperator= (const Port &)
 Assingment forbidden.
 
void loadStateWithoutReferences (const ObjectState *state)
 
void attachSocket (const std::string &socketName)
 

Private Attributes

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

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}
static bool isValidComponentName(const std::string &name)
std::string name_
Name of the port.
Definition Port.hh:107
Socket * socket1_
Connection to the first socket.
Definition Port.hh:111
Socket * socket2_
Connection to the second socket.
Definition Port.hh:113
Unit * parentUnit() const
virtual std::string name() const
Definition Port.cc:141
Unit * parentUnit_
Parent unit.
Definition Port.hh:109
void addPort(Port &port)
Definition Unit.cc:213

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}
virtual TCEString name() const
void loadStateWithoutReferences(const ObjectState *state)
Definition Port.cc:434
virtual boost::format text(int textId)

References TTAMachine::Unit::addPort(), loadStateWithoutReferences(), TTAMachine::Component::name(), 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}
#define assert(condition)
virtual void detachSocket(Socket &socket)
Definition Port.cc:237

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}
virtual Machine * machine() const
Navigator< Socket > SocketNavigator
Navigator type for SocketNavigator.
Definition Machine.hh:215
virtual void attachSocket(Socket &socket)
Definition Port.cc:191

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 {
193 string procName = "Port::attachSocket";
194
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);
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}
static std::string socketPortConnectionError(const TTAMachine::Socket &socket, const TTAMachine::Port &port, const MachineTester &tester)
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
bool connectionExists() const
virtual void ensureRegistration(const Component &component) const
MachineTester & machineTester() const
Definition Machine.cc:671
@ UNKNOWN
Unknown direction.
Definition Socket.hh:61
Direction direction() const

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(), BlocksGCU::BlocksGCU(), BlocksIMM::BlocksIMM(), BlocksRF::BlocksRF(), 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(), loadState(), FUPortDialog::onCancel(), RFPortDialog::onCancel(), SRPortDialog::onCancel(), IUPortDialog::onOK(), FUPortDialog::onSocketChoice(), RFPortDialog::onSocketChoice(), SRPortDialog::onSocketChoice(), IUPortDialog::updateSocket(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), and SRPortDialog::updateSockets().

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}
void detachPort(const Port &port)
Definition Socket.cc:631

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

Referenced by loadState(), FUPortDialog::onCancel(), RFPortDialog::onCancel(), SRPortDialog::onCancel(), IUPortDialog::onOK(), FUPortDialog::onSocketChoice(), RFPortDialog::onSocketChoice(), SRPortDialog::onSocketChoice(), 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(), IUPortDialog::updateSocket(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), SRPortDialog::updateSockets(), 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}
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59

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

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), MachineStateBuilder::addPortToFU(), BusBroker::allAvailableResources(), InputFUBroker::allAvailableResources(), InputPSocketBroker::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(), MachineConnectivityCheck::isConnected(), isInput(), MachineTester::legalPortConnections(), MachineAnalysis::MachineAnalysis(), MachineConnectivityCheck::needsRegisterCopiesDueImmediateOperands(), BlockImplementationDialog::onHDBSelection(), SmartHWOperation::port(), ProgrammabilityValidator::printConnection(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), ExecutionPipelineBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), MachineConnectivityCheck::toRfConnected(), InputPSocketBroker::unassign(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), SRPortDialog::updateSockets(), 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

Returns true if this port can be used to write data from unit to bus.

Returns
True if output port.

Definition at line 308 of file Port.cc.

308 {
309 return outputSocket() != NULL;
310}
virtual Socket * outputSocket() const
Definition Port.cc:281

References outputSocket().

Referenced by RegisterCopyAdder::addConnectionRegisterCopies(), ProGe::NetlistGenerator::addGCUToNetlist(), ProGe::RV32MicroCodeGenerator::addIPorts(), ProGe::RV32MicroCodeGenerator::addR1RPorts(), ProGe::RV32MicroCodeGenerator::addRPorts(), ProGe::RV32MicroCodeGenerator::addUJPorts(), TDGen::analyzeMachineRegisters(), TDGen::analyzeRegisters(), TTAMachine::Unit::bidirPortCount(), FUGen::checkForValidity(), SimulatorFrontend::compareState(), RegisterCopyAdder::countAndAddConnectionRegisterCopiesToRR(), llvm::LLVMTCEBuilder::createTerminalRegister(), TTAProgram::CodeGenerator::createTerminalRegister(), llvm::LLVMTCEBuilder::emitSPInitialization(), MachineConnectivityCheck::findPossibleSourcePorts(), MachineConnectivityCheck::findReadPorts(), CompiledSimCodeGenerator::fuOutputPorts(), CompiledSimCodeGenerator::generateTriggerCode(), getOutputPort(), CompiledSimCodeGenerator::handleOperationWithoutDag(), TTAMachine::Unit::inputPortCount(), ProGe::NetlistGenerator::netlistPort(), TTAMachine::HWOperation::numberOfOutputs(), TTAMachine::Unit::outputPortCount(), FUGen::parseOperations(), TTAMachine::RegisterFile::updateMaxReadsAndWrites(), and DefaultDecoderGenerator::writeRFCntrlSignals().

Here is the call graph for this function:

◆ 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::BaseFUPort, TTAMachine::FUPort, TTAMachine::RFPort, TTAMachine::SpecialRegisterPort, and UniversalFUPort.

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}
std::string errorMessage() const
Definition Exception.cc:123
bool hasAttribute(const std::string &name) const
std::string stringAttribute(const std::string &name) const
static const std::string OSKEY_FIRST_SOCKET
ObjectState attribute key for the name of the connected socket.
Definition Port.hh:84
static const std::string OSKEY_SECOND_SOCKET
ObjectState attribute key for the name of the other connected socket.
Definition Port.hh:86
virtual void detachAllSockets()
Definition Port.cc:536

References attachSocket(), detachAllSockets(), Exception::errorMessage(), ObjectState::hasAttribute(), loadStateWithoutReferences(), TTAMachine::Component::name(), 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::BaseFUPort::loadState(), TTAMachine::RFPort::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}
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the port.
Definition Port.hh:82

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(), ProximFUDetailsCmd::Do(), ProximFUPortDetailsCmd::Do(), AddFUImplementationCmd::Do(), CodeCompressorPlugin::encodeFUTerminal(), InterpolatingFUEstimator::estimatePortReadDelay(), InterpolatingRFEstimator::estimatePortReadDelay(), InterpolatingFUEstimator::estimatePortWriteDelay(), InterpolatingRFEstimator::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(), TTAMachine::HWOperation::loadState(), loadState(), TTAMachine::FUPort::loadStateWithoutReferences(), loadStateWithoutReferences(), CostEstimator::Estimator::longestPath(), main(), ProGe::NetlistGenerator::netlistPort(), GCUDialog::onEditPort(), AddWatchDialog::onFUChoice(), FUGuardDialog::onFUChoice(), FUArchitectureDialog::onOK(), FUPortDialog::onOK(), IUPortDialog::onOK(), RFPortDialog::onOK(), SRPortDialog::onOK(), OperationDialog::onOperandSelection(), ExecutionPipelineResource::operandAllowedAtCycle(), operandBindingsString(), ExecutionPipelineResource::operandOverwritten(), HDB::FUArchitecture::operator==(), FUTestbenchGenerator::parseFuPorts(), FUGen::parseOperations(), Port(), Port(), TTAMachine::PortGuard::PortGuard(), CompiledSimSymbolGenerator::portSymbol(), BF2Scheduler::preAllocateFunctionUnits(), SimProgramBuilder::processBidirTerminal(), CostEstimator::Estimator::registerFilePortReadDelay(), CostEstimator::Estimator::registerFilePortWriteDelay(), BF2Scheduler::releasePortForOp(), HDB::HDBManager::resolveArchitecturePort(), MachineResourceManager::rFPortOrFUIndexReference(), TTAMachine::PortGuard::saveState(), saveState(), FUGen::scheduleOperations(), setName(), MachineTestReporter::socketDirectionSettingError(), MachineTestReporter::socketPortConnectionError(), MachineTestReporter::socketSegmentConnectionError(), SimulatorFrontend::state(), ProGe::RV32MicroCodeGenerator::throwInputPortError(), ProGe::RV32MicroCodeGenerator::throwOutputPortError(), ProGe::RV32MicroCodeGenerator::throwTriggeringPortError(), FUGuardDialog::TransferDataToWindow(), FUPortDialog::TransferDataToWindow(), IUPortDialog::TransferDataToWindow(), RFPortDialog::TransferDataToWindow(), SRPortDialog::TransferDataToWindow(), ProximPortWindow::update(), FUArchitectureDialog::update(), BusDialog::updateGuardLists(), OperationDialog::updateOperandList(), FUDialog::updatePortList(), GCUDialog::updatePortList(), IUDialog::updatePortList(), RFDialog::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}
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60

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

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), MachineStateBuilder::addPortToFU(), BusBroker::allAvailableResources(), OutputPSocketBroker::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(), MachineConnectivityCheck::isConnected(), isOutput(), MachineTester::legalPortConnections(), MachineAnalysis::MachineAnalysis(), BlockImplementationDialog::onHDBSelection(), SmartHWOperation::port(), ProgrammabilityValidator::printConnection(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), ExecutionPipelineBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), TTAProgram::Move::sourceSocket(), MachineConnectivityCheck::toRfConnected(), FUGuardDialog::TransferDataToWindow(), IUPortDialog::updateSocket(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), SRPortDialog::updateSockets(), 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(), attachSocket(), MachineConnectivityCheck::busConnectedToDestination(), OutputPSocketResource::canAssign(), MachineTester::canConnect(), ProDeSocketEditPolicy::canHandle(), MachineConnectivityCheck::canWriteAllImmediates(), POMValidator::checkConnectivity(), BEMValidator::checkSocketCodeTable(), TTAMachine::FUPort::cleanupGuards(), TTAMachine::FUPort::cleanupOperandBindings(), TTAProgram::TPEFProgramFactory::createInstruction(), BlocksConnectIC::explore(), VLIWConnectIC::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(), IUPortDialog::onOK(), RFPortDialog::onOK(), RFPortDialog::onSocketChoice(), ProgramOperation::outputIndexFromGuard(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::RFPort::parentUnit(), ExecutionPipelineResource::poConflictsWithInputPort(), Port(), 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(), TTAProgram::ProgramWriter::terminalResource(), IUPortDialog::updateSocket(), and RFPortDialog::updateSockets().

◆ 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::BaseFUPort, TTAMachine::FUPort, TTAMachine::RFPort, and TTAMachine::SpecialRegisterPort.

Definition at line 404 of file Port.cc.

404 {
405
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}
void setAttribute(const std::string &name, const std::string &value)
static const std::string OSNAME_PORT
ObjectState name for Port.
Definition Port.hh:80

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

Referenced by TTAMachine::BaseFUPort::saveState(), TTAMachine::RFPort::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}
Port(const std::string &name, Unit &parentUnit)
Definition Port.cc:67

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

Referenced by AddFUFromHDBDialog::onAdd(), FUPortDialog::onOK(), IUPortDialog::onOK(), RFPortDialog::onOK(), and SRPortDialog::onOK().

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(), 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}
static void abortProgram() __attribute__((noreturn))
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
virtual int socketCount() const
Definition Port.cc:375
int segmentCount() const

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(), ADFSerializer::machineFUPort(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfPort(), 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(), ADFSerializer::machineFUPort(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfPort(), 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(), 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: