115 map<const IDF::FUImplementationLocation*, CostEstimates*>
121 set<const IDF::FUImplementationLocation*> fuImplementations;
122 for (set<string>::const_iterator i = usedHDBs_.begin();
123 i != usedHDBs_.end(); i++) {
127 set<RowID>::const_iterator
id = fuEntryIDs.begin();
128 for (;
id != fuEntryIDs.end();
id++) {
136 fuImplementations.insert(fuIDF);
139 map<const IDF::FUImplementationLocation*, CostEstimates*> results;
140 set<const IDF::FUImplementationLocation*>::const_iterator iter =
141 fuImplementations.begin();
145 if (
static_cast<int>(frequencyMHz) <= 0 &&
146 static_cast<int>(maxArea) <= 0) {
148 for (; iter != fuImplementations.end(); iter++) {
150 pair<const IDF::FUImplementationLocation*, CostEstimates*>(
157 while (iter != fuImplementations.end()) {
160 double area = estimator_.functionUnitArea(fu, *(*iter));
161 if (area > maxArea &&
static_cast<int>(maxArea) > 0) {
164 fuImplementations.erase(rmIt);
167 double delayInNanoSeconds =
168 estimator_.functionUnitMaximumComputationDelay(fu, *(*iter));
171 if (delayInNanoSeconds > 0 && (
static_cast<double>(1000) /
static_cast<double>(delayInNanoSeconds)) <
static_cast<double>(frequencyMHz)) {
174 fuImplementations.erase(rmIt);
181 pair<const IDF::FUImplementationLocation*, CostEstimates*>(
182 (*iter), estimates));
186 fuImplementations.erase(rmIt);
211 list<TTAMachine::FunctionUnit*>
213 const std::set<std::string>& operationSet,
int width)
217 set<string> operations;
218 set<string>::const_iterator oper = operationSet.begin();
219 for (; oper != operationSet.end(); oper++) {
224 list<pair<TTAMachine::FunctionUnit*, int> >functionUnits;
225 for (set<string>::const_iterator i = usedHDBs_.begin();
226 i != usedHDBs_.end(); i++) {
228 set<RowID> fuArchIDs =
231 set<RowID>::const_iterator iter = fuArchIDs.begin();
232 for (;iter != fuArchIDs.end(); iter++) {
238 bool portsDiffer =
false;
239 for (
int p = 0; p < fuArch->
architecture().portCount(); p++) {
248 pair<FunctionUnit*, int> fuIntPair(&fuArch->
architecture(), 0);
249 functionUnits.push_back(fuIntPair);
253 list<TTAMachine::FunctionUnit*> results;
256 while (operations.size() != 0) {
257 list<pair<TTAMachine::FunctionUnit*, int> >::iterator fu =
258 functionUnits.begin();
259 for (; fu != functionUnits.end(); fu++) {
260 int neededOperations = 0;
261 set<string>::iterator operation = operations.begin();
262 while (operation != operations.end()) {
263 if ((*fu).first->hasOperation(*operation)) {
268 (*fu).second = neededOperations;
271 list<TTAMachine::FunctionUnit*> bestMatches;
275 for (fu = functionUnits.begin(); fu != functionUnits.end(); fu++) {
276 if ((*fu).second > bestFU) {
278 bestMatches.push_back((*fu).first);
279 bestFU = (*fu).second;
280 }
else if ((*fu).second == bestFU) {
281 bestMatches.push_back((*fu).first);
286 if (bestMatches.size() != 0) {
289 int minOperations = -1;
290 int maxPortWidth = -1;
292 list<TTAMachine::FunctionUnit*>::const_iterator bestMatchFU =
294 for (; bestMatchFU != bestMatches.end(); bestMatchFU++) {
295 int fuMaxLatency = (*bestMatchFU)->maxLatency();
296 if (fuMaxLatency < minLatency) {
297 minLatency = fuMaxLatency;
298 minOperations = (*bestMatchFU)->operationCount();
299 bestFU = (*bestMatchFU);
300 }
else if (minLatency == -1) {
301 minLatency = fuMaxLatency;
303 bestFU = (*bestMatchFU);
304 }
else if (fuMaxLatency == minLatency) {
306 if (fuOperations < minOperations) {
307 minOperations = fuOperations;
308 bestFU = (*bestMatchFU);
309 }
else if (minOperations == -1) {
310 minOperations = fuOperations;
311 bestFU = (*bestMatchFU);
312 }
else if (fuOperations == minOperations) {
313 int bestFUPortWidth = 0;
315 i < (*bestMatchFU)->operationPortCount();
318 FUPort* port = (*bestMatchFU)->operationPort(i);
320 if (bestFUPortWidth < port->width()) {
321 bestFUPortWidth = port->
width();
325 if (maxPortWidth < bestFUPortWidth) {
326 maxPortWidth = bestFUPortWidth;
327 bestFU = (*bestMatchFU);
337 results.push_back(bestFU);
340 list<pair<FunctionUnit*, int> >::iterator fuIntIter =
341 functionUnits.begin();
342 for (; fuIntIter != functionUnits.end(); fuIntIter++) {
343 if ((*fuIntIter).first == bestFU) {
344 functionUnits.erase(fuIntIter);
352 if (operations.size() != 0) {
376 map<const IDF::RFImplementationLocation*, CostEstimates*>
383 set<const IDF::RFImplementationLocation*> rfImplementations;
384 for (set<string>::const_iterator i = usedHDBs_.begin();
385 i != usedHDBs_.end(); i++) {
391 for (
int p = 0; p < rf.
portCount(); p++) {
411 set<RowID>::const_iterator
id = rfEntryIDs.begin();
412 for (;
id != rfEntryIDs.end();
id++) {
419 rfImplementations.insert(rfIDF);
422 map<const IDF::RFImplementationLocation*, CostEstimates*> results;
423 set<const IDF::RFImplementationLocation*>::const_iterator iter =
424 rfImplementations.begin();
428 if (
static_cast<int>(frequencyMHz) <= 0 &&
429 static_cast<int>(maxArea) <= 0) {
431 for (; iter != rfImplementations.end(); iter++) {
433 pair<const IDF::RFImplementationLocation*, CostEstimates*>(
439 while (iter != rfImplementations.end()) {
442 double area = estimator_.registerFileArea(rf, *(*iter));
443 if (area > maxArea &&
static_cast<int>(maxArea) > 0) {
446 rfImplementations.erase(rmIt);
449 double delayInNanoSeconds =
450 estimator_.registerFileMaximumComputationDelay(rf, *(*iter));
453 if ((1000/delayInNanoSeconds) < frequencyMHz) {
456 rfImplementations.erase(rmIt);
463 pair<const IDF::RFImplementationLocation*, CostEstimates*>(
464 (*iter), estimates));
468 rfImplementations.erase(rmIt);
493 map<const IDF::IUImplementationLocation*, CostEstimates*>
499 set<const IDF::IUImplementationLocation*> iuImplementations;
500 for (set<string>::const_iterator i = usedHDBs_.begin();
501 i != usedHDBs_.end(); i++) {
506 set<RowID> iuEntryIDs =
519 set<RowID>::const_iterator
id = iuEntryIDs.begin();
520 for (;
id != iuEntryIDs.end();
id++) {
527 iuImplementations.insert(iuIDF);
530 map<const IDF::IUImplementationLocation*, CostEstimates*> results;
531 set<const IDF::IUImplementationLocation*>::const_iterator iter =
532 iuImplementations.begin();
536 if (
static_cast<int>(frequencyMHz) <= 0 &&
537 static_cast<int>(maxArea) <= 0) {
539 for (; iter != iuImplementations.end(); iter++) {
541 pair<const IDF::IUImplementationLocation*, CostEstimates*>(
547 while (iter != iuImplementations.end()) {
550 double area = estimator_.registerFileArea(iu, *(*iter));
551 if (area > maxArea &&
static_cast<int>(maxArea) > 0) {
554 iuImplementations.erase(rmIt);
557 double delayInNanoSeconds =
558 estimator_.registerFileMaximumComputationDelay(iu, *(*iter));
561 if ((1000/delayInNanoSeconds) < frequencyMHz) {
564 iuImplementations.erase(rmIt);
571 pair<const IDF::IUImplementationLocation*, CostEstimates*>(
572 (*iter), estimates));
576 iuImplementations.erase(rmIt);
604 const std::string& icDecoderHDB,
const double& frequency,
605 const double& maxArea) {
620 idf = selectComponents(
621 mach, icDecoder, icDecoderHDB, frequency, maxArea);
647 const std::string& icDecoderHDB,
const double& frequency,
648 const double& maxArea) {
650 for (
int i = 0; i < hdbRegistry.
hdbCount(); i++) {
651 addHDB(hdbRegistry.
hdb(i));
657 selectFUs(mach, idf, frequency, maxArea);
660 selectRFs(mach, idf);
663 selectIUs(mach, idf, frequency, maxArea);
666 std::vector<std::string> icDecPaths =
670 std::vector<std::string>::const_iterator iter = icDecPaths.begin();
671 for (; iter != icDecPaths.end(); iter++) {
672 std::string path = *iter;
693 const double& frequency,
const double& maxArea,
694 const bool& filterLongestPathDelay) {
698 for (
int i = 0; i < fuNav.
count(); i++) {
701 map<const IDF::FUImplementationLocation*, CostEstimates*> fuMap =
702 fuImplementations(*fu, frequency, maxArea);
705 set<std::pair<const IDF::FUImplementationLocation*, CostEstimates*>,
709 i != fuMap.end(); i++) {
711 std::make_pair(i->first, i->second));
714 set<std::pair<const IDF::FUImplementationLocation*, CostEstimates*> >::
715 const_iterator iter = fuSet.begin();
716 if (fuMap.size() != 0) {
719 if (filterLongestPathDelay && maxArea > 0 && frequency > 0) {
720 double longestPathDelay = 0;
723 while (iter != fuSet.end()) {
725 if (estimate == NULL) {
726 std::string errorMsg =
"When selecting FUs regarding"
727 " longest path delay, no cost estimates were"
728 " found for FU: " + fu->
name();
730 __FILE__, __LINE__,
__func__, errorMsg, 1);
734 area = estimate->
area();
738 }
else if (longestPathDelay <
741 area = estimate->
area();
743 }
else if (longestPathDelay ==
745 area < estimate->area()) {
746 area = estimate->
area();
771 "no implementations found for FU: " + fu->
name());
785 const double& frequency,
const double& maxArea) {
789 for (
int i = 0; i < rfNav.
count(); i++) {
791 map<const IDF::RFImplementationLocation*, CostEstimates*> rfMap;
796 rfMap = rfImplementations(*rf,
true, frequency, maxArea);
799 rfMap = rfImplementations(*rf,
false, frequency, maxArea);
802 set<std::pair<const IDF::RFImplementationLocation*, CostEstimates*>,
implComp> rfSet;
803 for ( map<const IDF::RFImplementationLocation*, CostEstimates*>::const_iterator i = rfMap.begin();
804 i != rfMap.end(); i++) {
805 rfSet.insert(std::make_pair(i->first, i->second));
807 set<std::pair<const IDF::RFImplementationLocation*, CostEstimates*> >::const_iterator iter = rfSet.begin();
808 if (rfMap.size() != 0) {
809 double longestPathDelay = 0;
814 if (maxArea > 0 && frequency > 0) {
815 while (iter != rfSet.end()) {
817 if (estimate == NULL) {
818 std::string errorMsg =
"When selecting RFs regarding"
819 " longest path delay, no cost estimates were"
820 " found for RF: " + rf->
name();
822 __FILE__, __LINE__,
__func__, errorMsg, 1);
826 area = estimate->
area();
830 }
else if (longestPathDelay < estimate->longestPathDelay()) {
832 area = estimate->
area();
834 }
else if (longestPathDelay == estimate->
longestPathDelay() && area < estimate->area()) {
835 area = estimate->
area();
857 "no implementations found for RF: " + rf->
name());
869 const double& frequency,
const double& maxArea) {
873 for (
int index = 0; index < iuNav.
count(); index++) {
876 map<const IDF::IUImplementationLocation*, CostEstimates*> iuMap =
877 iuImplementations(*iu, frequency, maxArea);
880 set<std::pair<const IDF::IUImplementationLocation*, CostEstimates*>,
implComp> iuSet;
881 for (map<const IDF::IUImplementationLocation*, CostEstimates*>::const_iterator i =
882 iuMap.begin(); i != iuMap.end(); i++) {
883 iuSet.insert(std::make_pair(i->first, i->second));
887 if (iuMap.size() != 0) {
888 double longestPathDelay = 0;
891 set<std::pair<const IDF::RFImplementationLocation*, CostEstimates*> >::const_iterator wanted = iter;
893 while (iter != iuSet.end()) {
895 if (estimate == NULL) {
896 std::string errorMsg =
"When selecting IUs regarding"
897 " longest path delay, no cost estimates were"
898 " found for IU: " + iu->
name();
900 __FILE__, __LINE__,
__func__, errorMsg, 1);
904 area = estimate->
area();
908 }
else if (longestPathDelay < estimate->longestPathDelay()) {
910 area = estimate->
area();
912 }
else if (longestPathDelay == estimate->
longestPathDelay() && area < estimate->area()) {
913 area = estimate->
area();
934 "no implementations found for IU: " + iu->
name());