62 "Explorer plugin that produces a clustered machine with N lanes/nodes "
63 "and an 'extras' node.");
71 addressSpaces_(
"data"),
80 VLSUConnectionBuses_(1000){
86 addParameter(NodePN_,
STRING,
false, node_);
87 addParameter(NodeCountPN_,
UINT,
false,
89 addParameter(ExtraPN_,
STRING,
false, extra_);
91 addParameter(VectorLSUPN_,
BOOL,
false,
95 addParameter(AddressSpacesPN_,
STRING,
false, addressSpaces_);
96 addParameter(AddBroadcastPN_,
BOOL,
false,
98 addParameter(AddRingConnectionPN_,
BOOL,
false,
100 addParameter(AddBarConnectionPN_,
BOOL,
false,
102 addParameter(AddStarConnectionPN_,
BOOL,
false,
105 addParameter(ReuseRFPortsPN_,
BOOL,
false,
128 virtual std::vector<RowID>
131 std::vector<RowID> result;
134 if (extra_ ==
"" && node_ ==
"") {
136 "No node.adf or extra.adf defined. "
137 "Give adfs as plugin parameters.";
154 "Error loading the \'" + node_ +
"\'";
166 "Error loading the \'" + extra_ +
"\'";
177 addComponents(finalMach, nodeMach, extraMach, nodeCount_);
186 if (vectorLSU_ && nodeCount_ > 1) {
189 "VectorLSGenerator", &db());
202 std::vector<RowID> addedLSUConf =
207 bool connectAgain =
false;
211 connectVectorLSU(finalMach, nodeMach, extraMach, nodeCount_);
212 }
while (connectAgain);
220 selector_.selectComponentsToConf(conf, dsdb, finalMach);
230 result.push_back(confID);
274 readOptionalParameter(NodePN_, node_);
275 readOptionalParameter(NodeCountPN_, nodeCount_);
276 readOptionalParameter(ExtraPN_, extra_);
277 readOptionalParameter(BuildIDFPN_, buildIDF_);
278 readOptionalParameter(VectorLSUPN_, vectorLSU_);
279 readOptionalParameter(AddressSpacesPN_, addressSpaces_);
280 readOptionalParameter(AddBroadcastPN_, addBroadcast_);
281 readOptionalParameter(AddRingConnectionPN_, addRing_);
282 readOptionalParameter(AddBarConnectionPN_, addBar_);
283 readOptionalParameter(AddStarConnectionPN_, addStar_);
284 readOptionalParameter(NodesPerBusPN_, nodesPerBus_);
285 readOptionalParameter(ReuseRFPortsPN_, reuseRFPorts_);
286 if (vectorLSU_ && extra_ ==
"") {
288 <<
"Warning: vector LSUs can be added only if there's an extras node."
292 readOptionalParameter(SharedLSULatencyPN_,sharedLSULatency_);
293 readOptionalParameter(DataLSULatencyPN_,dataLSULatency_);
294 readOptionalParameter(VLSUConnectionBusesPN_,VLSUConnectionBuses_);
298 typedef std::set<TTAMachine::Guard*, TTAMachine::MachinePart::Comparator>
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));
324 unsigned nodeCount) {
326 std::map<Bus*, std::pair<Bus*, int> > busMapping;
332 GuardSet extrasGuards = findGuards(finalMach);
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);
343 connectRegisterFiles(
344 finalMach, nodeMach, extraMach, nodeCount, extrasGuards,
346 addGuardsToBuses(busMapping, extrasGuards);
351 addAllGuardsToConnectionBuses(finalMach, connectionBuses);
356 nodeNamePrefix << nodeId <<
"_";
357 return nodeNamePrefix;
364 for (BusVector::const_iterator i = connectionBuses.begin();
365 i != connectionBuses.end(); ++i) {
368 Bus* connectionBus = *i;
369 for (
int b = 0; b < busNav.
count(); b++) {
380 for (std::map<
Bus*, std::pair<Bus*, int> >::iterator i =
381 busMapping.begin(); i != busMapping.end(); i++) {
383 copyGuards(*(i->second.first), *(i->first), nodeNamePrefix(i->second.second));
385 for (GuardSet::iterator j = extrasGuards.begin();
386 j != extrasGuards.end(); j++) {
387 if (!i->first->hasGuard(**j)) {
388 (*j)->copyTo(*i->first);
403 std::map<
Bus*, std::pair<Bus*, int> >& busMapping) {
408 for (
unsigned j = 0; j < nodeCount; j++) {
409 bool socketsCreated =
false;
411 for (
int i = 0; i < busNav.
count(); i++) {
414 busMapping[addBus] = std::pair<Bus*,int>(originalBus, j);
420 finalMach->
addBus(*addBus);
422 TCEString msg =
"ADFCombiner: Tried to add Bus with an "
423 "already existing name (" + busName +
")";
428 for (
int k = 0; k < socketNav.
count(); k++) {
430 if (socketNav.
item(k)->portCount() == 0) {
436 if (!socketsCreated) {
438 getNodeComponentName(socketNav.
item(k)->name(), j);
443 TCEString msg =
"ADFCombiner: Tried to add Socket with "
444 " an already existing name (" + socketName +
")";
452 getNodeComponentName(socketNav.
item(k)->name(), j);
458 if (socketNav.
item(k)->isConnectedTo(
462 socketNav.
item(k)->direction());
466 socketsCreated =
true;
484 for (
unsigned j = 0; j < nodeCount; j++) {
485 for (
int i = 0; i < RFNav.
count(); i++) {
489 getNodeComponentName(RFNav.
item(i)->name(), j);
495 "ADFCombiner: Tried to add RF with an already"
496 "existing name (" + RFName +
")";
500 connectPorts(finalMach, originalRF, addRF, j);
516 for (
unsigned j = 0; j < nodeCount; j++) {
517 for (
int i = 0; i < FUNav.
count(); i++) {
521 getNodeComponentName(FUNav.
item(i)->name(), j);
527 "ADFCombiner: Tried to add FU with an already"
528 "existing name (" + FUName +
")";
539 connectPorts(finalMach, originalFU, addFU, j);
577 for (
int k = 0; k < original->
portCount(); k++) {
580 if (socket != NULL) {
582 getNodeComponentName(socket->
name(), count);
588 if (socket != NULL) {
590 getNodeComponentName(socket->
name(), count);
596 if (socket != NULL) {
598 getNodeComponentName(socket->
name(), count);
604 if (socket != NULL) {
606 getNodeComponentName(socket->
name(), count);
627 for (
int i = 0; i < ANav.
count(); i++) {
650 std::set<TTAMachine::Guard*, TTAMachine::MachinePart::Comparator>
665 for (
int i = 0; i < nodeNav.
count(); i++) {
668 for (
unsigned int j = 0; j < nodeCount -1; j++) {
669 TCEString firstName = getNodeComponentName(rfName, j);
670 TCEString secondName = getNodeComponentName(rfName, j+1);
677 int width = std::max(firstRF->
width(), secondRF->
width());
681 newBus = busNav.
item(busName);
683 newBus = createBus(finalMach, busName, width);
685 connectionBuses.push_back(newBus);
688 for (GuardSet::iterator k = extrasGuards.begin();
689 k != extrasGuards.end(); k++) {
691 (*k)->copyTo(*newBus);
694 createPortsAndSockets(
695 finalMach, firstRF, newBus, firstName,
false);
696 createPortsAndSockets(
697 finalMach, secondRF, newBus, secondName,
false);
701 if (extraMach == NULL)
continue;
708 TCEString firstName = getNodeComponentName(rfName, 0);
709 TCEString lastName = getNodeComponentName(rfName, nodeCount -1);
713 for (
int k = 0; k < extraNav.
count(); k++) {
715 getExtraComponentName(extraNav.
item(k)->name());
721 int width = std::max(firstRF->
width(), extraRF->
width());
722 TCEString busName =
"connect_extra_first";
725 newBus = busNav.
item(busName);
727 newBus = createBus(finalMach, busName, width);
729 for (GuardSet::iterator j = extrasGuards.begin();
730 j != extrasGuards.end(); j++) {
732 (*j)->copyTo(*newBus);
735 createPortsAndSockets(
736 finalMach, firstRF, newBus, firstName,
false);
737 createPortsAndSockets(
738 finalMach, extraRF, newBus, extraName,
false);
741 if (firstName != lastName) {
742 width = std::max(lastRF->
width(), extraRF->
width());
743 busName =
"connect_extra_last";
745 newBus = busNav.
item(busName);
747 newBus = createBus(finalMach, busName, width);
749 for (GuardSet::iterator j = extrasGuards.begin();
750 j != extrasGuards.end(); j++) {
752 (*j)->copyTo(*newBus);
755 createPortsAndSockets(
756 finalMach, lastRF, newBus, lastName,
false);
757 createPortsAndSockets(
758 finalMach, extraRF, newBus, extraName,
false);
764 int busCount = nodeCount;
765 for (
int i = 0; i < busCount; i++) {
770 connectionBuses.push_back(newBus);
772 for (
int i = 0; i < nodeNav.
count(); i++) {
775 for (
unsigned int j = 0; j < nodeCount; j++) {
779 getNodeComponentName(rfName, j);
781 finalNav.
item(nodeName);
782 createPortsAndSockets(
783 finalMach, nodeRF, newBus, nodeName,
false);
787 if (extraMach == NULL)
continue;
792 for (
int k = 0; k < extraNav.
count(); k++) {
794 getExtraComponentName(extraNav.
item(k)->name());
797 int width = extraRF->
width();
801 createPortsAndSockets(finalMach, extraRF, newBus, extraName,
false);
802 for (GuardSet::iterator j = extrasGuards.begin();
803 j != extrasGuards.end(); j++) {
805 (*j)->copyTo(*newBus);
814 for (
int k = 0; k < extraImmNav.
count(); k++) {
816 getExtraComponentName(extraImmNav.
item(k)->name());
819 int width = extraImm->
width();
823 createPortsAndSockets(
824 finalMach, extraImm, newBus, extraName,
true);
825 for (GuardSet::iterator j = extrasGuards.begin();
826 j != extrasGuards.end(); j++) {
828 (*j)->copyTo(*newBus);
835 if (extraMach != NULL) {
839 for (
unsigned int i = 0; i*nodesPerBus_ < nodeCount; i++) {
843 createBus(finalMach, busName, 32);
844 connectionBuses.push_back(newBus);
846 for (
int k = 0; k < extraNav.
count(); k++) {
848 getExtraComponentName(extraNav.
item(k)->name());
850 finalNav.
item(newName);
852 int width = extraRF->
width();
856 createPortsAndSockets(
857 finalMach, extraRF, newBus, extraName,
false, i);
858 for (GuardSet::iterator j = extrasGuards.begin();
859 j != extrasGuards.end(); j++) {
861 (*j)->copyTo(*newBus);
866 for (
int j = 0; j < nodeNav.
count(); j++) {
870 k < nodesPerBus_ && (i*nodesPerBus_)+k
873 getNodeComponentName(
874 rfName, ((i*nodesPerBus_)+k));
876 finalNav.
item(nodeName);
877 createPortsAndSockets(
878 finalMach, nodeRF, newBus, nodeName,
false);
885 for (
int k = 0; k < extraImmNav.
count(); k++) {
887 getExtraComponentName(extraImmNav.
item(k)->name());
890 int width = extraImm->
width();
894 createPortsAndSockets(
895 finalMach, extraImm, newBus, extraName,
true);
896 for (GuardSet::iterator j = extrasGuards.begin();
897 j != extrasGuards.end(); j++) {
899 (*j)->copyTo(*newBus);
907 for (
unsigned int i = 0; i*nodesPerBus_ < nodeCount-1; i++) {
911 createBus(finalMach, busName, 32);
912 connectionBuses.push_back(newBus);
914 for (
int j = 0; j < nodeNav.
count(); j++) {
918 k < nodesPerBus_ && (i*nodesPerBus_)+k
919 < nodeCount-1; k++) {
921 getNodeComponentName(
922 rfName, ((i*nodesPerBus_)+k+1));
924 finalNav.
item(nodeName);
925 createPortsAndSockets(
926 finalMach, nodeRF, newBus, nodeName,
false);
931 for (
int j = 0; j < nodeNav.
count(); j++) {
935 getNodeComponentName(rfName, 0);
937 finalNav.
item(node0Name);
938 int width = node0RF->
width();
942 createPortsAndSockets(
943 finalMach, node0RF, newBus, node0Name,
false, i);
964 finalMach->
addBus(*newBus);
967 "ADFCombiner: Tried to add Bus with an already"
968 "existing name (" + busName +
")";
984 int nodeNumber = -1) {
991 if (!reuseRFPorts_) {
993 for (
int k = 0; k < rf->
portCount(); k++) {
994 if (rf->
port(k)->
name() == name +
"_connect_r") {
995 readPort = rf->
port(k);
997 if (rf->
port(k)->
name() == name +
"_connect_w") {
998 writePort = rf->
port(k);
1001 }
else if (reuseRFPorts_ && nodeNumber != -1) {
1004 int indexRead = nodeNumber % rf->
maxReads();
1005 int indexWrite = nodeNumber % rf->
maxWrites();
1007 int foundWrites = 0;
1008 for (
int k = 0; k < rf->
portCount(); k++) {
1010 if (foundReads == indexRead) {
1011 readPort = rf->
port(k);
1017 if (foundWrites == indexWrite) {
1018 writePort = rf->
port(k);
1026 for (
int k = 0; k < rf->
portCount(); k++) {
1028 if (readPort == NULL) {
1029 readPort = rf->
port(k);
1034 if (writePort == NULL) {
1035 writePort = rf->
port(k);
1042 if (readPort == NULL) {
1044 name +
"_connect_r", *rf);
1046 if (!readOnly && writePort == NULL) {
1048 name +
"_connect_w", *rf);
1056 if (readSocket == NULL) {
1063 "ADFCombiner: Tried to add Socket with "
1064 " an already existing name (" + readSocket->
name() +
")";
1066 __FILE__, __LINE__,
__func__, msg);
1069 readSocket = socketNavigator.
item(readPort->
name());
1073 if (!readOnly && writeSocket == NULL) {
1074 if (!socketNavigator.
hasItem(writePort->
name())) {
1080 "ADFCombiner: Tried to add Socket with "
1081 " an already existing name (" + writeSocket->
name() +
")";
1083 __FILE__, __LINE__,
__func__, msg);
1086 writeSocket = socketNavigator.
item(writePort->
name());
1097 if (!readOnly && writePort->
inputSocket() == NULL) {
1122 int triggerIndex = -1;
1123 int outputPortCount = 0;
1124 bool broadcastUnit =
false;
1125 for (
int i = 0; i < finalNav.
count(); i++) {
1127 bool unconnected =
false;
1136 unconnected =
false;
1151 }
else if (addBroadcast_){
1156 broadcastUnit =
true;
1159 verboseLog(
"Candidate for Vector LSU does not have "
1160 "address space defined - " + fu->
name());
1164 if (vectorLSU == NULL) {
1186 "ADFCombiner: Tried to add Socket with "
1187 " an already existing name (" + triggerSocket->
name() +
")";
1189 __FILE__, __LINE__,
__func__, msg);
1197 "ADFCombiner: Tried to add Socket with "
1198 " an already existing name (" + inExtraSocket->
name() +
")";
1200 __FILE__, __LINE__,
__func__, msg);
1209 "ADFCombiner: Tried to add Socket with "
1210 " an already existing name (" + outExtraSocket->
name() +
")";
1212 __FILE__, __LINE__,
__func__, msg);
1224 for (
int i = 0; i < extraBusNav.
count(); i++) {
1226 if (i>VLSUConnectionBuses_)
1228 triggerSocket->
attachBus(*finalBusNav.
item(busName)->segment(0));
1230 inExtraSocket->
attachBus(*finalBusNav.
item(busName)->segment(0));
1232 outExtraSocket->
attachBus(*finalBusNav.
item(busName)->segment(0));
1250 TTAMachine::ExecutionPipeline::OperandSet::iterator it =
1251 readOperandSet.begin();
1252 bool writeConnectedToExtra =
false;
1253 for (; it != readOperandSet.end(); it++) {
1255 if (port != trigger && port != inExtra) {
1267 "ADFCombiner: Tried to add Socket with "
1268 " an already existing name (" + inputSocket->
name() +
")";
1270 __FILE__, __LINE__,
__func__, msg);
1279 for (
int i = 0; i < nodeBusNav.
count(); i++) {
1288 nodeBusNav.
item(i)->name() +
"_connect_" +
1291 if (i>VLSUConnectionBuses_)
1294 *finalBusNav.
item(busName)->segment(0))) {
1296 *finalBusNav.
item(busName)->segment(0));
1299 if (!writeConnectedToExtra) {
1300 for (
int i = 0; i < extraBusNav.
count(); i++) {
1302 if (i>VLSUConnectionBuses_)
1305 *finalBusNav.
item(busName)->segment(0)))
1307 *finalBusNav.
item(busName)->segment(0));
1309 writeConnectedToExtra =
true;
1317 it = writeOperandSet.begin();
1318 bool readConnectedToExtra =
false;
1319 for (; it != writeOperandSet.end(); it++) {
1321 if (port == outExtra)
1333 "ADFCombiner: Tried to add Socket with "
1334 " an already existing name (" + outputSocket->
name() +
")";
1336 __FILE__, __LINE__,
__func__, msg);
1345 for (
int i = 0; i < nodeBusNav.
count(); i++) {
1354 nodeBusNav.
item(i)->name() +
"_connect_" +
1357 if (i>VLSUConnectionBuses_)
1360 *finalBusNav.
item(busName)->segment(0))) {
1362 *finalBusNav.
item(busName)->segment(0));
1365 if (!readConnectedToExtra && !broadcastUnit) {
1366 for (
int i = 0; i < extraBusNav.
count(); i++) {
1368 if (i>VLSUConnectionBuses_)
1371 *finalBusNav.
item(busName)->segment(0)))
1373 *finalBusNav.
item(busName)->segment(0));
1375 readConnectedToExtra =
true;
1385 for (
int i = 0; i < finalNav.
count(); i++) {
1387 finalNav.
item(i)->setName(getExtraComponentName(oldName));
1391 for (
int i = 0; i < finalRFNav.
count(); i++) {
1393 finalRFNav.
item(i)->setName(getExtraComponentName(oldName));
1397 for (
int i = 0; i < finalImmNav.
count(); i++) {
1399 finalImmNav.
item(i)->setName(getExtraComponentName(oldName));
1407 return "EX_" + originalName;
1412 for (
int i = 0; i < originalBus.
guardCount(); ++i) {
1415 TCEString rfName = prefix + rg->registerFile()->name();
1416 int index = rg->registerIndex();
1419 if (rfNew == NULL) {
1420 std::cerr <<
"RF: " << rfName <<
" not found from mach!"
1425 rg->isInverted(), *rfNew, index, &addBus);
1427 FUPort* fuPort = pg->port();
1431 for (
int i = 0; i < fu->
portCount(); i++) {
1432 if (fu->
port(i) == fuPort) {
1440 if (fuNew == NULL) {
1441 std::cerr <<
"FU: " << fuName <<
" not found from mach!"
1446 new PortGuard(pg->isInverted(), *port, addBus);