AMF-Placer  2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GlobalPlacer.cc
Go to the documentation of this file.
1 
26 #include "GlobalPlacer.h"
27 
28 #include <cmath>
29 #include <codecvt>
30 
31 GlobalPlacer::GlobalPlacer(PlacementInfo *placementInfo, std::map<std::string, std::string> &JSONCfg,
32  bool resetLegalizationInfo)
33  : placementInfo(placementInfo), JSONCfg(JSONCfg)
34 {
35  if (JSONCfg.find("GlobalPlacerVerbose") != JSONCfg.end())
36  verbose = JSONCfg["GlobalPlacerVerbose"] == "true";
37  if (JSONCfg.find("DumpLUTCoordTrace") != JSONCfg.end() || JSONCfg.find("DumpDSPCoordTrace") != JSONCfg.end() ||
38  JSONCfg.find("DumpFFCoordTrace") != JSONCfg.end() || JSONCfg.find("DumpLUTFFCoordTrace") != JSONCfg.end() ||
39  JSONCfg.find("DumpCARRYCoordTrace") != JSONCfg.end() || JSONCfg.find("DumpAllCoordTrace") != JSONCfg.end())
40  dumpOptTrace = true;
41  if (JSONCfg.find("y2xRatio") != JSONCfg.end())
42  y2xRatio = std::stof(JSONCfg["y2xRatio"]);
43 
44  if (JSONCfg.find("disableSpreadingConvergeRatio") != JSONCfg.end())
45  {
46  disableSpreadingForgetRatio = JSONCfg["disableSpreadingConvergeRatio"] == "true";
47  }
48  if (JSONCfg.find("DirectMacroLegalize") != JSONCfg.end())
49  {
50  directMacroLegalize = JSONCfg["DirectMacroLegalize"] == "true";
52  {
53  print_warning("Direct Macro Legalization is enbaled. It might undermine the HPWL.");
54  }
55  }
56 
57  if (JSONCfg.find("DSPCritical") != JSONCfg.end())
58  DSPCritical = JSONCfg["DSPCritical"] == "true";
59 
60  if (JSONCfg.find("DumpClockUtilization") != JSONCfg.end())
61  {
62  dumpClockUtilization = JSONCfg["DumpClockUtilization"] == "true";
63  }
64 
65  if (JSONCfg.find("GlobalPlacerPrintHPWL") != JSONCfg.end())
66  printHPWL = JSONCfg["GlobalPlacerPrintHPWL"] == "true";
67 
68  hasUserDefinedClusterInfo = JSONCfg.find("designCluster") != JSONCfg.end();
69 
72 
73  std::vector<DesignInfo::DesignCellType> macroTypesToLegalize;
74  macroTypesToLegalize.clear();
75  macroTypesToLegalize.push_back(DesignInfo::CellType_RAMB18E2);
76  macroTypesToLegalize.push_back(DesignInfo::CellType_RAMB36E2);
77  macroTypesToLegalize.push_back(DesignInfo::CellType_FIFO18E2);
78  macroTypesToLegalize.push_back(DesignInfo::CellType_FIFO36E2);
79  macroTypesToLegalize.push_back(DesignInfo::CellType_DSP48E2);
81  macroTypesToLegalize, JSONCfg);
82  macroTypesToLegalize.clear();
83  macroTypesToLegalize.push_back(DesignInfo::CellType_CARRY8);
85  macroTypesToLegalize, JSONCfg);
86 
87  std::vector<std::string> lclbTypeList(1, "SLICEL");
89  new CLBLegalizer("lCLBLegalizer", placementInfo, placementInfo->getDeviceInfo(), lclbTypeList, JSONCfg);
90 
91  std::vector<std::string> mclbTypeList(1, "SLICEM");
93  new CLBLegalizer("mCLBLegalizer", placementInfo, placementInfo->getDeviceInfo(), mclbTypeList, JSONCfg);
94 
95  if (resetLegalizationInfo)
97 
98  if (JSONCfg.find("pseudoNetWeightConsiderNetNum") != JSONCfg.end())
99  {
100  pseudoNetWeightConsiderNetNum = JSONCfg["pseudoNetWeightConsiderNetNum"] == "true";
101  }
102  else
103  {
105  }
106 
108  {
109  print_warning("pseudoNetWeightConsiderNetNum option is turn on: " +
110  std::to_string(placementInfo->getPUWithManyNetsRatio()));
111  }
112  else
113  {
114  print_warning("pseudoNetWeightConsiderNetNum option is turn off: " +
115  std::to_string(placementInfo->getPUWithManyNetsRatio()));
116  }
117 
119  historyHPWLs.clear();
120 }
121 
123 {
125  print_info("ClusterPlacement Total HPWL = " + std::to_string(placementInfo->updateB2BAndGetTotalHPWL()));
126 }
127 
128 void GlobalPlacer::GlobalPlacement_CLBElements(int iterNum, bool continuePreviousIteration, int lowerBoundIterNum,
129  bool enableMacroPseudoNet2Site, bool stopStrictly,
130  unsigned int spreadRegionBinNumLimit,
131  PlacementTimingOptimizer *timingOptimizer)
132 {
133  print_status("GlobalPlacer GlobalPlacement_CLBElements started");
134 
136  for (auto tmpNet : placementInfo->getDesignInfo()->getNets())
137  tmpNet->setOverallTimingNetEnhancement(1.0);
138 
139  pseudoNetWeight = 1.0;
140 
141  if (!continuePreviousIteration || oriPseudoNetWeight < 0)
142  {
143  if (JSONCfg.find("PseudoNetWeight") != JSONCfg.end())
144  pseudoNetWeight = std::stof(JSONCfg["PseudoNetWeight"]);
145  }
146  else
147  {
149  }
150 
152  if (placementInfo->getProgress() > 0.1)
154  else
155  progressRatio = 0.0;
156 
157  spreadingForgetRatio = 0.2;
158 
160  {
162  }
164  lowerBoundHPWL = 1;
165 
166  int iterCntAfterMacrosFixed = 0;
167 
168  // global placement iterations
169  for (int i = 0; i < iterNum || (!stopStrictly); i++)
170  {
171 
172  float displacementLimit = -10;
173  if (timingOptimizer)
174  {
175  if (timingOptimizer->getEffectFactor() >= 1)
176  displacementLimit = 10;
177 
178  if (timingOptimizer->getEffectFactor() > 0.5)
179  {
182  }
184 
185  timingOptimizer->conductStaticTimingAnalysis();
186  if (timingOptimizer->getEffectFactor() > 1)
188  }
189 
190  // lowerBound: Quadratic Programming based Wirelength Optimization
191  lowerBoundIterNum = (placementInfo->getProgress() < 0.965 && !macroCloseToSite) ? 2 : 2;
192 
193  for (int j = 0; j < lowerBoundIterNum; j++)
194  {
196  pseudoNetWeight, j == 0, true, enableMacroPseudoNet2Site, pseudoNetWeightConsiderNetNum,
197  (i > 1 || continuePreviousIteration) && hasUserDefinedClusterInfo, displacementLimit, timingOptimizer);
198  if (progressRatio > 0.5)
199  timingOptEnabled = true;
200  }
201 
203  print_info("HPWL after QP=" + std::to_string(lowerBoundHPWL) +
204  " pseudoNetWeight=" + std::to_string(pseudoNetWeight));
205  print_status("WLOptimizer Iteration#" + to_string_align3(i) + " Done HPWL=" + std::to_string(lowerBoundHPWL));
206 
207  if (dumpOptTrace)
208  {
209  dumpCoord();
210  }
211 
212  // upperBound: Placement Unit Spreading
213 
214  spreading(i, spreadRegionBinNumLimit, displacementLimit);
215 
217  print_status("Spreader Iteration#" + to_string_align3(i) + " Done HPWL=" + std::to_string(upperBoundHPWL));
218 
219  if (dumpOptTrace)
220  {
221  dumpCoord();
222  }
223 
224  // legalize macros (DSPs/BRAMs)
225  if (enableMacroPseudoNet2Site)
226  {
227  bool timingDrivenLegalization = false;
228  if (timingOptimizer)
229  {
230  if (timingOptimizer->getEffectFactor() > 0.6)
231  timingDrivenLegalization = true;
232  }
233  if (!continuePreviousIteration && !DSPCritical)
234  {
235  if (i >= 8)
236  {
237  macroLegalize(i, timingDrivenLegalization);
238  print_status("Legalization Iteration#" + to_string_align3(i) + " Done");
239  }
240  }
241  else
242  {
243  macroLegalize(i, timingDrivenLegalization);
244  print_status("Legalization Iteration#" + to_string_align3(i) + " Done");
245  }
246  }
247 
248  if (printHPWL)
249  {
250  print_info("HPWL after LG=" + std::to_string(upperBoundHPWL) +
251  " pseudoNetWeight=" + std::to_string(pseudoNetWeight));
252  }
253 
254  if (minHPWL > upperBoundHPWL)
255  {
257  if (minHPWL < placementInfo->getMinHPWL())
258  {
260  }
261  }
262 
264 
267  {
268  print_warning("macroCloseToSite=" + std::to_string(macroCloseToSite) +
269  " and minHPWL is updated to be: " + std::to_string(upperBoundHPWL));
272  pseudoNetWeight *= 0.5;
274  }
275 
276  // heuristic update pseudoNetWeight
278 
279  print_info("upperBoundHPWL / lowerBoundHPWL=" + std::to_string(upperBoundHPWL / lowerBoundHPWL));
280  print_info("averageMacroLegalDisplacementL=" + std::to_string(averageMacroLegalDisplacement));
281  print_info("macroCloseToSite=" + std::to_string(macroCloseToSite));
282  print_info("macroLegalizationFixed=" + std::to_string(macroLegalizationFixed));
283  print_info("progressRatio=" + std::to_string(progressRatio));
284  print_info("upperBoundHPWL=" + std::to_string(upperBoundHPWL));
285  print_info("minHPWL=" + std::to_string(minHPWL));
286  print_info("clockLegal=" + std::to_string(clockLegal));
287 
288  // converge criteria
289  bool criteria0 = upperBoundHPWL / lowerBoundHPWL < 1.02 &&
291  pseudoNetWeight > 0.02;
292  bool criteria1 = (progressRatio > 0.98 || (progressRatio > 0.95 && HPWLChangeLittle)) &&
294  bool criteria2 = upperBoundHPWL < minHPWL * 2 && macroLegalizationFixed && i > 30;
295  bool criteria3 = iterCntAfterMacrosFixed >= 2 && progressRatio > 0.925 && upperBoundHPWL / minHPWL < 1.02 &&
297  bool criteria4 = iterCntAfterMacrosFixed >= 2 && macroLegalizationFixed;
298 
300  iterCntAfterMacrosFixed++;
301  // criteria0 || criteria1 || criteria2 ||
302  if (criteria3 || criteria4)
303  {
304  print_status("Global Placer: B2B converge");
306  BRAMDSPLegalizer->dumpMatching(true, true);
308  CARRYMacroLegalizer->dumpMatching(true, true);
309  if (!mCLBLegalizer->hasNoTarget())
310  mCLBLegalizer->dumpMatching(true, true);
311  break;
312  }
313 
314  if (progressRatio > 0.98 && macroCloseToSite && !continuePreviousIteration)
315  {
316  print_status("Global Placer: Should do packing now before further optimization");
317  break;
318  }
319  }
320 
322  dumpCoord();
323  dumpLUTFFCoordinate(true);
324 
326 
327  // record the global placer setting
331  // macroSpreader->spreadPlacementUnits();
332 }
333 
334 void GlobalPlacer::GlobalPlacement_fixedCLB(int iterNum, float pseudoNetWeight)
335 {
336  print_status("GlobalPlacer GlobalPlacement_fixedCLB started");
338 
339  dumpCoord();
340  int lowerBoundIterNum = 6;
341  for (auto curCell : placementInfo->getCells())
342  {
343  if (!curCell->isLUT() && !curCell->isFF())
344  continue;
345 
346  auto curPU = placementInfo->getCellId2PlacementUnit()[curCell->getCellId()];
347 
348  if (curPU->isLocked())
349  continue;
350 
351  curPU->setFixed();
352  }
353  for (int i = 0; i < iterNum; i++)
354  {
355  for (int j = 0; j < lowerBoundIterNum; j++)
357  if (dumpOptTrace)
358  {
359  dumpCoord();
360  }
361 
362  print_status("WLOptimizer Iteration#" + std::to_string(i) + " Done");
363  print_info("HPWL after QP=" + std::to_string(placementInfo->updateB2BAndGetTotalHPWL()));
364  generalSpreader = nullptr;
365 
366  pseudoNetWeight *= 1.05;
367  }
368 
370  for (auto curCell : placementInfo->getCells())
371  {
372  if (!curCell->isLUT() && !curCell->isFF())
373  continue;
374 
375  auto curPU = placementInfo->getCellId2PlacementUnit()[curCell->getCellId()];
376 
377  if (curPU->isLocked())
378  continue;
379 
380  curPU->setUnfixed();
381  }
382  dumpCoord();
383  // dumpDSPCoordinate(true);
384  // dumpBRAMCoordinate(true);
385  // macroSpreader->spreadPlacementUnits();
386 }
387 
389 {
396 }
397 
398 void GlobalPlacer::printPlacedUnits(std::ostream &os)
399 {
400  print_info("Placed Units:");
402  {
403  if (curPU->isPlaced())
404  {
405  os << curPU;
406  }
407  }
408 }
409 
411 {
412  if (JSONCfg.find("DumpLUTCoordTrace") != JSONCfg.end())
413  {
414  std::string dumpFile = JSONCfg["DumpLUTCoordTrace"] + "-" + std::to_string(LUTCoordinateDumpCnt) + ".gz";
415  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
417  if (dumpFile != "")
418  {
419  std::stringstream outfile0;
420  for (auto curPU : placementInfo->getPlacementUnits())
421  {
422  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
423  {
424  float cellX = curUnpackedCell->X();
425  float cellY = curUnpackedCell->Y();
426  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
427  if (curCell->isLUT())
428  {
429  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
430  }
431  }
432  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
433  {
434  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
435  {
436  float offsetX_InMacro, offsetY_InMacro;
438  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
439  float cellX = curMacro->X() + offsetX_InMacro;
440  float cellY = curMacro->Y() + offsetY_InMacro;
441 
442  if (DesignInfo::isLUT(cellType))
443  {
444  if (curMacro->getCell(vId))
445  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
446  else
447  outfile0 << cellX << " " << cellY << "\n";
448  }
449  }
450  }
451  }
452  writeStrToGZip(dumpFile, outfile0);
453  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
454  }
455  }
456 }
457 
458 void GlobalPlacer::macroLegalize(int curIteration, bool timingDriven, PlacementTimingOptimizer *timingOptimizer)
459 {
460  // based on the global placement convergence progress and legalization displacement, select different strategies.
461  // TODO: make this part more clean and clear for reader!
463  return;
464  if (macroLocked)
465  {
467  if (macroLockedIterCnt > 3)
468  macroLocked = false;
469  else
470  return;
471  }
472 
474 
476  progressRatio < 0.9 && curIteration < 10) &&
478  {
479  // rough legalization phase
482  print_info("DSPBRAM Average Displacement Of Rough Legalization =" +
483  std::to_string(averageMacroLegalDisplacement));
484  print_info("MCLB Average Displacement Of Rough Legalization =" + std::to_string(averageMCLBLegalDisplacement));
485 
488  BRAMDSPLegalizer->legalize(false, false, timingDriven);
491  }
492  else
493  {
494  // exact legalization phase
498  print_info("DSPBRAM Average Displacement Of Exact Legalization =" +
499  std::to_string(averageMacroLegalDisplacement));
500  print_info("MCLB Average Displacement Of Exact Legalization =" + std::to_string(averageMCLBLegalDisplacement));
501  print_info("CARRY Average Displacement Of Exact Legalization =" +
502  std::to_string(averageCarryLegalDisplacement));
503  // gradually reduce the size of initial legalization window
505  mCLBLegalizer->setIntitialParameters(20.0, 20, 2);
506  CARRYMacroLegalizer->setIntitialParameters((float)2.0, 3, 2);
507 
512  {
513  if (curIteration >= 10 && (BRAMDSPLegalizer->hasNoTarget() || averageMacroLegalDisplacement < 7.5) &&
516  {
517  print_warning("too many times of legalization. enforce the elements to be fixed!");
518  macroCloseToSite = true;
519  for (auto pair : placementInfo->getPULegalXY().first)
520  {
521  auto curPU = pair.first;
522  curPU->setAnchorLocationAndForgetTheOriginalOne(placementInfo->getPULegalXY().first[curPU],
523  placementInfo->getPULegalXY().second[curPU]);
524  curPU->setFixed();
525  }
526  macroLegalizationFixed = true;
527  }
528  else
529  {
530  macroCloseToSite = true;
531 
533  {
534  print_status("BRAMDSPLegalizer: Launch.");
536  BRAMDSPLegalizer->legalize(true, directMacroLegalize, timingDriven);
537  macroCloseToSite = false;
538  }
541  {
543  (curIteration % 2 == 0 || averageCarryLegalDisplacement > 5000))
544  {
547  print_status("mCLBLegalizer: Launch.");
548  mCLBLegalizer->legalize(true);
549  print_status("CARRYMacroLegalizer: Launch.");
550  CARRYMacroLegalizer->legalize(true, directMacroLegalize, timingDriven);
551  }
552  macroCloseToSite = false;
553  }
555  macrosBindedToSites = true;
557  }
559  {
560  for (auto pair : placementInfo->getPULegalXY().first)
561  {
562  auto curPU = pair.first;
563  curPU->setAnchorLocationAndForgetTheOriginalOne(placementInfo->getPULegalXY().first[curPU],
564  placementInfo->getPULegalXY().second[curPU]);
565  }
566  }
567  if (macroCloseToSite)
568  {
569  for (auto pair : placementInfo->getPULegalXY().first)
570  {
571  auto curPU = pair.first;
572  curPU->setAnchorLocationAndForgetTheOriginalOne(placementInfo->getPULegalXY().first[curPU],
573  placementInfo->getPULegalXY().second[curPU]);
574  curPU->setFixed();
575  }
576  macroLegalizationFixed = true;
577  }
578  }
579  else
580  {
581  if (macroCloseToSite)
582  {
583  for (auto pair : placementInfo->getPULegalXY().first)
584  {
585  auto curPU = pair.first;
586  curPU->setAnchorLocationAndForgetTheOriginalOne(placementInfo->getPULegalXY().first[curPU],
587  placementInfo->getPULegalXY().second[curPU]);
588  curPU->setFixed();
589  }
590  macroLegalizationFixed = true;
591  }
592  }
593  }
594 
596  {
597  int i = historyAverageDisplacement.size();
598  float tmpAvg = (historyAverageDisplacement[i - 3] + historyAverageDisplacement[i - 2] +
600  3.0;
601 
602  float err = 0;
603  for (unsigned int i = historyAverageDisplacement.size() - 3; i < historyAverageDisplacement.size(); i++)
604  {
605  err += (historyAverageDisplacement[i] - tmpAvg) * (historyAverageDisplacement[i] - tmpAvg);
606  }
607  if (std::sqrt(err / 3) < 0.01)
608  {
609  macroLocked = true;
610  macroLockedIterCnt = 0;
612  print_warning("Macros will be locked for a while");
613  }
614  }
616 }
617 
618 void GlobalPlacer::spreading(int currentIteration, int spreadRegionSizeLimit, float displacementLimit)
619 {
621  float supplyRatio = (placementInfo->getBinGridW() < 2.5) ? 0.95 : (0.80 + 0.1 * progressRatio);
622 
624  {
625  std::string sharedCellType_SLICEL_CARRY8 = "SLICEL_CARRY8";
626  generalSpreader = new GeneralSpreader(placementInfo, JSONCfg, sharedCellType_SLICEL_CARRY8, currentIteration,
627  supplyRatio, verbose);
629  delete generalSpreader;
630  }
631 
632  std::string sharedCellType_SLICEL_MUXF8 = "SLICEL_MUXF8";
634  new GeneralSpreader(placementInfo, JSONCfg, sharedCellType_SLICEL_MUXF8, currentIteration, 0.75, verbose);
636  delete generalSpreader;
637 
638  std::string sharedCellType_SLICEL_MUXF7 = "SLICEL_MUXF7";
640  new GeneralSpreader(placementInfo, JSONCfg, sharedCellType_SLICEL_MUXF7, currentIteration, 0.75, verbose);
642  delete generalSpreader;
643 
644  // we gradually increase the shrinkRatio since the area adjustion of LUT/FF will be more accurate.
645  // we provide less area so the LUTs/FFs will not be too dense. Too dense placement might be seriously disturbed when
646  // some cells are inflatten.
647  std::string sharedCellType_SLICEL_LUT = "SLICEL_LUT";
649  new GeneralSpreader(placementInfo, JSONCfg, sharedCellType_SLICEL_LUT, currentIteration, supplyRatio, verbose);
651  delete generalSpreader;
652 
653  std::string sharedCellType_SLICEL_FF = "SLICEL_FF";
655  new GeneralSpreader(placementInfo, JSONCfg, sharedCellType_SLICEL_FF, currentIteration, supplyRatio, verbose);
657  delete generalSpreader;
658 
659  generalSpreader = nullptr;
660 
662  if (progressRatio > 0.4)
663  {
665  }
666 }
667 
668 void GlobalPlacer::updatePseudoNetWeight(float &pseudoNetWeight, int curIter)
669 {
671  if (progressRatio > 1)
672  progressRatio = 0.999;
673  if (std::pow(progressRatio, 0.6) > 0.4 && spreadingForgetRatio < 1)
674  spreadingForgetRatio = 0.5; // 1 - 0.4 * progressRatio;
675  else // the spreading control is not worthy when the placement is far from convergence.
679  HPWLChangeLittle = false;
680  progressRatio = std::pow(progressRatio, 0.6); // 0.5-1.4;0.6-1.3
682 
683  if (pseudoNetWeight < 0.0020)
684  pseudoNetWeight *= 1.825;
685  else
686  pseudoNetWeight *= 1.5 * (1 - progressRatio) + 1.01 * (progressRatio);
687 
688  historyHPWLs.push_back(upperBoundHPWL);
689 
691  {
692  print_warning("GlobalPlacer: clock region aware optimization is enabled.");
693  enableClockRegionAware = true;
694  }
695 
696  if (progressRatio > 0.75)
697  {
699  {
700  enableClockRegionAware = false;
701  }
703  }
704  int numRecorded = historyHPWLs.size();
705  if (numRecorded > 5)
706  {
707  float err = 0;
708  for (int vecId = numRecorded - 5; vecId < numRecorded; vecId++)
709  {
710  err += (minHPWL - historyHPWLs[vecId]) * (minHPWL - historyHPWLs[vecId]);
711  }
712  if (historyHPWLs[numRecorded - 1] > historyHPWLs[numRecorded - 2] &&
713  historyHPWLs[numRecorded - 2] > historyHPWLs[numRecorded - 3])
714  {
715  if (pseudoNetWeight > 0.03 && progressRatio < 0.95)
716  {
717  while (historyHPWLs.size() > 1)
718  historyHPWLs.pop_front();
719  pseudoNetWeight *= 0.75;
720  }
721  }
723  {
725  "GlobalPlacer: The upperbound HPWL increases too much, pseudoNetWeight is reduced by 50% to recover.");
727  pseudoNetWeight *= 0.5;
728  historyHPWLs.clear();
729  }
730  err = std::sqrt(err / 5);
731  print_info("GlobalPlacer: err=" + std::to_string(err) + " minHPWL=" + std::to_string(minHPWL) +
732  " err/minHPWL=" + std::to_string(err / minHPWL) + " progressRatio=" + std::to_string(progressRatio));
733 
735  pseudoNetWeight *= 1.05;
736 
737  if (err / minHPWL < 1.0 / 100.0 && progressRatio > 0.85 &&
739  {
740  print_status("Global Placer: B2B MAYBE converge");
741  HPWLChangeLittle = true;
742  pseudoNetWeight *= 2;
743  // break;
744  }
745  }
746  else if (numRecorded > 2 && updateMinHPWLAfterLegalization)
747  {
748  if (progressRatio > 0.6 && upperBoundHPWL / minHPWL > 1.333 && curIter > 10)
749  {
751  "GlobalPlacer: The upperbound HPWL increases too much, pseudoNetWeight is reduced by 50% to recover.");
753  pseudoNetWeight *= 0.5;
754  historyHPWLs.clear();
755  }
756  }
757  else
758  {
759  print_info("GlobalPlacer: minHPWL=" + std::to_string(minHPWL) +
760  " progressRatio=" + std::to_string(progressRatio));
761  }
762  // if (pseudoNetWeight > 1)
763  // {
764  // pseudoNetWeight = 1;
765  // }
766 }
767 
769 {
770  if (JSONCfg.find("DumpCARRYCoordTrace") != JSONCfg.end())
771  {
772  std::string dumpFile = JSONCfg["DumpCARRYCoordTrace"] + "-" + std::to_string(CARRYCoordinateDumpCnt) + ".gz";
773  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
775  if (dumpFile != "")
776  {
777  std::stringstream outfile0;
778  for (auto curPU : placementInfo->getPlacementUnits())
779  {
780  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
781  {
782  float cellX = curUnpackedCell->X();
783  float cellY = curUnpackedCell->Y();
784  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
785  if (curCell->isCarry())
786  {
787  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
788  }
789  }
790  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
791  {
792  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
793  {
794  float offsetX_InMacro, offsetY_InMacro;
796  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
797  float cellX = curMacro->X() + offsetX_InMacro;
798  float cellY = curMacro->Y() + offsetY_InMacro;
799 
800  if (DesignInfo::isCarry(cellType))
801  {
802  if (curMacro->getCell(vId))
803  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
804  else
805  outfile0 << cellX << " " << cellY << "\n";
806  }
807  }
808  }
809  }
810  writeStrToGZip(dumpFile, outfile0);
811  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
812  }
813  }
814 }
815 
817 {
818  if (JSONCfg.find("DumpFFCoordTrace") != JSONCfg.end())
819  {
820  std::string dumpFile = JSONCfg["DumpFFCoordTrace"] + "-" + std::to_string(FFCoordinateDumpCnt) + ".gz";
821  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
823  if (dumpFile != "")
824  {
825  std::stringstream outfile0;
826  for (auto curPU : placementInfo->getPlacementUnits())
827  {
828  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
829  {
830  float cellX = curUnpackedCell->X();
831  float cellY = curUnpackedCell->Y();
832  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
833  if (curCell->isFF())
834  {
835  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
836  }
837  }
838  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
839  {
840  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
841  {
842  float offsetX_InMacro, offsetY_InMacro;
844  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
845  float cellX = curMacro->X() + offsetX_InMacro;
846  float cellY = curMacro->Y() + offsetY_InMacro;
847 
848  if (DesignInfo::isFF(cellType))
849  {
850  if (curMacro->getCell(vId))
851  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
852  else
853  outfile0 << cellX << " " << cellY << "\n";
854  }
855  }
856  }
857  }
858  writeStrToGZip(dumpFile, outfile0);
859  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
860  }
861  }
862 }
863 
865 {
866  if (JSONCfg.find("DumpAllCoordTrace") != JSONCfg.end())
867  {
868  std::string dumpFile = JSONCfg["DumpAllCoordTrace"] + "-" + std::to_string(allCoordinateDumpCnt) + ".gz";
869  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
871  if (dumpFile != "")
872  {
873  std::stringstream outfile0;
874  for (auto curPU : placementInfo->getPlacementUnits())
875  {
876  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
877  {
878  float cellX = curUnpackedCell->X();
879  float cellY = curUnpackedCell->Y();
880  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
881  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
882  }
883  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
884  {
885  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
886  {
887  float offsetX_InMacro, offsetY_InMacro;
889  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
890  float cellX = curMacro->X() + offsetX_InMacro;
891  float cellY = curMacro->Y() + offsetY_InMacro;
892 
893  if (curMacro->getCell(vId))
894  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
895  else
896  outfile0 << cellX << " " << cellY << "\n";
897  }
898  }
899  }
900  writeStrToGZip(dumpFile, outfile0);
901  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
902  }
903  }
904 }
905 
907 {
908  if (!enforced)
909  {
910  if (JSONCfg.find("DumpLUTFFCoordTrace") != JSONCfg.end())
911  {
912  std::string dumpFile =
913  JSONCfg["DumpLUTFFCoordTrace"] + "-" + std::to_string(LUTFFCoordinateDumpCnt) + ".gz";
914  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
916  if (dumpFile != "")
917  {
918  std::stringstream outfile0;
919  for (auto curPU : placementInfo->getPlacementUnits())
920  {
921  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
922  {
923  float cellX = curUnpackedCell->X();
924  float cellY = curUnpackedCell->Y();
925  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
926  if (curCell->isFF() || curCell->isLUT())
927  {
928  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
929  }
930  }
931  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
932  {
933  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
934  {
935  float offsetX_InMacro, offsetY_InMacro;
937  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
938  float cellX = curMacro->X() + offsetX_InMacro;
939  float cellY = curMacro->Y() + offsetY_InMacro;
940 
941  if (DesignInfo::isFF(cellType) || DesignInfo::isLUT(cellType))
942  {
943  if (curMacro->getCell(vId))
944  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName()
945  << "\n";
946  else
947  outfile0 << cellX << " " << cellY << "\n";
948  }
949  }
950  }
951  }
952  writeStrToGZip(dumpFile, outfile0);
953  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
954  }
955  }
956  }
957  else
958  {
959  std::string dumpFile =
960  JSONCfg["dumpDirectory"] + "FinalLUTFF-" + std::to_string(LUTFFCoordinateDumpCnt) + ".gz";
961  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
963  if (dumpFile != "")
964  {
965  std::stringstream outfile0;
966  for (auto curPU : placementInfo->getPlacementUnits())
967  {
968  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
969  {
970  float cellX = curUnpackedCell->X();
971  float cellY = curUnpackedCell->Y();
972  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
973  if (curCell->isFF() || curCell->isLUT())
974  {
975  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
976  }
977  }
978  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
979  {
980  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
981  {
982  float offsetX_InMacro, offsetY_InMacro;
984  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
985  float cellX = curMacro->X() + offsetX_InMacro;
986  float cellY = curMacro->Y() + offsetY_InMacro;
987 
988  if (DesignInfo::isFF(cellType) || DesignInfo::isLUT(cellType))
989  {
990  if (curMacro->getCell(vId))
991  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
992  else
993  outfile0 << cellX << " " << cellY << "\n";
994  }
995  }
996  }
997  }
998  writeStrToGZip(dumpFile, outfile0);
999  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
1000  }
1001  }
1002 }
1003 
1005 {
1006  if (!enforced)
1007  {
1008  if (JSONCfg.find("DumpDSPCoordTrace") != JSONCfg.end())
1009  {
1010  std::string dumpFile = JSONCfg["DumpDSPCoordTrace"] + "-" + std::to_string(DSPCoordinateDumpCnt) + ".gz";
1011  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
1013  if (dumpFile != "")
1014  {
1015  std::stringstream outfile0;
1016  for (auto curPU : placementInfo->getPlacementUnits())
1017  {
1018  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1019  {
1020  float cellX = curUnpackedCell->X();
1021  float cellY = curUnpackedCell->Y();
1022  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
1023  if (curCell->isDSP())
1024  {
1025  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
1026  }
1027  }
1028  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1029  {
1030  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
1031  {
1032  float offsetX_InMacro, offsetY_InMacro;
1033  DesignInfo::DesignCellType cellType;
1034  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
1035  float cellX = curMacro->X() + offsetX_InMacro;
1036  float cellY = curMacro->Y() + offsetY_InMacro;
1037 
1038  if (DesignInfo::isDSP(cellType))
1039  {
1040  if (curMacro->getCell(vId))
1041  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName()
1042  << "\n";
1043  else
1044  outfile0 << cellX << " " << cellY << "\n";
1045  }
1046  }
1047  }
1048  }
1049  writeStrToGZip(dumpFile, outfile0);
1050  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
1051  }
1052  }
1053  }
1054  else
1055  {
1056  std::string dumpFile = +"FinalDSP-" + std::to_string(DSPCoordinateDumpCnt) + ".gz";
1057  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
1059  if (dumpFile != "")
1060  {
1061  std::stringstream outfile0;
1062  for (auto curPU : placementInfo->getPlacementUnits())
1063  {
1064  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1065  {
1066  float cellX = curUnpackedCell->X();
1067  float cellY = curUnpackedCell->Y();
1068  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
1069  if (curCell->isDSP())
1070  {
1071  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
1072  }
1073  }
1074  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1075  {
1076  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
1077  {
1078  float offsetX_InMacro, offsetY_InMacro;
1079  DesignInfo::DesignCellType cellType;
1080  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
1081  float cellX = curMacro->X() + offsetX_InMacro;
1082  float cellY = curMacro->Y() + offsetY_InMacro;
1083 
1084  if (DesignInfo::isDSP(cellType))
1085  {
1086  if (curMacro->getCell(vId))
1087  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
1088  else
1089  outfile0 << cellX << " " << cellY << "\n";
1090  }
1091  }
1092  }
1093  }
1094  writeStrToGZip(dumpFile, outfile0);
1095  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
1096  }
1097  }
1098 }
1099 
1101 {
1102  if (!enforced)
1103  {
1104  if (JSONCfg.find("DumpBRAMCoordTrace") != JSONCfg.end())
1105  {
1106  std::string dumpFile = JSONCfg["DumpBRAMCoordTrace"] + "-" + std::to_string(BRAMCoordinateDumpCnt) + ".gz";
1107  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
1109  if (dumpFile != "")
1110  {
1111  std::stringstream outfile0;
1112  for (auto curPU : placementInfo->getPlacementUnits())
1113  {
1114  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1115  {
1116  float cellX = curUnpackedCell->X();
1117  float cellY = curUnpackedCell->Y();
1118  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
1119  if (curCell->isBRAM())
1120  {
1121  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
1122  }
1123  }
1124  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1125  {
1126  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
1127  {
1128  float offsetX_InMacro, offsetY_InMacro;
1129  DesignInfo::DesignCellType cellType;
1130  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
1131  float cellX = curMacro->X() + offsetX_InMacro;
1132  float cellY = curMacro->Y() + offsetY_InMacro;
1133 
1134  if (DesignInfo::isBRAM(cellType))
1135  {
1136  if (curMacro->getCell(vId))
1137  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName()
1138  << "\n";
1139  else
1140  outfile0 << cellX << " " << cellY << "\n";
1141  }
1142  }
1143  }
1144  }
1145  writeStrToGZip(dumpFile, outfile0);
1146  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
1147  }
1148  }
1149  }
1150  else
1151  {
1152  std::string dumpFile = +"FinalBRAM-" + std::to_string(BRAMCoordinateDumpCnt) + ".gz";
1153  print_status("GlobalPlacer: dumping coordinate archieve to: " + dumpFile);
1155  if (dumpFile != "")
1156  {
1157  std::stringstream outfile0;
1158  for (auto curPU : placementInfo->getPlacementUnits())
1159  {
1160  if (auto curUnpackedCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1161  {
1162  float cellX = curUnpackedCell->X();
1163  float cellY = curUnpackedCell->Y();
1164  DesignInfo::DesignCell *curCell = curUnpackedCell->getCell();
1165  if (curCell->isBRAM())
1166  {
1167  outfile0 << cellX << " " << cellY << " " << curCell->getName() << "\n";
1168  }
1169  }
1170  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1171  {
1172  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
1173  {
1174  float offsetX_InMacro, offsetY_InMacro;
1175  DesignInfo::DesignCellType cellType;
1176  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
1177  float cellX = curMacro->X() + offsetX_InMacro;
1178  float cellY = curMacro->Y() + offsetY_InMacro;
1179 
1180  if (DesignInfo::isBRAM(cellType))
1181  {
1182  if (curMacro->getCell(vId))
1183  outfile0 << cellX << " " << cellY << " " << curMacro->getCell(vId)->getName() << "\n";
1184  else
1185  outfile0 << cellX << " " << cellY << "\n";
1186  }
1187  }
1188  }
1189  }
1190  writeStrToGZip(dumpFile, outfile0);
1191  print_status("GlobalPlacer: dumped coordinate archieve to: " + dumpFile);
1192  }
1193  }
1194 }
1195 
1197 {
1198  float range = 0.75;
1199  print_status("ParallelCLBPacker: conducting timing-driven detailed placement based on shortest path.");
1200  auto oriCellIdsInCriticalPaths = timingOptimizer->findCriticalPaths(0.9);
1201  std::set<PlacementInfo::PlacementUnit *> PUsTouched;
1202  PUsTouched.clear();
1203  std::vector<PlacementInfo::Location> &cellLoc = placementInfo->getCellId2location();
1204 
1205  int replaceCnt = 0;
1206  for (auto oriCellIdsInCriticalPath : oriCellIdsInCriticalPaths)
1207  {
1208  std::map<int, std::vector<PlacementInfo::Location>> cellId2CandidateLocation;
1209  cellId2CandidateLocation.clear();
1210 
1211  std::vector<int> cellIdsInCriticalPath;
1212  PlacementInfo::PlacementUnit *lastPU = nullptr;
1213  std::set<PlacementInfo::PlacementUnit *> PUsInCriticalPathSet;
1214  for (auto cellId : oriCellIdsInCriticalPath)
1215  {
1216  if (PUsInCriticalPathSet.find(placementInfo->getPlacementUnitByCellId(cellId)) ==
1217  PUsInCriticalPathSet.end())
1218  {
1219  PUsInCriticalPathSet.insert(placementInfo->getPlacementUnitByCellId(cellId));
1220  cellIdsInCriticalPath.push_back(cellId);
1221  }
1222  }
1223 
1224  bool CellUnmapped = false;
1225  for (auto cellId : cellIdsInCriticalPath)
1226  {
1227  auto curPU = placementInfo->getPlacementUnitByCellId(cellId);
1228 
1229  cellId2CandidateLocation[cellId] = std::vector<PlacementInfo::Location>(1, cellLoc[cellId]);
1230  }
1231 
1232  for (int orderI = cellIdsInCriticalPath.size() - 1; orderI >= 0; orderI--)
1233  {
1234  auto cellId = cellIdsInCriticalPath[orderI];
1235  auto curPU = placementInfo->getPlacementUnitByCellId(cellId);
1236 
1237  if (PUsTouched.find(curPU) != PUsTouched.end())
1238  {
1239  continue;
1240  }
1241  // std::cout << curCell << " has following candidates: \n";
1242  if (!curPU->isFixed() && !curPU->isLocked() && !curPU->checkHasLUTRAM() && !curPU->checkHasBRAM() &&
1243  !curPU->checkHasDSP())
1244  {
1245  float tmpRange = range;
1246  if (curPU->checkHasCARRY())
1247  {
1248  if (curPU->getCARRYNum() <= 2)
1249  tmpRange = tmpRange / curPU->getCARRYNum();
1250  else
1251  continue;
1252  }
1253  auto curX = cellLoc[cellId].X;
1254  auto curY = cellLoc[cellId].Y;
1255  for (float cX = curX - 1.0 * tmpRange; cX < curX + 1.1 * tmpRange; cX += 0.5 * tmpRange)
1256  {
1257  for (float cY = curY - 2.0 * tmpRange; cY < curY + 2.1 * tmpRange; cY += 1 * tmpRange)
1258  {
1259  if (std::fabs(cX - curX) + std::fabs(cY - curY) < 0.1)
1260  continue;
1261  PlacementInfo::Location newLoc;
1262  newLoc.X = cX;
1263  newLoc.Y = cY;
1264  cellId2CandidateLocation[cellId].push_back(newLoc);
1265  }
1266  }
1267  }
1268  }
1269  for (int orderI = cellIdsInCriticalPath.size() - 1; orderI >= 0; orderI--)
1270  {
1271  auto cellId = cellIdsInCriticalPath[orderI];
1272  auto curPU = placementInfo->getPlacementUnitByCellId(cellId);
1273  PUsTouched.insert(curPU);
1274  }
1275  // calculate the shortest paths
1276  std::vector<std::vector<float>> shortestPath_LayerSite;
1277  std::vector<std::vector<int>> shortestPath_LayerSite_backtrace;
1278  shortestPath_LayerSite.push_back(
1279  std::vector<float>(cellId2CandidateLocation[cellIdsInCriticalPath[0]].size(), 0.0));
1280  shortestPath_LayerSite_backtrace.push_back(
1281  std::vector<int>(cellId2CandidateLocation[cellIdsInCriticalPath[0]].size(), -1));
1282 
1283  int bestEndChoice = -1;
1284  float bestChoiceDelay = 100000;
1285 
1286  for (int i = 1; i < cellIdsInCriticalPath.size(); i++)
1287  {
1288  auto predCell = cellIdsInCriticalPath[i - 1];
1289  auto curCell = cellIdsInCriticalPath[i];
1290  auto &predCandidates = cellId2CandidateLocation[predCell];
1291  auto &curCandidates = cellId2CandidateLocation[curCell];
1292  shortestPath_LayerSite.push_back(std::vector<float>(cellId2CandidateLocation[curCell].size(), 100000.0));
1293  shortestPath_LayerSite_backtrace.push_back(std::vector<int>(cellId2CandidateLocation[curCell].size(), -1));
1294 
1295  for (int j = 0; j < predCandidates.size(); j++)
1296  {
1297  for (int k = 0; k < curCandidates.size(); k++)
1298  {
1299  float predX = predCandidates[j].X, predY = predCandidates[j].Y;
1300  float curX = curCandidates[k].X, curY = curCandidates[k].Y;
1301 
1302  float delay = timingOptimizer->getDelayByModel(predX, predY, curX, curY);
1303 
1304  if (shortestPath_LayerSite[i][k] > shortestPath_LayerSite[i - 1][j] + delay)
1305  {
1306  shortestPath_LayerSite[i][k] = shortestPath_LayerSite[i - 1][j] + delay;
1307  shortestPath_LayerSite_backtrace[i][k] = j;
1308 
1309  if (i == cellIdsInCriticalPath.size() - 1)
1310  {
1311  if (shortestPath_LayerSite[i][k] < bestChoiceDelay)
1312  {
1313  bestChoiceDelay = shortestPath_LayerSite[i][k];
1314  bestEndChoice = k;
1315  }
1316  }
1317  }
1318  }
1319  }
1320  }
1321 
1322  for (int i = shortestPath_LayerSite.size() - 1; i >= 0; i--)
1323  {
1324  if (bestEndChoice)
1325  {
1326  auto curCellId = cellIdsInCriticalPath[i];
1327  auto curPU = placementInfo->getPlacementUnitByCellId(curCellId);
1328  auto curCell = placementInfo->getCells()[curCellId];
1329 
1330  auto &curCandidates = cellId2CandidateLocation[curCellId];
1331  if (!curPU->isFixed() && !curPU->isLocked() && !curPU->checkHasLUTRAM() && !curPU->checkHasBRAM() &&
1332  !curPU->checkHasDSP())
1333  {
1334  if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1335  {
1336  float offsetX_InMacro = curMacro->getCellOffsetXInMacro(curCell),
1337  offsetY_InMacro = curMacro->getCellOffsetYInMacro(curCell);
1338 
1339  float resX = curCandidates[bestEndChoice].X - offsetX_InMacro;
1340  float resY = curCandidates[bestEndChoice].Y - offsetY_InMacro;
1341 
1342  placementInfo->legalizeXYInArea(curPU, resX, resY);
1343  curPU->setAnchorLocationAndForgetTheOriginalOne(resX, resY);
1344  for (int vId = 0; vId < curMacro->getNumOfCells(); vId++)
1345  {
1346  DesignInfo::DesignCellType cellType;
1347  float offsetX_InMacro, offsetY_InMacro;
1348  curMacro->getVirtualCellInfo(vId, offsetX_InMacro, offsetY_InMacro, cellType);
1349  DesignInfo::DesignCell *curCellInMacro = curMacro->getCell(vId);
1350 
1351  float cellX = curMacro->X() + offsetX_InMacro;
1352  float cellY = curMacro->Y() + offsetY_InMacro;
1353 
1354  cellLoc[curCellInMacro->getCellId()].X = cellX;
1355  cellLoc[curCellInMacro->getCellId()].Y = cellY;
1356  }
1357  }
1358  else if (auto unpacked = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1359  {
1360  placementInfo->legalizeXYInArea(curPU, curCandidates[bestEndChoice].X,
1361  curCandidates[bestEndChoice].Y);
1362  curPU->setAnchorLocationAndForgetTheOriginalOne(curCandidates[bestEndChoice].X,
1363  curCandidates[bestEndChoice].Y);
1364  cellLoc[unpacked->getCell()->getCellId()].X = curCandidates[bestEndChoice].X;
1365  cellLoc[unpacked->getCell()->getCellId()].Y = curCandidates[bestEndChoice].Y;
1366  }
1367  replaceCnt++;
1368  }
1369  }
1370  bestEndChoice = shortestPath_LayerSite_backtrace[i][bestEndChoice];
1371  }
1372  }
1373 
1375  print_status("ParallelCLBPacker: conducted timing-driven detailed placement (shortest path) and " +
1376  std::to_string(replaceCnt) + " PlacementUnits are replaced.");
1377  return replaceCnt;
1378 }
DesignInfo::isBRAM
static bool isBRAM(DesignCellType cellType)
Definition: DesignInfo.h:1341
PlacementInfo::Location
Definition: PlacementInfo.h:3595
GlobalPlacer::disableSpreadingForgetRatio
bool disableSpreadingForgetRatio
diable cell spreading forget ratio
Definition: GlobalPlacer.h:239
delayVisualization.delay
delay
Definition: delayVisualization.py:55
MacroLegalizer::getAverageDisplacementOfExactLegalization
float getAverageDisplacementOfExactLegalization()
Get the average displacement of exact legalization for the involved PlacementUnit.
Definition: MacroLegalizer.h:95
ClusterPlacer
ClusterPlacer will cluster nodes in the given netlist and place the clusters on the device based on s...
Definition: ClusterPlacer.h:54
GlobalPlacer::averageCarryLegalDisplacement
float averageCarryLegalDisplacement
record the legalization displacement of CARRY
Definition: GlobalPlacer.h:351
PlacementInfo::getProgress
float getProgress()
Get the Progress ratio of the placement.
Definition: PlacementInfo.h:3969
GlobalPlacer::LUTFFCoordinateDumpCnt
int LUTFFCoordinateDumpCnt
Definition: GlobalPlacer.h:324
PlacementTimingOptimizer::getDelayByModel
float getDelayByModel(PlacementTimingInfo::TimingGraph< DesignInfo::DesignCell >::TimingNode *node1, PlacementTimingInfo::TimingGraph< DesignInfo::DesignCell >::TimingNode *node2, float X1, float Y1, float X2, float Y2)
Definition: PlacementTimingOptimizer.h:103
DesignInfo::CellType_RAMB36E2
@ CellType_RAMB36E2
Definition: DesignInfo.h:111
PlacementInfo::setProgress
void setProgress(float p)
Set the progress ratio, indicating the progress of the placement convergence,.
Definition: PlacementInfo.h:3959
PlacementInfo::getPlacementUnits
std::vector< PlacementUnit * > & getPlacementUnits()
Definition: PlacementInfo.h:2810
PlacementInfo::getCells
std::vector< DesignInfo::DesignCell * > & getCells()
Definition: PlacementInfo.h:3898
GlobalPlacer::CARRYCoordinateDumpCnt
int CARRYCoordinateDumpCnt
Definition: GlobalPlacer.h:325
DeviceInfo::resetAllSiteMapping
void resetAllSiteMapping()
remove the mapped flags for all sites without fixed elements
Definition: DeviceInfo.h:1153
GlobalPlacer::printPlacedUnits
void printPlacedUnits(std::ostream &os)
Definition: GlobalPlacer.cc:398
DesignInfo::getNets
std::vector< DesignNet * > & getNets()
Definition: DesignInfo.h:1613
GlobalPlacer::WLOptimizer
WirelengthOptimizer * WLOptimizer
wirelength optimizer is based on numerial model and used to reduce the overall wirelength with variou...
Definition: GlobalPlacer.h:252
GlobalPlacer::spreading
void spreading(int currentIteration, int spreadRegionSizeLimit=100000000, float displacementLimit=-10)
cell spreading for all types of elements
Definition: GlobalPlacer.cc:618
PlacementInfo::PlacementMacro
a fixed group of multiple standard cells with constraints of their relative locations
Definition: PlacementInfo.h:1525
MacroLegalizer::setClockRegionAware
void setClockRegionAware(bool _clockRegionAware)
Definition: MacroLegalizer.h:149
MacroLegalizer::resetSitesMapped
void resetSitesMapped()
reset the mapped flag of the involved sites.
Definition: MacroLegalizer.cc:1507
GlobalPlacer::printHPWL
bool printHPWL
Definition: GlobalPlacer.h:451
DesignInfo::DesignCell
a DesignCell in design netlist, DesignPin objects of which might connect to DesignNet objects
Definition: DesignInfo.h:782
GlobalPlacer::macrosBindedToSites
bool macrosBindedToSites
macros are binded to sites and such binding will lead to pseudo nets between anchors and elements
Definition: GlobalPlacer.h:395
DesignInfo::CellType_FIFO18E2
@ CellType_FIFO18E2
Definition: DesignInfo.h:109
CLBLegalizer::getAverageDisplacementOfRoughLegalization
float getAverageDisplacementOfRoughLegalization()
Get the average displacement of rough legalization for the involved PlacementUnit.
Definition: CLBLegalizer.h:117
GlobalPlacer::dumpBRAMCoordinate
void dumpBRAMCoordinate(bool enforced=false)
Definition: GlobalPlacer.cc:1100
GlobalPlacer::historyHPWLs
std::deque< float > historyHPWLs
record the change history of HPWL
Definition: GlobalPlacer.h:363
PlacementTimingOptimizer::findCriticalPaths
std::vector< std::vector< int > > findCriticalPaths(float criticalRatio, bool checkOverlap=true, int pathNumThr=1000, int converThr=30)
Definition: PlacementTimingOptimizer.cc:119
GlobalPlacer::directMacroLegalize
bool directMacroLegalize
directly legalize macros without the phase of rough legalization (each standard cell in a macro will ...
Definition: GlobalPlacer.h:420
MacroLegalizer
MacroLegalizer maps DSP/BRAM/CARRY macros to legal location.
Definition: MacroLegalizer.h:58
CLBLegalizer::hasNoTarget
bool hasNoTarget()
Definition: CLBLegalizer.h:148
GlobalPlacer::averageMCLBLegalDisplacement
float averageMCLBLegalDisplacement
record the legalization displacement of SLICEM-Macro
Definition: GlobalPlacer.h:357
GlobalPlacer::dumpDSPCoordinate
void dumpDSPCoordinate(bool enforced=false)
Definition: GlobalPlacer.cc:1004
WirelengthOptimizer::getMacroPseudoNetEnhanceCnt
int getMacroPseudoNetEnhanceCnt()
Get the number of the conducted macro iterations.
Definition: WirelengthOptimizer.h:166
PlacementInfo::getCellId2location
std::vector< Location > & getCellId2location()
Definition: PlacementInfo.h:3600
PlacementInfo::getCellId2PlacementUnit
std::map< int, PlacementUnit * > & getCellId2PlacementUnit()
Definition: PlacementInfo.h:2830
DesignInfo::DesignCellType
DesignCellType
design cell types
Definition: DesignInfo.h:73
PlacementInfo::getMinHPWL
float getMinHPWL()
Definition: PlacementInfo.h:4210
GlobalPlacer::clusterPlacer
ClusterPlacer * clusterPlacer
cluster placer is used for initial placement
Definition: GlobalPlacer.h:245
GlobalPlacer::spreadingForgetRatio
float spreadingForgetRatio
we use the forget ratio to control the sensitivity of cell spreading during the location updateing (n...
Definition: GlobalPlacer.h:333
CLBLegalizer::dumpMatching
void dumpMatching(bool fixedColumn=false, bool enforce=false)
Definition: CLBLegalizer.cc:628
DesignInfo::DesignCell::isCarry
bool isCarry()
Definition: DesignInfo.h:963
GlobalPlacer::updateMinHPWLAfterLegalization
bool updateMinHPWLAfterLegalization
when legalization is started, the HPWL might have a significant change due to the legalization displa...
Definition: GlobalPlacer.h:383
DesignInfo::isCarry
static bool isCarry(DesignCellType cellType)
Definition: DesignInfo.h:1331
GlobalPlacer::y2xRatio
float y2xRatio
Definition: GlobalPlacer.h:222
GlobalPlacer::macroLocked
bool macroLocked
lock the macro binding and bypass serveral legalizaiton iterations for wirelength stable convergence
Definition: GlobalPlacer.h:407
GlobalPlacer::BRAMDSPLegalizer
MacroLegalizer * BRAMDSPLegalizer
legalize multi-site BRAM/DSP elements
Definition: GlobalPlacer.h:264
PlacementInfo::getPULegalXY
std::pair< std::map< PlacementInfo::PlacementUnit *, float >, std::map< PlacementInfo::PlacementUnit *, float > > & getPULegalXY()
get the locations (pair of X,Y) of the legalized PlacementUnit objects
Definition: PlacementInfo.h:3693
GlobalPlacer::oriPseudoNetWeight
float oriPseudoNetWeight
record the pseudo net weight at the end of placement functions for later iterations....
Definition: GlobalPlacer.h:434
GlobalPlacer::enableClockRegionAware
bool enableClockRegionAware
Definition: GlobalPlacer.h:449
GlobalPlacer.h
This header file contains the definitions of GlobalPlacer class and its internal modules and APIs whi...
GlobalPlacer::HPWLChangeLittle
bool HPWLChangeLittle
the small change of minHPWL might imply that the optimization converges.
Definition: GlobalPlacer.h:389
PlacementInfo::updateB2BAndGetTotalHPWL
double updateB2BAndGetTotalHPWL()
update the B2B net model for the placement and get the total HPWL of all the nets in the design
Definition: PlacementInfo.h:3913
DesignInfo::isDSP
static bool isDSP(DesignCellType cellType)
Definition: DesignInfo.h:1336
PlacementTimingOptimizer
Definition: PlacementTimingOptimizer.h:46
GlobalPlacer::upperBoundHPWL
float upperBoundHPWL
upperbound HPWL is obtained just after cell spreading and legalization
Definition: GlobalPlacer.h:370
GlobalPlacer::dumpCARRYCoordinate
void dumpCARRYCoordinate()
Definition: GlobalPlacer.cc:768
PlacementInfo::PlacementUnit::X
float X()
Definition: PlacementInfo.h:1024
GlobalPlacer::LUTCoordinateDumpCnt
int LUTCoordinateDumpCnt
Definition: GlobalPlacer.h:320
GlobalPlacer::updatePseudoNetWeight
void updatePseudoNetWeight(float &pseudoNetWeight, int curIter)
update pseudo net weight according to placement progress
Definition: GlobalPlacer.cc:668
PlacementInfo::getDeviceInfo
DeviceInfo * getDeviceInfo()
Definition: PlacementInfo.h:3308
PlacementInfo::adjustLUTFFUtilization_Routability_Reset
void adjustLUTFFUtilization_Routability_Reset()
reset the inflate ratio of all the cells to be 1, for re-evaluation
Definition: PlacementInfo.cc:1511
PlacementInfo::enhanceDDRNet
void enhanceDDRNet()
Definition: PlacementInfo.cc:2073
PlacementInfo::Location::X
float X
Definition: PlacementInfo.h:3596
delayVisualization.X
X
Definition: delayVisualization.py:80
GlobalPlacer::dumpLUTFFCoordinate
void dumpLUTFFCoordinate(bool enforced=false)
Definition: GlobalPlacer.cc:906
CLBLegalizer::legalize
void legalize(bool exactLegalization=false)
conduct legalization and map the PlacementUnit of one of the given types to sites
Definition: CLBLegalizer.cc:78
GlobalPlacer::averageMacroLegalDisplacement
float averageMacroLegalDisplacement
record the legalization displacement of DSP/BRAM
Definition: GlobalPlacer.h:345
PlacementInfo::resetPULegalInformation
void resetPULegalInformation()
forget all the legalization information
Definition: PlacementInfo.h:3702
WirelengthOptimizer::reloadPlacementInfo
void reloadPlacementInfo()
re-initialize some parameters and optimizer configuration according to the PlacementInfo
Definition: WirelengthOptimizer.cc:69
GlobalPlacer::timingOptEnabled
bool timingOptEnabled
Definition: GlobalPlacer.h:450
to_string_align3
std::string to_string_align3(int __val)
Definition: strPrint.cc:62
DesignInfo::CellType_RAMB18E2
@ CellType_RAMB18E2
Definition: DesignInfo.h:110
CLBLegalizer::getAverageDisplacementOfExactLegalization
float getAverageDisplacementOfExactLegalization()
Get the average displacement of exact legalization for the involved PlacementUnit.
Definition: CLBLegalizer.h:95
PlacementInfo::updateElementBinGrid
void updateElementBinGrid()
map design cells to the bins in the bin grid.
Definition: PlacementInfo.cc:906
GlobalPlacer::dumpOptTrace
bool dumpOptTrace
Definition: GlobalPlacer.h:221
GlobalPlacer::allCoordinateDumpCnt
int allCoordinateDumpCnt
Definition: GlobalPlacer.h:326
DesignInfo::CellType_FIFO36E2
@ CellType_FIFO36E2
Definition: DesignInfo.h:108
GlobalPlacer::pseudoNetWeight
float pseudoNetWeight
the pseudo net weight in the iterations of placement functions
Definition: GlobalPlacer.h:440
DesignInfo::isFF
static bool isFF(DesignCellType cellType)
Definition: DesignInfo.h:1360
DesignInfo::DesignCell::isFF
bool isFF()
Definition: DesignInfo.h:933
print_status
void print_status(std::string tmp_string)
Definition: strPrint.cc:44
GlobalPlacer::verbose
bool verbose
Definition: GlobalPlacer.h:220
DesignInfo::DesignCell::isBRAM
bool isBRAM()
Definition: DesignInfo.h:954
DesignInfo::DesignElement::getName
const std::string & getName() const
Definition: DesignInfo.h:243
print_warning
void print_warning(std::string tmp_string)
Definition: strPrint.cc:57
PlacementInfo::enhanceHighFanoutNet
void enhanceHighFanoutNet()
Definition: PlacementInfo.cc:2019
GlobalPlacer::dumpFFCoordinate
void dumpFFCoordinate()
Definition: GlobalPlacer.cc:816
MacroLegalizer::legalize
void legalize(bool exactLegalization=false, bool directLegalization=false, bool _timingDrivenLegalize=false)
conduct legalization and map the PlacementUnit of one of the given types to sites
Definition: MacroLegalizer.cc:63
GeneralSpreader
GeneralSpreader accounts for the cell spreading, which controls the cell density of specific resource...
Definition: GeneralSpreader.h:50
GlobalPlacer::macroLegalizationFixed
bool macroLegalizationFixed
fix the macros to the exact legal location
Definition: GlobalPlacer.h:413
PlacementInfo::isDensePlacement
bool isDensePlacement()
Definition: PlacementInfo.h:4388
PlacementInfo::getPlacementUnitByCellId
PlacementUnit * getPlacementUnitByCellId(int cellId)
Definition: PlacementInfo.h:3127
CLBLegalizer::setIntitialParameters
void setIntitialParameters(float displacementThr, int candidateNum, int _candidateFactor=-1)
Set the intitial parameters of the legalizer.
Definition: CLBLegalizer.h:129
PlacementInfo::PlacementUnit
a movement unit in placement with information of location and resource demand
Definition: PlacementInfo.h:1010
DesignInfo::DesignCell::getCellId
int getCellId()
Get the Cell Id in the cell list.
Definition: DesignInfo.h:1037
GlobalPlacer::DSPCritical
bool DSPCritical
Definition: GlobalPlacer.h:424
DesignInfo::DesignCell::isLUT
bool isLUT()
Definition: DesignInfo.h:927
GlobalPlacer::BRAMCoordinateDumpCnt
int BRAMCoordinateDumpCnt
Definition: GlobalPlacer.h:322
MacroLegalizer::dumpMatching
void dumpMatching(bool fixedColumn=false, bool enforce=false)
Definition: MacroLegalizer.cc:922
writeStrToGZip
void writeStrToGZip(std::string fileName, std::stringstream &data)
Definition: dumpZip.cc:29
PlacementInfo::legalizeXYInArea
void legalizeXYInArea(PlacementUnit *curPU, float &fX, float &fY)
move the PlacementUnit to ensure the cells in it are within the device area.
Definition: PlacementInfo.h:3364
GlobalPlacer::macroLegalize
void macroLegalize(int curIteration, bool timingDriven=false, PlacementTimingOptimizer *timingOptimizer=nullptr)
legalize specific types of macro to the target regions
Definition: GlobalPlacer.cc:458
MacroLegalizer::hasNoTarget
bool hasNoTarget()
Definition: MacroLegalizer.h:159
GlobalPlacer::timingDrivenDetailedPlacement_shortestPath_intermediate
int timingDrivenDetailedPlacement_shortestPath_intermediate(PlacementTimingOptimizer *timingOptimizer)
Definition: GlobalPlacer.cc:1196
PlacementTimingOptimizer::getEffectFactor
float getEffectFactor()
Definition: PlacementTimingOptimizer.h:93
GlobalPlacer::GlobalPlacement_CLBElements
void GlobalPlacement_CLBElements(int iterNum, bool continuePreviousIteration=false, int lowerBoundIterNum=6, bool enableMacroPseudoNet2Site=false, bool stopStrictly=false, unsigned int spreadRegionBinNumLimit=10000000, PlacementTimingOptimizer *timingOptimizer=nullptr)
wirelength optimization + cell spreading + legalization + area adjustion
Definition: GlobalPlacer.cc:128
PlacementInfo::enhanceRiskyClockNet
void enhanceRiskyClockNet()
Definition: PlacementInfo.cc:2034
GlobalPlacer::GlobalPlacement_fixedCLB
void GlobalPlacement_fixedCLB(int iterNum, float pseudoNetWeight)
fix the locations of CLB and let macros move without low pseudo net at initial stages,...
Definition: GlobalPlacer.cc:334
DesignInfo::CellType_DSP48E2
@ CellType_DSP48E2
Definition: DesignInfo.h:90
PlacementInfo::isClockLegalizationRisky
bool isClockLegalizationRisky()
Definition: PlacementInfo.h:4394
PlacementInfo::getBinGridW
float getBinGridW()
Get the width of a bin in grid.
Definition: PlacementInfo.h:3615
GlobalPlacer::pseudoNetWeightConsiderNetNum
bool pseudoNetWeightConsiderNetNum
set adaptive pseudo net weight according to net density
Definition: GlobalPlacer.h:230
GlobalPlacer::JSONCfg
std::map< std::string, std::string > & JSONCfg
Definition: GlobalPlacer.h:219
PlacementInfo::checkClockUtilization
bool checkClockUtilization(bool dump)
check the utlization of the clock regions on the device
Definition: PlacementInfo.cc:2087
GlobalPlacer::dumpLUTCoordinate
void dumpLUTCoordinate()
Definition: GlobalPlacer.cc:410
GlobalPlacer::lowerBoundHPWL
float lowerBoundHPWL
lowerbound HPWL is obtained just after wirelength optimization
Definition: GlobalPlacer.h:376
GlobalPlacer::hasUserDefinedClusterInfo
bool hasUserDefinedClusterInfo
Definition: GlobalPlacer.h:448
GlobalPlacer::dumpAllCellsCoordinate
void dumpAllCellsCoordinate()
Definition: GlobalPlacer.cc:864
PlacementTimingOptimizer::conductStaticTimingAnalysis
float conductStaticTimingAnalysis(bool enforeOptimisticTiming=false)
Definition: PlacementTimingOptimizer.cc:218
MacroLegalizer::setClockRegionCasLegalization
void setClockRegionCasLegalization(bool _clockRegionCasLegalization)
Definition: MacroLegalizer.h:154
DesignInfo::CellType_CARRY8
@ CellType_CARRY8
Definition: DesignInfo.h:89
delayVisualization.Y
Y
Definition: delayVisualization.py:80
WirelengthOptimizer::GlobalPlacementQPSolve
void GlobalPlacementQPSolve(float pesudoNetWeight, bool firstIteration=true, bool forwardSolutionToNextIteration=false, bool enableMacroPseudoNet2Site=false, bool considerNetNum=true, bool enableUserDefinedClusterOpt=false, float displacementLimit=-10, PlacementTimingOptimizer *timingOptimizer=nullptr)
use quadratic model to estimate the HPWL and some timing/user-defined pseudo nets are involved for sp...
Definition: WirelengthOptimizer.cc:100
ClusterPlacer::ClusterPlacement
void ClusterPlacement()
conduct cluster placement, cluster nodes in the given netlist and place the clusters on the device as...
Definition: ClusterPlacer.cc:60
GlobalPlacer::macroLockedIterCnt
int macroLockedIterCnt
Definition: GlobalPlacer.h:426
PlacementInfo::PlacementUnpackedCell
the smallest, indivisible, representable component. It will include only one standard cell
Definition: PlacementInfo.h:1447
GlobalPlacer::clusterPlacement
void clusterPlacement()
cluster elements and conduct initial placement at coarse-grained level
Definition: GlobalPlacer.cc:122
GlobalPlacer::minHPWL
float minHPWL
Definition: GlobalPlacer.h:364
PlacementInfo::setMacroLegalizationParameters
void setMacroLegalizationParameters(int cnt, float _macroLegalizationWeight)
Set the Macro Legalization Parameters.
Definition: PlacementInfo.h:4075
GlobalPlacer::mCLBLegalizer
CLBLegalizer * mCLBLegalizer
legalize single-site SLICEM-CLB elements
Definition: GlobalPlacer.h:276
print_info
void print_info(std::string tmp_string)
Definition: strPrint.cc:39
MacroLegalizer::setIntitialParameters
void setIntitialParameters(float displacementThr, int candidateNum, int _candidateFactor=-1)
Set the intitial parameters of the legalizer.
Definition: MacroLegalizer.h:131
MacroLegalizer::getAverageDisplacementOfRoughLegalization
float getAverageDisplacementOfRoughLegalization()
Get the average displacement of rough legalization for the involved PlacementUnit.
Definition: MacroLegalizer.h:117
GlobalPlacer::CARRYMacroLegalizer
MacroLegalizer * CARRYMacroLegalizer
legalize multi-site CARRY elements
Definition: GlobalPlacer.h:270
checkHalfColumn.i
int i
Definition: checkHalfColumn.py:5
PlacementInfo::getDesignInfo
DesignInfo * getDesignInfo()
Definition: PlacementInfo.h:3303
GlobalPlacer::FFCoordinateDumpCnt
int FFCoordinateDumpCnt
Definition: GlobalPlacer.h:323
GlobalPlacer::macroCloseToSite
bool macroCloseToSite
macros are located closely to their legalized locations
Definition: GlobalPlacer.h:401
WirelengthOptimizer::getMacroLegalizationWeight
float getMacroLegalizationWeight()
Get the net weight for macro legalization.
Definition: WirelengthOptimizer.h:176
GlobalPlacer::generalSpreader
GeneralSpreader * generalSpreader
a general spreading will spread cells to meet cell density requirements
Definition: GlobalPlacer.h:258
GlobalPlacer::lCLBLegalizer
CLBLegalizer * lCLBLegalizer
legalize single-site SLICEL-CLB elements
Definition: GlobalPlacer.h:282
DesignInfo::isLUT
static bool isLUT(DesignCellType cellType)
Definition: DesignInfo.h:1324
GlobalPlacer::neighborDisplacementUpperbound
float neighborDisplacementUpperbound
the distance threshold for the neighbor detection during area adjustion
Definition: GlobalPlacer.h:446
PlacementInfo::getPUWithManyNetsRatio
float getPUWithManyNetsRatio()
get the proportion of the PlacementUnit objects with high interconnection density
Definition: PlacementInfo.h:4194
PlacementInfo::adjustLUTFFUtilization
void adjustLUTFFUtilization(float neighborDisplacementUpperbound, bool enfore=false)
adjust the resource demand of LUTs/FFs according to packing feasibility and routing congestion
Definition: PlacementInfo.cc:1544
GlobalPlacer::DSPCoordinateDumpCnt
int DSPCoordinateDumpCnt
Definition: GlobalPlacer.h:321
PlacementInfo::setMinHPWL
void setMinHPWL(float val)
record the minimum HPWL during placement procedure
Definition: PlacementInfo.h:4205
GlobalPlacer::dumpClockUtilization
bool dumpClockUtilization
Definition: GlobalPlacer.h:422
GlobalPlacer::historyAverageDisplacement
std::deque< float > historyAverageDisplacement
Definition: GlobalPlacer.h:427
GlobalPlacer::progressRatio
float progressRatio
the similarity between upperbound wirelength and lowerbound wirelength
Definition: GlobalPlacer.h:339
CLBLegalizer
CLBLegalizer maps CLBs (each of which consists of one site) to legal location. e.g....
Definition: CLBLegalizer.h:62
PlacementInfo::PlacementUnit::getCARRYNum
int getCARRYNum()
Definition: PlacementInfo.h:1361
PlacementInfo::setPseudoNetWeight
void setPseudoNetWeight(float weight)
Set the Pseudo Net Weight according to a given value.
Definition: PlacementInfo.h:4014
PlacementInfo::Location::Y
float Y
Definition: PlacementInfo.h:3597
WirelengthOptimizer
WirelengthOptimizer builds numerical models based on the element locations and calls solvers to find ...
Definition: WirelengthOptimizer.h:54
GlobalPlacer::GlobalPlacer
GlobalPlacer(PlacementInfo *placementInfo, std::map< std::string, std::string > &JSONCfg, bool resetLegalizationInfo=true)
Construct a new Global Placer object based on placement information.
Definition: GlobalPlacer.cc:31
GlobalPlacer::dumpCoord
void dumpCoord()
Definition: GlobalPlacer.cc:388
CLBLegalizer::resetSitesMapped
void resetSitesMapped()
reset the mapped flag of the involved sites.
Definition: CLBLegalizer.cc:1002
PlacementInfo
Information related to FPGA placement (wirelength optimization, cell spreading, legalization,...
Definition: PlacementInfo.h:59
GeneralSpreader::spreadPlacementUnits
void spreadPlacementUnits(float forgetRatio, bool enableClockRegionAware=false, float displacementLimit=-10, unsigned int spreadRegionBinSizeLimit=1000000)
spread cells with a given forgetting ratio
Definition: GeneralSpreader.cc:52
GlobalPlacer::placementInfo
PlacementInfo * placementInfo
Definition: GlobalPlacer.h:216
DesignInfo::DesignCell::isDSP
bool isDSP()
Definition: DesignInfo.h:971