OpenASIP 2.2
Loading...
Searching...
No Matches
ADFCombiner.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2012 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file ADFCombiner.cc
26 *
27 * Explorer plugin that combines two input architectures (and multiplies one)
28 *
29 * @author Vladimir Guzma 2012 (vladimir.guzma-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include <vector>
34#include <string>
36#include "DSDBManager.hh"
37#include "Machine.hh"
38#include "HDBRegistry.hh"
39#include "StringTools.hh"
40#include "RFPort.hh"
41#include "FUPort.hh"
43#include "Exception.hh"
44#include "Segment.hh"
45#include "HWOperation.hh"
46#include "ExecutionPipeline.hh"
47#include "Guard.hh"
48#include "ControlUnit.hh"
50#include "Conversion.hh"
51
52//using namespace TTAProgram;
53using namespace TTAMachine;
54using namespace HDB;
55using std::endl;
56
57/**
58 * Explorer plugin that adds machine components to a given machine.
59 */
62 "Explorer plugin that produces a clustered machine with N lanes/nodes "
63 "and an 'extras' node.");
64
66 node_("node.adf"),
67 nodeCount_(4),
68 extra_(""),
71 addressSpaces_("data"),
75 addStar_(true),
76 nodesPerBus_(1),
77 reuseRFPorts_(true),
81
82 // compulsory parameters
83 // no compulsory parameters
84
85 // parameters that have a default value
93
94
107
114
115
116 }
117
118 virtual bool requiresStartingPointArchitecture() const { return false; }
119 virtual bool producesArchitecture() const { return true; }
120 virtual bool requiresHDB() const { return false; }
121 virtual bool requiresSimulationData() const { return false; }
122 virtual bool requiresApplication() const { return false; }
123
124 /**
125 * Explorer plugin that adds machine components to a given machine with
126 * adf parameter or with configuration id in dsdb.
127 */
128 virtual std::vector<RowID>
129 explore(const RowID& /*configurationID*/, const unsigned int&) {
131 std::vector<RowID> result;
132
133 // check if adf given
134 if (extra_ == "" && node_ == "") {
135 TCEString msg =
136 "No node.adf or extra.adf defined. "
137 "Give adfs as plugin parameters.";
138 throw Exception(
139 __FILE__, __LINE__, __func__, msg);
140 }
141
142 DSDBManager& dsdb = db();
144 conf.hasImplementation = false;
145 TTAMachine::Machine* nodeMach = NULL;
146 TTAMachine::Machine* extraMach = NULL;
147 TTAMachine::Machine* finalMach = NULL;
148
149 // load the adf from file or from dsdb
150 try {
152 } catch (const Exception& e) {
153 TCEString msg =
154 "Error loading the \'" + node_ + "\'";
155 throw Exception(
156 __FILE__, __LINE__, __func__, msg);
157 }
158 assert(nodeMach != NULL);
159
160 if (extra_ != "") {
161 try {
163 finalMach = new TTAMachine::Machine(*extraMach);
164 } catch (const Exception& e) {
165 TCEString msg =
166 "Error loading the \'" + extra_ + "\'";
167 throw Exception(
168 __FILE__, __LINE__, __func__, msg);
169 }
170 } else {
171 extraMach = NULL;
172 finalMach = new TTAMachine::Machine();
173 }
174
175 // Copies the extra machine to new architecture
176 // add components
177 addComponents(finalMach, nodeMach, extraMach, nodeCount_);
178
179 // add machine to configuration
180 conf.architectureID = dsdb.addArchitecture(*finalMach);
181
182 // add new configuration to dsdb
183 RowID confID = dsdb.addConfiguration(conf);
184
185 // If requested, adds wide load/store unit
186 if (vectorLSU_ && nodeCount_ > 1) {
189 "VectorLSGenerator", &db());
190
191 lsuAdd->giveParameter("node_count", Conversion::toString(nodeCount_));
192 lsuAdd->giveParameter(
193 "address_spaces", Conversion::toString(addressSpaces_));
194 lsuAdd->giveParameter(
195 "add_broadcast", Conversion::toString(addBroadcast_));
196
197 lsuAdd->giveParameter(
198 "shared_lsu_latency", Conversion::toString(sharedLSULatency_));
199 lsuAdd->giveParameter(
200 "data_lsu_latency", Conversion::toString(dataLSULatency_));
201
202 std::vector<RowID> addedLSUConf =
203 lsuAdd->explore(confID);
204
205 finalMach = dsdb.architecture(addedLSUConf.back());
206
207 bool connectAgain = false;
208 // Connect vector units, one at a time.
209 do {
210 connectAgain =
211 connectVectorLSU(finalMach, nodeMach, extraMach, nodeCount_);
212 } while (connectAgain);
213
214 conf.architectureID = dsdb.addArchitecture(*finalMach);
215 confID = dsdb.addConfiguration(conf);
216 }
217 if (buildIDF_) {
218 try {
219 // add idf to configuration
220 selector_.selectComponentsToConf(conf, dsdb, finalMach);
221 conf.architectureID = dsdb.addArchitecture(*finalMach);
222 confID = dsdb.addConfiguration(conf);
223 } catch (const Exception& e) {
224 throw Exception(
225 __FILE__, __LINE__, __func__, e.errorMessageStack());
226 }
227 } else {
228 conf.hasImplementation = false;
229 }
230 result.push_back(confID);
231 return result;
232 }
233
234private:
235 /// Selector used by the plugin.
237
238 static const TCEString NodePN_;
240 static const TCEString ExtraPN_;
241 static const TCEString BuildIDFPN_;
253
269
270 /**
271 * Reads the parameters given to the plugin.
272 */
296
297 typedef std::vector<TTAMachine::Bus*> BusVector;
298 typedef std::set<TTAMachine::Guard*, TTAMachine::MachinePart::Comparator>
300
303 GuardSet guards;
304
305 const TTAMachine::Machine::BusNavigator& busNav =
306 mach->busNavigator();
307
308 for (int k = 0; k < busNav.count(); k++) {
309 for (int j = 0; j < busNav.item(k)->guardCount(); j++) {
310 guards.insert(busNav.item(k)->guard(j));
311 }
312 }
313 return guards;
314 }
315 /**
316 * Copies node.adf to the final machine nodeCount times.
317 *
318 * @return The initial machine of NULL if an error occurred.
319 */
321 TTAMachine::Machine* finalMach,
322 TTAMachine::Machine* nodeMach,
323 TTAMachine::Machine* extraMach,
324 unsigned nodeCount) {
325
326 std::map<Bus*, std::pair<Bus*, int> > busMapping;
327 // Order is important here!
328 // When adding busses also socket will be created
329 // and the RF and FU ports will be connected to them when adding.
330
331 // find guards that have come from extras
332 GuardSet extrasGuards = findGuards(finalMach);
333
334 renameExtraUnits(finalMach);
335 addAddressSpaces(finalMach, nodeMach);
336 if (extraMach != NULL)
337 addAddressSpaces(finalMach, extraMach);
338 addBuses(finalMach, nodeMach, nodeCount, busMapping);
339 addRegisterFiles(finalMach, nodeMach, nodeCount);
340 addFunctionUnits(finalMach, nodeMach, nodeCount);
341
342 BusVector connectionBuses;
344 finalMach, nodeMach, extraMach, nodeCount, extrasGuards,
345 connectionBuses);
346 addGuardsToBuses(busMapping, extrasGuards);
347
348 /* For the node-only machine, copy the guards from the nodes to the
349 connection buses to enable predicated inter-node moves. */
350 if (extra_ == "")
351 addAllGuardsToConnectionBuses(finalMach, connectionBuses);
352 }
353
356 nodeNamePrefix << nodeId << "_";
357 return nodeNamePrefix;
358 }
359
360 void
362 TTAMachine::Machine* finalMach,
363 const BusVector& connectionBuses) {
364 for (BusVector::const_iterator i = connectionBuses.begin();
365 i != connectionBuses.end(); ++i) {
367 finalMach->busNavigator();
368 Bus* connectionBus = *i;
369 for (int b = 0; b < busNav.count(); b++) {
370 Bus* origBus = busNav.item(b);
371 origBus->copyGuardsTo(*connectionBus);
372 }
373 }
374
375 }
376
377 void
378 addGuardsToBuses(std::map<Bus*, std::pair<Bus*, int> >& busMapping,
379 GuardSet& extrasGuards) {
380 for (std::map<Bus*, std::pair<Bus*, int> >::iterator i =
381 busMapping.begin(); i != busMapping.end(); i++) {
382
383 copyGuards(*(i->second.first), *(i->first), nodeNamePrefix(i->second.second));
384
385 for (GuardSet::iterator j = extrasGuards.begin();
386 j != extrasGuards.end(); j++) {
387 if (!i->first->hasGuard(**j)) {
388 (*j)->copyTo(*i->first);
389 }
390 }
391 }
392 }
393
394
395 /**
396 * Adds buses and sockets to the machine.
397 *
398 */
400 TTAMachine::Machine* finalMach,
401 TTAMachine::Machine* nodeMach,
402 unsigned nodeCount,
403 std::map<Bus*, std::pair<Bus*, int> >& busMapping) {
404 const Machine::SocketNavigator socketNav = nodeMach->socketNavigator();
405 const TTAMachine::Machine::BusNavigator& busNav =
406 nodeMach->busNavigator();
407
408 for (unsigned j = 0; j < nodeCount; j++) {
409 bool socketsCreated = false;
410 // Add busses
411 for (int i = 0; i < busNav.count(); i++) {
412 TTAMachine::Bus* addBus = busNav.item(i)->copy();
413 TTAMachine::Bus* originalBus = busNav.item(i);
414 busMapping[addBus] = std::pair<Bus*,int>(originalBus, j);
415
416 TCEString busName =
417 originalBus->name() + "_connect_" + Conversion::toString(j);
418 addBus->setName(busName);
419 try {
420 finalMach->addBus(*addBus);
421 } catch (const ComponentAlreadyExists& e) {
422 TCEString msg = "ADFCombiner: Tried to add Bus with an "
423 "already existing name (" + busName + ")";
424 throw Exception(
425 __FILE__, __LINE__, __func__, msg);
426 }
427
428 for (int k = 0; k < socketNav.count(); k++) {
429 TTAMachine::Socket* addSocket = NULL;
430 if (socketNav.item(k)->portCount() == 0) {
431 // Don't bother copying sockets that are not connected
432 // to any ports.
433 continue;
434 }
435 // When first bus added, create also new sockets
436 if (!socketsCreated) {
437 TCEString socketName =
438 getNodeComponentName(socketNav.item(k)->name(), j);
439 addSocket = new TTAMachine::Socket(socketName);
440 try {
441 finalMach->addSocket(*addSocket);
442 } catch (const ComponentAlreadyExists& e) {
443 TCEString msg = "ADFCombiner: Tried to add Socket with "
444 " an already existing name (" + socketName +")";
445 throw Exception(
446 __FILE__, __LINE__, __func__, msg);
447 }
448 } else {
449 // Sockets were create for first bus already, just pick
450 // them based on their known generated names.
451 TCEString socketName =
452 getNodeComponentName(socketNav.item(k)->name(), j);
453 addSocket =
454 finalMach->socketNavigator().item(socketName);
455 }
456 // Connect sockets to bus
457 for (int l = 0; l < originalBus->segmentCount(); l++) {
458 if (socketNav.item(k)->isConnectedTo(
459 *originalBus->segment(l))) {
460 addSocket->attachBus(*addBus->segment(l));
461 addSocket->setDirection(
462 socketNav.item(k)->direction());
463 }
464 }
465 }
466 socketsCreated = true;
467 }
468 }
469 }
470
471 /**
472 * Adds register file(s) to the machine
473 *
474 *
475 * @return void
476 */
477
479 TTAMachine::Machine* finalMach,
480 TTAMachine::Machine* nodeMach, unsigned nodeCount) {
481
483 nodeMach->registerFileNavigator();
484 for (unsigned j = 0; j < nodeCount; j++) {
485 for (int i = 0; i < RFNav.count(); i++) {
486 TTAMachine::RegisterFile* addRF = RFNav.item(i)->copy();
487 TTAMachine::RegisterFile* originalRF = RFNav.item(i);
488 TCEString RFName =
489 getNodeComponentName(RFNav.item(i)->name(), j);
490 addRF->setName(RFName);
491 try {
492 finalMach->addRegisterFile(*addRF);
493 } catch (const ComponentAlreadyExists& e) {
494 TCEString msg =
495 "ADFCombiner: Tried to add RF with an already"
496 "existing name (" + RFName +")";
497 throw Exception(
498 __FILE__, __LINE__, __func__, msg);
499 }
500 connectPorts(finalMach, originalRF, addRF, j);
501 }
502 }
503 }
504 /**
505 * Adds function unit(s) to the machine
506 *
507 *
508 * @return void
509 */
510
512 TTAMachine::Machine* finalMach,
513 TTAMachine::Machine* nodeMach, unsigned nodeCount) {
515 nodeMach->functionUnitNavigator();
516 for (unsigned j = 0; j < nodeCount; j++) {
517 for (int i = 0; i < FUNav.count(); i++) {
518 TTAMachine::FunctionUnit* addFU = FUNav.item(i)->copy();
519 TTAMachine::FunctionUnit* originalFU = FUNav.item(i);
520 TCEString FUName =
521 getNodeComponentName(FUNav.item(i)->name(), j);
522 addFU->setName(FUName);
523 try {
524 finalMach->addFunctionUnit(*addFU);
525 } catch (const ComponentAlreadyExists& e) {
526 TCEString msg =
527 "ADFCombiner: Tried to add FU with an already"
528 "existing name (" + FUName +")";
529 throw Exception(
530 __FILE__, __LINE__, __func__, msg);
531 }
532 if (originalFU->hasAddressSpace()) {
533 TCEString aName = originalFU->addressSpace()->name();
535 finalMach->addressSpaceNavigator();
536 assert(aNav.hasItem(aName));
537 addFU->setAddressSpace(aNav.item(aName));
538 }
539 connectPorts(finalMach, originalFU, addFU, j);
540 }
541 }
542
543 if (extra_ == "") {
544 TTAMachine::ControlUnit *originalCU = nodeMach->controlUnit();
545 TTAMachine::ControlUnit *copyCU = originalCU->copy();
546 finalMach->setGlobalControl(*copyCU);
547 if (originalCU->hasAddressSpace()) {
548 TCEString aName = originalCU->addressSpace()->name();
550 finalMach->addressSpaceNavigator();
551 assert(aNav.hasItem(aName));
552 copyCU->setAddressSpace(aNav.item(aName));
553
554 // Connect the CU to all node 0 buses for now.
555 // @todo remove the connections not to RFs and
556 // ensure the buses are guarded
558 conn.connectControlUnit(*copyCU);
559 }
560
561 }
562 }
563
564 /**
565 * Connect unit ports to sockets.
566 *
567 *
568 * @return void
569 */
570
572 TTAMachine::Machine* finalMach,
573 TTAMachine::Unit* original,
574 TTAMachine::Unit* newUnit,
575 int count) {
576
577 for (int k = 0; k < original->portCount(); k++) {
578 TTAMachine::Port* port = original->port(k);
579 TTAMachine::Socket* socket = port->inputSocket();
580 if (socket != NULL) {
581 TCEString socketName =
582 getNodeComponentName(socket->name(), count);
583 TTAMachine::Socket* newSocket =
584 finalMach->socketNavigator().item(socketName);
585 newUnit->port(k)->attachSocket(*newSocket);
586 }
587 socket = port->outputSocket();
588 if (socket != NULL) {
589 TCEString socketName =
590 getNodeComponentName(socket->name(), count);
591 TTAMachine::Socket* newSocket =
592 finalMach->socketNavigator().item(socketName);
593 newUnit->port(k)->attachSocket(*newSocket);
594 }
595 socket = port->unconnectedSocket(0);
596 if (socket != NULL) {
597 TCEString socketName =
598 getNodeComponentName(socket->name(), count);
599 TTAMachine::Socket* newSocket =
600 finalMach->socketNavigator().item(socketName);
601 newUnit->port(k)->attachSocket(*newSocket);
602 }
603 socket = port->unconnectedSocket(1);
604 if (socket != NULL) {
605 TCEString socketName =
606 getNodeComponentName(socket->name(), count);
607 TTAMachine::Socket* newSocket =
608 finalMach->socketNavigator().item(socketName);
609 newUnit->port(k)->attachSocket(*newSocket);
610 }
611 }
612 }
613
614 /**
615 * Adds address spaces from node machine to final one, if missing.
616 * Address spaces from extra machine are already in final.
617 *
618 *
619 * @return void
620 */
622 TTAMachine::Machine* finalMach,
623 TTAMachine::Machine* nodeMach) {
624
626 nodeMach->addressSpaceNavigator();
627 for (int i = 0; i < ANav.count(); i++) {
628 TTAMachine::AddressSpace* origA = ANav.item(i);
629 if (!finalMach->addressSpaceNavigator().hasItem(origA->name())) {
630 ObjectState* origState = origA->saveState();
631 // Creating address space registers it.
632 TTAMachine::AddressSpace* aSpace =
633 new TTAMachine::AddressSpace(origState, *finalMach);
634 assert(
635 finalMach->addressSpaceNavigator().hasItem(aSpace->name()));
636 }
637 }
638 }
639
640
641
642 /**
643 * Connect register files from extra and node into a ring, star or bar.
644 */
646 TTAMachine::Machine* finalMach,
647 TTAMachine::Machine* nodeMach,
648 TTAMachine::Machine* extraMach,
649 unsigned nodeCount,
650 std::set<TTAMachine::Guard*, TTAMachine::MachinePart::Comparator>
651 extrasGuards,
652 BusVector& connectionBuses) {
653
655 nodeMach->registerFileNavigator();
657 finalMach->registerFileNavigator();
658
660 finalMach->immediateUnitNavigator();
661
663 finalMach->busNavigator();
664 if (addRing_) {
665 for (int i = 0; i < nodeNav.count(); i++) {
666 TCEString rfName = nodeNav.item(i)->name();
667 // Connect register file between neighbouring node
668 for (unsigned int j = 0; j < nodeCount -1; j++) {
669 TCEString firstName = getNodeComponentName(rfName, j);
670 TCEString secondName = getNodeComponentName(rfName, j+1);
671 TTAMachine::RegisterFile* firstRF = finalNav.item(firstName);
672 TTAMachine::RegisterFile* secondRF = finalNav.item(secondName);
673
674 TCEString busName = "connect_"
676 "_" + Conversion::toString(j + 1);
677 int width = std::max(firstRF->width(), secondRF->width());
678 TTAMachine::Bus* newBus = NULL;
679
680 if (busNav.hasItem(busName)) {
681 newBus = busNav.item(busName);
682 } else {
683 newBus = createBus(finalMach, busName, width);
684 }
685 connectionBuses.push_back(newBus);
686
687 // Copy guards from extras to neighbour connection buses.
688 for (GuardSet::iterator k = extrasGuards.begin();
689 k != extrasGuards.end(); k++) {
690 if (!newBus->hasGuard(**k)) {
691 (*k)->copyTo(*newBus);
692 }
693 }
695 finalMach, firstRF, newBus, firstName, false);
697 finalMach, secondRF, newBus, secondName, false);
698 }
699
700 // A clustered machine without an extras node.
701 if (extraMach == NULL) continue;
702
704 extraMach->registerFileNavigator();
705
706 // Add connections between RF in extra.adf with first and
707 // last of the multiplied nodes
708 TCEString firstName = getNodeComponentName(rfName, 0);
709 TCEString lastName = getNodeComponentName(rfName, nodeCount -1);
710 TTAMachine::RegisterFile* firstRF = finalNav.item(firstName);
711 TTAMachine::RegisterFile* lastRF = finalNav.item(lastName);
712
713 for (int k = 0; k < extraNav.count(); k++) {
714 TCEString newName =
715 getExtraComponentName(extraNav.item(k)->name());
716 TTAMachine::RegisterFile* extraRF = finalNav.item(newName);
717 if (extraRF->width() != firstRF->width()) {
718 continue;
719 }
720 TCEString extraName = extraRF->name();
721 int width = std::max(firstRF->width(), extraRF->width());
722 TCEString busName = "connect_extra_first";
723 TTAMachine::Bus* newBus = NULL;
724 if (busNav.hasItem(busName)) {
725 newBus = busNav.item(busName);
726 } else {
727 newBus = createBus(finalMach, busName, width);
728 }
729 for (GuardSet::iterator j = extrasGuards.begin();
730 j != extrasGuards.end(); j++) {
731 if (!newBus->hasGuard(**j)) {
732 (*j)->copyTo(*newBus);
733 }
734 }
736 finalMach, firstRF, newBus, firstName, false);
738 finalMach, extraRF, newBus, extraName, false);
739 // In case we only one node, there is no need to bidirectional
740 // connection
741 if (firstName != lastName) {
742 width = std::max(lastRF->width(), extraRF->width());
743 busName = "connect_extra_last";
744 if (busNav.hasItem(busName)) {
745 newBus = busNav.item(busName);
746 } else {
747 newBus = createBus(finalMach, busName, width);
748 }
749 for (GuardSet::iterator j = extrasGuards.begin();
750 j != extrasGuards.end(); j++) {
751 if (!newBus->hasGuard(**j)) {
752 (*j)->copyTo(*newBus);
753 }
754 }
756 finalMach, lastRF, newBus, lastName, false);
758 finalMach, extraRF, newBus, extraName, false);
759 }
760 }
761 }
762 }
763 if (addBar_) {
764 int busCount = nodeCount;
765 for (int i = 0; i < busCount; i++) {
766 TCEString busName =
767 "connect_all_" + Conversion::toString(i);
768
769 TTAMachine::Bus* newBus = createBus(finalMach, busName, 32);
770 connectionBuses.push_back(newBus);
771
772 for (int i = 0; i < nodeNav.count(); i++) {
773 // Pick all register files in node, one by one
774 TCEString rfName = nodeNav.item(i)->name();
775 for (unsigned int j = 0; j < nodeCount; j++) {
776 // connect register file from all node to the
777 // bus
778 TCEString nodeName =
779 getNodeComponentName(rfName, j);
780 TTAMachine::RegisterFile* nodeRF =
781 finalNav.item(nodeName);
783 finalMach, nodeRF, newBus, nodeName, false);
784 }
785 }
786
787 if (extraMach == NULL) continue;
788
790 extraMach->registerFileNavigator();
791
792 for (int k = 0; k < extraNav.count(); k++) {
793 TCEString newName =
794 getExtraComponentName(extraNav.item(k)->name());
795 TTAMachine::RegisterFile* extraRF = finalNav.item(newName);
796 TCEString extraName = extraRF->name();
797 int width = extraRF->width();
798 if (width == 1)
799 continue;
800
801 createPortsAndSockets(finalMach, extraRF, newBus, extraName, false);
802 for (GuardSet::iterator j = extrasGuards.begin();
803 j != extrasGuards.end(); j++) {
804 if (!newBus->hasGuard(**j)) {
805 (*j)->copyTo(*newBus);
806 }
807 }
808 }
809
811 extraMach->immediateUnitNavigator();
812
813
814 for (int k = 0; k < extraImmNav.count(); k++) {
815 TCEString newName =
816 getExtraComponentName(extraImmNav.item(k)->name());
817 TTAMachine::ImmediateUnit* extraImm = finalImmNav.item(newName);
818 TCEString extraName = extraImm->name();
819 int width = extraImm->width();
820 if (width == 1)
821 continue;
822
824 finalMach, extraImm, newBus, extraName, true);
825 for (GuardSet::iterator j = extrasGuards.begin();
826 j != extrasGuards.end(); j++) {
827 if (!newBus->hasGuard(**j)) {
828 (*j)->copyTo(*newBus);
829 }
830 }
831 }
832 }
833 }
834 if (addStar_) {
835 if (extraMach != NULL) {
837 extraMach->registerFileNavigator();
838
839 for (unsigned int i = 0; i*nodesPerBus_ < nodeCount; i++) {
840 TCEString busName =
841 "star_" + Conversion::toString(i);
842 TTAMachine::Bus* newBus =
843 createBus(finalMach, busName, 32);
844 connectionBuses.push_back(newBus);
845 // Connect RFs in extra to the bus
846 for (int k = 0; k < extraNav.count(); k++) {
847 TCEString newName =
848 getExtraComponentName(extraNav.item(k)->name());
849 TTAMachine::RegisterFile* extraRF =
850 finalNav.item(newName);
851 TCEString extraName = extraRF->name();
852 int width = extraRF->width();
853 if (width == 1)
854 continue;
855
857 finalMach, extraRF, newBus, extraName, false, i);
858 for (GuardSet::iterator j = extrasGuards.begin();
859 j != extrasGuards.end(); j++) {
860 if (!newBus->hasGuard(**j)) {
861 (*j)->copyTo(*newBus);
862 }
863 }
864 }
865
866 for (int j = 0; j < nodeNav.count(); j++) {
867 // Pick all register files in node, one by one
868 TCEString rfName = nodeNav.item(j)->name();
869 for (int k = 0;
870 k < nodesPerBus_ && (i*nodesPerBus_)+k
871 < nodeCount; k++) {
872 TCEString nodeName =
874 rfName, ((i*nodesPerBus_)+k));
876 finalNav.item(nodeName);
878 finalMach, nodeRF, newBus, nodeName, false);
879 }
880 }
881
883 extraMach->immediateUnitNavigator();
884
885 for (int k = 0; k < extraImmNav.count(); k++) {
886 TCEString newName =
887 getExtraComponentName(extraImmNav.item(k)->name());
888 TTAMachine::ImmediateUnit* extraImm = finalImmNav.item(newName);
889 TCEString extraName = extraImm->name();
890 int width = extraImm->width();
891 if (width == 1)
892 continue;
893
895 finalMach, extraImm, newBus, extraName, true);
896 for (GuardSet::iterator j = extrasGuards.begin();
897 j != extrasGuards.end(); j++) {
898 if (!newBus->hasGuard(**j)) {
899 (*j)->copyTo(*newBus);
900 }
901 }
902 }
903
904 }
905 } else { // extrasless - connect all to lane 0
906
907 for (unsigned int i = 0; i*nodesPerBus_ < nodeCount-1; i++) {
908 TCEString busName =
909 "star_" + Conversion::toString(i);
910 TTAMachine::Bus* newBus =
911 createBus(finalMach, busName, 32);
912 connectionBuses.push_back(newBus);
913
914 for (int j = 0; j < nodeNav.count(); j++) {
915 // Pick all register files in node, one by one
916 TCEString rfName = nodeNav.item(j)->name();
917 for (int k = 0;
918 k < nodesPerBus_ && (i*nodesPerBus_)+k
919 < nodeCount-1; k++) {
920 TCEString nodeName =
922 rfName, ((i*nodesPerBus_)+k+1));
924 finalNav.item(nodeName);
926 finalMach, nodeRF, newBus, nodeName, false);
927 }
928 }
929
930
931 for (int j = 0; j < nodeNav.count(); j++) {
932 // Pick all register files in node, one by one
933 TCEString rfName = nodeNav.item(j)->name();
934 TCEString node0Name =
935 getNodeComponentName(rfName, 0);
936 TTAMachine::RegisterFile* node0RF =
937 finalNav.item(node0Name);
938 int width = node0RF->width();
939 if (width == 1)
940 continue;
941
943 finalMach, node0RF, newBus, node0Name, false, i);
944
945 }
946 }
947 }
948 }
949 }
950 /**
951 * Create single bus with given name and width.
952 */
954 TTAMachine::Machine* finalMach,
955 TCEString busName,
956 int width) {
957 TTAMachine::Bus* newBus = new TTAMachine::Bus(
958 busName, width, 0,
960 TTAMachine::Segment* newSegment =
961 new TTAMachine::Segment(busName, *newBus);
962 assert(newBus->hasSegment(newSegment->name()));
963 try {
964 finalMach->addBus(*newBus);
965 } catch (const ComponentAlreadyExists& e) {
966 TCEString msg =
967 "ADFCombiner: Tried to add Bus with an already"
968 "existing name (" + busName +")";
969 throw Exception(
970 __FILE__, __LINE__, __func__, msg);
971 }
972 return newBus;
973 }
974 /**
975 * Create new ports in RF and connected them to sockets
976 * and connect sockets to the bus.
977 */
979 TTAMachine::Machine* finalMach,
981 TTAMachine::Bus* newBus,
983 bool readOnly,
984 int nodeNumber = -1) {
985
986 TTAMachine::RFPort* readPort = NULL;
987 TTAMachine::RFPort* writePort = NULL;
988 TTAMachine::Socket* readSocket = NULL;
989 TTAMachine::Socket* writeSocket = NULL;
990
991 if (!reuseRFPorts_) {
992 // Create new ports and sockets for the register files connections
993 for (int k = 0; k < rf->portCount(); k++) {
994 if (rf->port(k)->name() == name + "_connect_r") {
995 readPort = rf->port(k);
996 }
997 if (rf->port(k)->name() == name + "_connect_w") {
998 writePort = rf->port(k);
999 }
1000 }
1001 } else if (reuseRFPorts_ && nodeNumber != -1) {
1002 // If the callee passed the node number, we connect only
1003 // certain ports to the bus.
1004 int indexRead = nodeNumber % rf->maxReads();
1005 int indexWrite = nodeNumber % rf->maxWrites();
1006 int foundReads = 0;
1007 int foundWrites = 0;
1008 for (int k = 0; k < rf->portCount(); k++) {
1009 if (rf->port(k)->outputSocket() != NULL) {
1010 if (foundReads == indexRead) {
1011 readPort = rf->port(k);
1012 readSocket = rf->port(k)->outputSocket();
1013 }
1014 foundReads++;
1015 }
1016 if (rf->port(k)->inputSocket() != NULL) {
1017 if (foundWrites == indexWrite) {
1018 writePort = rf->port(k);
1019 writeSocket = rf->port(k)->inputSocket();
1020 }
1021 foundWrites++;
1022 }
1023 }
1024 } else {
1025 // Just find first available port for reuse.
1026 for (int k = 0; k < rf->portCount(); k++) {
1027 if (rf->port(k)->outputSocket() != NULL) {
1028 if (readPort == NULL) {
1029 readPort = rf->port(k);
1030 readSocket = rf->port(k)->outputSocket();
1031 }
1032 }
1033 if (!readOnly && rf->port(k)->inputSocket() != NULL) {
1034 if (writePort == NULL) {
1035 writePort = rf->port(k);
1036 writeSocket = rf->port(k)->inputSocket();
1037 }
1038 }
1039 }
1040 }
1041
1042 if (readPort == NULL) {
1043 readPort = new TTAMachine::RFPort(
1044 name + "_connect_r", *rf);
1045 }
1046 if (!readOnly && writePort == NULL) {
1047 writePort = new TTAMachine::RFPort(
1048 name + "_connect_w", *rf);
1049 }
1050
1051 const Machine::SocketNavigator socketNavigator =
1052 finalMach->socketNavigator();
1053
1054 // If we reused the ports, the socket is already known, if not
1055 // try to find it or create new one.
1056 if (readSocket == NULL) {
1057 if (!socketNavigator.hasItem(readPort->name())) {
1058 readSocket = new TTAMachine::Socket(readPort->name());
1059 try {
1060 finalMach->addSocket(*readSocket);
1061 } catch (const ComponentAlreadyExists& e) {
1062 TCEString msg =
1063 "ADFCombiner: Tried to add Socket with "
1064 " an already existing name (" + readSocket->name() +")";
1065 throw Exception(
1066 __FILE__, __LINE__, __func__, msg);
1067 }
1068 } else {
1069 readSocket = socketNavigator.item(readPort->name());
1070 }
1071 }
1072
1073 if (!readOnly && writeSocket == NULL) {
1074 if (!socketNavigator.hasItem(writePort->name())) {
1075 writeSocket = new TTAMachine::Socket(writePort->name());
1076 try {
1077 finalMach->addSocket(*writeSocket);
1078 } catch (const ComponentAlreadyExists& e) {
1079 TCEString msg =
1080 "ADFCombiner: Tried to add Socket with "
1081 " an already existing name (" + writeSocket->name() +")";
1082 throw Exception(
1083 __FILE__, __LINE__, __func__, msg);
1084 }
1085 } else {
1086 writeSocket = socketNavigator.item(writePort->name());
1087 }
1088 }
1089
1090 if (readPort->outputSocket() == NULL) {
1091 readPort->attachSocket(*readSocket);
1092 }
1093 if (!readSocket->isConnectedTo(*newBus->segment(0))) {
1094 readSocket->attachBus(*newBus->segment(0));
1095 readSocket->setDirection(Socket::OUTPUT);
1096 }
1097 if (!readOnly && writePort->inputSocket() == NULL) {
1098 writePort->attachSocket(*writeSocket);
1099 }
1100 if (!readOnly && !writeSocket->isConnectedTo(*newBus->segment(0))) {
1101 writeSocket->attachBus(*newBus->segment(0));
1102 writeSocket->setDirection(Socket::INPUT);
1103 }
1104 }
1105 /**
1106 * If extra has LSU that is not connected to any of the buses,
1107 * treat it as a vector LSU and connect address write port to extra
1108 * and data ports to respective number of nodes.
1109 */
1111 TTAMachine::Machine* finalMach,
1112 TTAMachine::Machine* nodeMach,
1113 TTAMachine::Machine* extraMach,
1114 int nodeCount){
1115
1117 finalMach->functionUnitNavigator();
1118 TTAMachine::FunctionUnit* vectorLSU = NULL;
1119 TTAMachine::FUPort* trigger = NULL;
1120 TTAMachine::FUPort* inExtra = NULL;
1121 TTAMachine::FUPort* outExtra = NULL;
1122 int triggerIndex = -1;
1123 int outputPortCount = 0;
1124 bool broadcastUnit = false;
1125 for (int i = 0; i < finalNav.count(); i++) {
1126 TTAMachine::FunctionUnit* fu = finalNav.item(i);
1127 bool unconnected = false;
1128 for(int j = 0; j < fu->operationPortCount(); j++) {
1129 if (fu->operationPort(j)->socketCount() == 0) {
1130 unconnected = true;
1131 outputPortCount++;
1132 if (fu->operationPort(j)->isTriggering()) {
1133 triggerIndex = j;
1134 }
1135 } else {
1136 unconnected = false;
1137 triggerIndex = -1;
1138 }
1139 }
1140 if (unconnected) {
1141 // We found FU in extra that is not connected to any sockets,
1142 // that is agreed indication that is it vector load/store and
1143 // needs specific connectivity.
1144 // Let's check if it has address space
1145 if (fu->hasAddressSpace()) {
1146 // Ok, it seems to be load/store we look for, stop looking.
1147 // Find equivalends in final architecture
1148 vectorLSU = fu;
1149 trigger = vectorLSU->operationPort(triggerIndex);
1150 break;
1151 } else if (addBroadcast_){
1152 // We enabled addition of broadcast unit, so there is
1153 // unit without the address space.
1154 vectorLSU = fu;
1155 trigger = vectorLSU->operationPort(triggerIndex);
1156 broadcastUnit = true;
1157 break;
1158 } else {
1159 verboseLog("Candidate for Vector LSU does not have "
1160 "address space defined - " + fu->name());
1161 }
1162 }
1163 }
1164 if (vectorLSU == NULL) {
1165 // No unconnected vector LSU found, nothing to do here.
1166 return false;
1167 }
1168
1169 assert(trigger != NULL);
1170 TCEString prefix = vectorLSU->name();
1171 TTAMachine::Socket* triggerSocket =
1172 new TTAMachine::Socket(prefix + "_" + trigger->name());
1173 TTAMachine::Socket* inExtraSocket = NULL;
1174 if (inExtra)
1175 inExtraSocket =
1176 new TTAMachine::Socket(prefix + "_" + inExtra->name());
1177 TTAMachine::Socket* outExtraSocket = NULL;
1178 if (outExtra)
1179 outExtraSocket =
1180 new TTAMachine::Socket(prefix + "_" + outExtra->name());
1181
1182 try {
1183 finalMach->addSocket(*triggerSocket);
1184 } catch (const ComponentAlreadyExists& e) {
1185 TCEString msg =
1186 "ADFCombiner: Tried to add Socket with "
1187 " an already existing name (" + triggerSocket->name() +")";
1188 throw Exception(
1189 __FILE__, __LINE__, __func__, msg);
1190 }
1191 trigger->attachSocket(*triggerSocket);
1192 if (inExtra) {
1193 try {
1194 finalMach->addSocket(*inExtraSocket);
1195 } catch (const ComponentAlreadyExists& e) {
1196 TCEString msg =
1197 "ADFCombiner: Tried to add Socket with "
1198 " an already existing name (" + inExtraSocket->name() +")";
1199 throw Exception(
1200 __FILE__, __LINE__, __func__, msg);
1201 }
1202 inExtra->attachSocket(*inExtraSocket);
1203 }
1204 if (outExtra) {
1205 try {
1206 finalMach->addSocket(*outExtraSocket);
1207 } catch (const ComponentAlreadyExists& e) {
1208 TCEString msg =
1209 "ADFCombiner: Tried to add Socket with "
1210 " an already existing name (" + outExtraSocket->name() +")";
1211 throw Exception(
1212 __FILE__, __LINE__, __func__, msg);
1213 }
1214 outExtra->attachSocket(*outExtraSocket);
1215 }
1216
1217 const TTAMachine::Machine::BusNavigator& extraBusNav =
1218 extraMach->busNavigator();
1219 const TTAMachine::Machine::BusNavigator& nodeBusNav =
1220 nodeMach->busNavigator();
1221 const TTAMachine::Machine::BusNavigator& finalBusNav =
1222 finalMach->busNavigator();
1223 // Connect trigger socket to all the buses in extra.
1224 for (int i = 0; i < extraBusNav.count(); i++) {
1225 TCEString busName = extraBusNav.item(i)->name();
1227 continue;
1228 triggerSocket->attachBus(*finalBusNav.item(busName)->segment(0));
1229 if (inExtra)
1230 inExtraSocket->attachBus(*finalBusNav.item(busName)->segment(0));
1231 if (outExtra)
1232 outExtraSocket->attachBus(*finalBusNav.item(busName)->segment(0));
1233 }
1234 triggerSocket->setDirection(Socket::INPUT);
1235 if (inExtra)
1236 inExtraSocket->setDirection(Socket::INPUT);
1237 if (outExtra)
1238 outExtraSocket->setDirection(Socket::OUTPUT);
1239
1240
1241 for (int j = 0; j < vectorLSU->operationCount(); j++) {
1242 // We run this for all the HW operations, so some
1243 // sockets port connections could already exists
1244 TTAMachine::HWOperation* operation = vectorLSU->operation(j);
1245 TTAMachine::ExecutionPipeline* pipeline = operation->pipeline();
1246
1247 // connect write ports to nodes.
1249 pipeline->readOperands();
1250 TTAMachine::ExecutionPipeline::OperandSet::iterator it =
1251 readOperandSet.begin();
1252 bool writeConnectedToExtra = false;
1253 for (; it != readOperandSet.end(); it++) {
1254 TTAMachine::Port* port = operation->port(*it);
1255 if (port != trigger && port != inExtra) {
1256 // Trigger is already connected to extra, we just connect
1257 // rest of writing ports.
1258 TCEString socketName = prefix + "_" + port->name();
1259 TTAMachine::Socket* inputSocket = NULL;
1260 if (!finalMach->socketNavigator().hasItem(socketName)) {
1261 inputSocket =
1262 new TTAMachine::Socket(prefix + "_" + port->name());
1263 try {
1264 finalMach->addSocket(*inputSocket);
1265 } catch (const ComponentAlreadyExists& e) {
1266 TCEString msg =
1267 "ADFCombiner: Tried to add Socket with "
1268 " an already existing name (" + inputSocket->name() +")";
1269 throw Exception(
1270 __FILE__, __LINE__, __func__, msg);
1271 }
1272 } else {
1273 inputSocket =
1274 finalMach->socketNavigator().item(socketName);
1275 }
1276 if (!port->isConnectedTo(*inputSocket)){
1277 port->attachSocket(*inputSocket);
1278 }
1279 for (int i = 0; i < nodeBusNav.count(); i++) {
1280 /// The name of bus is generated same way as when creating
1281 /// new buses for nodes. Any change there must be reflected
1282 /// here as well!
1283 /// In case LSU has more ports then there are nodes
1284 /// we start from beginning.
1285 // Operand index 1 is trigger, usefull operand
1286 // indexes starts from 2, node counting starts from 0
1287 TCEString busName =
1288 nodeBusNav.item(i)->name() + "_connect_" +
1289 Conversion::toString((*it -2) % nodeCount);
1290 assert(finalBusNav.hasItem(busName));
1292 continue;
1293 if (!inputSocket->isConnectedTo(
1294 *finalBusNav.item(busName)->segment(0))) {
1295 inputSocket->attachBus(
1296 *finalBusNav.item(busName)->segment(0));
1297 }
1298 }
1299 if (!writeConnectedToExtra) {
1300 for (int i = 0; i < extraBusNav.count(); i++) {
1301 TCEString busName = extraBusNav.item(i)->name();
1303 continue;
1304 if (!inputSocket->isConnectedTo(
1305 *finalBusNav.item(busName)->segment(0)))
1306 inputSocket->attachBus(
1307 *finalBusNav.item(busName)->segment(0));
1308 }
1309 writeConnectedToExtra = true;
1310 }
1311 inputSocket->setDirection(Socket::INPUT);
1312 }
1313 }
1314 // connect read ports to nodes.
1316 pipeline->writtenOperands();
1317 it = writeOperandSet.begin();
1318 bool readConnectedToExtra = false;
1319 for (; it != writeOperandSet.end(); it++) {
1320 TTAMachine::Port* port = operation->port(*it);
1321 if (port == outExtra)
1322 continue;
1323 assert(port != trigger);
1324 TCEString socketName = prefix + "_" + port->name();
1325 TTAMachine::Socket* outputSocket = NULL;
1326 if (!finalMach->socketNavigator().hasItem(socketName)) {
1327 outputSocket =
1328 new TTAMachine::Socket(prefix + "_" + port->name());
1329 try {
1330 finalMach->addSocket(*outputSocket);
1331 } catch (const ComponentAlreadyExists& e) {
1332 TCEString msg =
1333 "ADFCombiner: Tried to add Socket with "
1334 " an already existing name (" + outputSocket->name() +")";
1335 throw Exception(
1336 __FILE__, __LINE__, __func__, msg);
1337 }
1338 } else {
1339 outputSocket =
1340 finalMach->socketNavigator().item(socketName);
1341 }
1342 if (!port->isConnectedTo(*outputSocket)){
1343 port->attachSocket(*outputSocket);
1344 }
1345 for (int i = 0; i < nodeBusNav.count(); i++) {
1346 /// The name of bus is generated same way as when creating
1347 /// new buses for nodes. Any change there must be reflected
1348 /// here as well!
1349 /// In case LSU has more ports then there are nodes
1350 /// we start from beginning.
1351 // Operand index 1 is trigger, usefull operand
1352 // indexes starts from 2, node counting starts from 0
1353 TCEString busName =
1354 nodeBusNav.item(i)->name() + "_connect_" +
1355 Conversion::toString((*it -2) % nodeCount);
1356 assert(finalBusNav.hasItem(busName));
1358 continue;
1359 if (!outputSocket->isConnectedTo(
1360 *finalBusNav.item(busName)->segment(0))) {
1361 outputSocket->attachBus(
1362 *finalBusNav.item(busName)->segment(0));
1363 }
1364 }
1365 if (!readConnectedToExtra && !broadcastUnit) {
1366 for (int i = 0; i < extraBusNav.count(); i++) {
1367 TCEString busName = extraBusNav.item(i)->name();
1369 continue;
1370 if (!outputSocket->isConnectedTo(
1371 *finalBusNav.item(busName)->segment(0)))
1372 outputSocket->attachBus(
1373 *finalBusNav.item(busName)->segment(0));
1374 }
1375 readConnectedToExtra = true;
1376 }
1377 outputSocket->setDirection(Socket::OUTPUT);
1378 }
1379 }
1380 return true;
1381 }
1384 finalMach->functionUnitNavigator();
1385 for (int i = 0; i < finalNav.count(); i++) {
1386 TCEString oldName = finalNav.item(i)->name();
1387 finalNav.item(i)->setName(getExtraComponentName(oldName));
1388 }
1390 finalMach->registerFileNavigator();
1391 for (int i = 0; i < finalRFNav.count(); i++) {
1392 TCEString oldName = finalRFNav.item(i)->name();
1393 finalRFNav.item(i)->setName(getExtraComponentName(oldName));
1394 }
1396 finalMach->immediateUnitNavigator();
1397 for (int i = 0; i < finalImmNav.count(); i++) {
1398 TCEString oldName = finalImmNav.item(i)->name();
1399 finalImmNav.item(i)->setName(getExtraComponentName(oldName));
1400 }
1401 }
1403 return "L_" + Conversion::toString(idx) + "_" + originalName;
1404 }
1405
1407 return "EX_" + originalName;
1408 }
1409
1410 void copyGuards(TTAMachine::Bus &originalBus,
1411 TTAMachine::Bus &addBus, const TCEString& prefix) {
1412 for (int i = 0; i < originalBus.guardCount(); ++i) {
1413 Guard* guard = originalBus.guard(i);
1414 if (RegisterGuard* rg = dynamic_cast<RegisterGuard*>(guard)) {
1415 TCEString rfName = prefix + rg->registerFile()->name();
1416 int index = rg->registerIndex();
1417 RegisterFile* rfNew =
1418 addBus.machine()->registerFileNavigator().item(rfName);
1419 if (rfNew == NULL) {
1420 std::cerr << "RF: " << rfName << " not found from mach!"
1421 << std::endl;
1422 continue;
1423 }
1424 new RegisterGuard(
1425 rg->isInverted(), *rfNew, index, &addBus);
1426 } else if (PortGuard* pg = dynamic_cast<PortGuard*>(guard)) {
1427 FUPort* fuPort = pg->port();
1428 FunctionUnit* fu =
1429 static_cast<FunctionUnit*>(fuPort->parentUnit());
1430 int index = -1;
1431 for (int i = 0; i < fu->portCount(); i++) {
1432 if (fu->port(i) == fuPort) {
1433 index = i;
1434 }
1435 }
1436 assert(index != -1);
1437 TCEString fuName = prefix + fu->name();
1438 FunctionUnit* fuNew =
1439 addBus.machine()->functionUnitNavigator().item(fuName);
1440 if (fuNew == NULL) {
1441 std::cerr << "FU: " << fuName << " not found from mach!"
1442 << std::endl;
1443 continue;
1444 }
1445 FUPort* port = static_cast<FUPort*>(fuNew->port(index));
1446 new PortGuard(pg->isInverted(), *port, addBus);
1447 }
1448 }
1449 }
1450};
1451
1452// parameters
1453const TCEString ADFCombiner::NodePN_("node");
1454const TCEString ADFCombiner::NodeCountPN_("node_count");
1455const TCEString ADFCombiner::ExtraPN_("extra");
1456const TCEString ADFCombiner::BuildIDFPN_("build_idf");
1457const TCEString ADFCombiner::VectorLSUPN_("vector_lsu");
1458const TCEString ADFCombiner::AddressSpacesPN_("address_spaces");
1459const TCEString ADFCombiner::AddBroadcastPN_("add_broadcast");
1463const TCEString ADFCombiner::NodesPerBusPN_("nodes_per_bus");
1464const TCEString ADFCombiner::ReuseRFPortsPN_("reuse_rf_ports");
1465const TCEString ADFCombiner::SharedLSULatencyPN_("shared_lsu_latency");
1466const TCEString ADFCombiner::DataLSULatencyPN_("data_lsu_latency");
1467const TCEString ADFCombiner::VLSUConnectionBusesPN_("vlsu_connection_buses");
1468
#define verboseLog(text)
#define __func__
#define assert(condition)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
#define EXPORT_DESIGN_SPACE_EXPLORER_PLUGIN(PLUGIN_NAME__)
find Finds info of the inner loops in the false
#define UINT(OPERAND)
Definition OSAL.hh:313
#define BOOL()
void connectRegisterFiles(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, TTAMachine::Machine *extraMach, unsigned nodeCount, std::set< TTAMachine::Guard *, TTAMachine::MachinePart::Comparator > extrasGuards, BusVector &connectionBuses)
virtual bool requiresStartingPointArchitecture() const
TCEString addressSpaces_
void addAllGuardsToConnectionBuses(TTAMachine::Machine *finalMach, const BusVector &connectionBuses)
static const TCEString BuildIDFPN_
void addBuses(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, unsigned nodeCount, std::map< Bus *, std::pair< Bus *, int > > &busMapping)
TCEString getNodeComponentName(TCEString originalName, int idx)
virtual std::vector< RowID > explore(const RowID &, const unsigned int &)
static const TCEString AddBarConnectionPN_
static const TCEString VLSUConnectionBusesPN_
virtual bool requiresApplication() const
static const TCEString ReuseRFPortsPN_
GuardSet findGuards(TTAMachine::Machine *mach)
ComponentImplementationSelector selector_
Selector used by the plugin.
std::set< TTAMachine::Guard *, TTAMachine::MachinePart::Comparator > GuardSet
static const TCEString DataLSULatencyPN_
static const TCEString AddRingConnectionPN_
TTAMachine::Bus * createBus(TTAMachine::Machine *finalMach, TCEString busName, int width)
void copyGuards(TTAMachine::Bus &originalBus, TTAMachine::Bus &addBus, const TCEString &prefix)
std::vector< TTAMachine::Bus * > BusVector
void createPortsAndSockets(TTAMachine::Machine *finalMach, TTAMachine::RegisterFile *rf, TTAMachine::Bus *newBus, TCEString name, bool readOnly, int nodeNumber=-1)
PLUGIN_DESCRIPTION("Explorer plugin that produces a clustered machine with N lanes/nodes " "and an 'extras' node.")
bool connectVectorLSU(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, TTAMachine::Machine *extraMach, int nodeCount)
static const TCEString AddBroadcastPN_
int sharedLSULatency_
static const TCEString AddStarConnectionPN_
void readParameters()
TCEString extra_
static const TCEString NodePN_
static const TCEString NodeCountPN_
static const TCEString SharedLSULatencyPN_
static const TCEString VectorLSUPN_
static const TCEString ExtraPN_
void renameExtraUnits(TTAMachine::Machine *finalMach)
void addComponents(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, TTAMachine::Machine *extraMach, unsigned nodeCount)
void addFunctionUnits(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, unsigned nodeCount)
TCEString getExtraComponentName(TCEString originalName)
void addRegisterFiles(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach, unsigned nodeCount)
void addGuardsToBuses(std::map< Bus *, std::pair< Bus *, int > > &busMapping, GuardSet &extrasGuards)
virtual bool requiresHDB() const
virtual bool requiresSimulationData() const
void addAddressSpaces(TTAMachine::Machine *finalMach, TTAMachine::Machine *nodeMach)
virtual bool producesArchitecture() const
int VLSUConnectionBuses_
TCEString nodeNamePrefix(int nodeId)
static const TCEString AddressSpacesPN_
static const TCEString NodesPerBusPN_
void connectPorts(TTAMachine::Machine *finalMach, TTAMachine::Unit *original, TTAMachine::Unit *newUnit, int count)
TCEString node_
static std::ostream & logStream()
void selectComponentsToConf(DSDBManager::MachineConfiguration &conf, DSDBManager &dsdb, TTAMachine::Machine *mach=NULL, const std::string &icDecoder="ic_hdb", const std::string &icDecoderHDB="asic_130nm_1.5V.hdb", const double &frequency=0, const double &maxArea=0)
static std::string toString(const T &source)
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
RowID addConfiguration(const MachineConfiguration &conf)
void readOptionalParameter(const std::string paramName, T &param) const
virtual std::string name() const
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
virtual void giveParameter(const std::string &name, const std::string &value)
virtual DSDBManager & db()
static DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &pluginName, DSDBManager *dsdb=NULL)
std::string errorMessageStack(bool messagesOnly=false) const
Definition Exception.cc:138
void connectControlUnit(TTAMachine::ControlUnit &gcu) const
virtual ObjectState * saveState() const
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
virtual int width() const
virtual RFPort * port(const std::string &name) const
virtual bool hasSegment(const std::string &name) const
Definition Bus.cc:284
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual void setName(const std::string &name)
Definition Bus.cc:196
bool hasGuard(const Guard &guard) const
Definition Bus.cc:393
Guard * guard(int index) const
Definition Bus.cc:456
virtual int segmentCount() const
Definition Bus.cc:385
int guardCount() const
Definition Bus.cc:441
virtual void copyGuardsTo(Bus &other) const
Definition Bus.cc:1155
virtual Machine * machine() const
virtual TCEString name() const
virtual ControlUnit * copy() const
OperandSet writtenOperands(int cycle) const
OperandSet readOperands(int cycle) const
std::set< int > OperandSet
Set for operand indexes.
virtual bool isTriggering() const
Definition FUPort.cc:182
virtual AddressSpace * addressSpace() const
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
virtual FUPort * operationPort(const std::string &name) const
virtual void setAddressSpace(AddressSpace *as)
virtual int operationPortCount() const
virtual void setName(const std::string &name)
virtual bool hasAddressSpace() const
virtual BaseFUPort * port(const std::string &name) const
ExecutionPipeline * pipeline() const
virtual FUPort * port(int operand) const
ComponentType * item(int index) const
bool hasItem(const std::string &name) 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 BusNavigator busNavigator() const
Definition Machine.cc:356
virtual void addFunctionUnit(FunctionUnit &unit)
Definition Machine.cc:202
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition Machine.cc:392
virtual void addBus(Bus &bus)
Definition Machine.cc:139
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
@ SIGN
Sign extension.
Definition Machine.hh:82
virtual void addRegisterFile(RegisterFile &unit)
Definition Machine.cc:236
virtual void setGlobalControl(ControlUnit &unit)
Definition Machine.cc:317
static Machine * loadFromADF(const std::string &adfFileName)
Definition Machine.cc:899
virtual void addSocket(Socket &socket)
Definition Machine.cc:157
virtual Socket * outputSocket() const
Definition Port.cc:281
virtual void attachSocket(Socket &socket)
Definition Port.cc:191
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
virtual Socket * inputSocket() const
Definition Port.cc:261
virtual std::string name() const
Definition Port.cc:141
virtual int maxReads() const
virtual void setName(const std::string &name)
virtual int maxWrites() const
std::string name() const
void setDirection(Direction direction)
Definition Socket.cc:130
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59
bool isConnectedTo(const Bus &bus) const
Definition Socket.cc:331
void attachBus(Segment &bus)
Definition Socket.cc:166
virtual int portCount() const
Definition Unit.cc:135
virtual Port * port(const std::string &name) const
Definition Unit.cc:116