34 const float eps = 1e-3;
35 if (a->
Y() <= b->
Y() + eps && a->
Y() >= b->
Y() - eps)
36 return a->
X() < b->
X();
37 else if (a->
Y() < b->
Y() - eps)
39 else if (a->
Y() > b->
Y() + eps)
71 if (
JSONCfg.find(
"mergedSharedCellType2sharedCellType") !=
JSONCfg.end())
78 FILEbuf sbuf(popen(unzipCmnd.c_str(),
"r"));
79 std::istream infile(&sbuf);
83 std::string siteName, tileName,
siteType, tileType, strBELs, clockRegionName, fill0, fill1, fill2, fill3, fill4,
87 while (std::getline(infile,
line))
89 std::istringstream iss(
line);
90 iss >> fill0 >> siteName >> fill1 >> tileName >> fill7 >> clockRegionName >> fill2 >>
siteType >> fill3 >>
91 tileType >> fill4 >>
centerX >> fill5 >>
centerY >> fill6 >> strBELs;
92 assert(fill0 ==
"site=>");
93 assert(fill1 ==
"tile=>");
94 assert(fill7 ==
"clockRegionName=>");
95 assert(fill2 ==
"sitetype=>");
96 assert(fill3 ==
"tiletype=>");
97 std::string tmpFrom =
"X";
98 std::string tmpTo =
"";
103 std::vector<std::string> coordNumbers(0);
104 strSplit(clockRegionName, coordNumbers,
" ");
105 assert(coordNumbers.size() == 2);
106 int clockRegionX = std::stoi(coordNumbers[0]);
107 int clockRegionY = std::stoi(coordNumbers[1]);
113 std::pair<int, int> clockRegionCoord(clockRegionX, clockRegionY);
140 strBELs = strBELs.substr(1, strBELs.size() - 2);
141 std::vector<std::string> BELnames;
144 for (std::string BELname : BELnames)
146 std::vector<std::string> splitedName;
147 strSplit(BELname, splitedName,
"/");
148 addBEL(BELname, splitedName[1], curSite);
152 assert(
false &&
"Parser Error");
157 std::map<std::string, std::vector<DeviceSite *>>::iterator tmpIt;
160 std::sort(tmpIt->second.begin(), tmpIt->second.end(),
siteSortCmp);
166 "(YxX) clock regions on the device");
180 std::pair<int, int> clockRegionCoord(j,
i);
254 for (
auto curClockCol : colRow)
266 assert(
sites.size() > 0);
268 return a->getSiteY() == b->getSiteY() ? (a->getSiteX() < b->getSiteX()) : a->getSiteY() < b->getSiteY();
271 assert(
sites.size() > 0);
272 for (
unsigned int i = 0;
i <
sites.size();
i++)
274 if (
sites[
i]->getName().find(
"SLICE") == 0)
281 for (
int i =
sites.size() - 1;
i >= 0;
i--)
283 if (
sites[
i]->getName().find(
"SLICE") == 0)
291 for (
unsigned int i = 0;
i <
sites.size();
i++)
301 if (
sites[
i]->getName().find(
"SLICE") == 0)
317 for (
int levelY = 0; levelY <
columnNumY; levelY++)
319 for (
unsigned int colOffset = 0; colOffset <
clockColumns[levelY].size(); colOffset++)
325 for (
auto curSite :
sites)
327 if (curSite->getName().find(
"SLICE") != 0)
332 int levelY = (curSite->getSiteY() -
bottomSiteY) / eachLevelY;
333 int offsetX = curSite->getTile()->getTileIdX() -
leftTileIdX;
336 std::cout << curSite->getName() <<
"\n";
341 std::cout << curSite->getName() <<
"\n";
344 assert(offsetX >= 0);
347 curSite->setClockHalfColumn(
clockColumns[levelY][offsetX]);
356 for (
int levelY = 0; levelY <
columnNumY; levelY++)
358 for (
unsigned int colOffset = 0; colOffset <
clockColumns[levelY].size(); colOffset++)
391 clockRegion->addClockAndCell(netId, cellId, locX, locY);
398 assert(infile.good() &&
399 "The file for special pin offset information does not exist and please check your path settings");
402 std::string refpinname, fill0, fill1, fill2;
403 float offsetX, offsetY;
405 std::vector<std::string> refPinsName;
406 std::map<std::string, float> name2offsetX;
407 std::map<std::string, float> name2offsetY;
409 name2offsetY.clear();
410 name2offsetX.clear();
412 while (std::getline(infile,
line))
414 std::istringstream iss(
line);
415 iss >> fill0 >> refpinname >> fill1 >> offsetX >> fill2 >> offsetY;
418 refPinsName.push_back(refpinname);
419 name2offsetX[refpinname] = offsetX;
420 name2offsetY[refpinname] = offsetY;
423 assert(
false &&
"Parser Error");
426 std::string STR_PCIE_3_1 =
"PCIE_3_1";
433 PCIESite->setSitePinInfos(sitePins);
448 parentTile = tilePtr;
463 childrenSites.push_back(childSite);
472 std::string existTypes =
"";
475 existTypes += tmptype +
" ";
480 for (std::map<std::string, std::vector<DeviceTile *>>::iterator it =
tileType2Tiles.begin();
483 print_info(
"#" + it->first +
": " + std::to_string(it->second.size()));
490 existTypes += tmptype +
" ";
495 for (std::map<std::string, std::vector<DeviceSite *>>::iterator it =
siteType2Sites.begin();
498 print_info(
"#" + it->first +
": " + std::to_string(it->second.size()));
503 for (std::string tmptype :
BELTypes)
505 existTypes += tmptype +
" ";
510 for (std::map<std::string, std::vector<DeviceBEL *>>::iterator it =
BELType2BELs.begin();
513 print_info(
"#" + it->first +
": " + std::to_string(it->second.size()));
523 BELs.push_back(newBEL);
542 sites.push_back(newSite);
559 tiles.push_back(tile);
573 std::ifstream infile(curFileName.c_str());
574 assert(infile.good() &&
575 "The mergedSharedCellType2sharedCellType file does not exist and please check your path settings");
577 while (std::getline(infile,
line))
579 std::vector<std::string> BELTypePair;
583 "] when creating PlacementBins");