OpenASIP 2.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
TTAMachine::Socket Class Reference

#include <Socket.hh>

Inheritance diagram for TTAMachine::Socket:
Inheritance graph
Collaboration diagram for TTAMachine::Socket:
Collaboration graph

Public Types

enum  Direction { INPUT , OUTPUT , UNKNOWN }
 

Public Member Functions

 Socket (const std::string &name)
 
 Socket (const ObjectState *state)
 
virtual ~Socket ()
 
virtual void setName (const std::string &name)
 
void setDirection (Direction direction)
 
Direction direction () const
 
void attachBus (Segment &bus)
 
void detachBus (Segment &bus)
 
void detachBus (Bus &bus)
 
int portCount () const
 
Portport (int index) const
 
void detachAllPorts ()
 
const Connectionconnection (const Segment &bus) const
 
bool isConnectedTo (const Bus &bus) const
 
bool isConnectedTo (const Segment &bus) const
 
std::set< Bus * > connectedBuses ()
 
const std::set< Bus * > connectedBuses () const
 
int segmentCount () const
 
Segmentsegment (int index) const
 
bool hasDataPortWidth () const
 
const std::string & dataPortWidth () const
 
void setDataPortWidth (const std::string &width)
 
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 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_SOCKET = "socket"
 ObjectState name for socket.
 
static const std::string OSKEY_DIRECTION = "direction"
 ObjectState attribute key for socket direction.
 
static const std::string OSVALUE_INPUT = "input"
 ObjectState attribute value for input direction.
 
static const std::string OSVALUE_OUTPUT = "output"
 ObjectState attribute value for output direction.
 
static const std::string OSVALUE_UNKNOWN = "unknown"
 ObjectState attribute value for unknown direction.
 
- Static Public Attributes inherited from TTAMachine::Component
static const std::string OSNAME_COMPONENT = "component"
 ObjectState name for component.
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the component.
 

Private Types

typedef std::vector< const Connection * > ConnectionTable
 Table of Connection pointers.
 
typedef std::vector< Port * > PortTable
 Table of port connections.
 

Private Member Functions

 Socket (const Socket &)
 Copying forbidden.
 
Socketoperator= (const Socket &)
 Assingment forbidden.
 
void removeConnection (const Connection *connection)
 
void attachPort (Port &port)
 
void detachPort (const Port &port)
 
void detachAllBuses ()
 

Private Attributes

Direction direction_
 Direction of the socket.
 
std::string dataPortWidth_
 Dataport width.
 
ConnectionTable busses_
 Contains all connections to busses.
 
PortTable ports_
 Contains all connections to ports.
 

Friends

class Port
 

Additional Inherited Members

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

Detailed Description

Represents a socket in the TTA processor.

Definition at line 53 of file Socket.hh.

Member Typedef Documentation

◆ ConnectionTable

typedef std::vector<const Connection*> TTAMachine::Socket::ConnectionTable
private

Table of Connection pointers.

Definition at line 112 of file Socket.hh.

◆ PortTable

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

Table of port connections.

Definition at line 114 of file Socket.hh.

Member Enumeration Documentation

◆ Direction

Direction of data movements in socket.

Enumerator
INPUT 

Data goes from bus to port.

OUTPUT 

Data goes from port to bus.

UNKNOWN 

Unknown direction.

Definition at line 58 of file Socket.hh.

58 {
59 INPUT, ///< Data goes from bus to port.
60 OUTPUT, ///< Data goes from port to bus.
61 UNKNOWN ///< Unknown direction.
62 };
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59
@ UNKNOWN
Unknown direction.
Definition Socket.hh:61

Constructor & Destructor Documentation

◆ Socket() [1/3]

TTAMachine::Socket::Socket ( const std::string &  name)

Constructor.

Parameters
nameName of the socket.
Exceptions
InvalidNameIf the given name is not valid for a component.

Definition at line 69 of file Socket.cc.

Component(const std::string &name)
virtual TCEString name() const
std::string dataPortWidth_
Dataport width.
Definition Socket.hh:129
Direction direction_
Direction of the socket.
Definition Socket.hh:127

◆ Socket() [2/3]

TTAMachine::Socket::Socket ( const ObjectState state)

Constructor.

Loads the state of the socket from the given ObjectState instance but does not create connections to other components.

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

Definition at line 82 of file Socket.cc.

◆ ~Socket()

TTAMachine::Socket::~Socket ( )
virtual

Destructor.

Definition at line 88 of file Socket.cc.

88 {
91}
static void deleteAllItems(ContainerType &aMap)
virtual void unsetMachine()
Definition Socket.cc:443
ConnectionTable busses_
Contains all connections to busses.
Definition Socket.hh:131

References busses_, AssocTools::deleteAllItems(), and unsetMachine().

Here is the call graph for this function:

◆ Socket() [3/3]

TTAMachine::Socket::Socket ( const Socket )
private

Copying forbidden.

Member Function Documentation

◆ attachBus()

void TTAMachine::Socket::attachBus ( Segment bus)

Attaches a bus to the socket.

If no bus is currently attached, the direction of the socket is set to Socket::INPUT or Socket::OUTPUT. When possible, the direction is set to Socket::INPUT. Otherwise, it is set to Socket::OUTPUT.

Parameters
busThe segment of a bus being attached.
Exceptions
IllegalRegistrationIf the bus is not registered to the same machine as the socket.
IllegalConnectivityIf the socket is attached to ports in such a way that its direction cannot be either input or output.

Definition at line 166 of file Socket.cc.

166 {
167 const string procName = "Socket::attachBus";
168
169 ensureRegistration(*bus.parentBus());
170 MachineTester& tester = machine()->machineTester();
171 if (!tester.canConnect(*this, bus)) {
173 *this, bus, tester);
174 throw IllegalConnectivity(__FILE__, __LINE__, procName, errorMsg);
175 }
176
177 if (!bus.isConnectedTo(*this)) {
178 const Connection* conn = new Connection(*this, bus);
179 busses_.push_back(conn);
180 bus.attachSocket(*this);
181 } else {
182 assert(false);
183 }
184
185 // set the direction
186 if (direction_ == UNKNOWN) {
187 if (tester.canSetDirection(*this, INPUT)) {
189 } else if (tester.canSetDirection(*this, OUTPUT)) {
191 } else {
192 string errorMsg = "Direction of the socket cannot be set.";
194 __FILE__, __LINE__, procName, errorMsg);
196 }
197 }
198}
#define assert(condition)
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)
static std::string socketSegmentConnectionError(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment, const MachineTester &tester)
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
virtual bool canSetDirection(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
virtual Machine * machine() const
virtual void ensureRegistration(const Component &component) const
MachineTester & machineTester() const
Definition Machine.cc:671
void setDirection(Direction direction)
Definition Socket.cc:130

References Application::abortProgram(), assert, TTAMachine::Segment::attachSocket(), busses_, MachineTester::canConnect(), MachineTester::canSetDirection(), direction_, TTAMachine::Component::ensureRegistration(), INPUT, TTAMachine::Segment::isConnectedTo(), TTAMachine::Component::machine(), TTAMachine::Machine::machineTester(), OUTPUT, TTAMachine::Segment::parentBus(), setDirection(), MachineTestReporter::socketSegmentConnectionError(), UNKNOWN, and Application::writeToErrorLog().

Referenced by ADFCombiner::addBuses(), SimpleICOptimizer::addConnections(), TTAMachine::Segment::attachSocket(), FullyConnectedCheck::attachSocketToAllBusses(), BlocksGCU::BlocksGCU(), ADFCombiner::connectVectorLSU(), UniversalMachine::construct(), BlocksTranslator::CreateConnection(), ADFCombiner::createPortsAndSockets(), SocketBusConnCmd::Do(), VLIWConnectIC::explore(), loadState(), and SocketDialog::onAttach().

Here is the call graph for this function:

◆ attachPort()

void TTAMachine::Socket::attachPort ( Port port)
private

Notifies the socket that a port has been attached to it.

Private helper method used only by friend class Port.

Parameters
portThe port that has been attached to this socket.

Definition at line 618 of file Socket.cc.

618 {
619 ports_.push_back(&port);
620}
Port * port(int index) const
Definition Socket.cc:266
PortTable ports_
Contains all connections to ports.
Definition Socket.hh:133

References port(), and ports_.

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

Here is the call graph for this function:

◆ connectedBuses() [1/2]

std::set< Bus * > TTAMachine::Socket::connectedBuses ( )

Returns set of buses where the socket is connected to.

Definition at line 368 of file Socket.cc.

368 {
369 set<Bus*> result;
370 for (const Connection* conn : busses_) {
371 result.insert(conn->bus()->parentBus());
372 }
373
374 return result;
375}

References busses_.

◆ connectedBuses() [2/2]

const std::set< Bus * > TTAMachine::Socket::connectedBuses ( ) const

Returns set of buses where the socket is connected to.

Definition at line 381 of file Socket.cc.

381 {
382 set<Bus*> result;
383 for (const Connection* conn : busses_) {
384 result.insert(conn->bus()->parentBus());
385 }
386
387 return result;
388}

References busses_.

◆ connection()

const Connection & TTAMachine::Socket::connection ( const Segment bus) const

Returns the Connection object which connects this socket and the given segment.

This method is not intended for clients. Do not use this method. The connection must exist before calling this function.

Parameters
busThe segment of a bus which is attached to this socket.
Returns
Connection object which joins the socket and the segment.

Definition at line 302 of file Socket.cc.

302 {
303
304 ConnectionTable::const_iterator iter = busses_.begin();
305 while (iter != busses_.end()) {
306 if ((*iter)->bus() == &bus) {
307 return **iter;
308 } else {
309 iter++;
310 }
311 }
312
313 string errorMsg = "The requested Connection object does not exist in "
314 "Socket.";
315 string procName = "Socket::connection";
316 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
318
319 // this return statement is only to avoid warning in Solaris environment
320 return **iter;
321}

References Application::abortProgram(), busses_, and Application::writeToErrorLog().

Referenced by TTAMachine::Segment::attachSocket(), detachBus(), and removeConnection().

Here is the call graph for this function:

◆ dataPortWidth()

const std::string & TTAMachine::Socket::dataPortWidth ( ) const

Definition at line 415 of file Socket.cc.

415 {
416 return dataPortWidth_;
417}

References dataPortWidth_.

Referenced by DefaultICGenerator::writeInterconnectionNetwork().

◆ detachAllBuses()

void TTAMachine::Socket::detachAllBuses ( )
private

Detaches all the buses from this socket.

Definition at line 640 of file Socket.cc.

640 {
641 while (busses_.size() > 0) {
642 Segment* bus = busses_[0]->bus();
643 detachBus(*bus);
644 }
645}
void detachBus(Segment &bus)
Definition Socket.cc:213

References busses_, and detachBus().

Referenced by loadState(), and unsetMachine().

Here is the call graph for this function:

◆ detachAllPorts()

void TTAMachine::Socket::detachAllPorts ( )

Detaches all ports from the socket.

Definition at line 278 of file Socket.cc.

278 {
279 PortTable::iterator iter = ports_.begin();
280 while (iter != ports_.end()) {
281 // removes the socket from ports_
282 (*iter)->detachSocket(*this);
283 iter = ports_.begin();
284 }
285 ports_.clear();
286}

References ports_.

Referenced by unsetMachine().

◆ detachBus() [1/2]

void TTAMachine::Socket::detachBus ( Bus bus)

Detaches all the segments of the given bus from the socket.

If there are no buses connected to the socket after detaching the given bus, the direction of the socket is set to Socket::UNKNOWN. Note that detaching the bus may affect to the value of maximum simultaneous register reads of register files connected to the socket.

Parameters
busBus to be detached.

Definition at line 244 of file Socket.cc.

244 {
245 int segments = bus.segmentCount();
246 for (int i = 0; i < segments; i++) {
247 Segment* segment = bus.segment(i);
248 if (isConnectedTo(*segment)) {
250 }
251 }
252}
bool isConnectedTo(const Bus &bus) const
Definition Socket.cc:331
Segment * segment(int index) const
Definition Socket.cc:401

References detachBus(), isConnectedTo(), TTAMachine::Bus::segment(), segment(), and TTAMachine::Bus::segmentCount().

Here is the call graph for this function:

◆ detachBus() [2/2]

void TTAMachine::Socket::detachBus ( Segment bus)

Detaches the given segment of a bus from the socket.

If there are no buses connected to the socket after detaching the given segment, the direction of the socket is set to Socket::UNKNOWN. Note that detaching a segment may affect to the value of maximum simultaneous register reads of register files connected to the socket.

Parameters
busThe segment to be detached.
Exceptions
InstanceNotFoundIf the given segment is not attached to the socket.

Definition at line 213 of file Socket.cc.

213 {
214 if (!isConnectedTo(bus)) {
215 string procName = "Socket::detachBus";
216 throw InstanceNotFound(__FILE__, __LINE__, procName);
217 }
218
219 const Connection& conn = connection(bus);
220 removeConnection(&conn);
221
222 if (bus.isConnectedTo(*this)) {
223 bus.detachSocket(*this);
224 delete &conn;
225 }
226
227 // set socket direction to unknown if it has no connections to buses
228 if (segmentCount() == 0) {
230 }
231}
void removeConnection(const Connection *connection)
Definition Socket.cc:605
const Connection & connection(const Segment &bus) const
Definition Socket.cc:302
int segmentCount() const

References connection(), TTAMachine::Segment::detachSocket(), direction_, isConnectedTo(), TTAMachine::Segment::isConnectedTo(), removeConnection(), segmentCount(), and UNKNOWN.

Referenced by detachAllBuses(), detachBus(), TTAMachine::Segment::detachSocket(), SocketBusConnCmd::Do(), SocketDialog::onDetach(), SimpleICOptimizer::removeAllConnections(), and TTAMachine::Connection::~Connection().

Here is the call graph for this function:

◆ detachPort()

void TTAMachine::Socket::detachPort ( const Port port)
private

Notifies the socket that a port has been detached from it.

Private helper method used only by friend class Port.

Parameters
portThe port that has been detached from this socket.

Definition at line 631 of file Socket.cc.

631 {
633}
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)

References port(), ports_, and ContainerTools::removeValueIfExists().

Referenced by TTAMachine::Port::detachAllSockets(), and TTAMachine::Port::detachSocket().

Here is the call graph for this function:

◆ direction()

Direction TTAMachine::Socket::direction ( ) const

Referenced by DefaultICGenerator::addICToNetlist(), BEMGenerator::addPortCodes(), TTAMachine::Port::attachSocket(), InputPSocketBroker::buildResources(), OutputPSocketBroker::buildResources(), DefaultICGenerator::busAltSignal(), DefaultDecoderGenerator::busCntrlSignalPinOfSocket(), DefaultDecoderGenerator::busControlWidth(), DefaultICDecoderEstimator::busParameters(), MachineTester::canConnect(), MachineTester::canSetDirection(), BEMValidator::checkDestinationField(), BEMValidator::checkSourceField(), DefaultDecoderGenerator::completeDecoderBlock(), SocketFactory::createEditPart(), TTAProgram::TPEFProgramFactory::createInstruction(), DefaultDecoderGenerator::dataControlWidth(), DefaultICDecoderEstimator::delayOfSocket(), SocketBusConnCmd::Do(), DefaultICDecoderEstimator::estimateICArea(), DefaultICDecoderEstimator::estimateICEnergy(), BlocksConnectIC::explore(), VLIWConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), DefaultICGenerator::generateSocketsAndMuxes(), TTAMachine::Port::inputSocket(), DefaultICGenerator::inputSocketControlValue(), DefaultICGenerator::inputSocketDataPortWidth(), DefaultICGenerator::inputSockets(), loadState(), DefaultICGenerator::maxOutputSocketDataPortWidth(), DefaultDecoderGenerator::needsBusControl(), DefaultDecoderGenerator::needsDataControl(), BEMValidator::needsSourceField(), TTAMachine::Port::outputSocket(), DefaultICGenerator::outputSocketCntrlPinForSegment(), DefaultICGenerator::outputSocketDataControlValue(), DefaultICGenerator::outputSocketDataPortWidth(), DefaultICGenerator::outputSockets(), setDirection(), BEMGenerator::socket(), BEMGenerator::socketCount(), DefaultICGenerator::socketEntityName(), DefaultICGenerator::socketIsGenerated(), DefaultICDecoderEstimator::socketParameters(), SocketDialog::updateDirection(), IUPortDialog::updateSocket(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), SRPortDialog::updateSockets(), DefaultDecoderGenerator::writeBusControlRulesOfOutputSocket(), DefaultICGenerator::writeInterconnectionNetwork(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().

◆ hasDataPortWidth()

bool TTAMachine::Socket::hasDataPortWidth ( ) const

Definition at line 410 of file Socket.cc.

410 {
411 return !dataPortWidth_.empty();
412}

References dataPortWidth_.

Referenced by DefaultICGenerator::writeInterconnectionNetwork().

◆ isConnectedTo() [1/2]

bool TTAMachine::Socket::isConnectedTo ( const Bus bus) const

◆ isConnectedTo() [2/2]

bool TTAMachine::Socket::isConnectedTo ( const Segment bus) const

Checks whether the socket is connected to the given segment.

Parameters
busSegment of a bus.
Returns
True if connected, otherwise false.

Definition at line 350 of file Socket.cc.

350 {
351
352 ConnectionTable::const_iterator iter = busses_.begin();
353 while (iter != busses_.end()) {
354 if ((*iter)->bus() == &bus) {
355 return true;
356 } else {
357 iter++;
358 }
359 }
360
361 return false;
362}

References busses_.

◆ loadState()

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

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the machine already has a socket by the same name as the new name of this socket or if the given ObjectState tree is invalid.

Reimplemented from TTAMachine::Component.

Definition at line 502 of file Socket.cc.

502 {
503 string procName = "Socket::loadState";
504 MOMTextGenerator textGenerator;
505
506 if (state->name() != OSNAME_SOCKET) {
507 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
508 }
509
511
512 // load connections to busses
514
515 try {
516
517 for (int childIndex = 0; childIndex < state->childCount();
518 childIndex++) {
519 ObjectState* child = state->child(childIndex);
520
521 if (child->name() == Connection::OSNAME_CONNECTION) {
522 string busName =
524 string segmentName =
526
527 if (!isRegistered()) {
528 format text = textGenerator.text(
530 text % name();
532 __FILE__, __LINE__, procName, text.str());
533 }
534
536 Bus* bus = NULL;
537 Segment* segment = NULL;
538
539 try {
540 bus = busNav.item(busName);
541 } catch (InstanceNotFound&) {
542 format text = textGenerator.text(
544 text % busName % name();
546 __FILE__, __LINE__, procName, text.str());
547 }
548
549 try {
550 segment = bus->segment(segmentName);
551 } catch (InstanceNotFound&) {
552 format text = textGenerator.text(
554 text % name() % segmentName % busName;
556 __FILE__, __LINE__, procName, text.str());
557 }
558
560
561 } else {
563 __FILE__, __LINE__, procName);
564 }
565 }
566
567 } catch (const Exception& exception) {
569 __FILE__, __LINE__, procName, exception.errorMessage());
570 }
571
572 // load direction
573 string direction("");
574 try {
576 if (direction == OSVALUE_INPUT) {
578 } else if (direction == OSVALUE_OUTPUT) {
580 } else if (direction == OSVALUE_UNKNOWN) {
581 if (segmentCount() > 0) {
582 format text = textGenerator.text(
584 TXT_UNKNOWN_SOCKET_DIR_AND_SEGMENT_CONN);
586 __FILE__, __LINE__, procName, text.str());
587 }
589 } else {
590 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
591 }
592
593 } catch (const Exception& exception) {
595 __FILE__, __LINE__, procName, exception.errorMessage());
596 }
597}
std::string errorMessage() const
Definition Exception.cc:123
ObjectState * child(int index) const
std::string stringAttribute(const std::string &name) const
std::string name() const
int childCount() const
virtual void loadState(const ObjectState *state)
virtual bool isRegistered() const
static const std::string OSKEY_SEGMENT
ObjectState attribute key for segment name.
Definition Connection.hh:64
static const std::string OSKEY_BUS
ObjectState attribute key for bus name.
Definition Connection.hh:62
static const std::string OSNAME_CONNECTION
ObjectState name for Connection.
Definition Connection.hh:58
Navigator< Bus > BusNavigator
Navigator type for BusNavigator.
Definition Machine.hh:213
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
static const std::string OSVALUE_INPUT
ObjectState attribute value for input direction.
Definition Socket.hh:104
static const std::string OSNAME_SOCKET
ObjectState name for socket.
Definition Socket.hh:100
static const std::string OSKEY_DIRECTION
ObjectState attribute key for socket direction.
Definition Socket.hh:102
Direction direction() const
void detachAllBuses()
Definition Socket.cc:640
static const std::string OSVALUE_OUTPUT
ObjectState attribute value for output direction.
Definition Socket.hh:106
void attachBus(Segment &bus)
Definition Socket.cc:166
static const std::string OSVALUE_UNKNOWN
ObjectState attribute value for unknown direction.
Definition Socket.hh:108
virtual boost::format text(int textId)

References attachBus(), TTAMachine::Machine::busNavigator(), ObjectState::child(), ObjectState::childCount(), detachAllBuses(), direction(), direction_, Exception::errorMessage(), INPUT, TTAMachine::Component::isRegistered(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::loadState(), TTAMachine::Component::machine(), TTAMachine::Component::name(), ObjectState::name(), TTAMachine::Connection::OSKEY_BUS, OSKEY_DIRECTION, TTAMachine::Connection::OSKEY_SEGMENT, TTAMachine::Connection::OSNAME_CONNECTION, OSNAME_SOCKET, OSVALUE_INPUT, OSVALUE_OUTPUT, OSVALUE_UNKNOWN, OUTPUT, TTAMachine::Bus::segment(), segment(), segmentCount(), setDirection(), ObjectState::stringAttribute(), Texts::TextGenerator::text(), MOMTextGenerator::TXT_SOCKET_REF_LOAD_ERR, MOMTextGenerator::TXT_SOCKET_REF_LOAD_ERR_BUS, MOMTextGenerator::TXT_SOCKET_REF_LOAD_ERR_SEGMENT, and UNKNOWN.

Referenced by PasteComponentCmd::Do(), TTAMachine::Machine::loadState(), and SocketDialog::onAttach().

Here is the call graph for this function:

◆ operator=()

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

Assingment forbidden.

◆ port()

Port * TTAMachine::Socket::port ( int  index) const

Returns a port by the given index.

The given index must be greater or equal to 0 and less than the number of ports attached to the socket.

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

Definition at line 266 of file Socket.cc.

266 {
267 if (index < 0 || index >= portCount()) {
268 string procName = "Socket::port";
269 throw OutOfRange(__FILE__, __LINE__, procName);
270 }
271 return ports_[index];
272}
int portCount() const

References portCount(), and ports_.

Referenced by DefaultICGenerator::addICToNetlist(), BEMGenerator::addPortCodes(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), attachPort(), DefaultICDecoderEstimator::busParameters(), BEMValidator::checkSocketCodeTable(), TTAProgram::TPEFProgramFactory::createInstruction(), DefaultICDecoderGenerator::dataPortWidth(), detachPort(), SocketBusConnCmd::Do(), BlocksConnectIC::explore(), VLIWConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), BEMGenerator::haveEqualConnections(), DefaultICGenerator::inputSocketDataPortWidth(), MachineTester::legalPortConnections(), DefaultICGenerator::maxOutputSocketDataPortWidth(), BEMValidator::needsSocketCodeTable(), BEMGenerator::needsSocketCodeTable(), DefaultICGenerator::outputSocketDataControlValue(), DefaultICGenerator::outputSocketDataPortWidth(), SimpleICOptimizer::removeAllConnections(), TTAProgram::TPEFProgramFactory::resolveSocketAllocations(), InputPSocketBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), DefaultICDecoderEstimator::socketParameters(), ConnectionSweeper::sweepBypasses(), ConnectionSweeper::sweepRFs(), and DefaultICGenerator::writeInterconnectionNetwork().

Here is the call graph for this function:

◆ portCount()

int TTAMachine::Socket::portCount ( ) const

Referenced by DefaultICGenerator::addICToNetlist(), BEMGenerator::addPortCodes(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), DefaultICDecoderEstimator::busParameters(), BEMValidator::checkDestinationField(), BEMValidator::checkSocketCodeTable(), BEMValidator::checkSourceField(), DefaultDecoderGenerator::completeDecoderBlock(), TTAProgram::TPEFProgramFactory::createInstruction(), DefaultDecoderGenerator::dataControlWidth(), DefaultICDecoderGenerator::dataPortWidth(), SocketBusConnCmd::Do(), BlocksConnectIC::explore(), VLIWConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), DefaultICGenerator::generateSocketsAndMuxes(), BEMGenerator::haveEqualConnections(), DefaultICGenerator::inputSocketDataPortWidth(), MachineTester::legalPortConnections(), DefaultICGenerator::maxOutputSocketDataPortWidth(), DefaultDecoderGenerator::needsBusControl(), DefaultDecoderGenerator::needsDataControl(), BEMValidator::needsSocketCodeTable(), BEMGenerator::needsSocketCodeTable(), BEMValidator::needsSourceField(), DefaultICGenerator::outputSocketDataControlValue(), DefaultICGenerator::outputSocketDataPortWidth(), port(), SimpleICOptimizer::removeAllConnections(), TTAProgram::TPEFProgramFactory::resolveSocketAllocations(), InputPSocketBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), DefaultICGenerator::socketEntityName(), DefaultICGenerator::socketIsGenerated(), DefaultICDecoderEstimator::socketParameters(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultICGenerator::writeInterconnectionNetwork(), DefaultDecoderGenerator::writeRulesForSourceControlSignals(), and DefaultDecoderGenerator::writeSocketCntrlSignals().

◆ removeConnection()

void TTAMachine::Socket::removeConnection ( const Connection connection)
private

Removes a connection from the connection table.

Parameters
connectionThe connection to be removed.

Definition at line 605 of file Socket.cc.

References busses_, connection(), and ContainerTools::removeValueIfExists().

Referenced by detachBus().

Here is the call graph for this function:

◆ saveState()

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

Saves the contents of the socket to an ObjectState object.

Returns
The newly created ObjectState object.

Reimplemented from TTAMachine::Component.

Definition at line 465 of file Socket.cc.

465 {
466
468 root->setName(OSNAME_SOCKET);
469
470 // set direction
471 if (direction_ == INPUT) {
473 } else if (direction_ == OUTPUT) {
475 } else {
477 }
478
479 // add connections
480 ConnectionTable::const_iterator iter = busses_.begin();
481 while (iter != busses_.end()) {
482 const Connection* conn = *iter;
483 ObjectState* bus = conn->saveState();
484 root->addChild(bus);
485 iter++;
486 }
487
488 return root;
489}
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void addChild(ObjectState *child)
virtual ObjectState * saveState() const

References ObjectState::addChild(), busses_, direction_, INPUT, OSKEY_DIRECTION, OSNAME_SOCKET, OSVALUE_INPUT, OSVALUE_OUTPUT, OSVALUE_UNKNOWN, OUTPUT, TTAMachine::Connection::saveState(), TTAMachine::Component::saveState(), ObjectState::setAttribute(), and ObjectState::setName().

Referenced by SocketDialog::onAttach().

Here is the call graph for this function:

◆ segment()

Segment * TTAMachine::Socket::segment ( int  index) const

By the given index, returns the segment a socket is connected to.

The given index must be greater or equal to 0 and smaller than the number of segments attached to the socket.

Parameters
indexThe index.
Returns
Segment by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 401 of file Socket.cc.

401 {
402 if (index < 0 || index >= segmentCount()) {
403 string procName = "Socket::segment";
404 throw OutOfRange(__FILE__, __LINE__, procName);
405 }
406 return busses_[index]->bus();
407}

References busses_, and segmentCount().

Referenced by MachineConnectivityCheck::appendConnectedDestinationBuses(), MachineConnectivityCheck::appendConnectedSourceBuses(), MachineConnectivityCheck::busConnectedToPort(), MachineConnectivityCheck::canWriteAllImmediates(), DefaultDecoderGenerator::connectedBuses(), BlocksTranslator::CreateConnection(), detachBus(), DefaultICGenerator::inputSocketControlValue(), loadState(), DefaultICGenerator::outputSocketCntrlPinForSegment(), InputPSocketBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), DefaultICDecoderEstimator::socketParameters(), SocketDialog::updateConnected(), and DefaultICGenerator::writeInterconnectionNetwork().

Here is the call graph for this function:

◆ segmentCount()

int TTAMachine::Socket::segmentCount ( ) const

◆ setDataPortWidth()

void TTAMachine::Socket::setDataPortWidth ( const std::string &  width)

Definition at line 420 of file Socket.cc.

420 {
421 dataPortWidth_ = width;
422}

References dataPortWidth_.

Referenced by DefaultICGenerator::addICToNetlist().

◆ setDirection()

void TTAMachine::Socket::setDirection ( Direction  direction)

Sets the direction of the socket.

The given direction must be either Socket::INPUT or Socket::OUTPUT.

Parameters
directionThe new direction.
Exceptions
IllegalConnectivityIf the direction of the port cannot be changed.

Definition at line 130 of file Socket.cc.

130 {
131 const string procName = "Socket::setDirection";
132
133 if (!isRegistered()) {
134 MOMTextGenerator textGenerator;
135 format text = textGenerator.text(
137 text % name();
138 throw IllegalConnectivity(__FILE__, __LINE__, procName, text.str());
139 }
140
141 MachineTester& tester = machine()->machineTester();
142 if (tester.canSetDirection(*this, direction)) {
144 } else {
146 *this, direction, tester);
147 throw IllegalConnectivity(__FILE__, __LINE__, procName, errorMsg);
148 }
149}
static std::string socketDirectionSettingError(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction, const MachineTester &tester)

References MachineTester::canSetDirection(), direction(), direction_, TTAMachine::Component::isRegistered(), TTAMachine::Component::machine(), TTAMachine::Machine::machineTester(), TTAMachine::Component::name(), MachineTestReporter::socketDirectionSettingError(), Texts::TextGenerator::text(), and MOMTextGenerator::TXT_SET_DIR_SOCKET_NOT_REGISTERED.

Referenced by ADFCombiner::addBuses(), SimpleICOptimizer::addConnections(), attachBus(), BlocksGCU::BlocksGCU(), ADFCombiner::connectVectorLSU(), UniversalMachine::construct(), BlocksTranslator::CreateConnection(), ADFCombiner::createPortsAndSockets(), FullyConnectedCheck::createSocket(), SocketBusConnCmd::Do(), BlocksConnectIC::explore(), VLIWConnectIC::explore(), loadState(), and SocketDialog::onDirection().

Here is the call graph for this function:

◆ setMachine()

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

Registers the socket to a machine.

Parameters
machMachine to which the socket is to be registered.
Exceptions
ComponentAlreadyExistsIf there already is another socket by the same name in the machine.

Implements TTAMachine::Component.

Definition at line 432 of file Socket.cc.

432 {
433 internalSetMachine(mach);
434 mach.addSocket(*this);
435}
void internalSetMachine(Machine &machine)

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

Referenced by FullyConnectedCheck::createSocket(), and AddSocketCmd::Do().

Here is the call graph for this function:

◆ setName()

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

Sets the name of the socket.

Parameters
nameNew name of the socket.
Exceptions
ComponentAlreadyExistsIf a socket with the given name is already in the same machine.
InvalidNameIf the given name is not valid for a component.

Reimplemented from TTAMachine::Component.

Definition at line 103 of file Socket.cc.

103 {
104 if (name == this->name()) {
105 return;
106 }
107
108 if (machine() != NULL) {
109 if (machine()->socketNavigator().hasItem(name)) {
110 string procName = "Socket::setName";
111 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
112 } else {
114 }
115 } else {
117 }
118}
virtual void setName(const std::string &name)

References TTAMachine::Component::machine(), TTAMachine::Component::name(), and TTAMachine::Component::setName().

Referenced by SocketDialog::onOK().

Here is the call graph for this function:

◆ unsetMachine()

void TTAMachine::Socket::unsetMachine ( )
virtual

Removes the socket from the machine it is registered to.

Detaches all the busses and ports attached to the socket.

Implements TTAMachine::Component.

Definition at line 443 of file Socket.cc.

443 {
444
445 if (machine() == NULL) {
446 return;
447 }
448
449 Machine* mach = machine();
451
454
455 mach->removeSocket(*this);
456}
void detachAllPorts()
Definition Socket.cc:278

References detachAllBuses(), detachAllPorts(), TTAMachine::Component::internalUnsetMachine(), TTAMachine::Component::machine(), and TTAMachine::Machine::removeSocket().

Referenced by ~Socket().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ Port

friend class Port
friend

Definition at line 136 of file Socket.hh.

Member Data Documentation

◆ busses_

ConnectionTable TTAMachine::Socket::busses_
private

Contains all connections to busses.

Definition at line 131 of file Socket.hh.

Referenced by attachBus(), connectedBuses(), connectedBuses(), connection(), detachAllBuses(), isConnectedTo(), removeConnection(), saveState(), segment(), and ~Socket().

◆ dataPortWidth_

std::string TTAMachine::Socket::dataPortWidth_
private

Dataport width.

Definition at line 129 of file Socket.hh.

Referenced by dataPortWidth(), hasDataPortWidth(), and setDataPortWidth().

◆ direction_

Direction TTAMachine::Socket::direction_
private

Direction of the socket.

Definition at line 127 of file Socket.hh.

Referenced by attachBus(), detachBus(), loadState(), saveState(), and setDirection().

◆ OSKEY_DIRECTION

const string TTAMachine::Socket::OSKEY_DIRECTION = "direction"
static

ObjectState attribute key for socket direction.

Definition at line 102 of file Socket.hh.

Referenced by loadState(), saveState(), ADFSerializer::socketToMachine(), and ADFSerializer::socketToMDF().

◆ OSNAME_SOCKET

const string TTAMachine::Socket::OSNAME_SOCKET = "socket"
static

◆ OSVALUE_INPUT

const string TTAMachine::Socket::OSVALUE_INPUT = "input"
static

ObjectState attribute value for input direction.

Definition at line 104 of file Socket.hh.

Referenced by loadState(), saveState(), ADFSerializer::socketToMachine(), and ADFSerializer::socketToMDF().

◆ OSVALUE_OUTPUT

const string TTAMachine::Socket::OSVALUE_OUTPUT = "output"
static

ObjectState attribute value for output direction.

Definition at line 106 of file Socket.hh.

Referenced by loadState(), saveState(), ADFSerializer::socketToMachine(), and ADFSerializer::socketToMDF().

◆ OSVALUE_UNKNOWN

const string TTAMachine::Socket::OSVALUE_UNKNOWN = "unknown"
static

ObjectState attribute value for unknown direction.

Definition at line 108 of file Socket.hh.

Referenced by loadState(), saveState(), and ADFSerializer::socketToMachine().

◆ ports_

PortTable TTAMachine::Socket::ports_
private

Contains all connections to ports.

Definition at line 133 of file Socket.hh.

Referenced by attachPort(), detachAllPorts(), detachPort(), and port().


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