62 "Explorer plugin that produces a clustered machine with N lanes/nodes "
63 "and an 'extras' node.");
128 virtual std::vector<RowID>
131 std::vector<RowID> result;
136 "No node.adf or extra.adf defined. "
137 "Give adfs as plugin parameters.";
154 "Error loading the \'" +
node_ +
"\'";
166 "Error loading the \'" +
extra_ +
"\'";
189 "VectorLSGenerator", &
db());
202 std::vector<RowID> addedLSUConf =
207 bool connectAgain =
false;
212 }
while (connectAgain);
230 result.push_back(confID);
288 <<
"Warning: vector LSUs can be added only if there's an extras node."
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;
336 if (extraMach != NULL)
338 addBuses(finalMach, nodeMach, nodeCount, busMapping);
344 finalMach, nodeMach, extraMach, nodeCount, extrasGuards,
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++) {
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) {
443 TCEString msg =
"ADFCombiner: Tried to add Socket with "
444 " an already existing name (" + socketName +
")";
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++) {
495 "ADFCombiner: Tried to add RF with an already"
496 "existing name (" + RFName +
")";
516 for (
unsigned j = 0; j < nodeCount; j++) {
517 for (
int i = 0; i < FUNav.
count(); i++) {
527 "ADFCombiner: Tried to add FU with an already"
528 "existing name (" + FUName +
")";
577 for (
int k = 0; k < original->
portCount(); k++) {
580 if (socket != NULL) {
588 if (socket != NULL) {
596 if (socket != NULL) {
604 if (socket != NULL) {
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++) {
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);
695 finalMach, firstRF, newBus, firstName,
false);
697 finalMach, secondRF, newBus, secondName,
false);
701 if (extraMach == NULL)
continue;
713 for (
int k = 0; k < extraNav.
count(); k++) {
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);
736 finalMach, firstRF, newBus, firstName,
false);
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);
756 finalMach, lastRF, newBus, lastName,
false);
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++) {
781 finalNav.
item(nodeName);
783 finalMach, nodeRF, newBus, nodeName,
false);
787 if (extraMach == NULL)
continue;
792 for (
int k = 0; k < extraNav.
count(); k++) {
797 int width = extraRF->
width();
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++) {
819 int width = extraImm->
width();
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++) {
844 connectionBuses.push_back(newBus);
846 for (
int k = 0; k < extraNav.
count(); k++) {
850 finalNav.
item(newName);
852 int width = extraRF->
width();
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++) {
876 finalNav.
item(nodeName);
878 finalMach, nodeRF, newBus, nodeName,
false);
885 for (
int k = 0; k < extraImmNav.
count(); k++) {
890 int width = extraImm->
width();
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++) {
912 connectionBuses.push_back(newBus);
914 for (
int j = 0; j < nodeNav.
count(); j++) {
919 < nodeCount-1; k++) {
924 finalNav.
item(nodeName);
926 finalMach, nodeRF, newBus, nodeName,
false);
931 for (
int j = 0; j < nodeNav.
count(); j++) {
937 finalNav.
item(node0Name);
938 int width = node0RF->
width();
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) {
993 for (
int k = 0; k < rf->
portCount(); k++) {
995 readPort = rf->
port(k);
998 writePort = rf->
port(k);
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;
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++) {
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_" +
1294 *finalBusNav.
item(busName)->segment(0))) {
1296 *finalBusNav.
item(busName)->segment(0));
1299 if (!writeConnectedToExtra) {
1300 for (
int i = 0; i < extraBusNav.
count(); i++) {
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_" +
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++) {
1371 *finalBusNav.
item(busName)->segment(0)))
1373 *finalBusNav.
item(busName)->segment(0));
1375 readConnectedToExtra =
true;
1385 for (
int i = 0; i < finalNav.
count(); i++) {
1391 for (
int i = 0; i < finalRFNav.
count(); i++) {
1397 for (
int i = 0; i < finalImmNav.
count(); i++) {
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);
#define assert(condition)
int RowID
Type definition of row ID in relational databases.
#define EXPORT_DESIGN_SPACE_EXPLORER_PLUGIN(PLUGIN_NAME__)
find Finds info of the inner loops in the false
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
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_
static const TCEString AddStarConnectionPN_
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
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)
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 ¶m) 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
void connectControlUnit(TTAMachine::ControlUnit &gcu) const
virtual ObjectState * saveState() const
FunctionUnit * parentUnit() const
virtual int width() const
virtual RFPort * port(const std::string &name) const
virtual bool hasSegment(const std::string &name) const
virtual Segment * segment(int index) const
virtual void setName(const std::string &name)
bool hasGuard(const Guard &guard) const
Guard * guard(int index) const
virtual int segmentCount() const
virtual void copyGuardsTo(Bus &other) const
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
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
virtual FunctionUnitNavigator functionUnitNavigator() const
virtual SocketNavigator socketNavigator() const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
virtual BusNavigator busNavigator() const
virtual void addFunctionUnit(FunctionUnit &unit)
virtual AddressSpaceNavigator addressSpaceNavigator() const
virtual void addBus(Bus &bus)
virtual ControlUnit * controlUnit() const
virtual void addRegisterFile(RegisterFile &unit)
virtual void setGlobalControl(ControlUnit &unit)
static Machine * loadFromADF(const std::string &adfFileName)
virtual void addSocket(Socket &socket)
virtual Socket * outputSocket() const
virtual void attachSocket(Socket &socket)
virtual int socketCount() const
virtual Socket * unconnectedSocket(int index) const
virtual bool isConnectedTo(const Socket &socket) const
virtual Socket * inputSocket() const
virtual std::string name() const
virtual int maxReads() const
virtual void setName(const std::string &name)
virtual int maxWrites() const
void setDirection(Direction direction)
@ OUTPUT
Data goes from port to bus.
@ INPUT
Data goes from bus to port.
bool isConnectedTo(const Bus &bus) const
void attachBus(Segment &bus)
virtual int portCount() const
virtual Port * port(const std::string &name) const