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

#include <MachineResourceModifier.hh>

Collaboration diagram for MachineResourceModifier:
Collaboration graph

Public Types

typedef std::multimap< double, TTAMachine::Bus * > BusMap
 Map of bus amounts in percents.
 
typedef std::multimap< double, TTAMachine::RegisterFile * > RegisterMap
 Map of register amounts in percents.
 
typedef std::multimap< double, TTAMachine::FunctionUnit * > FunctionUnitMap
 Map of function unit amounts in percents.
 

Public Member Functions

 MachineResourceModifier ()
 
virtual ~MachineResourceModifier ()
 
void addBusesByAmount (int busesToAdd, TTAMachine::Machine &mach)
 
void increaseAllRFsThatDiffersByAmount (int registersToAdd, TTAMachine::Machine &mach)
 
void percentualRegisterIncrease (double percentsOfRegistersToAdd, TTAMachine::Machine &mach)
 
void increaseAllFUsThatDiffersByAmount (int moreFUs, TTAMachine::Machine &mach)
 
void percentualFUIncrease (double percentualFUIncrease, TTAMachine::Machine &mach)
 
void reduceBuses (const int &busesToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames)
 
bool removeBuses (const int &countToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames)
 
void removeNotConnectedSockets (TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames)
 
void analyzeBuses (const TTAMachine::Machine &mach, BusMap &busMap) const
 
void analyzeRegisters (const TTAMachine::Machine &mach, RegisterMap &registerMap) const
 
void analyzeFunctionUnits (const TTAMachine::Machine &mach, FunctionUnitMap &unitMap) const
 

Private Member Functions

bool hasSlot (const TTAMachine::Machine &mach, const std::string &slotName)
 

Detailed Description

Class that adds or removes resources of the given architecture.

Definition at line 49 of file MachineResourceModifier.hh.

Member Typedef Documentation

◆ BusMap

typedef std::multimap<double, TTAMachine::Bus*> MachineResourceModifier::BusMap

Map of bus amounts in percents.

Definition at line 52 of file MachineResourceModifier.hh.

◆ FunctionUnitMap

Map of function unit amounts in percents.

Definition at line 56 of file MachineResourceModifier.hh.

◆ RegisterMap

Map of register amounts in percents.

Definition at line 54 of file MachineResourceModifier.hh.

Constructor & Destructor Documentation

◆ MachineResourceModifier()

MachineResourceModifier::MachineResourceModifier ( )

The constructor.

Definition at line 48 of file MachineResourceModifier.cc.

48 {
49}

◆ ~MachineResourceModifier()

MachineResourceModifier::~MachineResourceModifier ( )
virtual

The destructor.

Definition at line 54 of file MachineResourceModifier.cc.

54 {
55}

Member Function Documentation

◆ addBusesByAmount()

void MachineResourceModifier::addBusesByAmount ( int  busesToAdd,
TTAMachine::Machine mach 
)

Adds given number of buses to the given architecture.

Determines the bus parameters in basis of the original architecture and the most common bus types are added first.

Parameters
busesToAddNumber of buses to add. @mach Architecture where the buses are added.

Definition at line 67 of file MachineResourceModifier.cc.

68 {
69
70 BusMap busMap;
71 analyzeBuses(mach, busMap);
72
73 int addedBuses = 0;
74 std::multimap<double, TTAMachine::Bus*>::const_iterator iter = busMap.end();
75 while (iter != busMap.begin()) {
76 iter--;
77 if (addedBuses == busesToAdd) {
78 break;
79 }
80 double numberToAdd = ceil((*iter).first * busesToAdd);
81
82 while (numberToAdd > 0) {
83 if (addedBuses < busesToAdd) {
84 TTAMachine::Bus& original = *(*iter).second;
85 TTAMachine::Bus* newBus = original.copy();
86
87 int busNum = 0;
88 std::string busBaseName = original.name();
90 mach.busNavigator();
91 while (busNavigator.hasItem(
92 busBaseName + Conversion::toString(busNum))) {
93 busNum++;
94 }
95
96 newBus->setName(busBaseName + Conversion::toString(busNum));
97 mach.addBus(*newBus);
98
99 original.copyGuardsTo(*newBus);
100 // Fully connect the machine.
102 check.fix(mach);
103 addedBuses++;
104 }
105 numberToAdd--;
106 }
107 }
108}
static std::string toString(const T &source)
virtual std::string fix(TTAMachine::Machine &mach) const
std::multimap< double, TTAMachine::Bus * > BusMap
Map of bus amounts in percents.
void analyzeBuses(const TTAMachine::Machine &mach, BusMap &busMap) const
virtual void setName(const std::string &name)
Definition Bus.cc:196
virtual Bus * copy() const
Definition Bus.cc:1145
virtual void copyGuardsTo(Bus &other) const
Definition Bus.cc:1155
virtual TCEString name() const
bool hasItem(const std::string &name) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
virtual void addBus(Bus &bus)
Definition Machine.cc:139

References TTAMachine::Machine::addBus(), analyzeBuses(), TTAMachine::Machine::busNavigator(), TTAMachine::Bus::copy(), TTAMachine::Bus::copyGuardsTo(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Component::name(), TTAMachine::Bus::setName(), and Conversion::toString().

Referenced by GrowMachine::explore().

Here is the call graph for this function:

◆ analyzeBuses()

void MachineResourceModifier::analyzeBuses ( const TTAMachine::Machine mach,
BusMap busMap 
) const

Analyzes the bus types of the architecture.

Parameters
machMachine to be analyzed.
busMapMap where bus counts are stored.

Definition at line 272 of file MachineResourceModifier.cc.

273 {
274
276
277 std::set<int> checkedBuses;
278 for (int i = 0; i < busNavigator.count(); i++) {
279
280 // go trough only the buses that are not already counted
281 if (checkedBuses.find(i) != checkedBuses.end()) {
282 continue;
283 }
284
285 TTAMachine::Bus* bus = busNavigator.item(i);
286 int counter = 1;
287 for (int j = i + 1; j < busNavigator.count(); j++) {
288 if (bus->isArchitectureEqual(*busNavigator.item(j))) {
289 checkedBuses.insert(j);
290 counter++;
291 }
292 }
293 busMap.insert(
294 std::pair<double, TTAMachine::Bus*>(
295 Conversion::toDouble(counter) /
296 Conversion::toDouble(busNavigator.count()), bus));
297 checkedBuses.insert(i);
298 }
299
300 assert(Conversion::toInt(checkedBuses.size()) == busNavigator.count());
301}
#define assert(condition)
static double toDouble(const T &source)
static int toInt(const T &source)
virtual bool isArchitectureEqual(const Bus &bus) const
Definition Bus.cc:1111
ComponentType * item(int index) const

References assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), Conversion::toDouble(), and Conversion::toInt().

Referenced by addBusesByAmount(), and reduceBuses().

Here is the call graph for this function:

◆ analyzeFunctionUnits()

void MachineResourceModifier::analyzeFunctionUnits ( const TTAMachine::Machine mach,
FunctionUnitMap unitMap 
) const

Analyzes the unit types of the architecture.

Parameters
machMachine which function units are analyzed.
unitMapMap where unit counts are stored. FU pointers in the map are pointers to the machine units.

Definition at line 554 of file MachineResourceModifier.cc.

555 {
556
559
560 std::set<int> checkedUnits;
561 for (int i = 0; i < unitNavigator.count(); i++) {
562 // go trough only the units that are not already counted
563 if (checkedUnits.find(i) != checkedUnits.end()) {
564 continue;
565 }
566
567 TTAMachine::FunctionUnit* fu = unitNavigator.item(i);
568 int counter = 1;
569 for (int j = i + 1; j < unitNavigator.count(); j++) {
570 if (fu->isArchitectureEqual(unitNavigator.item(j))) {
571 checkedUnits.insert(j);
572 counter++;
573 }
574 }
575
576 unitMap.insert(
577 std::pair<double, TTAMachine::FunctionUnit*>(
578 Conversion::toDouble(counter) /
579 Conversion::toDouble(unitNavigator.count()), fu));
580 checkedUnits.insert(i);
581 }
582
583 assert(Conversion::toInt(checkedUnits.size())
584 == unitNavigator.count());
585}
virtual bool isArchitectureEqual(const FunctionUnit *fu, const bool checkPortWidths=true) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380

References assert, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::FunctionUnit::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), Conversion::toDouble(), and Conversion::toInt().

Referenced by increaseAllFUsThatDiffersByAmount(), MinimizeMachine::minimizeFunctionUnits(), and percentualFUIncrease().

Here is the call graph for this function:

◆ analyzeRegisters()

void MachineResourceModifier::analyzeRegisters ( const TTAMachine::Machine mach,
RegisterMap registerMap 
) const

Analyzes the register types of the architecture.

Parameters
machMachine which registers are analyzed.
registerMapMap where register counts are stored.

Definition at line 410 of file MachineResourceModifier.cc.

411 {
412
415
416 std::set<int> checkedRegisters;
417 for (int i = 0; i < registerNavigator.count(); i++) {
418 // go trough only the registers that are not already counted
419 if (checkedRegisters.find(i) != checkedRegisters.end()) {
420 continue;
421 }
422 // @todo boolean registers are propably not needed to multiply
423 TTAMachine::RegisterFile* rf = registerNavigator.item(i);
424 int counter = 1;
425 for (int j = i + 1; j < registerNavigator.count(); j++) {
426 if (rf->isArchitectureEqual(*registerNavigator.item(j))) {
427 checkedRegisters.insert(j);
428 counter++;
429 }
430 }
431
432 registerMap.insert(
433 std::pair<double, TTAMachine::RegisterFile*>(
434 Conversion::toDouble(counter) /
435 Conversion::toDouble(registerNavigator.count()), rf));
436
437 checkedRegisters.insert(i);
438 }
439
440 assert(Conversion::toInt(checkedRegisters.size())
441 == registerNavigator.count());
442}
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual bool isArchitectureEqual(const RegisterFile &rf) const

References assert, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::RegisterFile::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::registerFileNavigator(), Conversion::toDouble(), and Conversion::toInt().

Referenced by increaseAllRFsThatDiffersByAmount(), MinimizeMachine::minimizeRegisterFiles(), and percentualRegisterIncrease().

Here is the call graph for this function:

◆ hasSlot()

bool MachineResourceModifier::hasSlot ( const TTAMachine::Machine mach,
const std::string &  slotName 
)
private

Returns true if the machine contains an Instruction template slot for given bus name.

Parameters
machMachine where the slot is searched.
busNameName of the slot that is searched.
Returns
True if the machine contains template slot for the given bus name.

Definition at line 218 of file MachineResourceModifier.cc.

219 {
220
223 for (int i = 0; i < itNav.count(); i++) {
224 for (int slot = 0;
225 slot < itNav.item(i)->slotCount();
226 slot++) {
227
228 if (itNav.item(i)->slot(slot)->slot() == slotName) {
229 return true;
230 }
231 }
232 }
233 return false;
234}
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition Machine.cc:428

References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), and TTAMachine::Machine::Navigator< ComponentType >::item().

Referenced by reduceBuses(), and removeBuses().

Here is the call graph for this function:

◆ increaseAllFUsThatDiffersByAmount()

void MachineResourceModifier::increaseAllFUsThatDiffersByAmount ( int  unitsToAdd,
TTAMachine::Machine mach 
)

Increase all different funtion units by given amount.

Parameters
unitsToAddHow many function units are added for each fu type.
machMachine where the function units are added.

Definition at line 451 of file MachineResourceModifier.cc.

452 {
453
454 FunctionUnitMap fuMap;
455 analyzeFunctionUnits(mach, fuMap);
456
457 std::multimap<double, TTAMachine::FunctionUnit*>::const_iterator iter =
458 fuMap.end();
459 while (iter != fuMap.begin()) {
460 iter--;
461 int addedUnits = 0;
462 while (addedUnits < unitsToAdd) {
463 ObjectState* newFuState = (*iter).second->saveState();
465 new TTAMachine::FunctionUnit(newFuState);
466 delete newFuState;
467
468 newFuState = NULL;
469 int fuNum = 1;
470 std::string fuBaseName = "fu";
473 while (fuNavigator.hasItem(
474 fuBaseName + Conversion::toString(fuNum))) {
475 fuNum++;
476 }
477 newFU->setName(fuBaseName + Conversion::toString(fuNum));
478 mach.addFunctionUnit(*newFU);
479
480 // set the same address space to the new unit.
481 newFU->setAddressSpace((*iter).second->addressSpace());
482
483 // Fully connect the machine (adds new sockets).
485 check.fix(mach);
486 addedUnits++;
487 }
488 }
489}
std::multimap< double, TTAMachine::FunctionUnit * > FunctionUnitMap
Map of function unit amounts in percents.
void analyzeFunctionUnits(const TTAMachine::Machine &mach, FunctionUnitMap &unitMap) const
virtual void setAddressSpace(AddressSpace *as)
virtual void setName(const std::string &name)
virtual void addFunctionUnit(FunctionUnit &unit)
Definition Machine.cc:202

References TTAMachine::Machine::addFunctionUnit(), analyzeFunctionUnits(), FullyConnectedCheck::fix(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::FunctionUnit::setName(), and Conversion::toString().

Referenced by GrowMachine::explore().

Here is the call graph for this function:

◆ increaseAllRFsThatDiffersByAmount()

void MachineResourceModifier::increaseAllRFsThatDiffersByAmount ( int  registersToAdd,
TTAMachine::Machine mach 
)

Increase all different register files by given amount.

Parameters
registersToAddNumber of every register type will be added.
machMachine which registers are added.

Definition at line 311 of file MachineResourceModifier.cc.

312 {
313
314 RegisterMap rfMap;
315 analyzeRegisters(mach, rfMap);
316
317 std::multimap<double, TTAMachine::RegisterFile*>::const_iterator iter =
318 rfMap.end();
319 while (iter != rfMap.begin()) {
320 iter--;
321 if (!(*iter).second->isUsedAsGuard()) {
322 int addedRegisters = 0;
323 while (addedRegisters < registersToAdd) {
324 ObjectState* newRFState = (*iter).second->saveState();
326 new TTAMachine::RegisterFile(newRFState);
327 delete newRFState;
328 newRFState = NULL;
329
330 int rfNum = 1;
331 std::string rfBaseName = "rf";
334 while (rfNavigator.hasItem(
335 rfBaseName + Conversion::toString(rfNum))) {
336 rfNum++;
337 }
338 newRF->setName(rfBaseName + Conversion::toString(rfNum));
339 mach.addRegisterFile(*newRF);
340 // Fully connect the machine.
342 check.fix(mach);
343 addedRegisters++;
344 }
345 }
346 }
347}
std::multimap< double, TTAMachine::RegisterFile * > RegisterMap
Map of register amounts in percents.
void analyzeRegisters(const TTAMachine::Machine &mach, RegisterMap &registerMap) const
virtual void addRegisterFile(RegisterFile &unit)
Definition Machine.cc:236
virtual void setName(const std::string &name)

References TTAMachine::Machine::addRegisterFile(), analyzeRegisters(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterFile::setName(), and Conversion::toString().

Referenced by GrowMachine::explore().

Here is the call graph for this function:

◆ percentualFUIncrease()

void MachineResourceModifier::percentualFUIncrease ( double  percentualFUIncrease,
TTAMachine::Machine mach 
)

Increase all different function units by percentage value.

Fully connects the machine after adding the units.

Parameters
percentualFUIncreaseHow much will the function units be increased in percents.
machMachine which function units are increased.

Definition at line 501 of file MachineResourceModifier.cc.

502 {
503
504 if (percentualFUIncrease < 0.0) {
505 // nothing to add
506 return;
507 }
508
509 FunctionUnitMap fuMap;
510 analyzeFunctionUnits(mach, fuMap);
513
514 std::multimap<double, TTAMachine::FunctionUnit*>::const_iterator iter =
515 fuMap.end();
516 while (iter != fuMap.begin()) {
517 iter--;
518 int addedUnits = 0;
519 int unitsToAdd =
520 Conversion::toInt(ceil((*iter).first * percentualFUIncrease));
521 while (addedUnits < unitsToAdd) {
523 new TTAMachine::FunctionUnit((*iter).second->saveState());
524 int fuNum = 1;
525 std::string fuBaseName = "fu";
528 while (fuNavigator.hasItem(
529 fuBaseName + Conversion::toString(fuNum))) {
530 fuNum++;
531 }
532 newFU->setName(fuBaseName + Conversion::toString(fuNum));
533 mach.addFunctionUnit(*newFU);
534
535 // set the same address space to the new unit.
536 newFU->setAddressSpace((*iter).second->addressSpace());
537
538 // Fully connect the machine.
540 check.fix(mach);
541 addedUnits++;
542 }
543 }
544}
void percentualFUIncrease(double percentualFUIncrease, TTAMachine::Machine &mach)
const_iterator end() const noexcept

References TTAMachine::Machine::addFunctionUnit(), analyzeFunctionUnits(), TTAMachine::Machine::Navigator< ComponentType >::end(), FullyConnectedCheck::fix(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), percentualFUIncrease(), TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::FunctionUnit::setName(), Conversion::toInt(), and Conversion::toString().

Referenced by percentualFUIncrease().

Here is the call graph for this function:

◆ percentualRegisterIncrease()

void MachineResourceModifier::percentualRegisterIncrease ( double  percentsOfRegistersToAdd,
TTAMachine::Machine mach 
)

Increase all different register files by percentage value.

Fully connects the machine after adding the units.

Parameters
percentualRegisterIncreaseHow much will the register files be increased in percents.
machMachine which registers are increased.

Definition at line 359 of file MachineResourceModifier.cc.

360 {
361
362 if (percentsOfRegistersToAdd < 0.0) {
363 // nothing to add
364 return;
365 }
366
367 RegisterMap rfMap;
368 analyzeRegisters(mach, rfMap);
371
372 std::multimap<double, TTAMachine::RegisterFile*>::const_iterator iter =
373 rfMap.end();
374 while (iter != rfMap.begin()) {
375 iter--;
376 if (!(*iter).second->isUsedAsGuard()) {
377 int addedRegisters = 0;
378 int registersToAdd =
380 ceil((*iter).first * percentsOfRegistersToAdd));
381 while (addedRegisters < registersToAdd) {
383 new TTAMachine::RegisterFile((*iter).second->saveState());
384 int rfNum = 1;
385 std::string rfBaseName = "rf";
388 while (rfNavigator.hasItem(
389 rfBaseName + Conversion::toString(rfNum))) {
390 rfNum++;
391 }
392 newRF->setName(rfBaseName + Conversion::toString(rfNum));
393 mach.addRegisterFile(*newRF);
394 // Fully connect the machine.
396 check.fix(mach);
397 addedRegisters++;
398 }
399 }
400 }
401}

References TTAMachine::Machine::addRegisterFile(), analyzeRegisters(), TTAMachine::Machine::Navigator< ComponentType >::end(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterFile::setName(), Conversion::toInt(), and Conversion::toString().

Here is the call graph for this function:

◆ reduceBuses()

void MachineResourceModifier::reduceBuses ( const int &  busesToRemove,
TTAMachine::Machine mach,
std::list< std::string > &  removedBusNames 
)

Reduces the amount of buses with a given number using some strange algorithm.

Won't remove buses that are immediate template slots. Remove slots first. Slots may cause that given number of buses cannot be removed. (I, maattae, have really no idea why this function does what it does. And what it does isn't actually very clear.)

Parameters
busesToRemoveNumber of buses to remove.
machMachine where the buses are removed.
removedBusNameNames of the removed buses are added at the end of this list.

Definition at line 125 of file MachineResourceModifier.cc.

127 {
128
129 BusMap busMap;
130 analyzeBuses(mach, busMap);
131
132 int removedBuses = 0;
133 std::multimap<double, TTAMachine::Bus*>::const_iterator iter =
134 busMap.begin();
135
136 while (iter != busMap.end() && removedBuses != busesToRemove) {
137
138 double numberToRemove = ceil(iter->first * busesToRemove);
139
141
142 for (int i = 0; numberToRemove > 0 && i < navigator.count(); i++) {
143 if (removedBuses < busesToRemove) {
144 if ((*iter).second->isArchitectureEqual(
145 *navigator.item(i))) {
148 if (hasSlot(mach, navigator.item(i)->name())) {
149 // buses that contains template slot are not removed
150 continue;
151 }
152 // remove the bus
153 removedBusNames.push_back(
154 (*iter).second->name());
155 mach.removeBus(*(navigator.item(i)));
156 removedBuses++;
157 numberToRemove--;
158 }
159 } else {
160 // continue with next bus type
161 break;
162 }
163 }
164 iter++;
165 }
166}
bool hasSlot(const TTAMachine::Machine &mach, const std::string &slotName)
virtual void removeBus(Bus &bus)
Definition Machine.cc:477

References analyzeBuses(), TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), hasSlot(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::Machine::removeBus().

Here is the call graph for this function:

◆ removeBuses()

bool MachineResourceModifier::removeBuses ( const int &  countToRemove,
TTAMachine::Machine mach,
std::list< std::string > &  removedBusNames 
)

Removes busses from machine.

Doens't remove buses that have template slots.

Parameters
countToRemoveNumber of buses to remove in optimal case.
machMachine where buses are going to be removed.
removedBusNameNames of the removed buses are added at the end of this list.
Returns
True if the number of buses to be removed were actually removed, false otherwise.

Definition at line 182 of file MachineResourceModifier.cc.

184 {
185
189
190 // TODO: make test that the last guard bus isn't removed either.
191 for (int busesRemoved = 0, i = 0; 0 < navigator.count(); ++i) {
192 if ( countToRemove == busesRemoved ) {
193 return true;
194 }
195 // buses that contains template slot are not removed
196 if (hasSlot(mach, navigator.item(i)->name())) {
197 continue;
198 }
199 removedBusNames.push_back(navigator.item(i)->name());
200 // remove the bus
201 mach.removeBus(*(navigator.item(i)));
202 ++busesRemoved;
203 --i;
204 }
205 return false;
206}

References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), hasSlot(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::Machine::removeBus().

Referenced by MinimizeMachine::minimizeBuses().

Here is the call graph for this function:

◆ removeNotConnectedSockets()

void MachineResourceModifier::removeNotConnectedSockets ( TTAMachine::Machine mach,
std::list< std::string > &  removedSocketNames 
)

Removes not sockets that have no connection to any port from the machine.

Parameters
machMachine where the sockets are removed.
removedSocketNamesNames of the removed sockets are inserted at the end of this list.

Definition at line 244 of file MachineResourceModifier.cc.

245 {
246
247 std::list<std::string> socketsToRemove;
248
250 for (int i = 0; i < navigator.count(); i++) {
251 if (navigator.item(i)->portCount() == 0 ||
252 navigator.item(i)->segmentCount() == 0) {
253 socketsToRemove.push_back(navigator.item(i)->name());
254 }
255 }
256
257 std::list<std::string>::const_iterator iter = socketsToRemove.begin();
258 while (iter != socketsToRemove.end()) {
259 mach.removeSocket(*navigator.item(*iter));
260 removedSocketNames.push_back(*iter);
261 iter++;
262 }
263}
const_iterator begin() const noexcept
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
virtual void removeSocket(Socket &socket)
Definition Machine.cc:490

References TTAMachine::Machine::Navigator< ComponentType >::begin(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::removeSocket(), and TTAMachine::Machine::socketNavigator().

Referenced by MinimizeMachine::minimizeFunctionUnits(), MinimizeMachine::minimizeRegisterFiles(), RemoveUnconnectedComponents::removeSockets(), and ProGe::ProcessorGenerator::removeUnconnectedSockets().

Here is the call graph for this function:

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