OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MachineTester Class Reference

#include <MachineTester.hh>

Inheritance diagram for MachineTester:
Inheritance graph
Collaboration diagram for MachineTester:
Collaboration graph

Public Member Functions

 MachineTester (const TTAMachine::Machine &machine)
 
virtual ~MachineTester ()
 
virtual bool canConnect (const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
 
virtual bool canConnect (const TTAMachine::Socket &socket, const TTAMachine::Port &port)
 
virtual bool canBridge (const TTAMachine::Bus &source, const TTAMachine::Bus &destination)
 
virtual bool canSetDirection (const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
 
bool connectionExists () const
 
bool illegalRegistration () const
 
bool loop () const
 
TTAMachine::BusbranchedBus () const
 
bool wrongSocketDirection () const
 
bool maxConnections () const
 
bool unknownSocketDirection () const
 
bool noConnections () const
 
TTAMachine::PortsameDirSocketConnection (TTAMachine::Socket::Direction direction) const
 
TTAMachine::PortforbiddenSocketDirection (TTAMachine::Socket::Direction direction) const
 
bool registerFilePortAlreadyConnected () const
 

Static Public Member Functions

static bool isValidComponentName (const std::string &name)
 

Private Member Functions

 MachineTester (const MachineTester &tester)
 
MachineTesteroperator= (const MachineTester &tester)
 
void clearState ()
 
bool legalPortConnections (const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
 

Static Private Member Functions

static bool areInSameChain (const TTAMachine::Bus &bus1, const TTAMachine::Bus &bus2)
 

Private Attributes

const TTAMachine::Machinemachine_
 The machine on which the tests are carried out.
 
bool connectionExists_
 Indicates if the reason for the last test failure is that the tested connection already exists.
 
bool rfPortAlreadyConnected_
 Indicates if the reason for failure is that a port of register file is already connected to a particular socket.
 
bool illegalRegistration_
 Indicates if the reason for last test failure was illegal registration.
 
bool loop_
 Indicates if the reason for failure when trying to bridge two busses is that a loop in the bus chain would be created.
 
const TTAMachine::BusbranchedBus_
 If the reason for failure when trying to bridge two busses is that a branch in the bus chain would be created, this is the branched bus.
 
bool wrongSocketDirection_
 Indicates if the reason for failure when trying to connect a socket to a port was that the direction of the socket is incompatible with the direction of other sockets connected to the port.
 
bool maxConnections_
 Indicates if the reason for failure when trying to connect a socket to a port was that this connection would exceed the maximum number of connections allowed for a port.
 
bool unknownDir_
 Indicates if tried to set the socket direction to Socket::UNKNOWN.
 
bool noConnections_
 Indicates if the reason for failure when tried to set socket direction was that the socket has no segment connections.
 
TTAMachine::PortsameDirInputSocketConn_
 If the reason for failure when tried to set socket direction to input was that the socket is connected to a port that already has an input socket connected, this is the port.
 
TTAMachine::PortsameDirOutputSocketConn_
 If the reason for failure when tried to set socket direction to output was that the socket is connected to a port that already has an output socket connected, this is the port.
 
TTAMachine::PortforbiddenInputSocketDir_
 If the reason for failure when tried to set socket direction to input was the socket is connected to a unit that cannot be connected to an input socket, this is the port of the unit.
 

Detailed Description

MachineTester is a class that implements all the API needed for diagnostics of machine model.

Definition at line 46 of file MachineTester.hh.

Constructor & Destructor Documentation

◆ MachineTester() [1/2]

MachineTester::MachineTester ( const TTAMachine::Machine machine)

Constructor.

Parameters
machineThe machine on which the tests are done.

Definition at line 57 of file MachineTester.cc.

57 :
59
60 clearState();
61}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
const TTAMachine::Machine * machine_
The machine on which the tests are carried out.

References clearState().

Here is the call graph for this function:

◆ ~MachineTester()

MachineTester::~MachineTester ( )
virtual

Destructor.

Definition at line 67 of file MachineTester.cc.

67 {
68}

◆ MachineTester() [2/2]

MachineTester::MachineTester ( const MachineTester tester)
private

Member Function Documentation

◆ areInSameChain()

bool MachineTester::areInSameChain ( const TTAMachine::Bus bus1,
const TTAMachine::Bus bus2 
)
staticprivate

Checks if the given buses are in the same bus chain.

Parameters
bus1The first bus.
bus2The second bus.
Returns
True if they are in the same chain, otherwise false.

Definition at line 521 of file MachineTester.cc.

521 {
522
523 if (&bus1 == &bus2) {
524 return true;
525 }
526
527 const Bus* bus = &bus1;
528 while (bus->hasPreviousBus()) {
529 bus = bus->previousBus();
530 if (bus == &bus2) {
531 return true;
532 }
533 }
534
535 bus = &bus1;
536 while (bus->hasNextBus()) {
537 bus = bus->nextBus();
538 if (bus == &bus2) {
539 return true;
540 }
541 }
542
543 return false;
544}
virtual Bus * previousBus() const
Definition Bus.cc:518
virtual bool hasPreviousBus() const
Definition Bus.cc:473
virtual bool hasNextBus() const
Definition Bus.cc:488
virtual Bus * nextBus() const
Definition Bus.cc:501

References TTAMachine::Bus::hasNextBus(), TTAMachine::Bus::hasPreviousBus(), TTAMachine::Bus::nextBus(), and TTAMachine::Bus::previousBus().

Referenced by canBridge().

Here is the call graph for this function:

◆ branchedBus()

Bus * MachineTester::branchedBus ( ) const

If the reason for failure when tried to join two buses by a bridge was a branched bus chain, returns the bus that was going to be branched. Otherwise returns NULL.

Returns
The branched bus.

Definition at line 380 of file MachineTester.cc.

380 {
381 if (branchedBus_ == NULL) {
382 return NULL;
383 } else {
384 return const_cast<Bus*>(branchedBus_);
385 }
386}
const TTAMachine::Bus * branchedBus_
If the reason for failure when trying to bridge two busses is that a branch in the bus chain would be...

References branchedBus_.

Referenced by MachineTestReporter::bridgingError().

◆ canBridge()

bool MachineTester::canBridge ( const TTAMachine::Bus source,
const TTAMachine::Bus destination 
)
virtual

Checks if the given source and destination buses can be joined by a new bridge.

If the test has negative outcome, the reason for it can be queried using the following functions: illegalRegistration, loop, connectionExists, branchedBus.

Parameters
sourceThe source bus of the bridge.
destinationThe destination bus of the bridge.
Returns
True if the can be created, otherwise false.

Reimplemented in DummyMachineTester.

Definition at line 203 of file MachineTester.cc.

203 {
204
205 clearState();
206
207 // check registration of the buses
208 if (source.machine() != machine_ || destination.machine() != machine_) {
210 return false;
211 }
212
213 if (&source == &destination) {
214 return false;
215 }
216
217 // check if there already exists an equal bridge
218 if (source.canWrite(destination)) {
219 connectionExists_ = true;
220 return false;
221 } else if (destination.canWrite(source)) {
222 // if an opposite bridge already exists between the buses, the new
223 // bridge can be created
224 return true;
225 }
226
227 // check if a loop would be created
228
229 // Buses cannot be joined by a new bridge if they are already in the same
230 // chain and are not adjacent. If they are adjacent then it is possible
231 // to join them in order the create a bidirection bridge.
232 if (areInSameChain(source, destination)) {
233 bool adjacent = false;
234 if (source.hasNextBus()) {
235 if (source.nextBus() == &destination) {
236 adjacent = true;
237 }
238 }
239 if (source.hasPreviousBus()) {
240 if (source.previousBus() == &destination) {
241 adjacent = true;
242 }
243 }
244 if (!adjacent) {
245 loop_ = true;
246 return false;
247 }
248 }
249
250 // check that a branch will not be created
251 if (source.hasNextBus() && source.hasPreviousBus()) {
252 if (source.nextBus() != &destination &&
253 source.previousBus() != &destination) {
254 branchedBus_ = &source;
255 return false;
256 }
257 }
258 if (destination.hasNextBus() && destination.hasPreviousBus()) {
259 if (destination.nextBus() != &source &&
260 destination.previousBus() != &source) {
261 branchedBus_ = &destination;
262 return false;
263 }
264 }
265
266 return true;
267}
bool illegalRegistration_
Indicates if the reason for last test failure was illegal registration.
bool loop_
Indicates if the reason for failure when trying to bridge two busses is that a loop in the bus chain ...
bool connectionExists_
Indicates if the reason for the last test failure is that the tested connection already exists.
static bool areInSameChain(const TTAMachine::Bus &bus1, const TTAMachine::Bus &bus2)
virtual bool canWrite(const Bus &bus) const
Definition Bus.cc:558
virtual Machine * machine() const

References areInSameChain(), branchedBus_, TTAMachine::Bus::canWrite(), clearState(), connectionExists_, TTAMachine::Bus::hasNextBus(), TTAMachine::Bus::hasPreviousBus(), illegalRegistration_, loop_, TTAMachine::Component::machine(), machine_, TTAMachine::Bus::nextBus(), and TTAMachine::Bus::previousBus().

Referenced by TTAMachine::Bridge::Bridge(), AddBridgeCmd::Do(), TTAMachine::Bridge::loadState(), BridgeDialog::onInputBus(), BridgeDialog::onOK(), and BridgeDialog::updateBusChoices().

Here is the call graph for this function:

◆ canConnect() [1/2]

bool MachineTester::canConnect ( const TTAMachine::Socket socket,
const TTAMachine::Port port 
)
virtual

Checks if the given socket can be connected to the given port.

If false is returned, the reason for the test failure can be queried using the following functions: illegalRegistration, connectionExists, wrongSocketDirection, maxConnections.

Parameters
socketThe socket.
portThe port.
Returns
True if the connection can be made, otherwise false.

Reimplemented in DummyMachineTester.

Definition at line 127 of file MachineTester.cc.

127 {
128
129 clearState();
130
131 // check registration
132 if (socket.machine() != machine_ ||
133 port.parentUnit()->machine() != machine_) {
135 return false;
136 }
137
138 // check the existing connections of the port
139 Socket* inputSocket = port.inputSocket();
140 Socket* outputSocket = port.outputSocket();
141 Socket* firstUnconnected = port.unconnectedSocket(0);
142 Socket* secondUnconnected = port.unconnectedSocket(1);
143
144 if (inputSocket == &socket || outputSocket == &socket ||
145 firstUnconnected == &socket || secondUnconnected == &socket) {
146 connectionExists_ = true;
147 return false;
148 }
149
150 if ((inputSocket != NULL && socket.direction() == Socket::INPUT) ||
151 (outputSocket != NULL && socket.direction() == Socket::OUTPUT)) {
153 return false;
154 }
155 if (port.socketCount() == 2) {
156 maxConnections_ = true;
157 return false;
158 }
159
160 // check the special cases of allowed socket directions
161 Unit* parentUnit = port.parentUnit();
162 if (dynamic_cast<ImmediateUnit*>(parentUnit) != NULL) {
163 assert(port.socketCount() <= 1);
164 if (port.socketCount() == 1) {
165 maxConnections_ = true;
166 return false;
167 }
168 if (socket.direction() == Socket::INPUT) {
170 return false;
171 }
172 }
173
174 // ports of a register file cannot be connected to same socket
175 RegisterFile* parentRf = dynamic_cast<RegisterFile*>(parentUnit);
176 if (parentRf != NULL) {
177 for (int i = 0; i < parentRf->portCount(); i++) {
178 Port* rfPort = parentRf->port(i);
179 if (rfPort->isConnectedTo(socket)) {
181 return false;
182 }
183 }
184 }
185
186 return true;
187}
#define assert(condition)
bool wrongSocketDirection_
Indicates if the reason for failure when trying to connect a socket to a port was that the direction ...
bool maxConnections_
Indicates if the reason for failure when trying to connect a socket to a port was that this connectio...
bool rfPortAlreadyConnected_
Indicates if the reason for failure is that a port of register file is already connected to a particu...
virtual RFPort * port(const std::string &name) const
virtual Socket * outputSocket() const
Definition Port.cc:281
virtual int socketCount() const
Definition Port.cc:375
virtual Socket * unconnectedSocket(int index) const
Definition Port.cc:323
virtual bool isConnectedTo(const Socket &socket) const
Definition Port.cc:393
Unit * parentUnit() const
virtual Socket * inputSocket() const
Definition Port.cc:261
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59
Direction direction() const
virtual int portCount() const
Definition Unit.cc:135

References assert, clearState(), connectionExists_, TTAMachine::Socket::direction(), illegalRegistration_, TTAMachine::Socket::INPUT, TTAMachine::Port::inputSocket(), TTAMachine::Port::isConnectedTo(), TTAMachine::Component::machine(), machine_, maxConnections_, TTAMachine::Socket::OUTPUT, TTAMachine::Port::outputSocket(), TTAMachine::Port::parentUnit(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), rfPortAlreadyConnected_, TTAMachine::Port::socketCount(), TTAMachine::Port::unconnectedSocket(), and wrongSocketDirection_.

Here is the call graph for this function:

◆ canConnect() [2/2]

bool MachineTester::canConnect ( const TTAMachine::Socket socket,
const TTAMachine::Segment segment 
)
virtual

Tests if the given socket can be connected to the given segment.

After calling this function, the reason for a test failure can be queried. Functions for querying the possible reasons are: connectionExists, illegalRegistration, sameDirSocketConnection, forbiddenSocketDirection.

Note that only the first reason encountered is recorded.

Parameters
socketThe socket.
segmentThe segment.
Returns
True if the connection can be made.

Reimplemented in DummyMachineTester.

Definition at line 86 of file MachineTester.cc.

86 {
87
88 clearState();
89
90 if (socket.machine() != machine_) {
92 return false;
93 }
94 if (segment.parentBus()->machine() != machine_) {
96 return false;
97 }
98 if (socket.isConnectedTo(segment)) {
99 connectionExists_ = true;
100 return false;
101 }
102
103 // check that the direction of the socket can be set if needed
104 if (socket.segmentCount() == 0) {
105 if (!legalPortConnections(socket, Socket::INPUT) &&
107 return false;
108 }
109 }
110
111 return true;
112}
bool legalPortConnections(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
Bus * parentBus() const
bool isConnectedTo(const Bus &bus) const
Definition Socket.cc:331
int segmentCount() const

References clearState(), connectionExists_, illegalRegistration_, TTAMachine::Socket::INPUT, TTAMachine::Socket::isConnectedTo(), legalPortConnections(), TTAMachine::Component::machine(), machine_, TTAMachine::Socket::OUTPUT, TTAMachine::Segment::parentBus(), and TTAMachine::Socket::segmentCount().

Referenced by TTAMachine::Socket::attachBus(), TTAMachine::Port::attachSocket(), TTAMachine::Segment::attachSocket(), FullyConnectedCheck::attachSocketToAllBusses(), ProDePortEditPolicy::canHandle(), ProDeSegmentEditPolicy::canHandle(), ProDeSocketEditPolicy::canHandle(), RemoveUnconnectedComponents::checkFUPorts(), RemoveUnconnectedComponents::checkRFPorts(), FullyConnectedCheck::connectFUPort(), FullyConnectedCheck::connectIUPort(), FullyConnectedCheck::connectRFPort(), FullyConnectedCheck::connectSpecialRegisterPort(), SocketDialog::onAttach(), FullyConnectedCheck::socketAttachedToAllBusses(), SocketDialog::updateConnected(), IUPortDialog::updateSocket(), FUPortDialog::updateSockets(), RFPortDialog::updateSockets(), and SRPortDialog::updateSockets().

Here is the call graph for this function:

◆ canSetDirection()

bool MachineTester::canSetDirection ( const TTAMachine::Socket socket,
TTAMachine::Socket::Direction  direction 
)
virtual

Checks if the direction of the given socket can be set to the given value.

Takes into account the ports that are directly connected to the given socket only. The reason for error can be queried for using the following functions: unknownSocketDirection, noConnections, sameDirSocketConnection, forbiddenSocketDirection.

Parameters
socketThe socket.
directionThe new direction of the socket.
Returns
True if the direction can be set, otherwise false.

Reimplemented in DummyMachineTester.

Definition at line 283 of file MachineTester.cc.

285 {
286
287 clearState();
288
289 if (direction == Socket::UNKNOWN) {
290 unknownDir_ = true;
291 return false;
292 }
293 if (socket.segmentCount() == 0) {
294 noConnections_ = true;
295 return false;
296 }
297 if (direction == socket.direction()) {
298 return true;
299 }
300
301 return legalPortConnections(socket, direction);
302}
bool noConnections_
Indicates if the reason for failure when tried to set socket direction was that the socket has no seg...
bool unknownDir_
Indicates if tried to set the socket direction to Socket::UNKNOWN.
@ UNKNOWN
Unknown direction.
Definition Socket.hh:61

References clearState(), TTAMachine::Socket::direction(), legalPortConnections(), noConnections_, TTAMachine::Socket::segmentCount(), TTAMachine::Socket::UNKNOWN, and unknownDir_.

Referenced by TTAMachine::Socket::attachBus(), SocketDialog::onDirection(), and TTAMachine::Socket::setDirection().

Here is the call graph for this function:

◆ clearState()

void MachineTester::clearState ( )
private

Clears the state of the object.

Definition at line 497 of file MachineTester.cc.

497 {
498 connectionExists_ = false;
500 illegalRegistration_ = false;
501 loop_ = false;
502 branchedBus_ = NULL;
503 wrongSocketDirection_ = false;
504 maxConnections_ = false;
505 unknownDir_ = false;
506 noConnections_ = false;
510}
TTAMachine::Port * sameDirOutputSocketConn_
If the reason for failure when tried to set socket direction to output was that the socket is connect...
TTAMachine::Port * sameDirInputSocketConn_
If the reason for failure when tried to set socket direction to input was that the socket is connecte...
TTAMachine::Port * forbiddenInputSocketDir_
If the reason for failure when tried to set socket direction to input was the socket is connected to ...

References branchedBus_, connectionExists_, forbiddenInputSocketDir_, illegalRegistration_, loop_, maxConnections_, noConnections_, rfPortAlreadyConnected_, sameDirInputSocketConn_, sameDirOutputSocketConn_, unknownDir_, and wrongSocketDirection_.

Referenced by canBridge(), canConnect(), canConnect(), canSetDirection(), and MachineTester().

◆ connectionExists()

bool MachineTester::connectionExists ( ) const

Returns true if the reason for failure of the previous test was that a connection exists already between the components.

Returns
True if a connection exists, otherwise false.

Definition at line 342 of file MachineTester.cc.

342 {
343 return connectionExists_;
344}

References connectionExists_.

Referenced by TTAMachine::Port::attachSocket(), MachineTestReporter::bridgingError(), MachineTestReporter::socketPortConnectionError(), and MachineTestReporter::socketSegmentConnectionError().

◆ forbiddenSocketDirection()

Port * MachineTester::forbiddenSocketDirection ( TTAMachine::Socket::Direction  direction) const

If the reason for failure when tried to set socket direction was that the socket was connected to a port of a unit that doesn't allow sockets of such direction to be connected, returns the port. Otherwise returns NULL.

Parameters
directionThe direction that was tried to set.
Returns
The port.

Definition at line 471 of file MachineTester.cc.

471 {
472 if (direction == Socket::INPUT) {
474 } else {
475 return NULL;
476 }
477}

References forbiddenInputSocketDir_, and TTAMachine::Socket::INPUT.

Referenced by MachineTestReporter::socketDirectionSettingError(), and MachineTestReporter::socketSegmentConnectionError().

◆ illegalRegistration()

bool MachineTester::illegalRegistration ( ) const

Returns true if the reason for failure of the previous test was illegal registration of components.

Returns
True if the components were not registered to the same machine, otherwise false.

Definition at line 355 of file MachineTester.cc.

355 {
357}

References illegalRegistration_.

Referenced by MachineTestReporter::bridgingError(), MachineTestReporter::socketPortConnectionError(), and MachineTestReporter::socketSegmentConnectionError().

◆ isValidComponentName()

bool MachineTester::isValidComponentName ( const std::string &  name)
static

Checks whether the given string is a valid machine component name.

Parameters
nameThe name to check.
Returns
True if the name is valid, otherwise false.

Definition at line 312 of file MachineTester.cc.

312 {
313
314 if (name.length() == 0) {
315 return false;
316 }
317
318 for (unsigned int i = 0; i < name.length(); i++) {
319 char character = name[i];
320 if (i == 0) {
321 if (!isalpha(character)) {
322 return false;
323 }
324 } else {
325 if (!isalpha(character) && !isdigit(character) &&
326 character != '_' && character != ':') {
327 return false;
328 }
329 }
330 }
331 return true;
332}

Referenced by TTAMachine::ExecutionPipeline::checkResourceName(), TTAMachine::Component::Component(), TTAMachine::HWOperation::HWOperation(), TTAMachine::Port::loadStateWithoutReferences(), TTAMachine::Segment::loadStateWithoutReferences(), OperationDialog::onAddResource(), BusDialog::onAddSegment(), ImmediateSlotDialog::onAddSlot(), TemplateListDialog::onAddTemplate(), BridgeDialog::onOK(), BusDialog::onOK(), SocketDialog::onOK(), AddressSpaceDialog::onOK(), FUDialog::onOK(), FUPortDialog::onOK(), GCUDialog::onOK(), IUDialog::onOK(), IUPortDialog::onOK(), OperationDialog::onOK(), RFDialog::onOK(), RFPortDialog::onOK(), SRPortDialog::onOK(), TTAMachine::Port::Port(), TTAMachine::Segment::Segment(), TTAMachine::HWOperation::setName(), TTAMachine::Component::setName(), TTAMachine::PipelineElement::setName(), TTAMachine::Port::setName(), and TTAMachine::Segment::setName().

◆ legalPortConnections()

bool MachineTester::legalPortConnections ( const TTAMachine::Socket socket,
TTAMachine::Socket::Direction  direction 
)
private

Checks if the given socket will have legal connections to ports if its direction is changed to the given value.

Parameters
socketThe socket to test.
directionThe direction to test.
Returns
True if the connections will stay legal, otherwise false.

Definition at line 556 of file MachineTester.cc.

558 {
559
560 for (int i = 0; i < socket.portCount(); i++) {
561 Port* port = socket.port(i);
562 if (direction == Socket::INPUT && port->inputSocket() != NULL) {
564 return false;
565 } else if (direction == Socket::OUTPUT &&
566 port->outputSocket() != NULL) {
568 return false;
569 }
570 Unit* parent = port->parentUnit();
571 if (dynamic_cast<ImmediateUnit*>(parent) != NULL &&
572 direction == Socket::INPUT) {
574 return false;
575 }
576 }
577
578 return true;
579}
Port * port(int index) const
Definition Socket.cc:266
int portCount() const

References forbiddenInputSocketDir_, TTAMachine::Socket::INPUT, TTAMachine::Port::inputSocket(), TTAMachine::Socket::OUTPUT, TTAMachine::Port::outputSocket(), TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), sameDirInputSocketConn_, and sameDirOutputSocketConn_.

Referenced by canConnect(), and canSetDirection().

Here is the call graph for this function:

◆ loop()

bool MachineTester::loop ( ) const

If the reason for failure when tried to join two buses by a bridge was loop in bus chain, returns true. Otherwise returns false.

Returns
True, if loop was the reason for failure.

Definition at line 367 of file MachineTester.cc.

367 {
368 return loop_;
369}

References loop_.

Referenced by MachineTestReporter::bridgingError().

◆ maxConnections()

bool MachineTester::maxConnections ( ) const

Checks if maximum number of connections in port was the reason for failure when tried to attach a port to a socket.

Returns
True, if maximum number of connection was the reason, otherwise false.

Definition at line 410 of file MachineTester.cc.

410 {
411 return maxConnections_;
412}

References maxConnections_.

Referenced by MachineTestReporter::socketPortConnectionError().

◆ noConnections()

bool MachineTester::noConnections ( ) const

Returns true if the reason for failure when tried to set socket direction was that the socket has no connections to segments.

Returns
True if the socket has no connections to segments, otherwise false.

Definition at line 437 of file MachineTester.cc.

437 {
438 return noConnections_;
439}

References noConnections_.

Referenced by MachineTestReporter::socketDirectionSettingError().

◆ operator=()

MachineTester & MachineTester::operator= ( const MachineTester tester)
private

◆ registerFilePortAlreadyConnected()

bool MachineTester::registerFilePortAlreadyConnected ( ) const

Tells whether the reason for failure when tried to attach a port to a socket was that the parent unit of the port was register file and a port of the register file was already connected to the socket.

Returns
True if that was the reason, otherwise false.

Definition at line 488 of file MachineTester.cc.

488 {
490}

References rfPortAlreadyConnected_.

Referenced by MachineTestReporter::socketPortConnectionError().

◆ sameDirSocketConnection()

Port * MachineTester::sameDirSocketConnection ( TTAMachine::Socket::Direction  direction) const

If the reason for failure when tried to set socket direction was that the socket was connected to a port that was connected to another socket that has the same direction, returns that port. Otherwise returns NULL.

Parameters
directionThe direction that was tried to set.
Returns
The port.

Definition at line 451 of file MachineTester.cc.

451 {
452 if (direction == Socket::INPUT) {
454 } else if (direction == Socket::OUTPUT) {
456 } else {
457 return NULL;
458 }
459}

References TTAMachine::Socket::INPUT, TTAMachine::Socket::OUTPUT, sameDirInputSocketConn_, and sameDirOutputSocketConn_.

Referenced by MachineTestReporter::socketDirectionSettingError(), and MachineTestReporter::socketSegmentConnectionError().

◆ unknownSocketDirection()

bool MachineTester::unknownSocketDirection ( ) const

Returns true if the reason for failure when tried to set socket direction was unknown direction. The direction of socket can never be set to unknown.

Returns
True if the reason for failure was unknown socket direction, otherwise false.

Definition at line 424 of file MachineTester.cc.

424 {
425 return unknownDir_;
426}

References unknownDir_.

Referenced by MachineTestReporter::socketDirectionSettingError().

◆ wrongSocketDirection()

bool MachineTester::wrongSocketDirection ( ) const

Checks if wrong direction of socket was the reason for failure when tried to attach a port to a socket.

Returns
True, if wrong direction of socket was the reason, otherwise false.

Definition at line 397 of file MachineTester.cc.

397 {
399}

References wrongSocketDirection_.

Referenced by MachineTestReporter::socketPortConnectionError().

Member Data Documentation

◆ branchedBus_

const TTAMachine::Bus* MachineTester::branchedBus_
private

If the reason for failure when trying to bridge two busses is that a branch in the bus chain would be created, this is the branched bus.

Definition at line 109 of file MachineTester.hh.

Referenced by branchedBus(), canBridge(), and clearState().

◆ connectionExists_

bool MachineTester::connectionExists_
private

Indicates if the reason for the last test failure is that the tested connection already exists.

Definition at line 97 of file MachineTester.hh.

Referenced by canBridge(), canConnect(), canConnect(), clearState(), and connectionExists().

◆ forbiddenInputSocketDir_

TTAMachine::Port* MachineTester::forbiddenInputSocketDir_
private

If the reason for failure when tried to set socket direction to input was the socket is connected to a unit that cannot be connected to an input socket, this is the port of the unit.

Definition at line 134 of file MachineTester.hh.

Referenced by clearState(), forbiddenSocketDirection(), and legalPortConnections().

◆ illegalRegistration_

bool MachineTester::illegalRegistration_
private

Indicates if the reason for last test failure was illegal registration.

Definition at line 103 of file MachineTester.hh.

Referenced by canBridge(), canConnect(), canConnect(), clearState(), and illegalRegistration().

◆ loop_

bool MachineTester::loop_
private

Indicates if the reason for failure when trying to bridge two busses is that a loop in the bus chain would be created.

Definition at line 106 of file MachineTester.hh.

Referenced by canBridge(), clearState(), and loop().

◆ machine_

const TTAMachine::Machine* MachineTester::machine_
private

The machine on which the tests are carried out.

Definition at line 94 of file MachineTester.hh.

Referenced by canBridge(), canConnect(), and canConnect().

◆ maxConnections_

bool MachineTester::maxConnections_
private

Indicates if the reason for failure when trying to connect a socket to a port was that this connection would exceed the maximum number of connections allowed for a port.

Definition at line 117 of file MachineTester.hh.

Referenced by canConnect(), clearState(), and maxConnections().

◆ noConnections_

bool MachineTester::noConnections_
private

Indicates if the reason for failure when tried to set socket direction was that the socket has no segment connections.

Definition at line 122 of file MachineTester.hh.

Referenced by canSetDirection(), clearState(), and noConnections().

◆ rfPortAlreadyConnected_

bool MachineTester::rfPortAlreadyConnected_
private

Indicates if the reason for failure is that a port of register file is already connected to a particular socket.

Definition at line 100 of file MachineTester.hh.

Referenced by canConnect(), clearState(), and registerFilePortAlreadyConnected().

◆ sameDirInputSocketConn_

TTAMachine::Port* MachineTester::sameDirInputSocketConn_
private

If the reason for failure when tried to set socket direction to input was that the socket is connected to a port that already has an input socket connected, this is the port.

Definition at line 126 of file MachineTester.hh.

Referenced by clearState(), legalPortConnections(), and sameDirSocketConnection().

◆ sameDirOutputSocketConn_

TTAMachine::Port* MachineTester::sameDirOutputSocketConn_
private

If the reason for failure when tried to set socket direction to output was that the socket is connected to a port that already has an output socket connected, this is the port.

Definition at line 130 of file MachineTester.hh.

Referenced by clearState(), legalPortConnections(), and sameDirSocketConnection().

◆ unknownDir_

bool MachineTester::unknownDir_
private

Indicates if tried to set the socket direction to Socket::UNKNOWN.

Definition at line 119 of file MachineTester.hh.

Referenced by canSetDirection(), clearState(), and unknownSocketDirection().

◆ wrongSocketDirection_

bool MachineTester::wrongSocketDirection_
private

Indicates if the reason for failure when trying to connect a socket to a port was that the direction of the socket is incompatible with the direction of other sockets connected to the port.

Definition at line 113 of file MachineTester.hh.

Referenced by canConnect(), clearState(), and wrongSocketDirection().


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