OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
FullyConnectedCheck Class Reference

#include <FullyConnectedCheck.hh>

Inheritance diagram for FullyConnectedCheck:
Inheritance graph
Collaboration diagram for FullyConnectedCheck:
Collaboration graph

Public Member Functions

 FullyConnectedCheck ()
 
virtual ~FullyConnectedCheck ()
 
virtual bool check (const TTAMachine::Machine &mach) const
 
virtual bool check (const TTAMachine::Machine &mach, MachineCheckResults &results) const
 
virtual bool canFix (const TTAMachine::Machine &mach) const
 
virtual std::string fix (TTAMachine::Machine &mach) const
 
void connectFUPort (TTAMachine::FUPort &port) const
 
void connectSpecialRegisterPort (TTAMachine::SpecialRegisterPort &port) const
 
void connectControlUnit (TTAMachine::ControlUnit &gcu) const
 
- Public Member Functions inherited from MachineCheck
virtual std::string shortDescription () const
 
virtual std::string description () const
 
virtual ~MachineCheck ()
 

Protected Member Functions

 FullyConnectedCheck (const std::string &shortDesc)
 
- Protected Member Functions inherited from MachineCheck
 MachineCheck (const std::string &shortDesc_)
 

Private Member Functions

void connectIUPort (TTAMachine::RFPort &port) const
 
void connectRFPort (TTAMachine::RFPort &port, TTAMachine::Socket::Direction direction) const
 
TTAMachine::SocketcreateSocket (const TTAMachine::Unit &unit, TTAMachine::Socket::Direction direction) const
 
void attachSocketToAllBusses (TTAMachine::Socket &socket) const
 
bool socketAttachedToAllBusses (const TTAMachine::Socket &socket) const
 

Detailed Description

MachineCheck to check is the machine fully connected.

Definition at line 51 of file FullyConnectedCheck.hh.

Constructor & Destructor Documentation

◆ FullyConnectedCheck() [1/2]

FullyConnectedCheck::FullyConnectedCheck ( )

Constructor for using this generic class directly.

Definition at line 52 of file FullyConnectedCheck.cc.

52 :
53 MachineCheck("Fully connected machine check.") {
54}

◆ ~FullyConnectedCheck()

FullyConnectedCheck::~FullyConnectedCheck ( )
virtual

The destructor.

Definition at line 68 of file FullyConnectedCheck.cc.

68 {
69}

◆ FullyConnectedCheck() [2/2]

FullyConnectedCheck::FullyConnectedCheck ( const std::string &  shortDesc)
protected

Constructor for deriving.

Parameters
shortDescThe short description of the check.

Definition at line 61 of file FullyConnectedCheck.cc.

61 :
62 MachineCheck(shortDesc) {
63}

Member Function Documentation

◆ attachSocketToAllBusses()

void FullyConnectedCheck::attachSocketToAllBusses ( TTAMachine::Socket socket) const
private

Attaches given socket to all possible busses.

Parameters
socketSocket to connect.

Definition at line 552 of file FullyConnectedCheck.cc.

552 {
553
555 MachineTester tester(machine);
556
558
559 for (int b = 0; b < busNav.count(); b++) {
560 // for each bus in the machine
561 TTAMachine::Bus& bus = *busNav.item(b);
562 for (int seg = 0; seg < bus.segmentCount(); seg++) {
563 TTAMachine::Segment& segment = *bus.segment(seg);
564 // for each segment in the bus
565 if ((!socket.isConnectedTo(segment)) &&
566 tester.canConnect(socket, segment)) {
567
568 socket.attachBus(segment);
569 }
570 }
571 }
572}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual int segmentCount() const
Definition Bus.cc:385
virtual Machine * machine() const
ComponentType * item(int index) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
bool isConnectedTo(const Bus &bus) const
Definition Socket.cc:331
void attachBus(Segment &bus)
Definition Socket.cc:166

References TTAMachine::Socket::attachBus(), TTAMachine::Machine::busNavigator(), MachineTester::canConnect(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Socket::isConnectedTo(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), machine, TTAMachine::Bus::segment(), and TTAMachine::Bus::segmentCount().

Referenced by createSocket(), and fix().

Here is the call graph for this function:

◆ canFix()

bool FullyConnectedCheck::canFix ( const TTAMachine::Machine mach) const
virtual

Returns true if the machine can be fixed to pass the check.

Parameters
machThe machine to be analyzed.
Returns
True if the machine can be fixed to pass the check.

Reimplemented from MachineCheck.

Definition at line 78 of file FullyConnectedCheck.cc.

78 {
79
81 mach.bridgeNavigator();
82
84 mach.busNavigator();
85
86 if (busNav.count() == 0 || brNav.count() > 0) {
87 return false;
88 }
89 return true;
90}
virtual BridgeNavigator bridgeNavigator() const
Definition Machine.cc:404

References TTAMachine::Machine::bridgeNavigator(), TTAMachine::Machine::busNavigator(), and TTAMachine::Machine::Navigator< ComponentType >::count().

Referenced by fix(), and FullyConnectBussesCmd::isEnabled().

Here is the call graph for this function:

◆ check() [1/2]

bool FullyConnectedCheck::check ( const TTAMachine::Machine mach) const
virtual

Checks is the machine fully connected.

Parameters
machMachine to be checked.
Returns
True if the machine is fully connected.

Definition at line 99 of file FullyConnectedCheck.cc.

99 {
101 socketNav = mach.socketNavigator();
102
103 for (int so = 0; so < socketNav.count(); so++) {
104 // for each socket in the machine
105 if (!socketAttachedToAllBusses(*socketNav.item(so))) {
106 return false;
107 }
108 }
109
110 // check unconnected FU ports
112
113 for (int i = 0; i < fuNav.count(); i++) {
114 FunctionUnit& fu = *fuNav.item(i);
115 for (int p = 0; p < fu.operationPortCount(); p++) {
116 FUPort& port = *fu.operationPort(p);
117 if (port.socketCount() == 0) {
118 return false;
119 }
120 }
121 }
122
123 // check unconnected IU ports
126
127 for (int i = 0; i < iuNav.count(); i++) {
128 ImmediateUnit& iu = *iuNav.item(i);
129 for (int p = 0; p < iu.portCount(); p++) {
130 RFPort& port = *iu.port(p);
131 if (port.socketCount() == 0) {
132 return false;
133 }
134 }
135 }
136
137 // check unconnected RF ports
139
140 for (int i = 0; i < rfNav.count(); i++) {
141 RegisterFile& rf = *rfNav.item(i);
142 for (int p = 0; p < rf.portCount(); p++) {
143 RFPort& port = *rf.port(p);
144 if (port.socketCount() == 0) {
145 return false;
146 }
147 }
148 }
149
150 ControlUnit* gcu = mach.controlUnit();
151 if (gcu != NULL) {
152 for (int p = 0; p < gcu->operationPortCount(); p++) {
153 FUPort& port = *gcu->operationPort(p);
154 if (port.socketCount() == 0) {
155 return false;
156 }
157 }
158 }
159 return true;
160}
bool socketAttachedToAllBusses(const TTAMachine::Socket &socket) const
virtual RFPort * port(const std::string &name) const
virtual FUPort * operationPort(const std::string &name) const
virtual int operationPortCount() const
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
virtual int socketCount() const
Definition Port.cc:375
virtual int portCount() const
Definition Unit.cc:135

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), socketAttachedToAllBusses(), TTAMachine::Port::socketCount(), and TTAMachine::Machine::socketNavigator().

Referenced by RegisterQuantityCheck::check(), RegisterQuantityCheck::checkIntRegs(), RegisterQuantityCheck::checkWithIgnore(), RegisterQuantityCheck::checkWithIgnore(), RegisterQuantityCheck::fixIntRegs(), and FullyConnectBussesCmd::isEnabled().

Here is the call graph for this function:

◆ check() [2/2]

bool FullyConnectedCheck::check ( const TTAMachine::Machine mach,
MachineCheckResults results 
) const
virtual

Checks is the machine fully connected and adds errors to results.

Parameters
machMachine to be checked.
resultsCheck results.
Returns
True if the machine is fully connected.

Implements MachineCheck.

Definition at line 170 of file FullyConnectedCheck.cc.

171 {
172
173 bool result = true;
174
176 socketNav = mach.socketNavigator();
177
178 for (int so = 0; so < socketNav.count(); so++) {
179 // for each socket in the machine
180 if (!socketAttachedToAllBusses(*socketNav.item(so))) {
181 results.addError(
182 *this, "All sockets not connected to all busses.");
183 result = false;
184 }
185 }
186
187 // check unconnected FU ports
189
190 for (int i = 0; i < fuNav.count(); i++) {
191 FunctionUnit& fu = *fuNav.item(i);
192 for (int p = 0; p < fu.operationPortCount(); p++) {
193 FUPort& port = *fu.operationPort(p);
194 if (port.socketCount() == 0) {
195 results.addError(
196 *this, "FU: '" + fu.name() + "' port '" +
197 port.name() + "' not connected to any socket.");
198 result = false;
199 }
200 }
201 }
202
203 // check unconnected IU ports
206
207 for (int i = 0; i < iuNav.count(); i++) {
208 ImmediateUnit& iu = *iuNav.item(i);
209 for (int p = 0; p < iu.portCount(); p++) {
210 RFPort& port = *iu.port(p);
211 if (port.socketCount() == 0) {
212 results.addError(
213 *this, "IU: '" + iu.name() + "' port '" +
214 port.name() + "' not connected to any socket.");
215 result = false;
216 }
217 }
218 }
219
220 // check unconnected RF ports
222
223 for (int i = 0; i < rfNav.count(); i++) {
224 RegisterFile& rf = *rfNav.item(i);
225 for (int p = 0; p < rf.portCount(); p++) {
226 RFPort& port = *rf.port(p);
227 if (port.socketCount() == 0) {
228 results.addError(
229 *this, "RF: '" + rf.name() + "' port '" +
230 port.name() + "' not connected to any socket.");
231 result = false;
232 }
233 }
234 }
235
236 ControlUnit* gcu = mach.controlUnit();
237 if (gcu != NULL) {
238 for (int p = 0; p < gcu->operationPortCount(); p++) {
239 FUPort& port = *gcu->operationPort(p);
240 if (port.socketCount() == 0) {
241 results.addError(
242 *this, "GCU port '" +
243 port.name() + "' not connected to any socket.");
244 return false;
245 }
246 }
247 for (int p = 0; p < gcu->specialRegisterPortCount(); p++) {
249 if (port.socketCount() == 0) {
250 results.addError(
251 *this, "GCU port '" +
252 port.name() + "' not connected to any socket.");
253 }
254 }
255 }
256 return result;
257}
void addError(const MachineCheck &check, const std::string &errorMsg)
virtual TCEString name() const
SpecialRegisterPort * specialRegisterPort(int index) const
int specialRegisterPortCount() const
virtual std::string name() const
Definition Port.cc:141

References MachineCheckResults::addError(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), socketAttachedToAllBusses(), TTAMachine::Port::socketCount(), TTAMachine::Machine::socketNavigator(), TTAMachine::ControlUnit::specialRegisterPort(), and TTAMachine::ControlUnit::specialRegisterPortCount().

Here is the call graph for this function:

◆ connectControlUnit()

void FullyConnectedCheck::connectControlUnit ( TTAMachine::ControlUnit gcu) const

Definition at line 363 of file FullyConnectedCheck.cc.

363 {
364 for (int p = 0; p < gcu.operationPortCount(); p++) {
365 FUPort& port = *gcu.operationPort(p);
366 if (port.socketCount() == 0) {
367 connectFUPort(port);
368 }
369 }
370 for (int p = 0; p < gcu.specialRegisterPortCount(); p++) {
372 if (port.socketCount() == 0) {
374 }
375 }
376}
void connectSpecialRegisterPort(TTAMachine::SpecialRegisterPort &port) const
void connectFUPort(TTAMachine::FUPort &port) const

References connectFUPort(), connectSpecialRegisterPort(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), TTAMachine::Port::socketCount(), TTAMachine::ControlUnit::specialRegisterPort(), and TTAMachine::ControlUnit::specialRegisterPortCount().

Referenced by ADFCombiner::addFunctionUnits(), and fix().

Here is the call graph for this function:

◆ connectFUPort()

void FullyConnectedCheck::connectFUPort ( TTAMachine::FUPort port) const

Creates socket(s) and connects a FU port to all possible busses.

Parameters
portFU port to connect to busses.

Definition at line 497 of file FullyConnectedCheck.cc.

497 {
498
499 const FunctionUnit& fu = *port.parentUnit();
500 Machine& machine = *fu.machine();
501 MachineTester tester(machine);
502
504 const Machine::SocketNavigator socketNav =
506
507 // Operand ports.
508 for (int i = 0; i < fu.operationCount(); i++) {
509 const HWOperation& operation = *fu.operation(i);
510 for (int c = 0; c < operation.latency(); c++) {
511 if (port.inputSocket() == NULL &&
512 operation.pipeline()->isPortRead(port, c)) {
513
514 Socket* socket = createSocket(fu, Socket::INPUT);
515
516 if (tester.canConnect(*socket, port)) {
517 port.attachSocket(*socket);
518 } else {
519 delete socket;
520 }
521 break;
522 }
523 }
524 }
525
526 // Result ports.
527 for (int i = 0; i < fu.operationCount(); i++) {
528 const HWOperation& operation = *fu.operation(i);
529 for (int c = 0; c < operation.latency(); c++) {
530 if (port.outputSocket() == NULL &&
531 operation.pipeline()->isPortWritten(port, c)) {
532
533 Socket* socket = createSocket(fu, Socket::OUTPUT);
534 if (tester.canConnect(*socket, port)) {
535 port.attachSocket(*socket);
536 } else {
537 delete socket;
538 }
539 break;
540 }
541 }
542 }
543
544}
TTAMachine::Socket * createSocket(const TTAMachine::Unit &unit, TTAMachine::Socket::Direction direction) const
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
bool isPortWritten(const FUPort &port, int cycle) const
bool isPortRead(const FUPort &port, int cycle) const
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
ExecutionPipeline * pipeline() const
virtual Socket * outputSocket() const
Definition Port.cc:281
virtual void attachSocket(Socket &socket)
Definition Port.cc:191
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

References TTAMachine::Port::attachSocket(), TTAMachine::Machine::busNavigator(), MachineTester::canConnect(), createSocket(), TTAMachine::Socket::INPUT, TTAMachine::Port::inputSocket(), TTAMachine::ExecutionPipeline::isPortRead(), TTAMachine::ExecutionPipeline::isPortWritten(), TTAMachine::HWOperation::latency(), TTAMachine::Component::machine(), machine, TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::Socket::OUTPUT, TTAMachine::Port::outputSocket(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::HWOperation::pipeline(), and TTAMachine::Machine::socketNavigator().

Referenced by connectControlUnit(), fix(), and MinimalOpSetCheck::fix().

Here is the call graph for this function:

◆ connectIUPort()

void FullyConnectedCheck::connectIUPort ( TTAMachine::RFPort port) const
private

Connects an immediate unit port to all possible busses.

Parameters
portImmediate unit port to connect.

Definition at line 383 of file FullyConnectedCheck.cc.

383 {
384
385 MachineTester tester(*port.parentUnit()->machine());
386
387 Socket* socket = createSocket(*port.parentUnit(), Socket::OUTPUT);
388
389 if (tester.canConnect(*socket, port)) {
390 port.attachSocket(*socket);
391 } else {
392 delete socket;
393 }
394}
BaseRegisterFile * parentUnit() const
Definition RFPort.cc:93

References TTAMachine::Port::attachSocket(), MachineTester::canConnect(), createSocket(), TTAMachine::Component::machine(), TTAMachine::Socket::OUTPUT, and TTAMachine::RFPort::parentUnit().

Referenced by fix().

Here is the call graph for this function:

◆ connectRFPort()

void FullyConnectedCheck::connectRFPort ( TTAMachine::RFPort port,
TTAMachine::Socket::Direction  direction 
) const
private

Connects a register file port to all possible busses.

Parameters
portImmediate unit port to connect.

Definition at line 430 of file FullyConnectedCheck.cc.

430 {
431
432 MachineTester tester(*port.parentUnit()->machine());
433 const BaseRegisterFile& rf = *port.parentUnit();
434
435 Socket* socket = NULL;
436 socket = createSocket(rf, direction);
437
438 if (tester.canConnect(*socket, port)) {
439 port.attachSocket(*socket);
440 } else {
441 delete socket;
442 }
443
444}

References TTAMachine::Port::attachSocket(), MachineTester::canConnect(), createSocket(), TTAMachine::Component::machine(), and TTAMachine::RFPort::parentUnit().

Referenced by fix().

Here is the call graph for this function:

◆ connectSpecialRegisterPort()

void FullyConnectedCheck::connectSpecialRegisterPort ( TTAMachine::SpecialRegisterPort port) const

Connects a special register port to all possible busses.

Parameters
portSpecial register port to connect.

Definition at line 402 of file FullyConnectedCheck.cc.

403 {
404
405 MachineTester tester(*port.parentUnit()->machine());
406
407 Socket* inSocket = createSocket(*port.parentUnit(), Socket::INPUT);
408 Socket* outSocket = createSocket(*port.parentUnit(), Socket::OUTPUT);
409
410 if (tester.canConnect(*inSocket, port)) {
411 port.attachSocket(*inSocket);
412 } else {
413 delete inSocket;
414 }
415
416 if (tester.canConnect(*outSocket, port)) {
417 port.attachSocket(*outSocket);
418 } else {
419 delete outSocket;
420 }
421}

References TTAMachine::Port::attachSocket(), MachineTester::canConnect(), createSocket(), TTAMachine::Socket::INPUT, TTAMachine::Component::machine(), TTAMachine::Socket::OUTPUT, and TTAMachine::BaseFUPort::parentUnit().

Referenced by connectControlUnit().

Here is the call graph for this function:

◆ createSocket()

Socket * FullyConnectedCheck::createSocket ( const TTAMachine::Unit unit,
TTAMachine::Socket::Direction  direction 
) const
private

Creates a new socket to be attached to an unit.

Parameters
unitUnit whose name is used to generate a name for the socket.
directionDirection of the socket.
Returns
A new socket, attached to all possible busses, but not to a port.

Definition at line 454 of file FullyConnectedCheck.cc.

455 {
456
458
461
462 int s = 1;
463 std::string socketName = unit.name();
464 if (direction == Socket::INPUT) {
465 socketName = socketName + "_i";
466 } else {
467 socketName = socketName + "_o";
468 }
469
470 while (socketNav.hasItem(
471 socketName + Conversion::toString(s))) {
472
473 s++;
474 }
475
476 Socket* socket =
477 new Socket(socketName + Conversion::toString(s));
478
479 socket->setMachine(machine);
481
482 // direction can be set only if the socket is connected to a segment
483 if (socket->segmentCount() > 0) {
484 socket->setDirection(direction);
485 }
486
487 return socket;
488}
static std::string toString(const T &source)
void attachSocketToAllBusses(TTAMachine::Socket &socket) const
bool hasItem(const std::string &name) const
void setDirection(Direction direction)
Definition Socket.cc:130
virtual void setMachine(Machine &mach)
Definition Socket.cc:432
int segmentCount() const

References attachSocketToAllBusses(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Socket::INPUT, TTAMachine::Component::machine(), machine, TTAMachine::Component::name(), TTAMachine::Socket::segmentCount(), TTAMachine::Socket::setDirection(), TTAMachine::Socket::setMachine(), TTAMachine::Machine::socketNavigator(), and Conversion::toString().

Referenced by connectFUPort(), connectIUPort(), connectRFPort(), and connectSpecialRegisterPort().

Here is the call graph for this function:

◆ fix()

std::string FullyConnectedCheck::fix ( TTAMachine::Machine mach) const
virtual

Fixes the machine to pass the chek if possible.

Parameters
machMachine to be fixed.
Returns
Returns an empty string.
Exceptions
InvalidDataThows if the machine cannot be fixed.

Reimplemented from MachineCheck.

Definition at line 267 of file FullyConnectedCheck.cc.

267 {
268 if (!canFix(mach)) {
269 throw InvalidData(
270 __FILE__, __LINE__, __func__,
271 "Machines contains no busses or contains bridges.");
272 }
273
275 socketNav = mach.socketNavigator();
276
277 for (int so = 0; so < socketNav.count(); so++) {
278 // for each socket in the machine
279 attachSocketToAllBusses(*socketNav.item(so));
280 }
281 // Connect all unconnected FU ports to newly created sockets.
283
284 for (int i = 0; i < fuNav.count(); i++) {
285 FunctionUnit& fu = *fuNav.item(i);
286 for (int p = 0; p < fu.operationPortCount(); p++) {
287 FUPort& port = *fu.operationPort(p);
288 if (port.socketCount() == 0) {
289 connectFUPort(port);
290 }
291 }
292 }
293
294 // Connect all unconnected IU ports to new sockets.
297
298 for (int i = 0; i < iuNav.count(); i++) {
299 ImmediateUnit& iu = *iuNav.item(i);
300 for (int p = 0; p < iu.portCount(); p++) {
301 RFPort& port = *iu.port(p);
302 if (port.socketCount() == 0) {
303 connectIUPort(port);
304 }
305 }
306 }
307
308 // Connect all unconnected RF ports to new sockets.
310
311 for (int i = 0; i < rfNav.count(); i++) {
312 RegisterFile& rf = *rfNav.item(i);
313 int maxReads = rf.maxReads();
314 int maxWrites = rf.maxWrites();
315 bool lastWasReadPort = false;
316 for (int p = 0; p < rf.portCount(); p++) {
317 RFPort& port = *rf.port(p);
318 if (port.socketCount() == 0) {
319 if (maxReads > 0) {
321 maxReads--;
322 } else if (maxWrites > 0) {
324 maxWrites--;
325 } else {
326 // when maxReads == 0 and maxWrites == 0, connect every other
327 // port as a read port, every other as write
328 if (lastWasReadPort) {
330 lastWasReadPort = false;
331 } else {
333 lastWasReadPort = true;
334 }
335 }
336
337 }
338 else // port connected, check wheter it is input or output
339 {
340 if (port.inputSocket() != NULL) {
341 maxWrites--;
342 } else if (port.outputSocket() != NULL) {
343 maxReads--;
344 } else {
345 // port connected, but input and output sockets are null
346 throw InvalidData(
347 __FILE__, __LINE__, __func__,
348 "Port connected to unknown socket.");
349 }
350 }
351 }
352 }
353
354 ControlUnit* gcu = mach.controlUnit();
355 if (gcu != NULL) {
356 connectControlUnit(*gcu);
357 }
358
359 return "";
360}
#define __func__
void connectRFPort(TTAMachine::RFPort &port, TTAMachine::Socket::Direction direction) const
void connectControlUnit(TTAMachine::ControlUnit &gcu) const
void connectIUPort(TTAMachine::RFPort &port) const
virtual bool canFix(const TTAMachine::Machine &mach) const
virtual int maxReads() const
virtual int maxWrites() const

References __func__, attachSocketToAllBusses(), canFix(), connectControlUnit(), connectFUPort(), connectIUPort(), connectRFPort(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Socket::INPUT, TTAMachine::Port::inputSocket(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::RegisterFile::maxReads(), TTAMachine::RegisterFile::maxWrites(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), TTAMachine::Socket::OUTPUT, TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::Port::socketCount(), and TTAMachine::Machine::socketNavigator().

Referenced by MachineResourceModifier::addBusesByAmount(), FullyConnectBussesCmd::Do(), MachineResourceModifier::increaseAllFUsThatDiffersByAmount(), MachineResourceModifier::increaseAllRFsThatDiffersByAmount(), MachineResourceModifier::percentualFUIncrease(), and MachineResourceModifier::percentualRegisterIncrease().

Here is the call graph for this function:

◆ socketAttachedToAllBusses()

bool FullyConnectedCheck::socketAttachedToAllBusses ( const TTAMachine::Socket socket) const
private

Checks if the given socket is attached to all possible busses.

Parameters
socketSocket to check.
Returns
True if the socket is attached to all possible busses.

Definition at line 581 of file FullyConnectedCheck.cc.

581 {
582
584 MachineTester tester(machine);
585
587
588 for (int b = 0; b < busNav.count(); b++) {
589 // for each bus in the machine
590 TTAMachine::Bus& bus = *busNav.item(b);
591 for (int seg = 0; seg < bus.segmentCount(); seg++) {
592 TTAMachine::Segment& segment = *bus.segment(seg);
593 // for each segment in the bus
594 if (!socket.isConnectedTo(segment)) {
595 if (tester.canConnect(socket, segment)) {
596 return false;
597 }
598 }
599 }
600 }
601 return true;
602}

References TTAMachine::Machine::busNavigator(), MachineTester::canConnect(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Socket::isConnectedTo(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), machine, TTAMachine::Bus::segment(), and TTAMachine::Bus::segmentCount().

Referenced by check(), and check().

Here is the call graph for this function:

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