AMF-Placer  2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
ParallelCLBPacker.h
Go to the documentation of this file.
1 
26 #ifndef _PARALLELCLBPACKER_
27 #define _PARALLELCLBPACKER_
28 
29 #include "DesignInfo.h"
30 #include "DeviceInfo.h"
31 #include "KDTree/KDTree.h"
32 #include "MaximalCardinalityMatching/MaximalCardinalityMatching.h"
33 #include "PlacementInfo.h"
35 #include "WirelengthOptimizer.h"
36 #include "const.h"
37 #include "dumpZip.h"
38 #include "readZip.h"
39 #include "strPrint.h"
40 #include "stringCheck.h"
41 #include <assert.h>
42 #include <cmath>
43 #include <fstream>
44 #include <iostream>
45 #include <map>
46 #include <omp.h>
47 #include <queue>
48 #include <set>
49 #include <sstream>
50 #include <string>
51 #include <vector>
52 
53 // implemented based on the paper's Algorithm 1:
54 // W. Li and D. Z. Pan, "A New Paradigm for FPGA Placement Without Explicit Packing,"
55 // in IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 38, no. 11, pp. 2113-2126,
56 // Nov. 2019, doi: 10.1109/TCAD.2018.2877017.
57 
66 {
68  {
69  return lhs->getId() < rhs->getId();
70  }
71 };
72 
74 {
76  {
77  return lhs->getId() < rhs->getId();
78  }
79 };
80 
94 {
95  public:
116  std::map<std::string, std::string> &JSONCfg, int unchangedIterationThr, int numNeighbor,
117  float deltaD, float curD, float maxD, int PQSize, float HPWLWeight, std::string packerName,
119 
121  {
122  for (auto packingSite : packingSites)
123  delete packingSite;
124  }
125 
132  {
133  public:
135  {
136  FFs.clear();
137  };
138 
144  PackedControlSet(const PackedControlSet &anotherControlSet)
145  {
146  FFs.clear();
147  assert((anotherControlSet.getSize() > 0 || anotherControlSet.getCSId() < 0) &&
148  "the other one control set should not be empty.");
149  CSId = anotherControlSet.getCSId();
150  FFs = anotherControlSet.getFFs();
151  if (CSId >= 0)
152  {
153  CLK = anotherControlSet.getCLK();
154  SR = anotherControlSet.getSR();
155  CE = anotherControlSet.getCE();
156  FFType = anotherControlSet.getFFType();
157  }
158  else
159  {
160  CLK = nullptr;
161  SR = nullptr;
162  CE = nullptr;
163  }
164  };
165 
172  PackedControlSet &operator=(const PackedControlSet &anotherControlSet)
173  {
174  FFs.clear();
175  assert((anotherControlSet.getSize() > 0 || anotherControlSet.getCSId() < 0) &&
176  "the other one control set should not be empty.");
177  CSId = anotherControlSet.getCSId();
178  FFs = anotherControlSet.getFFs();
179  if (CSId >= 0)
180  {
181  CLK = anotherControlSet.getCLK();
182  SR = anotherControlSet.getSR();
183  CE = anotherControlSet.getCE();
184  FFType = anotherControlSet.getFFType();
185  }
186  else
187  {
188  CLK = nullptr;
189  SR = nullptr;
190  CE = nullptr;
191  }
192  return *this;
193  };
194 
196 
202  inline unsigned int getSize() const
203  {
204  return FFs.size();
205  }
206 
212  inline const std::vector<DesignInfo::DesignCell *> &getFFs() const
213  {
214  return FFs;
215  }
216 
221  inline void reset()
222  {
223  assert(FFs.size() == 0);
224  CSId = -1;
225  CLK = nullptr;
226  SR = nullptr;
227  CE = nullptr;
228  }
229 
235  inline void addFF(DesignInfo::DesignCell *curFF)
236  {
237  if (CSId < 0)
238  {
239  if (!curFF->isVirtualCell())
240  {
241  assert(curFF->getControlSetInfo());
242  CSId = curFF->getControlSetInfo()->getId();
243  CLK = curFF->getControlSetInfo()->getCLK();
244  SR = curFF->getControlSetInfo()->getSR();
245  CE = curFF->getControlSetInfo()->getCE();
246  FFType = curFF->getOriCellType();
247  }
248  }
249  else
250  {
251  if (!curFF->isVirtualCell())
252  {
253  assert(curFF->getControlSetInfo()->getId() == CSId);
254  }
255  }
256  FFs.push_back(curFF);
257  std::sort(FFs.begin(), FFs.end(), [](DesignInfo::DesignCell *a, DesignInfo::DesignCell *b) -> bool {
258  return a->getCellId() > b->getCellId();
259  });
260  }
261 
267  inline void removeXthFF(int i)
268  {
269  assert(i < (int)FFs.size());
270  assert(i >= 0);
271  FFs.erase(FFs.begin() + i);
272  updateCSID();
273  }
274 
275  inline void updateCSID()
276  {
277  bool allVirtual = true;
278  for (unsigned int i = 0; i < FFs.size(); i++)
279  {
280  if (!FFs[i]->isVirtualCell())
281  {
282  allVirtual = false;
283  break;
284  }
285  }
286 
287  if (allVirtual)
288  {
289  CSId = -1;
290  CLK = nullptr;
291  SR = nullptr;
292  CE = nullptr;
293  }
294  }
295 
302  inline int findFF(DesignInfo::DesignCell *curFF) const
303  {
304  for (unsigned int i = 0; i < FFs.size(); i++)
305  {
306  if (FFs[i] == curFF)
307  return i;
308  }
309  return -1;
310  }
311 
319  inline int getCSId() const
320  {
321  return CSId;
322  }
323 
331  inline void setCSId(int _CSId)
332  {
333  CSId = _CSId;
334  }
335 
337  {
338  assert(CSId >= 0);
339  return CLK;
340  }
341 
342  inline DesignInfo::DesignNet *getSR() const
343  {
344  assert(CSId >= 0);
345  return SR;
346  }
347 
348  inline DesignInfo::DesignNet *getCE() const
349  {
350  assert(CSId >= 0);
351  return CE;
352  }
353 
355  {
356  assert(CSId >= 0);
357  return FFType;
358  }
359 
367  inline bool compatibleWith(int inputCSId) const
368  {
369  if (CSId == -1 || inputCSId == -1)
370  return true;
371  return inputCSId == CSId;
372  }
373 
374  inline void setMustMainSlots()
375  {
376  mustMainSlots = true;
377  }
378 
379  inline bool isMustMainSlots()
380  {
381  return mustMainSlots;
382  }
383 
384  private:
385  int CSId = -1;
390  std::vector<DesignInfo::DesignCell *> FFs;
391  bool mustMainSlots = false;
392  };
393 
400  {
401  public:
421  int numNeighbor, float deltaD, float curD, float maxD, unsigned int PQSize, float y2xRatio,
422  float HPWLWeight, std::vector<PackingCLBSite *> &PUId2PackingCLBSite)
426  {
427  neighborPUs.clear();
428  seedClusters.clear();
429  seedClusters.clear();
430  priorityQueue.clear();
431  PU2TopCnt.clear();
432  // PU2HPWLChange.clear();
433  }
434 
436  {
438  {
440  }
441  for (auto tmpCluster : priorityQueue)
442  {
443  delete tmpCluster;
444  }
445  }
446 
453  {
454  public:
460  {
461  assert(false && "PackingCLBCluster should not initialize without parameters \"parentPackingCLB\". This "
462  "problem might be caused by resizing vector to a longer one");
463  }
465  {
467  id = random();
468  PUs.clear();
469  FFControlSets.clear();
470  FFControlSets.resize(4);
471  singleLUTs.clear();
472  pairedLUTs.clear();
473  // nets.clear();
474  }
476 
477  PackingCLBCluster(PackingCLBCluster *anotherPackingCLBCluster)
478  {
479  id = anotherPackingCLBCluster->getId();
480  FFControlSets = anotherPackingCLBCluster->getFFControlSets();
481  singleLUTs = anotherPackingCLBCluster->getSingleLUTs();
482  pairedLUTs = anotherPackingCLBCluster->getPairedLUTs();
483  PUs = anotherPackingCLBCluster->getPUs();
484  scoreInSite = anotherPackingCLBCluster->getScoreInSite();
485  parentPackingCLB = anotherPackingCLBCluster->getParentPackingCLB();
487  // net2ConnectivityScore = anotherPackingCLBCluster->getNet2ConnectivityScore();
488  HPWLChange = anotherPackingCLBCluster->getHPWLChange();
489  totalConnectivityScore = anotherPackingCLBCluster->getTotalConnectivityScore();
490  totalNetNum = anotherPackingCLBCluster->getTotalNetNum();
491  totalCellNum = anotherPackingCLBCluster->getTotalCellNum();
492  totalLen = anotherPackingCLBCluster->getTotalLen();
493  numMuxes = anotherPackingCLBCluster->getNumMuxes();
494  }
495 
501  inline int getId() const
502  {
503  return id;
504  }
505 
510  inline void refreshId()
511  {
512  id = random();
513  }
514 
523  {
524  if (LUTA->getInputPins().size() == 6 || LUTB->getInputPins().size() == 6 || LUTA->isLUT6() ||
525  LUTB->isLUT6())
526  return 12;
527 
528  int pinNumA = 0;
529  int totalPin = 0;
530  int netIds[5]; // be aware that a LUT might have pins connected to the same net and they should be
531  // treated as different inputs.
532 
533  for (auto tmpPin : LUTA->getInputPins())
534  {
535  if (!tmpPin->isUnconnected())
536  {
537  netIds[pinNumA] = tmpPin->getNet()->getElementIdInType();
538  pinNumA++;
539  }
540  }
541  totalPin = pinNumA;
542  for (auto tmpPin : LUTB->getInputPins())
543  {
544  if (!tmpPin->isUnconnected())
545  {
546  bool matched = false;
547  for (int i = 0; i < pinNumA; i++)
548  {
549  if (netIds[i] >= 0 && netIds[i] == tmpPin->getNet()->getElementIdInType())
550  {
551  netIds[i] = -1;
552  matched = true;
553  break;
554  }
555  }
556  if (!matched)
557  {
558  totalPin++;
559  }
560  }
561  }
562 
563  return totalPin;
564  }
565 
571  void maxCardinalityMatching(bool verbose = false);
572 
581 
593  bool compatibleInOneHalfCLB(DesignInfo::ControlSetInfo *CSPtr, int anotherHalfCLB);
594 
606  bool compatibleInOneHalfCLB(int halfCLB, int anotherHalfCLB);
614  bool addLUT(DesignInfo::DesignCell *curLUT);
615 
624  bool addToFFSet(DesignInfo::DesignCell *curFF, int halfCLB);
625 
634  bool addToFFSet(std::vector<DesignInfo::DesignCell *> curFFs, int halfCLB);
635 
648  bool addFF(DesignInfo::DesignCell *curFF, int enforceHalfCLB = -1, bool enforceMainFFSlot = false);
649 
663  bool addFFGroup(std::vector<DesignInfo::DesignCell *> curFFs, int enforceHalfCLB, bool enforceMainFFSlot,
664  bool isMuxMacro);
665 
667  {
668  if (!cell)
669  return false;
670  auto tmpPU = placementInfo->getPlacementUnitByCell(cell);
671  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
672  {
673  return (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX7 ||
674  tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX8);
675  }
676  return false;
677  }
678 
680  {
681  if (!cell)
682  return false;
683  auto tmpPU = placementInfo->getPlacementUnitByCell(cell);
684  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
685  {
686  return (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_CARRY);
687  }
688  return false;
689  }
690 
696  {
697  std::vector<bool> foundMuxFF(4, false);
698  for (unsigned int i = 0; i < getFFControlSets().size(); i++)
699  {
700  auto &CSFF = FFControlSets[i];
701  for (auto FF : CSFF.getFFs())
702  {
703  if (isMuxMacro(FF))
704  {
705  foundMuxFF[i] = true;
706  break;
707  }
708  }
709  }
710  for (unsigned int i = 0; i < FFControlSets.size(); i++)
711  {
712  auto &CSFF = FFControlSets[i];
713  if (foundMuxFF[i])
714  {
715  std::set<DesignInfo::DesignCell *> movedFFs;
716  movedFFs.clear();
717  for (auto FF : CSFF.getFFs())
718  {
719  if (!isMuxMacro(FF) && FF && FF->getControlSetInfo())
720  {
721  for (unsigned int k = 0; k < FFControlSets.size(); k++)
722  {
723  if (k == i || foundMuxFF[k])
724  continue;
725  int CSId = FF->getControlSetInfo()->getId();
726 
727  if (FFControlSets[k].getFFs().size() < 4 && FFControlSets[k].compatibleWith(CSId))
728  {
729  int anotherSetId = k - 1 + ((k % 2 == 0) ? 2 : 0);
730  if (compatibleInOneHalfCLB(i, anotherSetId))
731  {
732  assert(addFF(FF, k));
733  movedFFs.insert(FF);
734  break;
735  }
736  }
737  }
738  }
739  }
740  assert(movedFFs.size() < 4);
741 
742  for (auto movedFF : movedFFs)
743  {
744  int movedId = CSFF.findFF(movedFF);
745  assert(movedId >= 0);
746  CSFF.removeXthFF(movedId);
747  if (CSFF.getSize() == 0)
748  {
749  CSFF.reset();
750  }
751  }
752  }
753  }
754  }
755 
756  void moveFFFromCS1ToCS0(DesignInfo::DesignCell *targetFF, int CSGroupId1, int CSGroupId0)
757  {
758  int FFId = FFControlSets[CSGroupId1].findFF(targetFF);
759  assert(FFId >= 0);
760  FFControlSets[CSGroupId1].removeXthFF(FFId);
761  if (FFControlSets[CSGroupId1].getSize() == 0)
762  {
763  FFControlSets[CSGroupId1].reset();
764  }
765  FFControlSets[CSGroupId0].addFF(targetFF);
766  }
767 
772  bool evictFFsFromCarryHalfCLB(unsigned int FFSetId)
773  {
774  std::vector<bool> foundCarryFF(4, false);
775  for (unsigned int i = 0; i < getFFControlSets().size(); i++)
776  {
777  auto &CSFF = FFControlSets[i];
778  for (auto FF : CSFF.getFFs())
779  {
780  if (isCarryMacro(FF))
781  {
782  foundCarryFF[i] = true;
783  break;
784  }
785  }
786  }
787 
788  auto &CSFF = FFControlSets[FFSetId];
789  std::set<DesignInfo::DesignCell *> movedFFs;
790  movedFFs.clear();
791  if (foundCarryFF[FFSetId])
792  {
794  for (auto FF : CSFF.getFFs())
795  {
796  if (!isCarryMacro(FF) && FF && FF->getControlSetInfo())
797  {
798  for (unsigned int k = 0; k < FFControlSets.size(); k++)
799  {
800  if (k == FFSetId || foundCarryFF[k])
801  continue;
802  int CSId = FF->getControlSetInfo()->getId();
803 
804  if (FFControlSets[k].getFFs().size() < 4 && FFControlSets[k].compatibleWith(CSId))
805  {
806  int anotherSetId = k - 1 + ((k % 2 == 0) ? 2 : 0);
807  if (compatibleInOneHalfCLB(FFSetId, anotherSetId))
808  {
809  assert(addFF(FF, k));
810  movedFFs.insert(FF);
811  break;
812  }
813  }
814  }
815  }
816  }
817  assert(movedFFs.size() < 4);
818 
819  for (auto movedFF : movedFFs)
820  {
821  int movedId = CSFF.findFF(movedFF);
822  assert(movedId >= 0);
823  CSFF.removeXthFF(movedId);
824  if (CSFF.getSize() == 0)
825  {
826  CSFF.reset();
827  }
828  }
829  }
830  return movedFFs.size() > 0;
831  }
832 
839  {
840  if (singleLUTs.find(curLUT) != singleLUTs.end())
841  {
842  singleLUTs.erase(curLUT);
843  return;
844  }
845  for (auto LUTPair : pairedLUTs)
846  {
847  if (LUTPair.first == curLUT)
848  {
849  singleLUTs.insert(LUTPair.second);
850  pairedLUTs.erase(LUTPair);
851  return;
852  }
853  else if (LUTPair.second == curLUT)
854  {
855  singleLUTs.insert(LUTPair.first);
856  pairedLUTs.erase(LUTPair);
857  return;
858  }
859  }
860  assert(false && "should be erased successfully");
861  }
862 
869  {
870  unsigned int i = -1;
871  for (i = 0; i < FFControlSets.size(); i++)
872  {
873  int findFFLoc = FFControlSets[i].findFF(curFF);
874  if (findFFLoc >= 0)
875  {
876  FFControlSets[i].removeXthFF(findFFLoc);
877  if (FFControlSets[i].getSize() == 0)
878  {
879  FFControlSets[i].reset();
880  }
881  return;
882  }
883  }
884  assert(false && "should not reach here");
885  }
886 
894  {
895  assert(PUs.find(tmpPU) != PUs.end());
896  std::vector<DesignInfo::DesignCell *> cellsToRemove(0);
897  if (auto unpackCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(tmpPU))
898  {
899  cellsToRemove.push_back(unpackCell->getCell());
900  }
901  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
902  {
903  for (auto tmpCell : curMacro->getCells())
904  cellsToRemove.push_back(tmpCell);
905  }
906  // assert(checkCellCorrectness(tmpPU, false));
907  for (auto curCell : cellsToRemove)
908  {
909  if (curCell->isLUT())
910  {
911  removeLUT(curCell);
912  }
913  else if (curCell->isFF())
914  {
915  removeFF(curCell);
916  }
917  else
918  {
919  assert(curCell->isMux());
920  // assert(false && "unexpected type.");
921  }
922  }
923  PUs.erase(tmpPU);
924  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
925  {
926  if (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX7 ||
927  tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX8)
928  {
929  numMuxes--;
930  }
931  }
932  // assert(checkCellCorrectness(tmpPU, false));
933  hashed = false;
934  }
935 
944  {
945  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
946  {
947  if (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_LCLB)
948  {
949  if (parentPackingCLB->getCLBSite()->getSiteType() == "SLICEM")
950  return false;
951  }
952  }
953  return true;
954  }
955 
969  bool addPU(PlacementInfo::PlacementUnit *tmpPU, bool allowOverlap = false);
970 
980  {
981  PackingCLBCluster *fakeCluster = new PackingCLBCluster(this);
982  if (fakeCluster->addPU(tmpPU, false))
983  {
984  FFControlSets = fakeCluster->getFFControlSets();
985  singleLUTs = fakeCluster->getSingleLUTs();
986  pairedLUTs = fakeCluster->getPairedLUTs();
987  PUs.insert(tmpPU);
988  delete fakeCluster;
989  return true;
990  }
991  else
992  {
993  delete fakeCluster;
994  return false;
995  }
996  }
997 
999  {
1000  PackingCLBCluster *fakeCluster = new PackingCLBCluster(this);
1001  if (fakeCluster->addPU(tmpPU, false))
1002  {
1003  delete fakeCluster;
1004  return true;
1005  }
1006  else
1007  {
1008  delete fakeCluster;
1009  return false;
1010  }
1011  }
1012 
1019 
1028  {
1029  return PUs.find(tmpPU) != PUs.end();
1030  }
1031 
1032  inline const std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> &getPUs() const
1033  {
1034  return PUs;
1035  }
1036 
1037  inline std::set<DesignInfo::DesignCell *> getCellSet()
1038  {
1039  std::set<DesignInfo::DesignCell *> res;
1040  res.clear();
1041 
1042  for (auto cs : FFControlSets)
1043  {
1044  for (auto FF : cs.getFFs())
1045  {
1046  if (FF)
1047  {
1048  res.insert(FF);
1049  }
1050  }
1051  }
1052  for (auto LUT : singleLUTs)
1053  {
1054  if (LUT)
1055  {
1056  res.insert(LUT);
1057  }
1058  }
1059 
1060  for (auto LUTPair : pairedLUTs)
1061  {
1062  if (LUTPair.first)
1063  {
1064  res.insert(LUTPair.first);
1065  }
1066  if (LUTPair.second)
1067  {
1068  res.insert(LUTPair.second);
1069  }
1070  }
1071 
1073  {
1074  res.insert(parentPackingCLB->getCarryCell());
1075  }
1076 
1077  for (auto PU : PUs)
1078  {
1079  // if (PU->checkHasMUX())
1080  // {
1081  // if (auto muxMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(PU))
1082  // {
1083  // for (auto cell : muxMacro->getCells())
1084  // {
1085  // res.insert(cell);
1086  // }
1087  // }
1088  // }
1089  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(PU))
1090  {
1091  if (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX7)
1092  {
1093  for (auto cell : tmpMacro->getCells())
1094  {
1095  res.insert(cell);
1096  }
1097  }
1098  else if (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX8)
1099  {
1100  for (auto cell : tmpMacro->getCells())
1101  {
1102  res.insert(cell);
1103  }
1104  }
1105  }
1106  }
1107 
1109  {
1110  for (auto cell : parentPackingCLB->getLUTRAMMacro()->getCells())
1111  {
1112  res.insert(cell);
1113  }
1114  }
1115 
1116  if (parentPackingCLB->getFixedPairedLUTs().size())
1117  {
1118 
1119  for (auto LUTPair : parentPackingCLB->getFixedPairedLUTs())
1120  {
1121  if (LUTPair.first)
1122  {
1123  res.insert(LUTPair.first);
1124  }
1125  if (LUTPair.second)
1126  {
1127  res.insert(LUTPair.second);
1128  }
1129  }
1130  }
1131 
1132  return res;
1133  }
1134 
1135  inline const std::vector<PackedControlSet> &getFFControlSets() const
1136  {
1137  return FFControlSets;
1138  }
1139 
1145  inline const std::set<DesignInfo::DesignCell *> &getSingleLUTs() const
1146  {
1147  return singleLUTs;
1148  }
1149 
1155  inline std::vector<DesignInfo::DesignCell *> getSortedSingleLUTs()
1156  {
1157  std::vector<DesignInfo::DesignCell *> LUTs;
1158  LUTs.clear();
1159  for (auto tmpLUT : singleLUTs)
1160  LUTs.push_back(tmpLUT);
1161  std::sort(LUTs.begin(), LUTs.end(), [](DesignInfo::DesignCell *a, DesignInfo::DesignCell *b) -> bool {
1162  return a->getCellId() > b->getCellId();
1163  });
1164  return LUTs;
1165  }
1166 
1173  {
1174  assert(singleLUTs.find(tmpLUT) != singleLUTs.end());
1175  singleLUTs.erase(tmpLUT);
1176  }
1177 
1186  {
1187  if (singleLUTs.find(tmpLUT) != singleLUTs.end())
1188  {
1189  singleLUTs.erase(tmpLUT);
1190  return true;
1191  }
1192  else
1193  {
1194  return false;
1195  }
1196  }
1197 
1206  {
1207  for (auto pair : pairedLUTs)
1208  {
1209  if (tmpLUT == pair.first)
1210  {
1211  singleLUTs.insert(pair.second);
1212  pairedLUTs.erase(pair);
1213  return true;
1214  }
1215  if (tmpLUT == pair.second)
1216  {
1217  singleLUTs.insert(pair.first);
1218  pairedLUTs.erase(pair);
1219  return true;
1220  }
1221  }
1222  return false;
1223  }
1224 
1234  {
1235  for (auto pair : pairedLUTs)
1236  {
1237  if (tmpLUTA == pair.first)
1238  {
1239  assert(pair.second == tmpLUTB);
1240  pairedLUTs.erase(pair);
1241  return true;
1242  }
1243  if (tmpLUTA == pair.second)
1244  {
1245  assert(pair.first == tmpLUTB);
1246  pairedLUTs.erase(pair);
1247  return true;
1248  }
1249  }
1250  return false;
1251  }
1252 
1258  inline const std::set<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> &getPairedLUTs() const
1259  {
1260  return pairedLUTs;
1261  }
1262 
1268  inline std::vector<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> getSortedPairedLUTs()
1269  {
1270  std::vector<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> pairedLUTs_new;
1271  pairedLUTs_new.clear();
1272  for (auto tmpLUTs : pairedLUTs)
1273  pairedLUTs_new.push_back(tmpLUTs);
1274 
1275  std::sort(pairedLUTs_new.begin(), pairedLUTs_new.end(),
1276  [](std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *> &a,
1277  std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *> &b) -> bool {
1278  return a.first->getCellId() > b.first->getCellId();
1279  });
1280 
1281  return pairedLUTs_new;
1282  }
1283 
1293  inline bool areAllPUsValidForThisSite(const std::vector<PackingCLBSite *> &PUId2PackingCLBSite,
1294  PackingCLBSite *parentPackingCLBSite)
1295  {
1296  for (auto tmpPU : PUs)
1297  {
1298  if (PUId2PackingCLBSite[tmpPU->getId()])
1299  {
1300  if (PUId2PackingCLBSite[tmpPU->getId()] != parentPackingCLBSite)
1301  {
1302  return false;
1303  }
1305  {
1306  return false;
1307  }
1308  }
1309  }
1310  return true;
1311  }
1312 
1318  inline float getScoreInSite() const
1319  {
1320  return scoreInSite;
1321  }
1322 
1327  void updateScoreInSite();
1328 
1336 
1343  {
1344  return parentPackingCLB;
1345  }
1346 
1352  {
1353  hashId = PUs.size();
1355  {
1356  hashId += HiFPlacer_hashprimes[(unsigned char)(~(parentPackingCLB->getCarrySiteOffset()) & 0xff)];
1357  hashId %= 10001777;
1358  hashId +=
1359  HiFPlacer_hashprimes[(unsigned char)(~(parentPackingCLB->getCarryMacro()->getId()) & 0xff)];
1360  hashId %= 10001777;
1361  }
1363  {
1364  hashId +=
1365  HiFPlacer_hashprimes[(unsigned char)(~(parentPackingCLB->getLUTRAMMacro()->getId()) & 0xff)];
1366  hashId %= 10001777;
1367  }
1368  for (auto tmpPU : PUs)
1369  {
1370  if (auto unpackCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(tmpPU))
1371  {
1372  hashId += HiFPlacer_hashprimes[(unsigned char)(~(unpackCell->getCell()->getCellId()) & 0xff)] *
1373  unpackCell->getCell()->getCellId();
1374  hashId %= 10001777;
1375  }
1376  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
1377  {
1378  for (auto tmpCell : curMacro->getCells())
1379  {
1380  hashId += HiFPlacer_hashprimes[(unsigned char)(~(tmpCell->getCellId()) & 0xff)] *
1381  tmpCell->getCellId();
1382  hashId %= 10001777;
1383  }
1384  }
1385  }
1386  hashed = true;
1387  }
1388 
1397  {
1398 
1399  int clusterHashId = getHash();
1400 
1401  if (auto unpackCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(tmpPU))
1402  {
1403  clusterHashId +=
1404  HiFPlacer_hashprimes[(unsigned char)(~(unpackCell->getCell()->getCellId()) & 0xff)] *
1405  unpackCell->getCell()->getCellId();
1406  clusterHashId %= 10001777;
1407  }
1408  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
1409  {
1410  for (auto tmpCell : curMacro->getCells())
1411  {
1412  clusterHashId += HiFPlacer_hashprimes[(unsigned char)(~(tmpCell->getCellId()) & 0xff)] *
1413  tmpCell->getCellId();
1414  clusterHashId %= 10001777;
1415  }
1416  }
1417 
1418  return clusterHashId;
1419  }
1420 
1426  inline int getHash()
1427  {
1428  if (!hashed)
1429  clusterHash();
1430  return hashId;
1431  }
1432 
1438  inline int getHashConst() const
1439  {
1440  int hashId = 0;
1441  std::vector<DesignInfo::DesignCell *> cellsToCheck(0);
1442  for (auto tmpPU : PUs)
1443  {
1444  if (auto unpackCell = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(tmpPU))
1445  {
1446  hashId += 28901 * unpackCell->getCell()->getCellId();
1447  hashId %= 10001777;
1448  }
1449  else if (auto curMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
1450  {
1451  for (auto tmpCell : curMacro->getCells())
1452  {
1453  hashId += 28901 * tmpCell->getCellId();
1454  hashId %= 10001777;
1455  }
1456  }
1457  }
1458  return hashId;
1459  }
1460 
1468  {
1469  return parentPackingCLB->getHPWLChangeForPU(tmpPU);
1470  }
1471 
1477  inline float getTotalConnectivityScore() const
1478  {
1479  return totalConnectivityScore;
1480  }
1481 
1487  inline float getHPWLChange() const
1488  {
1489  return HPWLChange;
1490  }
1491 
1497  inline int getTotalNetNum() const
1498  {
1499  return totalNetNum;
1500  }
1501 
1507  inline int getTotalCellNum() const
1508  {
1509  return totalCellNum;
1510  }
1511 
1517  inline int getNumMuxes() const
1518  {
1519  return numMuxes;
1520  }
1521 
1527  inline int getTotalLen() const
1528  {
1529  return totalLen;
1530  }
1531 
1538  inline float getTotalCellWeight() const
1539  {
1540  float totalCellWeight = 0;
1541  for (auto curCell : singleLUTs)
1542  {
1543  totalCellWeight +=
1545  }
1546  for (auto pair : pairedLUTs)
1547  {
1548  totalCellWeight +=
1549  parentPackingCLB->getPlacementInfo()->getActualOccupationByCellId(pair.first->getCellId());
1550  totalCellWeight +=
1551  parentPackingCLB->getPlacementInfo()->getActualOccupationByCellId(pair.second->getCellId());
1552  }
1553  for (auto &CS : FFControlSets)
1554  {
1555  for (auto curCell : CS.getFFs())
1556  {
1557  totalCellWeight +=
1559  }
1560  }
1561  return totalCellWeight;
1562  }
1563 
1571  inline bool containFF(DesignInfo::DesignCell *curFF)
1572  {
1573  for (unsigned int i = 0; i < FFControlSets.size(); i++)
1574  {
1575  if (FFControlSets[i].findFF(curFF) >= 0)
1576  return true;
1577  }
1578  return false;
1579  }
1580 
1585  void printMyself();
1586 
1595  bool checkCellCorrectness(PlacementInfo::PlacementUnit *tmpPU, bool isAddPU);
1596 
1608  bool checkNumMuxCompatibleInFFSet(int i, int addNum);
1609 
1620  {
1621 
1622  auto &timingNodes =
1624  if (auto unpacked = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1625  {
1626  if (unpacked->getCell()->isVirtualCell())
1627  return 0;
1628  return timingNodes[unpacked->getCell()->getCellId()]->getLongestPathLength();
1629  }
1630  else if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1631  {
1632  int maxLen = 0;
1633  for (auto tmpCell : tmpMacro->getCells())
1634  {
1635  if (tmpCell->isVirtualCell())
1636  continue;
1637  int len = timingNodes[tmpCell->getCellId()]->getLongestPathLength();
1638  if (len > maxLen)
1639  maxLen = len;
1640  }
1641  return maxLen;
1642  }
1643  return 0;
1644  }
1645 
1656  {
1657 
1658  auto &timingNodes =
1660  if (auto unpacked = dynamic_cast<PlacementInfo::PlacementUnpackedCell *>(curPU))
1661  {
1662  if (unpacked->getCell()->isVirtualCell() ||
1663  timingNodes[unpacked->getCell()->getCellId()]->checkIsRegister())
1664  return 0;
1665  return (timingNodes[unpacked->getCell()->getCellId()]->getLatestInputArrival() -
1666  timingNodes[unpacked->getCell()->getCellId()]->getRequiredArrivalTime());
1667  }
1668  else if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(curPU))
1669  {
1670  float maxNegativeSlack = 0;
1671  for (auto tmpCell : tmpMacro->getCells())
1672  {
1673  if (tmpCell->isVirtualCell())
1674  continue;
1675 
1676  if (timingNodes[tmpCell->getCellId()]->checkIsRegister())
1677  continue;
1678  float negativeSlack = (timingNodes[tmpCell->getCellId()]->getLatestInputArrival() -
1679  timingNodes[tmpCell->getCellId()]->getRequiredArrivalTime());
1680  if (negativeSlack > maxNegativeSlack)
1681  maxNegativeSlack = negativeSlack;
1682  }
1683  return maxNegativeSlack;
1684  }
1685  return 0;
1686  }
1687 
1689  {
1691  }
1692 
1693  private:
1694  const unsigned int MaxNum_ControlSet = 4;
1695  const unsigned int MaxNum_FFinControlSet = 4;
1696  const unsigned int MaxNum_LUTSite = 8;
1697  int numMuxes = 0;
1698 
1704 
1710 
1715  float scoreInSite = -100000000;
1716 
1724  int hashId = -3654;
1725  bool hashed = false;
1726 
1731  int id = -1;
1732  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> PUs;
1733 
1742 
1749  float HPWLChange = 0;
1750 
1758  int totalNetNum = 0;
1759  int totalCellNum = 0;
1760 
1767  int totalLen = 0;
1768 
1773  float HPWLWeight = 0.01;
1774 
1775  // int muxF7Limit = 2;
1776  // int muxF8Limit = 1;
1777  // std::map<PlacementInfo::PlacementNet *, float> net2ConnectivityScore;
1778  // std::set<PlacementInfo::PlacementNet *> nets;
1779 
1786  std::vector<PackedControlSet> FFControlSets;
1787  std::vector<PackedControlSet> FFControlSets_backup;
1788 
1793  std::set<DesignInfo::DesignCell *> singleLUTs;
1794 
1799  std::set<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> pairedLUTs;
1800  };
1801 
1812  {
1813  auto qTop = priorityQueue[0];
1814  for (auto tmpPU : qTop->getPUs())
1815  {
1816  if (PUId2PackingCLBSite[tmpPU->getId()] != this)
1817  {
1818  return false;
1819  }
1820  }
1821  return true;
1822  }
1823 
1841  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> *
1842  findNeiborPUsFromBinGrid(DesignInfo::DesignCellType curCellType, float targetX, float targetY,
1843  float displacementLowerbound, float displacementUpperbound, int PUNumThreshold,
1844  const std::vector<PackingCLBSite *> &PUId2PackingCLBSite, float y2xRatio,
1845  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> *res = nullptr,
1846  bool clockRegionAware = true);
1847 
1848  inline std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> &getNeighborPUs()
1849  {
1850  return neighborPUs;
1851  }
1852 
1857  void refreshPrioryQueue();
1858 
1867 
1876 
1884 
1890 
1897  void updateStep(bool initial, bool debug = false);
1898 
1905  void updateConsistentPUsInTop();
1906 
1907  inline bool hasValidPQTop()
1908  {
1909  return priorityQueue.size();
1910  }
1911 
1913  {
1914  assert(priorityQueue.size());
1915  return priorityQueue[0];
1916  }
1917 
1919  {
1920  return CLBSite;
1921  }
1922 
1923  inline float getY2xRatio() const
1924  {
1925  return y2xRatio;
1926  }
1927 
1928  inline float getDetScore()
1929  {
1930  return detScore;
1931  }
1932 
1934  {
1935  return determinedClusterInSite;
1936  }
1937 
1939  {
1940  determinedClusterInSite = tmpCluster;
1941  }
1942 
1944  {
1945  return std::fabs(tmpPU->X() - getCLBSite()->X()) + y2xRatio * std::fabs(tmpPU->Y() - getCLBSite()->Y());
1946  float changeHPWL = 0;
1947  for (auto tmpNet : *tmpPU->getNetsSetPtr())
1948  {
1949  if (tmpNet->getUnits().size() > 64) // ignore large net
1950  continue;
1951  float newHPWL = tmpNet->getNewHPWLByTrying(tmpPU, CLBSite->X(), CLBSite->Y(), y2xRatio);
1952  float oriHPWL = tmpNet->getHPWL(y2xRatio);
1953  if (std::isnan(newHPWL) || std::isnan(oriHPWL))
1954  {
1955 #pragma omp critical
1956  {
1957  // TODO: Why there is such BUG???
1958  int o = 0;
1959  std::cout << "curPU === \n" << tmpPU << "\n";
1960  std::cout << "CLBSite->X()=" << CLBSite->X() << " CLBSite->Y()=" << CLBSite->Y()
1961  << " y2xRatio=" << y2xRatio << "\n";
1962  for (auto tmpPU0 : tmpNet->getUnits())
1963  {
1964  auto tmpPinOffset = tmpNet->getPinOffsetsInUnit()[o];
1965  std::cout << "PUXoffset=" << tmpPinOffset.x << " PUYoffset=" << tmpPinOffset.y << "\n";
1966  std::cout << "PU=" << tmpPU0 << "\n";
1967  o++;
1968  }
1969  float newHPWL1 = tmpNet->getNewHPWLByTrying(tmpPU, CLBSite->X(), CLBSite->Y(), y2xRatio);
1970  float oriHPWL1 = tmpNet->getHPWL(y2xRatio);
1971  std::cout << "newHPWL1=" << newHPWL1 << " oriHPWL1=" << oriHPWL1 << "\n";
1972  assert(false);
1973  }
1974  }
1975  changeHPWL += newHPWL - oriHPWL;
1976  }
1977  return changeHPWL;
1978  }
1979 
1980  inline void setDebug()
1981  {
1982  debug = true;
1983  }
1984 
1986  {
1987  return placementInfo;
1988  }
1989 
1994  inline void addCarry()
1995  {
1996  assert(determinedClusterInSite == nullptr);
1997  assert(CARRYChain);
1999  for (auto prefixedSingleLUT : conflictLUTs)
2000  {
2001  assert(fixedLUTsInPairs.find(prefixedSingleLUT) == fixedLUTsInPairs.end());
2002  // these are fixed LUT Pairs, should not be added
2003  assert(determinedClusterInSite->addLUT(prefixedSingleLUT));
2004  }
2005  for (int i = 0; i < 2; i++)
2006  {
2007  for (int j = 0; j < 2; j++)
2008  {
2009  for (int k = 0; k < 4; k++)
2010  {
2011  if (slotMapping.FFs[i][j][k])
2012  {
2013  // if (!slotMapping.FFs[i][j][k]->isVirtualCell())
2014  bool succ = determinedClusterInSite->addFF(slotMapping.FFs[i][j][k], i * 2 + j);
2015  if (!succ)
2016  {
2017  determinedClusterInSite->addFF(slotMapping.FFs[i][j][k], i * 2 + j);
2018  std::cout << CARRYChain << " \n =====================================\n targetFF:"
2019  << slotMapping.FFs[i][j][k] << "\n";
2020  std::cout << "slotMapping.FFs[i][j][k].CS=\n";
2021  if (!slotMapping.FFs[i][j][k]->isVirtualCell())
2022  {
2023  slotMapping.FFs[i][j][k]->getControlSetInfo()->display();
2024  }
2025  std::cout << "offset: " << CARRYChainSiteOffset << "\n";
2026  std::cout << "currentCluster:\n";
2028  std::cout << "FF-FFSet:\n";
2029  std::cout << DesignInfo::FFSRCompatible(
2030  slotMapping.FFs[i][j][k]->getOriCellType(),
2031  determinedClusterInSite->getFFControlSets()[0].getFFType());
2032  std::cout << "FF-FF:\n";
2033  std::cout << DesignInfo::FFSRCompatible(
2034  slotMapping.FFs[i][j][k]->getOriCellType(),
2035  determinedClusterInSite->getFFControlSets()[0].getFFs()[0]->getCellType());
2036  std::cout << "i,j,k: " << i << ", " << j << ", " << k << "\n";
2037  std::cout.flush();
2038  }
2039  assert(succ);
2040  }
2041  }
2042  }
2043  }
2046  }
2047 
2052  inline void addLUTRAMMacro()
2053  {
2054  assert(determinedClusterInSite == nullptr);
2055  assert(LUTRAMMacro);
2059  }
2060 
2061  inline void setNonCLBCell(DesignInfo::DesignCell *_NonCLBCell)
2062  {
2063  assert(determinedClusterInSite == nullptr);
2064  assert(_NonCLBCell);
2065  isNonCLBSite = true;
2066  nonCLBCell = _NonCLBCell;
2067  }
2068 
2069  inline bool checkIsPrePackedSite()
2070  {
2071  return isCarrySite || isLUTRAMSite;
2072  }
2073 
2074  inline bool checkIsCarrySite()
2075  {
2076  return isCarrySite;
2077  }
2078 
2079  inline bool checkIsNonCLBSite()
2080  {
2081  return isNonCLBSite;
2082  }
2083 
2084  inline bool checkIsMuxSite()
2085  {
2087  {
2088  return determinedClusterInSite->getNumMuxes() > 0;
2089  }
2090  return false;
2091  }
2092 
2093  inline bool checkIsLUTRAMSite()
2094  {
2095  return isLUTRAMSite;
2096  }
2097 
2099  {
2100  return CARRYChain;
2101  }
2102 
2104  {
2105  return carryCell;
2106  }
2107 
2109  {
2110  return LUTRAMMacro;
2111  }
2112 
2114  {
2115  return nonCLBCell;
2116  }
2117 
2118  inline int getCarrySiteOffset()
2119  {
2120  return CARRYChainSiteOffset;
2121  }
2122 
2131  {
2132  assert(LUTA);
2133  assert(LUTB);
2134 
2135  if (LUTA->getInputPins().size() == 6 || LUTB->getInputPins().size() == 6 || LUTA->isLUT6() ||
2136  LUTB->isLUT6())
2137  return 12;
2138 
2139  int pinNumA = 0;
2140  int totalPin = 0;
2141  int netIds[5]; // be aware that a LUT might have pins connected to the same net and they should be
2142  // treated as different inputs.
2143 
2144  for (auto tmpPin : LUTA->getInputPins())
2145  {
2146  if (!tmpPin->isUnconnected())
2147  {
2148  netIds[pinNumA] = tmpPin->getNet()->getElementIdInType();
2149  pinNumA++;
2150  }
2151  }
2152  totalPin = pinNumA;
2153  for (auto tmpPin : LUTB->getInputPins())
2154  {
2155  if (!tmpPin->isUnconnected())
2156  {
2157  bool matched = false;
2158  for (int i = 0; i < pinNumA; i++)
2159  {
2160  if (netIds[i] >= 0 && netIds[i] == tmpPin->getNet()->getElementIdInType())
2161  {
2162  netIds[i] = -1;
2163  matched = true;
2164  break;
2165  }
2166  }
2167  if (!matched)
2168  {
2169  totalPin++;
2170  }
2171  }
2172  }
2173 
2174  return totalPin;
2175  }
2176 
2184  {
2185  public:
2187  {
2188  Carry = nullptr;
2189  for (int i = 0; i < 2; i++)
2190  {
2191  MuxF8[i] = nullptr;
2192  for (int j = 0; j < 2; j++)
2193  {
2194  MuxF7[i][j] = nullptr;
2195  for (int k = 0; k < 4; k++)
2196  {
2197  LUTs[i][j][k] = nullptr;
2198  FFs[i][j][k] = nullptr;
2199  }
2200  }
2201  }
2202  }
2203  SiteBELMapping &operator=(const SiteBELMapping &anotherMapping)
2204  {
2205  Carry = anotherMapping.Carry;
2206  for (int i = 0; i < 2; i++)
2207  {
2208  MuxF8[i] = anotherMapping.MuxF8[i];
2209  for (int j = 0; j < 2; j++)
2210  {
2211  MuxF7[i][j] = anotherMapping.MuxF7[i][j];
2212  for (int k = 0; k < 4; k++)
2213  {
2214  LUTs[i][j][k] = anotherMapping.LUTs[i][j][k];
2215  FFs[i][j][k] = anotherMapping.FFs[i][j][k];
2216  }
2217  }
2218  }
2219  return (*this);
2220  }
2221 
2223  DesignInfo::DesignCell *targetFF) const
2224  {
2225  for (int i = 0; i < 2; i++)
2226  {
2227  for (int j = 0; j < 2; j++)
2228  {
2229  bool compatible = true;
2230  if (targetLUT->isLUT6() && j == 1)
2231  continue;
2232  for (int k = 0; k < 4; k++)
2233  {
2234  if (FFs[i][j][k])
2235  {
2236  if (FFs[i][j][k]->getControlSetInfo())
2237  {
2238  if (FFs[i][j][k]->getControlSetInfo()->getId() !=
2239  targetFF->getControlSetInfo()->getId())
2240  {
2241  compatible = false;
2242  }
2243  }
2244  }
2245  }
2246  for (int k = 0; k < 4; k++)
2247  {
2248  if (FFs[i][1 - j][k])
2249  {
2250  if (FFs[i][1 - j][k]->getControlSetInfo())
2251  {
2252  if (FFs[i][1 - j][k]->getControlSetInfo()->getCLK() !=
2253  targetFF->getControlSetInfo()->getCLK() ||
2254  FFs[i][1 - j][k]->getControlSetInfo()->getSR() !=
2255  targetFF->getControlSetInfo()->getSR())
2256  {
2257  compatible = false;
2258  }
2259  }
2260  }
2261  }
2262  if (compatible)
2263  {
2264  for (int k = 0; k < 4; k++)
2265  {
2266  if (!LUTs[i][j][k] && !FFs[i][j][k])
2267  {
2268  if (targetLUT->isLUT6() && LUTs[i][1 - j][k])
2269  continue;
2270  return true;
2271  }
2272  }
2273  }
2274  }
2275  }
2276  return false;
2277  }
2278 
2280  {
2281  for (int i = 0; i < 2; i++)
2282  {
2283  for (int j = 0; j < 2; j++)
2284  {
2285  bool compatible = true;
2286  if (targetLUT->isLUT6() && j == 1)
2287  continue;
2288  for (int k = 0; k < 4; k++)
2289  {
2290  if (FFs[i][j][k])
2291  {
2292  if (FFs[i][j][k]->getControlSetInfo())
2293  {
2294  if (FFs[i][j][k]->getControlSetInfo()->getId() !=
2295  targetFF->getControlSetInfo()->getId())
2296  {
2297  compatible = false;
2298  }
2299  }
2300  }
2301  }
2302  for (int k = 0; k < 4; k++)
2303  {
2304  if (FFs[i][1 - j][k])
2305  {
2306  if (FFs[i][1 - j][k]->getControlSetInfo())
2307  {
2308  if (FFs[i][1 - j][k]->getControlSetInfo()->getCLK() !=
2309  targetFF->getControlSetInfo()->getCLK() ||
2310  FFs[i][1 - j][k]->getControlSetInfo()->getSR() !=
2311  targetFF->getControlSetInfo()->getSR())
2312  {
2313  compatible = false;
2314  }
2315  }
2316  }
2317  }
2318  if (compatible)
2319  {
2320  for (int k = 0; k < 4; k++)
2321  {
2322  if (!LUTs[i][j][k] && !FFs[i][j][k])
2323  {
2324  if (targetLUT->isLUT6() && LUTs[i][1 - j][k])
2325  continue;
2326  LUTs[i][j][k] = targetLUT;
2327  FFs[i][j][k] = targetFF;
2328  return;
2329  }
2330  }
2331  }
2332  }
2333  }
2334  assert(false && "the LUT-FF pair should be assigned to a slot");
2335  return;
2336  }
2337 
2339  {
2340  for (int i = 0; i < 2; i++)
2341  {
2342  for (int j = 0; j < 2; j++)
2343  {
2344  for (int k = 0; k < 4; k++)
2345  {
2346  if (LUTs[i][j][k] == targetLUT)
2347  {
2348  LUTs[i][j][k] = nullptr;
2349  }
2350  if (FFs[i][j][k] == targetFF)
2351  {
2352  FFs[i][j][k] = nullptr;
2353  }
2354  }
2355  }
2356  }
2357  return;
2358  }
2359 
2361  {
2362  }
2363 
2365  {{nullptr, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr}},
2366  {{nullptr, nullptr, nullptr, nullptr},
2367  {nullptr, nullptr, nullptr, nullptr}}}; // [bottom_Or_Top][6 or 5][which Slot]
2369  {{nullptr, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr}},
2370  {{nullptr, nullptr, nullptr, nullptr},
2371  {nullptr, nullptr, nullptr, nullptr}}}; // [bottom_Or_Top][FF or FF2][which Slot]
2372  DesignInfo::DesignCell *MuxF7[2][2] = {{nullptr, nullptr},
2373  {nullptr, nullptr}}; // [bottom_Or_Top][which Slot]
2374  DesignInfo::DesignCell *MuxF8[2] = {nullptr, nullptr};
2376 
2377  const std::string MuxF8SlotNames[2] = {"F8MUX_BOT", "F8MUX_TOP"};
2378  const std::string MuxF7SlotNames[2][2] = {{"F7MUX_AB", "F7MUX_CD"}, {"F7MUX_EF", "F7MUX_GH"}};
2379  };
2380 
2381  void mapCarryRelatedCellsToSlots(PlacementInfo::PlacementMacro *_CARRYChain, float siteOffset);
2383 
2390  void finalMapToSlotsForCarrySite(int FFControlSetOrderId);
2391 
2397 
2406  inline bool compatibleInOneHalfCLB(int halfCLB, int anotherHalfCLB)
2407  {
2408  assert(determinedClusterInSite);
2409  auto &FFControlSets = determinedClusterInSite->getFFControlSets();
2410  if (FFControlSets[halfCLB].getCSId() < 0 || FFControlSets[anotherHalfCLB].getCSId() < 0)
2411  {
2412  return true;
2413  }
2414  else if (FFControlSets[anotherHalfCLB].getCLK() == FFControlSets[halfCLB].getCLK() &&
2415  FFControlSets[anotherHalfCLB].getSR() == FFControlSets[halfCLB].getSR() &&
2416  DesignInfo::FFSRCompatible(FFControlSets[anotherHalfCLB].getFFType(),
2417  FFControlSets[halfCLB].getFFType()))
2418  {
2419  return true;
2420  }
2421 
2422  return false;
2423  }
2424 
2431  void mapMuxF8Macro(int muxF8Offset, PlacementInfo::PlacementMacro *MUXF8Macro);
2438  void mapMuxF7Macro(int halfCLBOffset, PlacementInfo::PlacementMacro *MUXF7Macro);
2439 
2448 
2455  void greedyMapMuxForCommonLUTFFInSite(int FFControlSetOrderId);
2456 
2462 
2469  void finalMapToSlotsForCommonLUTFFInSite(int FFControlSetOrderId);
2470 
2476 
2478  {
2479  if (!cell)
2480  return false;
2481  auto tmpPU = placementInfo->getPlacementUnitByCell(cell);
2482  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
2483  {
2484  return (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX7 ||
2485  tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_MUX8);
2486  }
2487  return false;
2488  }
2489 
2491  {
2492  if (!cell)
2493  return false;
2494  auto tmpPU = placementInfo->getPlacementUnitByCell(cell);
2495  if (auto tmpMacro = dynamic_cast<PlacementInfo::PlacementMacro *>(tmpPU))
2496  {
2497  return (tmpMacro->getMacroType() == PlacementInfo::PlacementMacro::PlacementMacroType_CARRY);
2498  }
2499  return false;
2500  }
2501 
2502  void moveLUTToLUT6Slot();
2503 
2509  {
2511  {
2512  best_DirectConnect = -100000000;
2513  if (checkIsCarrySite())
2514  {
2516  }
2517  else if (checkIsLUTRAMSite())
2518  {
2519  }
2520  else if (checkIsMuxSite())
2521  {
2523  }
2524  else if (!checkIsPrePackedSite() && !checkIsMuxSite())
2525  {
2526  // LUTS-FFs Packing
2528  }
2529  else
2530  {
2531  // assert(false && "undefined packing situation");
2532  }
2533  }
2534  }
2535 
2541  std::set<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> &getFixedPairedLUTs()
2542  {
2543  return fixedPairedLUTs;
2544  }
2545 
2551  std::set<DesignInfo::DesignCell *> &getConflictLUTs()
2552  {
2553  return conflictLUTs;
2554  }
2555 
2566  {
2567  return conflictLUTs.find(tmpCell) != conflictLUTs.end();
2568  }
2569 
2576  {
2577  return slotMapping;
2578  }
2579 
2581  {
2582  return slotMapping;
2583  }
2584 
2593  inline int checkDirectLUTFFConnect(std::map<DesignInfo::DesignCell *, DesignInfo::DesignCell *> &FF2LUT,
2595  {
2596  if (!tmpFF || !tmpLUT)
2597  return 0;
2598  if (FF2LUT.find(tmpFF) == FF2LUT.end())
2599  return 0;
2600  if (tmpLUT->isVirtualCell() || tmpFF->isVirtualCell())
2601  return false;
2602  return FF2LUT[tmpFF] == tmpLUT;
2603  }
2604 
2613  inline float checkDirectLUTFFConnect_slack(std::map<DesignInfo::DesignCell *, DesignInfo::DesignCell *> &FF2LUT,
2615  {
2616 
2617  auto &timingNodes = placementInfo->getTimingInfo()->getSimplePlacementTimingInfo();
2619  if (!tmpFF || !tmpLUT)
2620  return 0.0;
2621  if (FF2LUT.find(tmpFF) == FF2LUT.end())
2622  return 0.0;
2623  if (tmpLUT->isVirtualCell() || tmpFF->isVirtualCell())
2624  return 0.0;
2625 
2626  if (FF2LUT[tmpFF] != tmpLUT)
2627  return 0.0;
2628 
2629  auto srcCell = tmpLUT;
2630  unsigned int srcCellId = srcCell->getCellId();
2631  auto srcNode = timingNodes[srcCellId];
2632  // int succPathLen = srcNode->getLongestPathLength();
2633  float slack = (srcNode->getLatestInputArrival() - srcNode->getRequiredArrivalTime()) / clockPeriod + 20;
2634  return slack;
2635  }
2636 
2637  inline void setClockRegionAwareTo(bool _clockRegionAware)
2638  {
2639  clockRegionAware = _clockRegionAware;
2640  }
2641 
2642  inline std::array<int, 3> getLUTSlot(DesignInfo::DesignCell *targetCell)
2643  {
2644  assert(targetCell->isLUT());
2645  for (int i = 0; i < 2; i++)
2646  {
2647  for (int j = 0; j < 2; j++)
2648  {
2649  for (int k = 0; k < 4; k++)
2650  {
2651  if (slotMapping.LUTs[i][j][k] == targetCell)
2652  {
2653  return std::array<int, 3>{i, j, k};
2654  }
2655  }
2656  }
2657  }
2658  assert(false && "the LUT should be found in slots.");
2659  return std::array<int, 3>{-1, -1, -1};
2660  }
2661  inline std::array<int, 3> getFFSlot(DesignInfo::DesignCell *targetCell)
2662  {
2663  assert(targetCell->isFF());
2664  for (int i = 0; i < 2; i++)
2665  {
2666  for (int j = 0; j < 2; j++)
2667  {
2668  for (int k = 0; k < 4; k++)
2669  {
2670  if (slotMapping.FFs[i][j][k] == targetCell)
2671  {
2672  return std::array<int, 3>{i, j, k};
2673  }
2674  }
2675  }
2676  }
2677  assert(false && "the FF should be found in slots.");
2678  return std::array<int, 3>{-1, -1, -1};
2679  }
2680 
2681  private:
2684 
2691 
2696  unsigned int numNeighbor = 10;
2697 
2702  float deltaD = 1.0;
2703 
2708  float curD = 0;
2709 
2714  float maxD = 10;
2715 
2720  unsigned int PQSize = 10;
2721 
2727  float y2xRatio = 1.0;
2728 
2733  float HPWLWeight = 0.01;
2734 
2739  bool clockRegionAware = true;
2740 
2742  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> neighborPUs;
2743  // std::map<PlacementInfo::PlacementUnit *, float> PU2HPWLChange;
2744  std::vector<PackingCLBCluster *> seedClusters;
2745  std::vector<PackingCLBCluster *> priorityQueue;
2746  std::map<PlacementInfo::PlacementUnit *, int, Packing_PUcompare> PU2TopCnt;
2747  const std::vector<PackingCLBSite *> &PUId2PackingCLBSite;
2749  float detScore = 0;
2750 
2751  bool isCarrySite = false;
2752  bool isLUTRAMSite = false;
2753  bool isNonCLBSite = false;
2759 
2760  bool debug = false;
2761 
2762  std::set<DesignInfo::DesignCell *> mappedCells;
2763  std::set<DesignInfo::DesignCell *> mappedLUTs;
2764  std::set<DesignInfo::DesignCell *> mappedFFs;
2765  std::set<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> fixedPairedLUTs;
2766  std::set<DesignInfo::DesignCell *> fixedLUTsInPairs;
2767  std::set<DesignInfo::DesignCell *> conflictLUTs;
2769 
2770  float best_DirectConnect = -100000000;
2772  std::set<DesignInfo::DesignCell *> best_mappedCells;
2773  std::set<DesignInfo::DesignCell *> best_mappedLUTs;
2774  std::set<DesignInfo::DesignCell *> best_mappedFFs;
2775  };
2776 
2781  typedef struct _siteWithScore
2782  {
2784  float score;
2785 
2787  {
2788  }
2790 
2795  typedef struct _PUWithScore
2796  {
2798  float score;
2799 
2801  {
2802  }
2804 
2809  class PULocation : public std::array<float, 2>
2810  {
2811  public:
2812  // dimension of the Point
2813  static const int DIM = 2;
2815  {
2816  assert(false);
2817  }
2819  {
2820  (*this)[0] = tmpPU->X();
2821  (*this)[1] = tmpPU->Y();
2822  }
2823  PULocation &operator=(const PULocation &anotherPULocation)
2824  {
2825  (*this)[0] = anotherPULocation[0];
2826  (*this)[1] = anotherPULocation[1];
2827  PU = anotherPULocation.getPU();
2828  return (*this);
2829  }
2830 
2832  {
2833  return PU;
2834  }
2835 
2836  private:
2838  };
2839 
2847 
2855  void packCLBsIteration(bool initial, bool debug = false);
2856 
2865  void packCLBs(int packIterNum, bool doExceptionHandling, bool debug = false);
2866 
2867  void addNonCLBPackingSites();
2868 
2870  int timingDrivenDetailedPlacement_shortestPath(int iterId, float displacementRatio);
2871  int timingDrivenDetailedPlacement_swap(int iterId);
2878  void exceptionHandling(bool verbose = false);
2879 
2894  std::vector<DeviceInfo::DeviceSite *> *findNeiborSitesFromBinGrid(DesignInfo::DesignCellType curCellType,
2895  float targetX, float targetY,
2896  float displacementLowerbound,
2897  float displacementUpperbound, float y2xRatio,
2898  bool clockRegionAware);
2899 
2900  std::vector<DeviceInfo::DeviceSite *> *
2901  findNeiborSitesFromBinGrid(DesignInfo::DesignCellType curCellType, float targetX, float targetY,
2902  float displacementLowerbound, float displacementUpperbound, float y2xRatio,
2903  bool clockRegionAware, float v1x, float v1y, float v2x, float v2y, int numLimit);
2904 
2915  bool exceptionPULegalize(PlacementInfo::PlacementUnit *curPU, float displacementThreshold, bool verbose);
2916 
2931  bool ripUpAndLegalizae(
2932  PackingCLBSite *curTargetPackingSite, PlacementInfo::PlacementUnit *curPU, float displacementThreshold,
2933  std::map<PackingCLBSite *, PackingCLBSite::PackingCLBCluster *> &packingSite2DeterminedCluster, bool verbose);
2934 
2940 
2946 
2954  void updatePackedMacro(bool setPUPseudoNetToCLBSite = false, bool setCLBFixed = false);
2955 
2960  void setPUsToBePacked();
2961 
2962  void dumpFinalPacking();
2963  void dumpDSPBRAMPlacementTcl(std::ofstream &outfileTcl);
2964  void dumpCLBPlacementTcl(std::ofstream &outfileTcl, bool packingRelatedToLUT6_2);
2965  void dumpPlacementTcl(std::string dumpTclFile);
2966  void dumpAllCellsCoordinate();
2967 
2968  private:
2972  std::map<std::string, std::string> &JSONCfg;
2979 
2985 
2990  float deltaD;
2991 
2996  float curD;
2997 
3002  float maxD;
3003 
3008  int PQSize;
3009 
3014  float HPWLWeight;
3015  std::string packerName;
3016 
3019 
3022 
3023  std::vector<PackingCLBSite *> PUId2PackingCLBSite;
3024  std::vector<PackingCLBSite *> packingSites;
3025  std::vector<std::vector<PackingCLBSite *>> clockColumns2PackingSites;
3026  std::vector<PackingCLBSite *> PUId2PackingCLBSiteCandidate;
3027  std::vector<PlacementInfo::PlacementUnit *> &placementUnits;
3028  std::vector<PlacementInfo::PlacementUnpackedCell *> &placementUnpackedCells;
3029  std::vector<PlacementInfo::PlacementMacro *> &placementMacros;
3030  std::set<DesignInfo::DesignCell *> &cellInMacros;
3031  std::map<int, PlacementInfo::PlacementUnit *> &cellId2PlacementUnit;
3032 
3033  std::map<DeviceInfo::DeviceSite *, PackingCLBSite *> deviceSite2PackingSite;
3034  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> packedPUs;
3035  std::set<PlacementInfo::PlacementUnit *, Packing_PUcompare> unpackedPUs;
3036  std::vector<PlacementInfo::PlacementUnit *> unpackedPUsVec;
3037  std::map<PackingCLBSite *, PlacementInfo::PlacementUnit *> involvedPackingSite2PU;
3038  std::vector<PULocation> PUPoints;
3039  std::vector<PackingCLBSite *> cellId2PackingSite;
3040 
3041  float y2xRatio = 1.0;
3042 
3047  bool clockRegionAware = true;
3048 };
3049 std::ostream &operator<<(std::ostream &os, const ParallelCLBPacker::PackingCLBSite::PackingCLBCluster *tmpCluster);
3050 // inline bool operator<(const ParallelCLBPacker::PackingCLBSite::PackingCLBCluster &A,
3051 // const ParallelCLBPacker::PackingCLBSite::PackingCLBCluster &B)
3052 // {
3053 // return A.getScoreInSite() < B.getScoreInSite();
3054 // }
3055 
3056 #endif
ParallelCLBPacker::dumpFinalPacking
void dumpFinalPacking()
Definition: ParallelCLBPacker.cc:3225
ParallelCLBPacker::dumpCLBPlacementTcl
void dumpCLBPlacementTcl(std::ofstream &outfileTcl, bool packingRelatedToLUT6_2)
Definition: ParallelCLBPacker.cc:3003
operator<<
std::ostream & operator<<(std::ostream &os, const ParallelCLBPacker::PackingCLBSite::PackingCLBCluster *tmpCluster)
Definition: ParallelCLBPacker_PackingCLBCluster.cc:923
DesignInfo::DesignCell::isVirtualCell
bool isVirtualCell()
Definition: DesignInfo.h:1042
ParallelCLBPacker::PackingCLBSite::getY2xRatio
float getY2xRatio() const
Definition: ParallelCLBPacker.h:1923
readZip.h
ParallelCLBPacker::PackingCLBSite::clockRegionAware
bool clockRegionAware
whether make clock region become constraints
Definition: ParallelCLBPacker.h:2739
ParallelCLBPacker::PackingCLBSite::CARRYChainSiteOffset
int CARRYChainSiteOffset
Definition: ParallelCLBPacker.h:2758
PlacementInfo::PlacementNet
Placement net, compared to design net, includes information related to placement.
Definition: PlacementInfo.h:1877
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addFFGroup
bool addFFGroup(std::vector< DesignInfo::DesignCell * > curFFs, int enforceHalfCLB, bool enforceMainFFSlot, bool isMuxMacro)
try to add a given list of FFs into this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:315
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::checkNumMuxCompatibleInFFSet
bool checkNumMuxCompatibleInFFSet(int i, int addNum)
check whether a specific number of Muxes can be compatible with a specific FFset for packing
Definition: ParallelCLBPacker_PackingCLBCluster.cc:291
ParallelCLBPacker::PackingCLBSite::setNonCLBCell
void setNonCLBCell(DesignInfo::DesignCell *_NonCLBCell)
Definition: ParallelCLBPacker.h:2061
ParallelCLBPacker::numNeighbor
int numNeighbor
the threshold number of cells for site
Definition: ParallelCLBPacker.h:2984
ParallelCLBPacker::PackingCLBSite::y2xRatio
float y2xRatio
a factor to tune the weights of the net spanning in Y-coordinate relative to the net spanning in X-co...
Definition: ParallelCLBPacker.h:2727
ParallelCLBPacker::designInfo
DesignInfo * designInfo
Definition: ParallelCLBPacker.h:2969
ParallelCLBPacker::exceptionHandling
void exceptionHandling(bool verbose=false)
handle the PlacementUnits that cannot be packed during the parallel procedure
Definition: ParallelCLBPacker.cc:1766
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getTotalCellWeight
float getTotalCellWeight() const
Get the total weights of cells in the cluster (each cell will have different weight in the placement)
Definition: ParallelCLBPacker.h:1538
ParallelCLBPacker::PackingCLBSite::removeClustersIncompatibleWithDetClusterFromPQ
void removeClustersIncompatibleWithDetClusterFromPQ()
remove clusters incompatible with determined cluster from PQ
Definition: ParallelCLBPacker_PackingCLBSite.cc:70
ParallelCLBPacker::cellInMacros
std::set< DesignInfo::DesignCell * > & cellInMacros
Definition: ParallelCLBPacker.h:3030
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::totalConnectivityScore
float totalConnectivityScore
the connectivity score for this cluster
Definition: ParallelCLBPacker.h:1741
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::containFF
bool containFF(DesignInfo::DesignCell *curFF)
check whether the cluster contains a specific FF cell
Definition: ParallelCLBPacker.h:1571
ParallelCLBPacker::PackedControlSet::CLK
DesignInfo::DesignNet * CLK
Definition: ParallelCLBPacker.h:386
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::SiteBELMapping
SiteBELMapping()
Definition: ParallelCLBPacker.h:2186
ParallelCLBPacker::PULocation::getPU
PlacementInfo::PlacementUnit * getPU() const
Definition: ParallelCLBPacker.h:2831
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addFF
bool addFF(DesignInfo::DesignCell *curFF, int enforceHalfCLB=-1, bool enforceMainFFSlot=false)
try to add a given FF into this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:260
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getHPWLChange
float getHPWLChange() const
Get the HWPL change term in the cluster score object.
Definition: ParallelCLBPacker.h:1487
ParallelCLBPacker::PackingCLBSite::LUTRAMMacro
PlacementInfo::PlacementMacro * LUTRAMMacro
Definition: ParallelCLBPacker.h:2755
ParallelCLBPacker::PackingCLBSite::PUId2PackingCLBSite
const std::vector< PackingCLBSite * > & PUId2PackingCLBSite
Definition: ParallelCLBPacker.h:2747
ParallelCLBPacker::ParallelCLBPacker
ParallelCLBPacker(DesignInfo *designInfo, DeviceInfo *deviceInfo, PlacementInfo *placementInfo, std::map< std::string, std::string > &JSONCfg, int unchangedIterationThr, int numNeighbor, float deltaD, float curD, float maxD, int PQSize, float HPWLWeight, std::string packerName, PlacementTimingOptimizer *timingOptimizer, WirelengthOptimizer *WLOptimizer=nullptr)
Construct a new Parallel CLB Packer object.
Definition: ParallelCLBPacker.cc:57
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::totalCellNum
int totalCellNum
Definition: ParallelCLBPacker.h:1759
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::printMyself
void printMyself()
a API to print the information of cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:1018
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::contains
bool contains(PlacementInfo::PlacementUnit *tmpPU)
check whether the cluster contains a specific PlacementUnit
Definition: ParallelCLBPacker.h:1027
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::MuxF7
DesignInfo::DesignCell * MuxF7[2][2]
Definition: ParallelCLBPacker.h:2372
ParallelCLBPacker::clockColumns2PackingSites
std::vector< std::vector< PackingCLBSite * > > clockColumns2PackingSites
Definition: ParallelCLBPacker.h:3025
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::recoverFFControlSets
void recoverFFControlSets()
Definition: ParallelCLBPacker.h:1688
ParallelCLBPacker::dumpPlacementTcl
void dumpPlacementTcl(std::string dumpTclFile)
Definition: ParallelCLBPacker.cc:3184
ParallelCLBPacker::PackingCLBSite::detScore
float detScore
Definition: ParallelCLBPacker.h:2749
ParallelCLBPacker::PackingCLBSite::updateStep
void updateStep(bool initial, bool debug=false)
a iteration to pack PlacementUnit into a CLB site
Definition: ParallelCLBPacker_PackingCLBSite.cc:434
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addPUFailReason
void addPUFailReason(PlacementInfo::PlacementUnit *tmpPU)
find/print the reason why the PlacementUnit fails to be added into this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:396
ParallelCLBPacker::PackingCLBSite::compatibleInOneHalfCLB
bool compatibleInOneHalfCLB(int halfCLB, int anotherHalfCLB)
check whether two half CLB can be packed togather
Definition: ParallelCLBPacker.h:2406
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::FFs
DesignInfo::DesignCell * FFs[2][2][4]
Definition: ParallelCLBPacker.h:2368
ParallelCLBPacker::PackingCLBSite::conflictLUTs
std::set< DesignInfo::DesignCell * > conflictLUTs
Definition: ParallelCLBPacker.h:2767
ParallelCLBPacker::dumpAllCellsCoordinate
void dumpAllCellsCoordinate()
Definition: ParallelCLBPacker.cc:3420
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::id
int id
the unique id for each cluster
Definition: ParallelCLBPacker.h:1731
ParallelCLBPacker::PackedControlSet::PackedControlSet
PackedControlSet(const PackedControlSet &anotherControlSet)
Construct a new Packed Control Set object by cloning another one.
Definition: ParallelCLBPacker.h:144
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::tryRemoveSingleLUTFromPairs
bool tryRemoveSingleLUTFromPairs(DesignInfo::DesignCell *tmpLUT)
try to remove a LUT from the set of paired LUTs
Definition: ParallelCLBPacker.h:1205
ParallelCLBPacker::PULocation::PULocation
PULocation()
Definition: ParallelCLBPacker.h:2814
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::refreshId
void refreshId()
refresh the Id of the PackingCLBCluster so we can know it is changed.
Definition: ParallelCLBPacker.h:510
WirelengthOptimizer.h
This header file contains the definitions of GlobalPlacer class and its internal modules and APIs whi...
ParallelCLBPacker::exceptionPULegalize
bool exceptionPULegalize(PlacementInfo::PlacementUnit *curPU, float displacementThreshold, bool verbose)
try to find a legal location for the given PlacementUnit when most of PlacementUnits are packed into ...
Definition: ParallelCLBPacker.cc:1931
ParallelCLBPacker::WLOptimizer
WirelengthOptimizer * WLOptimizer
Definition: ParallelCLBPacker.h:3018
ParallelCLBPacker::PackingCLBSite::isNonCLBSite
bool isNonCLBSite
Definition: ParallelCLBPacker.h:2753
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::compatibleInOneHalfCLB
bool compatibleInOneHalfCLB(DesignInfo::ControlSetInfo *CSPtr, int anotherHalfCLB)
check whether a control set can be placed in a given half CLB
Definition: ParallelCLBPacker_PackingCLBCluster.cc:209
ParallelCLBPacker::PackingCLBSite::mappedCells
std::set< DesignInfo::DesignCell * > mappedCells
Definition: ParallelCLBPacker.h:2762
PlacementTimingOptimizer.h
ParallelCLBPacker::PackingCLBSite::fixedLUTsInPairs
std::set< DesignInfo::DesignCell * > fixedLUTsInPairs
Definition: ParallelCLBPacker.h:2766
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::numMuxes
int numMuxes
Definition: ParallelCLBPacker.h:1697
PlacementInfo::PlacementMacro
a fixed group of multiple standard cells with constraints of their relative locations
Definition: PlacementInfo.h:1525
ParallelCLBPacker::PackingCLBSite::unchangedIterationThr
int unchangedIterationThr
specify how many iterations a PlacementUnit should stay at the top priority of a site before we final...
Definition: ParallelCLBPacker.h:2690
DesignInfo::DesignCell::isLUT6
bool isLUT6()
Definition: DesignInfo.h:923
ParallelCLBPacker::PackingCLBSite::slotMapping
SiteBELMapping slotMapping
Definition: ParallelCLBPacker.h:2768
ParallelCLBPacker::PackedControlSet::isMustMainSlots
bool isMustMainSlots()
Definition: ParallelCLBPacker.h:379
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::totalNetNum
int totalNetNum
the cell number term in the cluster score
Definition: ParallelCLBPacker.h:1758
ParallelCLBPacker::timingDrivenDetailedPlacement_swap
int timingDrivenDetailedPlacement_swap(int iterId)
Definition: ParallelCLBPacker.cc:1410
DesignInfo::DesignCell
a DesignCell in design netlist, DesignPin objects of which might connect to DesignNet objects
Definition: DesignInfo.h:782
PlacementInfo::checkClockColumnLegalization
bool checkClockColumnLegalization(PlacementInfo::PlacementUnit *curPU, DeviceInfo::DeviceSite *curSite)
check whether the given PlacementUnit can be mapped to the site considering the half-column clock leg...
Definition: PlacementInfo.h:4242
ParallelCLBPacker::_siteWithScore::score
float score
Definition: ParallelCLBPacker.h:2784
ParallelCLBPacker::PackingCLBSite::getPriorityQueueTop
const PackingCLBCluster * getPriorityQueueTop()
Definition: ParallelCLBPacker.h:1912
ParallelCLBPacker::PUId2PackingCLBSiteCandidate
std::vector< PackingCLBSite * > PUId2PackingCLBSiteCandidate
Definition: ParallelCLBPacker.h:3026
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::tryRemoveSingleLUT
bool tryRemoveSingleLUT(DesignInfo::DesignCell *tmpLUT)
try to remove a single LUT from the single LUT set
Definition: ParallelCLBPacker.h:1185
DesignInfo::DesignNet
a design net (hyperedge) defined in the design, connecting to pins of cells
Definition: DesignInfo.h:525
ParallelCLBPacker::_siteWithScore::site
PackingCLBSite * site
Definition: ParallelCLBPacker.h:2783
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::MaxNum_LUTSite
const unsigned int MaxNum_LUTSite
Definition: ParallelCLBPacker.h:1696
HiFPlacer_hashprimes
const int HiFPlacer_hashprimes[300]
Definition: const.h:28
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getSingleLUTs
const std::set< DesignInfo::DesignCell * > & getSingleLUTs() const
Get the set of single LUTs in this cluster (some other LUTs have been paired for packing)
Definition: ParallelCLBPacker.h:1145
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::placementInfo
PlacementInfo * placementInfo
the paraent CLB site for this cluster
Definition: ParallelCLBPacker.h:1709
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getInternalPinsNum
int getInternalPinsNum(PlacementInfo::PlacementNet *curNet)
Get the number of pins within this site for a given net (more pins are located in ont site will reduc...
Definition: ParallelCLBPacker_PackingCLBCluster.cc:491
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getPlacementUnitMaxPathNegativeSlack
float getPlacementUnitMaxPathNegativeSlack(PlacementInfo::PlacementUnit *curPU)
Get the max length of paths involving a given PlacementUnit.
Definition: ParallelCLBPacker.h:1655
ParallelCLBPacker::addNonCLBPackingSites
void addNonCLBPackingSites()
Definition: ParallelCLBPacker.cc:2743
ParallelCLBPacker::ripUpAndLegalizae
bool ripUpAndLegalizae(PackingCLBSite *curTargetPackingSite, PlacementInfo::PlacementUnit *curPU, float displacementThreshold, std::map< PackingCLBSite *, PackingCLBSite::PackingCLBCluster * > &packingSite2DeterminedCluster, bool verbose)
try to rip up the packing for a given CLB site and pack the given PlacementUnit in the site....
Definition: ParallelCLBPacker.cc:2050
PlacementInfo::PlacementMacro::PlacementMacroType_LCLB
@ PlacementMacroType_LCLB
Definition: PlacementInfo.h:1533
ParallelCLBPacker::PackingCLBSite::getLUTSlot
std::array< int, 3 > getLUTSlot(DesignInfo::DesignCell *targetCell)
Definition: ParallelCLBPacker.h:2642
ParallelCLBPacker::PackingCLBSite::checkDirectLUTFFConnect_slack
float checkDirectLUTFFConnect_slack(std::map< DesignInfo::DesignCell *, DesignInfo::DesignCell * > &FF2LUT, DesignInfo::DesignCell *tmpLUT, DesignInfo::DesignCell *tmpFF)
check whether the FF/LUT are directly connected and calculate the slack
Definition: ParallelCLBPacker.h:2613
ParallelCLBPacker::packedPUs
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > packedPUs
Definition: ParallelCLBPacker.h:3034
PlacementInfo::PlacementUnit::getNetsSetPtr
std::vector< PlacementNet * > * getNetsSetPtr()
Get the Nets Set Ptr object which records the nets connecting to the PlacementUnit.
Definition: PlacementInfo.h:1231
ParallelCLBPacker::dumpDSPBRAMPlacementTcl
void dumpDSPBRAMPlacementTcl(std::ofstream &outfileTcl)
Definition: ParallelCLBPacker.cc:2865
ParallelCLBPacker::maxD
float maxD
the maximum constraint of the neighbor search diameter
Definition: ParallelCLBPacker.h:3002
ParallelCLBPacker::PackingCLBSite::finalMapToSlotsForCommonLUTFFInSite
void finalMapToSlotsForCommonLUTFFInSite()
finally map LUTs/FFs to the exact slots in the sites
Definition: ParallelCLBPacker_PackingCLBSite.cc:2719
PlacementInfo::PlacementMacro::PlacementMacroType_CARRY
@ PlacementMacroType_CARRY
Definition: PlacementInfo.h:1537
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::HPWLChange
float HPWLChange
the HPWL term for the wirelength optimization
Definition: ParallelCLBPacker.h:1749
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getScoreInSite
float getScoreInSite() const
Get the score if this cluster is mapped the site.
Definition: ParallelCLBPacker.h:1318
ParallelCLBPacker::PackedControlSet::CSId
int CSId
Definition: ParallelCLBPacker.h:385
DesignInfo::ControlSetInfo::getCE
DesignInfo::DesignNet * getCE() const
Definition: DesignInfo.h:1264
ParallelCLBPacker::PackingCLBSite::setDeterminedClusterInSite
void setDeterminedClusterInSite(PackingCLBCluster *tmpCluster)
Definition: ParallelCLBPacker.h:1938
ParallelCLBPacker::_PUWithScore::score
float score
Definition: ParallelCLBPacker.h:2798
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::MuxF8
DesignInfo::DesignCell * MuxF8[2]
Definition: ParallelCLBPacker.h:2374
PlacementInfo::PlacementUnit::Y
float Y()
Definition: PlacementInfo.h:1029
ParallelCLBPacker::PackingCLBSite::PackingCLBSite
PackingCLBSite(PlacementInfo *placementInfo, DeviceInfo::DeviceSite *CLBSite, int unchangedIterationThr, int numNeighbor, float deltaD, float curD, float maxD, unsigned int PQSize, float y2xRatio, float HPWLWeight, std::vector< PackingCLBSite * > &PUId2PackingCLBSite)
Construct a new Packing CLB Site object.
Definition: ParallelCLBPacker.h:420
ParallelCLBPacker::DumpCLBPackingCnt
int DumpCLBPackingCnt
Definition: ParallelCLBPacker.h:3020
ParallelCLBPacker::PackingCLBSite::getCarryCell
DesignInfo::DesignCell * getCarryCell()
Definition: ParallelCLBPacker.h:2103
ParallelCLBPacker::PULocation::operator=
PULocation & operator=(const PULocation &anotherPULocation)
Definition: ParallelCLBPacker.h:2823
DesignInfo::DesignCellType
DesignCellType
design cell types
Definition: DesignInfo.h:73
ParallelCLBPacker::placementUnits
std::vector< PlacementInfo::PlacementUnit * > & placementUnits
Definition: ParallelCLBPacker.h:3027
ParallelCLBPacker::y2xRatio
float y2xRatio
Definition: ParallelCLBPacker.h:3041
ParallelCLBPacker::prePackLegalizedMacros
void prePackLegalizedMacros(PlacementInfo::PlacementMacro *tmpMacro)
Load the information of some packed macros like LUTRAM/Crossing-Clock-Domain FFs/Carry Chains have be...
Definition: ParallelCLBPacker.cc:29
Packing_PUcompare::operator()
bool operator()(PlacementInfo::PlacementUnit *lhs, PlacementInfo::PlacementUnit *rhs) const
Definition: ParallelCLBPacker.h:67
ParallelCLBPacker::PackingCLBSite::finalMapToSlots
void finalMapToSlots()
finally map the elements (CARRY/MUX/LUT/FF) packed in this site into the slots in the site
Definition: ParallelCLBPacker.h:2508
ParallelCLBPacker::placementInfo
PlacementInfo * placementInfo
Definition: ParallelCLBPacker.h:2971
ParallelCLBPacker::PackingCLBSite::getHPWLChangeForPU
float getHPWLChangeForPU(PlacementInfo::PlacementUnit *tmpPU)
Definition: ParallelCLBPacker.h:1943
PlacementTimingInfo::TimingGraph::getClockPeriod
float getClockPeriod()
Get the clock period.
Definition: PlacementTimingInfo.h:777
PlacementInfo::PlacementMacro::PlacementMacroType_MUX8
@ PlacementMacroType_MUX8
Definition: PlacementInfo.h:1541
ParallelCLBPacker::PackingCLBSite::finalMapToSlotsForCarrySite
void finalMapToSlotsForCarrySite()
find the slots in the site for Carry by enumeration
Definition: ParallelCLBPacker_PackingCLBSite.cc:544
ParallelCLBPacker::PackingCLBSite::deltaD
float deltaD
the increase step of the neighbor search diameter
Definition: ParallelCLBPacker.h:2702
ParallelCLBPacker::PackingCLBSite::mappedFFs
std::set< DesignInfo::DesignCell * > mappedFFs
Definition: ParallelCLBPacker.h:2764
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::removePUToConstructDetCluster
void removePUToConstructDetCluster(PlacementInfo::PlacementUnit *tmpPU)
remove some PlacementInfo::PlacementUnit from the cluster for later determined cluster construction o...
Definition: ParallelCLBPacker.h:893
ParallelCLBPacker::PackedControlSet::reset
void reset()
clear the control set information in this PackedControlSet (only when there is no FF in this set)
Definition: ParallelCLBPacker.h:221
ParallelCLBPacker::PackedControlSet::updateCSID
void updateCSID()
Definition: ParallelCLBPacker.h:275
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::clusterHash
void clusterHash()
we use a hash function to encode the cluster to easily check duplicated clusters in the candidates
Definition: ParallelCLBPacker.h:1351
ParallelCLBPacker::PackedControlSet
PackedControlSet stores the data of a combination of FFs within one control set (clock enable/preset-...
Definition: ParallelCLBPacker.h:132
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::pairedLUTs
std::set< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > pairedLUTs
the paired LUTs in the cluster
Definition: ParallelCLBPacker.h:1799
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getTotalNetNum
int getTotalNetNum() const
Get the total number of cells in this cluster.
Definition: ParallelCLBPacker.h:1497
ParallelCLBPacker::deviceSite2PackingSite
std::map< DeviceInfo::DeviceSite *, PackingCLBSite * > deviceSite2PackingSite
Definition: ParallelCLBPacker.h:3033
ParallelCLBPacker::PackedControlSet::getFFs
const std::vector< DesignInfo::DesignCell * > & getFFs() const
get the FFs in this PackedControlSet
Definition: ParallelCLBPacker.h:212
DesignInfo::FFSRCompatible
static bool FFSRCompatible(DesignCellType typeA, DesignCellType typeB)
Definition: DesignInfo.h:148
Packing_Netcompare::operator()
bool operator()(PlacementInfo::PlacementNet *lhs, PlacementInfo::PlacementNet *rhs) const
Definition: ParallelCLBPacker.h:75
ParallelCLBPacker::PackingCLBSite::checkIsLUTRAMSite
bool checkIsLUTRAMSite()
Definition: ParallelCLBPacker.h:2093
ParallelCLBPacker::findNeiborSitesFromBinGrid
std::vector< DeviceInfo::DeviceSite * > * findNeiborSitesFromBinGrid(DesignInfo::DesignCellType curCellType, float targetX, float targetY, float displacementLowerbound, float displacementUpperbound, float y2xRatio, bool clockRegionAware)
find the neighbors of specific cell type with given coordinate center
Definition: ParallelCLBPacker.cc:2432
ParallelCLBPacker::PQSize
int PQSize
the size of priority queue (the low-priority candidates will be removed)
Definition: ParallelCLBPacker.h:3008
PlacementTimingOptimizer
Definition: PlacementTimingOptimizer.h:46
DesignInfo.h
This header file contains the classes of data for a standalone design netlist.
ParallelCLBPacker::PackingCLBSite::~PackingCLBSite
~PackingCLBSite()
Definition: ParallelCLBPacker.h:435
ParallelCLBPacker::PackingCLBSite::isCarrySite
bool isCarrySite
Definition: ParallelCLBPacker.h:2751
PlacementInfo::PlacementUnit::X
float X()
Definition: PlacementInfo.h:1024
ParallelCLBPacker::PackingCLBSite::numNeighbor
unsigned int numNeighbor
the threshold number of cells for site
Definition: ParallelCLBPacker.h:2696
ParallelCLBPacker::PackedControlSet::PackedControlSet
PackedControlSet()
Definition: ParallelCLBPacker.h:134
ParallelCLBPacker::PackingCLBSite::moveLUTToLUT6Slot
void moveLUTToLUT6Slot()
Definition: ParallelCLBPacker_PackingCLBSite.cc:2735
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::Carry
DesignInfo::DesignCell * Carry
Definition: ParallelCLBPacker.h:2375
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::LUTs
DesignInfo::DesignCell * LUTs[2][2][4]
Definition: ParallelCLBPacker.h:2364
ParallelCLBPacker::PackingCLBSite::addCarry
void addCarry()
add CARRY-related PlacementUnit into this CLB site
Definition: ParallelCLBPacker.h:1994
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getPlacementUnitMaxPathLen
int getPlacementUnitMaxPathLen(PlacementInfo::PlacementUnit *curPU)
Get the max length of paths involving a given PlacementUnit.
Definition: ParallelCLBPacker.h:1619
ParallelCLBPacker::PackingCLBSite::getPlacementInfo
PlacementInfo * getPlacementInfo() const
Definition: ParallelCLBPacker.h:1985
ParallelCLBPacker::PackingCLBSite::SiteBELMapping
SiteBELMapping is a contain recording the mapping between cells and BELs.
Definition: ParallelCLBPacker.h:2184
DesignInfo::ControlSetInfo::getCLK
DesignInfo::DesignNet * getCLK() const
Definition: DesignInfo.h:1256
ParallelCLBPacker::allCoordinateDumpCnt
int allCoordinateDumpCnt
Definition: ParallelCLBPacker.h:3021
ParallelCLBPacker::PackingCLBSite::getDeterminedClusterInSite
PackingCLBCluster * getDeterminedClusterInSite()
Definition: ParallelCLBPacker.h:1933
ParallelCLBPacker::cellId2PlacementUnit
std::map< int, PlacementInfo::PlacementUnit * > & cellId2PlacementUnit
Definition: ParallelCLBPacker.h:3031
dumpZip.h
DeviceInfo.h
This header file contains the classes of data for a standalone device.
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::PackingCLBCluster
PackingCLBCluster(PackingCLBCluster *anotherPackingCLBCluster)
Definition: ParallelCLBPacker.h:477
ParallelCLBPacker::PackingCLBSite::isLUTRAMSite
bool isLUTRAMSite
Definition: ParallelCLBPacker.h:2752
PlacementInfo::PlacementMacro::PlacementMacroType_MUX7
@ PlacementMacroType_MUX7
Definition: PlacementInfo.h:1540
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::PUs
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > PUs
Definition: ParallelCLBPacker.h:1732
ParallelCLBPacker::PackingCLBSite::placementInfo
PlacementInfo * placementInfo
Definition: ParallelCLBPacker.h:2682
ParallelCLBPacker::PackingCLBSite::conflictLUTsContain
bool conflictLUTsContain(DesignInfo::DesignCell *tmpCell)
check whether a given cell is unpackable
Definition: ParallelCLBPacker.h:2565
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getHashConst
int getHashConst() const
Get the hash code of this cluster without changing the class variables of this cluster.
Definition: ParallelCLBPacker.h:1438
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::hashId
int hashId
a hash id to record the elements in this cluster
Definition: ParallelCLBPacker.h:1724
ParallelCLBPacker::_PUWithScore::_PUWithScore
_PUWithScore(PlacementInfo::PlacementUnit *PU, float score)
Definition: ParallelCLBPacker.h:2800
delayVisualization.X
X
Definition: delayVisualization.py:80
DesignInfo::DesignCell::getOriCellType
DesignCellType getOriCellType()
Get the Original Cell Type object defined in the design netlist.
Definition: DesignInfo.h:1089
PlacementInfo::getActualOccupationByCellId
float getActualOccupationByCellId(int id)
Get the Actual Occupation By Cell Id.
Definition: PlacementInfo.h:2995
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::updateScoreInSite
void updateScoreInSite()
update the score of this cluster by considering HPWL, interconnection density, timing and etc
Definition: ParallelCLBPacker_PackingCLBCluster.cc:515
ParallelCLBPacker::deltaD
float deltaD
the increase step of the neighbor search diameter
Definition: ParallelCLBPacker.h:2990
ParallelCLBPacker::PackedControlSet::mustMainSlots
bool mustMainSlots
Definition: ParallelCLBPacker.h:391
ParallelCLBPacker::PackingCLBSite::findNewClustersWithNeighborPUs
void findNewClustersWithNeighborPUs()
extend the clusters in the priority queue with the neighbor PlacementUnits
Definition: ParallelCLBPacker_PackingCLBSite.cc:256
ParallelCLBPacker::siteWithScore
struct ParallelCLBPacker::_siteWithScore siteWithScore
helper struct for candidate site sorting
ParallelCLBPacker::PackedControlSet::FFs
std::vector< DesignInfo::DesignCell * > FFs
Definition: ParallelCLBPacker.h:390
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::checkCellCorrectness
bool checkCellCorrectness(PlacementInfo::PlacementUnit *tmpPU, bool isAddPU)
a verification function to check whether the cells in this cluster are REALLY LEGAL.
Definition: ParallelCLBPacker_PackingCLBCluster.cc:770
ParallelCLBPacker::PackedControlSet::getCE
DesignInfo::DesignNet * getCE() const
Definition: ParallelCLBPacker.h:348
ParallelCLBPacker::PackingCLBSite::getNonCLBCell
DesignInfo::DesignCell * getNonCLBCell()
Definition: ParallelCLBPacker.h:2113
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getFFControlSets
const std::vector< PackedControlSet > & getFFControlSets() const
Definition: ParallelCLBPacker.h:1135
Packing_PUcompare
a utility struct for the comparison between PlacementInfo::PlacementUnit according to PU ID
Definition: ParallelCLBPacker.h:66
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::isMuxMacro
bool isMuxMacro(DesignInfo::DesignCell *cell)
Definition: ParallelCLBPacker.h:666
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::FFControlSets
std::vector< PackedControlSet > FFControlSets
the control set information for this cluster
Definition: ParallelCLBPacker.h:1786
stringCheck.h
ParallelCLBPacker::PackedControlSet::findFF
int findFF(DesignInfo::DesignCell *curFF) const
find the index in the list for a given FF cell pointer
Definition: ParallelCLBPacker.h:302
ParallelCLBPacker::setPUsToBePacked
void setPUsToBePacked()
set the packed attribute for the packed PlacementUnits
Definition: ParallelCLBPacker.cc:2542
DesignInfo::ControlSetInfo
A control set is a combination of CLK, CE and SR signal. It could be nullptr (not related to control ...
Definition: DesignInfo.h:1152
ParallelCLBPacker::PUWithScore
struct ParallelCLBPacker::_PUWithScore PUWithScore
helper struct for candidate site sorting
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getId
int getId() const
Get the Id of the PackingCLBCluster (just for debug information don't use it in algorithm)
Definition: ParallelCLBPacker.h:501
DeviceInfo::DeviceSite
Site class for site on device.
Definition: DeviceInfo.h:163
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::totalLen
int totalLen
the term of timing (paths) in the packing score
Definition: ParallelCLBPacker.h:1767
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::~PackingCLBCluster
~PackingCLBCluster()
Definition: ParallelCLBPacker.h:475
DesignInfo::ControlSetInfo::display
void display()
Definition: DesignInfo.h:1303
DesignInfo::ControlSetInfo::getSR
DesignInfo::DesignNet * getSR() const
Definition: DesignInfo.h:1260
ParallelCLBPacker::PackingCLBSite::greedyMapMuxForCommonLUTFFInSite
void greedyMapMuxForCommonLUTFFInSite()
find the slots in the site for Muxes by enumeration
Definition: ParallelCLBPacker_PackingCLBSite.cc:2059
ParallelCLBPacker::PackedControlSet::operator=
PackedControlSet & operator=(const PackedControlSet &anotherControlSet)
undate a new Packed Control Set object by cloning another one
Definition: ParallelCLBPacker.h:172
ParallelCLBPacker::unchangedIterationThr
int unchangedIterationThr
specify how many iterations a PlacementUnit should stay at the top priority of a site before we final...
Definition: ParallelCLBPacker.h:2978
strPrint.h
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getPairPinNum
unsigned int getPairPinNum(DesignInfo::DesignCell *LUTA, DesignInfo::DesignCell *LUTB)
check how many input pins will be needed if the two LUTs are packed.
Definition: ParallelCLBPacker.h:522
ParallelCLBPacker::PackingCLBSite::seedClusters
std::vector< PackingCLBCluster * > seedClusters
Definition: ParallelCLBPacker.h:2744
ParallelCLBPacker::PackedControlSet::addFF
void addFF(DesignInfo::DesignCell *curFF)
add a FF into this PackedControlSet and check the compatibility
Definition: ParallelCLBPacker.h:235
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::removeLUTFFPair
void removeLUTFFPair(DesignInfo::DesignCell *targetLUT, DesignInfo::DesignCell *targetFF)
Definition: ParallelCLBPacker.h:2338
DesignInfo::DesignCell::isFF
bool isFF()
Definition: DesignInfo.h:933
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::removeFF
void removeFF(DesignInfo::DesignCell *curFF)
remove a specific FF from this candidate cluster
Definition: ParallelCLBPacker.h:868
ParallelCLBPacker::PackingCLBSite::CARRYChain
PlacementInfo::PlacementMacro * CARRYChain
Definition: ParallelCLBPacker.h:2754
ParallelCLBPacker::~ParallelCLBPacker
~ParallelCLBPacker()
Definition: ParallelCLBPacker.h:120
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getCellSet
std::set< DesignInfo::DesignCell * > getCellSet()
Definition: ParallelCLBPacker.h:1037
ParallelCLBPacker::PackingCLBSite::best_mappedFFs
std::set< DesignInfo::DesignCell * > best_mappedFFs
Definition: ParallelCLBPacker.h:2774
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::removeSingleLUT
void removeSingleLUT(DesignInfo::DesignCell *tmpLUT)
remove a single LUT from the set of single LUTs in this cluster
Definition: ParallelCLBPacker.h:1172
ParallelCLBPacker::PackedControlSet::getSize
unsigned int getSize() const
Get the the number of FFs in this control set.
Definition: ParallelCLBPacker.h:202
const.h
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addLUT
bool addLUT(DesignInfo::DesignCell *curLUT)
try to add a given LUT into this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:113
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::singleLUTs
std::set< DesignInfo::DesignCell * > singleLUTs
the set of LUTs have not been paired with other LUTs in the clutser
Definition: ParallelCLBPacker.h:1793
ParallelCLBPacker::clockRegionAware
bool clockRegionAware
whether make clock region become constraints
Definition: ParallelCLBPacker.h:3047
ParallelCLBPacker::PackingCLBSite::getNeighborPUs
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > & getNeighborPUs()
Definition: ParallelCLBPacker.h:1848
ParallelCLBPacker::PackingCLBSite::HPWLWeight
float HPWLWeight
the factor of HPWL overhead in packing evaluation for a cell
Definition: ParallelCLBPacker.h:2733
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::removeLUT
void removeLUT(DesignInfo::DesignCell *curLUT)
remove a specific LUT from this candidate cluster
Definition: ParallelCLBPacker.h:838
ParallelCLBPacker::PackingCLBSite::determinedClusterInSite
PackingCLBCluster * determinedClusterInSite
Definition: ParallelCLBPacker.h:2748
ParallelCLBPacker::PackedControlSet::getCSId
int getCSId() const
get the control set id of this PackedControlSet.
Definition: ParallelCLBPacker.h:319
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster
PackingCLBCluster is a container of cells/PlacementUnits which can be packed in the corresponding CLB...
Definition: ParallelCLBPacker.h:453
ParallelCLBPacker::HPWLWeight
float HPWLWeight
the factor of HPWL overhead in packing evaluation for a cell
Definition: ParallelCLBPacker.h:3014
ParallelCLBPacker::PULocation::DIM
static const int DIM
Definition: ParallelCLBPacker.h:2813
ParallelCLBPacker::checkPackedPUsAndUnpackedPUs
void checkPackedPUsAndUnpackedPUs()
check the packing status for all the PlacementUnits
Definition: ParallelCLBPacker.cc:1722
ParallelCLBPacker::PackingCLBSite::CLBSite
DeviceInfo::DeviceSite * CLBSite
Definition: ParallelCLBPacker.h:2683
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addPU
bool addPU(PlacementInfo::PlacementUnit *tmpPU, bool allowOverlap=false)
try to add a given PlacementUnit into this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:621
ParallelCLBPacker::PackingCLBSite::isCarryMacro
bool isCarryMacro(DesignInfo::DesignCell *cell)
Definition: ParallelCLBPacker.h:2490
ParallelCLBPacker::_PUWithScore
helper struct for candidate site sorting
Definition: ParallelCLBPacker.h:2796
ParallelCLBPacker::PackingCLBSite::mappedLUTs
std::set< DesignInfo::DesignCell * > mappedLUTs
Definition: ParallelCLBPacker.h:2763
ParallelCLBPacker::timingDrivenDetailedPlacement_shortestPath_intermediate
int timingDrivenDetailedPlacement_shortestPath_intermediate()
Definition: ParallelCLBPacker.cc:1263
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getHash
int getHash()
Get the hash code for this cluster.
Definition: ParallelCLBPacker.h:1426
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getPUs
const std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > & getPUs() const
Definition: ParallelCLBPacker.h:1032
ParallelCLBPacker::unpackedPUsVec
std::vector< PlacementInfo::PlacementUnit * > unpackedPUsVec
Definition: ParallelCLBPacker.h:3036
ParallelCLBPacker::PackedControlSet::~PackedControlSet
~PackedControlSet()
Definition: ParallelCLBPacker.h:195
PlacementInfo::PlacementUnit
a movement unit in placement with information of location and resource demand
Definition: PlacementInfo.h:1010
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getParentPackingCLB
PackingCLBSite * getParentPackingCLB() const
Get the Parent Packing CLB site of this cluster (this can be used to get more device information)
Definition: ParallelCLBPacker.h:1342
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getTotalLen
int getTotalLen() const
Get the maximum length of the paths which involve this cluster.
Definition: ParallelCLBPacker.h:1527
ParallelCLBPacker::cellId2PackingSite
std::vector< PackingCLBSite * > cellId2PackingSite
Definition: ParallelCLBPacker.h:3039
ParallelCLBPacker::PackedControlSet::setCSId
void setCSId(int _CSId)
set the control set id of this PackedControlSet.
Definition: ParallelCLBPacker.h:331
ParallelCLBPacker::packCLBs
void packCLBs(int packIterNum, bool doExceptionHandling, bool debug=false)
packing the PlacementUnits (which are compatible to CLB sites) into CLB sites
Definition: ParallelCLBPacker.cc:288
DesignInfo::DesignCell::getCellId
int getCellId()
Get the Cell Id in the cell list.
Definition: DesignInfo.h:1037
PlacementInfo::PlacementUnit::getId
unsigned int getId()
Definition: PlacementInfo.h:1206
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::PackingCLBCluster
PackingCLBCluster(PackingCLBSite *parentPackingCLB)
Definition: ParallelCLBPacker.h:464
ParallelCLBPacker::PackedControlSet::setMustMainSlots
void setMustMainSlots()
Definition: ParallelCLBPacker.h:374
ParallelCLBPacker::updatePackedMacro
void updatePackedMacro(bool setPUPseudoNetToCLBSite=false, bool setCLBFixed=false)
Update the macros in PlacementInfo by regarding those elements in one CLB site as a macro.
Definition: ParallelCLBPacker.cc:2562
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::parentPackingCLB
PackingCLBSite * parentPackingCLB
the paraent CLB site for this cluster
Definition: ParallelCLBPacker.h:1703
DesignInfo::DesignCell::isLUT
bool isLUT()
Definition: DesignInfo.h:927
DeviceInfo::DeviceSite::getSiteType
std::string & getSiteType()
Definition: DeviceInfo.h:273
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::MaxNum_ControlSet
const unsigned int MaxNum_ControlSet
Definition: ParallelCLBPacker.h:1694
ParallelCLBPacker::PackingCLBSite::curD
float curD
current neighbor search diameter
Definition: ParallelCLBPacker.h:2708
DesignInfo::DesignCell::getControlSetInfo
ControlSetInfo * getControlSetInfo()
Get the Control Set Info object of this cell.
Definition: DesignInfo.h:1054
ParallelCLBPacker::PackingCLBSite::getLUTRAMMacro
PlacementInfo::PlacementMacro * getLUTRAMMacro()
Definition: ParallelCLBPacker.h:2108
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::tryRemoveLUTPairFromPairs
bool tryRemoveLUTPairFromPairs(DesignInfo::DesignCell *tmpLUTA, DesignInfo::DesignCell *tmpLUTB)
try to remove a pair of LUTs from the set of paired LUTs
Definition: ParallelCLBPacker.h:1233
ParallelCLBPacker::PackedControlSet::FFType
DesignInfo::DesignCellType FFType
Definition: ParallelCLBPacker.h:389
ParallelCLBPacker::PackingCLBSite::checkIsPrePackedSite
bool checkIsPrePackedSite()
Definition: ParallelCLBPacker.h:2069
PlacementInfo::getTimingInfo
PlacementTimingInfo * getTimingInfo()
Definition: PlacementInfo.h:3313
ParallelCLBPacker::timingDrivenDetailedPlacement_shortestPath
int timingDrivenDetailedPlacement_shortestPath(int iterId, float displacementRatio)
Definition: ParallelCLBPacker.cc:539
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::addToFFSet
bool addToFFSet(DesignInfo::DesignCell *curFF, int halfCLB)
try to add a given FF into a specific half CLB in this cluster
Definition: ParallelCLBPacker_PackingCLBCluster.cc:173
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::evictFFsFromMuxHalfCLB
void evictFFsFromMuxHalfCLB()
try to move FFs in Mux slot to other controlSet
Definition: ParallelCLBPacker.h:695
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::addLUTFFPair
void addLUTFFPair(DesignInfo::DesignCell *targetLUT, DesignInfo::DesignCell *targetFF)
Definition: ParallelCLBPacker.h:2279
ParallelCLBPacker::PULocation::PULocation
PULocation(PlacementInfo::PlacementUnit *tmpPU)
Definition: ParallelCLBPacker.h:2818
ParallelCLBPacker::PackingCLBSite::isPQTopCompletelyAccptedByCells
bool isPQTopCompletelyAccptedByCells()
check whether all the PlacementUnit in the top cluster in the priority queue have been assigned to th...
Definition: ParallelCLBPacker.h:1811
ParallelCLBPacker::PackingCLBSite::removeInvalidClustersFromPQ
void removeInvalidClustersFromPQ()
remove invalid clusters from the priority queue
Definition: ParallelCLBPacker_PackingCLBSite.cc:49
ParallelCLBPacker::PackingCLBSite::getFixedPairedLUTs
std::set< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > & getFixedPairedLUTs()
Get the fixed pairs of LUTs which should NOT be broken.
Definition: ParallelCLBPacker.h:2541
ParallelCLBPacker::JSONCfg
std::map< std::string, std::string > & JSONCfg
Definition: ParallelCLBPacker.h:2972
ParallelCLBPacker::_PUWithScore::PU
PlacementInfo::PlacementUnit * PU
Definition: ParallelCLBPacker.h:2797
ParallelCLBPacker::PackingCLBSite::unchangeIterationCnt
int unchangeIterationCnt
Definition: ParallelCLBPacker.h:2741
ParallelCLBPacker::PackingCLBSite::mapLUTRAMRelatedCellsToSlots
void mapLUTRAMRelatedCellsToSlots(PlacementInfo::PlacementMacro *_LUTRAMMacro)
Definition: ParallelCLBPacker_PackingCLBSite.cc:2757
ParallelCLBPacker::PackingCLBSite::getCLBSite
DeviceInfo::DeviceSite * getCLBSite()
Definition: ParallelCLBPacker.h:1918
ParallelCLBPacker::PackingCLBSite::addLUTRAMMacro
void addLUTRAMMacro()
add LUTRAM-related PlacementUnit into this CLB site
Definition: ParallelCLBPacker.h:2052
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::~SiteBELMapping
~SiteBELMapping()
Definition: ParallelCLBPacker.h:2360
ParallelCLBPacker::PackingCLBSite::getCarrySiteOffset
int getCarrySiteOffset()
Definition: ParallelCLBPacker.h:2118
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getSortedSingleLUTs
std::vector< DesignInfo::DesignCell * > getSortedSingleLUTs()
Get the sorted list of single LUTs in this cluster (some other LUTs have been paired for packing)
Definition: ParallelCLBPacker.h:1155
ParallelCLBPacker::PackingCLBSite::findNeiborPUsFromBinGrid
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > * findNeiborPUsFromBinGrid(DesignInfo::DesignCellType curCellType, float targetX, float targetY, float displacementLowerbound, float displacementUpperbound, int PUNumThreshold, const std::vector< PackingCLBSite * > &PUId2PackingCLBSite, float y2xRatio, std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > *res=nullptr, bool clockRegionAware=true)
find neighbor PlacementUnit around targetX/Y from the bin grid
Definition: ParallelCLBPacker_PackingCLBSite.cc:310
ParallelCLBPacker::PackedControlSet::getSR
DesignInfo::DesignNet * getSR() const
Definition: ParallelCLBPacker.h:342
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::HPWLWeight
float HPWLWeight
the configurable weight for the wirelength in the cluster score
Definition: ParallelCLBPacker.h:1773
ParallelCLBPacker::PackedControlSet::SR
DesignInfo::DesignNet * SR
Definition: ParallelCLBPacker.h:387
ParallelCLBPacker::PackingCLBSite::debug
bool debug
Definition: ParallelCLBPacker.h:2760
ParallelCLBPacker::packerName
std::string packerName
Definition: ParallelCLBPacker.h:3015
ParallelCLBPacker::unpackedPUs
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > unpackedPUs
Definition: ParallelCLBPacker.h:3035
ParallelCLBPacker::PackingCLBSite::getDetScore
float getDetScore()
Definition: ParallelCLBPacker.h:1928
ParallelCLBPacker::PackingCLBSite::getSlotMapping
const SiteBELMapping & getSlotMapping() const
Get the slot(BEL) mapping of the cells.
Definition: ParallelCLBPacker.h:2575
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getHPWLChangeForPU
float getHPWLChangeForPU(PlacementInfo::PlacementUnit *tmpPU)
get the HPWL change if a given PlacementUnit is moved to this site
Definition: ParallelCLBPacker.h:1467
PlacementTimingInfo::getSimplePlacementTimingInfo
std::vector< TimingGraph< DesignInfo::DesignCell >::TimingNode * > & getSimplePlacementTimingInfo()
Get the Simple Timing Info object which regard design cells as timing nodes.
Definition: PlacementTimingInfo.h:835
ParallelCLBPacker::PackingCLBSite::neighborPUs
std::set< PlacementInfo::PlacementUnit *, Packing_PUcompare > neighborPUs
Definition: ParallelCLBPacker.h:2742
DeviceInfo
Information class related to FPGA device, including the details of BEL/Site/Tile/ClockRegion.
Definition: DeviceInfo.h:43
DeviceInfo::DeviceSite::X
float X()
Definition: DeviceInfo.h:288
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getSortedPairedLUTs
std::vector< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > getSortedPairedLUTs()
Get the sorted list of the paired LUTs.
Definition: ParallelCLBPacker.h:1268
ParallelCLBPacker::PackingCLBSite::best_SlotMapping
SiteBELMapping best_SlotMapping
Definition: ParallelCLBPacker.h:2771
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::incrementalUpdateScoreInSite
void incrementalUpdateScoreInSite(PlacementInfo::PlacementUnit *tmpPU)
incrementally update the score of this cluster by considering that only a given PlacementUnit will be...
Definition: ParallelCLBPacker_PackingCLBCluster.cc:568
delayVisualization.Y
Y
Definition: delayVisualization.py:80
ParallelCLBPacker::PackingCLBSite::mapMuxF7Macro
void mapMuxF7Macro(int halfCLBOffset, PlacementInfo::PlacementMacro *MUXF7Macro)
map cells in MUXF7 macro to CLB slot
Definition: ParallelCLBPacker_PackingCLBSite.cc:1918
ParallelCLBPacker::PackingCLBSite::best_mappedCells
std::set< DesignInfo::DesignCell * > best_mappedCells
Definition: ParallelCLBPacker.h:2772
ParallelCLBPacker::PackingCLBSite::setClockRegionAwareTo
void setClockRegionAwareTo(bool _clockRegionAware)
Definition: ParallelCLBPacker.h:2637
PlacementInfo::PlacementUnpackedCell
the smallest, indivisible, representable component. It will include only one standard cell
Definition: PlacementInfo.h:1447
ParallelCLBPacker::involvedPackingSite2PU
std::map< PackingCLBSite *, PlacementInfo::PlacementUnit * > involvedPackingSite2PU
Definition: ParallelCLBPacker.h:3037
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::MaxNum_FFinControlSet
const unsigned int MaxNum_FFinControlSet
Definition: ParallelCLBPacker.h:1695
ParallelCLBPacker::PUPoints
std::vector< PULocation > PUPoints
Definition: ParallelCLBPacker.h:3038
ParallelCLBPacker::PackingCLBSite::fixedPairedLUTs
std::set< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > fixedPairedLUTs
Definition: ParallelCLBPacker.h:2765
PlacementInfo::PlacementNet::getId
int getId()
Get the Id of the net in current placement procedure.
Definition: PlacementInfo.h:1983
ParallelCLBPacker::PackedControlSet::compatibleWith
bool compatibleWith(int inputCSId) const
check whether this PackedControlSet can be compatible with a given control set ID
Definition: ParallelCLBPacker.h:367
ParallelCLBPacker::PackingCLBSite::mapCarryRelatedCellsToSlots
void mapCarryRelatedCellsToSlots(PlacementInfo::PlacementMacro *_CARRYChain, float siteOffset)
Definition: ParallelCLBPacker_PackingCLBSite.cc:2763
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::isPUTypeCompatibleWithSiteType
bool isPUTypeCompatibleWithSiteType(PlacementInfo::PlacementUnit *tmpPU)
check whether the type of the given PlacementUnit is compatible with the site type
Definition: ParallelCLBPacker.h:943
ParallelCLBPacker::PackingCLBSite::isMuxMacro
bool isMuxMacro(DesignInfo::DesignCell *cell)
Definition: ParallelCLBPacker.h:2477
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::clusterHashWithAdditionalPU
int clusterHashWithAdditionalPU(PlacementInfo::PlacementUnit *tmpPU)
incrementally update the hash function with an additional PlacementUnit. This hash will be used to en...
Definition: ParallelCLBPacker.h:1396
ParallelCLBPacker::PackingCLBSite::checkIsCarrySite
bool checkIsCarrySite()
Definition: ParallelCLBPacker.h:2074
PlacementInfo::PlacementMacro::getCells
std::vector< DesignInfo::DesignCell * > & getCells()
Definition: PlacementInfo.h:1724
ParallelCLBPacker::PackingCLBSite::maxD
float maxD
the maximum constraint of the neighbor search diameter
Definition: ParallelCLBPacker.h:2714
ParallelCLBPacker::PackingCLBSite::nonCLBCell
DesignInfo::DesignCell * nonCLBCell
Definition: ParallelCLBPacker.h:2757
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::areAllPUsValidForThisSite
bool areAllPUsValidForThisSite(const std::vector< PackingCLBSite * > &PUId2PackingCLBSite, PackingCLBSite *parentPackingCLBSite)
check whether all the PlacementUnit in this cluster are valid (not bound to other sites) for this sit...
Definition: ParallelCLBPacker.h:1293
ParallelCLBPacker::PackingCLBSite::hasValidPQTop
bool hasValidPQTop()
Definition: ParallelCLBPacker.h:1907
checkHalfColumn.i
int i
Definition: checkHalfColumn.py:5
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::operator=
SiteBELMapping & operator=(const SiteBELMapping &anotherMapping)
Definition: ParallelCLBPacker.h:2203
ParallelCLBPacker
ParallelCLBPacker will finally pack LUT/FF/MUX/CARRY elements into legal CLB sites in a parallel appr...
Definition: ParallelCLBPacker.h:94
DesignInfo::ControlSetInfo::getId
const int getId() const
Get the Id of the control set (each control set will have a unique Id)
Definition: DesignInfo.h:1278
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::isCarryMacro
bool isCarryMacro(DesignInfo::DesignCell *cell)
Definition: ParallelCLBPacker.h:679
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::tryAddPU
bool tryAddPU(PlacementInfo::PlacementUnit *tmpPU)
without modifying the original cluster container, try to add a given PlacementUnit into this cluster
Definition: ParallelCLBPacker.h:979
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::PackingCLBCluster
PackingCLBCluster()
Construct a new Packing CLB Cluster object (it should not be called.)
Definition: ParallelCLBPacker.h:459
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::FFControlSets_backup
std::vector< PackedControlSet > FFControlSets_backup
Definition: ParallelCLBPacker.h:1787
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::evictFFsFromCarryHalfCLB
bool evictFFsFromCarryHalfCLB(unsigned int FFSetId)
try to move FFs in Mux slot to other controlSet
Definition: ParallelCLBPacker.h:772
ParallelCLBPacker::PackingCLBSite::carryCell
DesignInfo::DesignCell * carryCell
Definition: ParallelCLBPacker.h:2756
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getTotalConnectivityScore
float getTotalConnectivityScore() const
Get the connectivity term in the cluster score object.
Definition: ParallelCLBPacker.h:1477
PlacementInfo::getPlacementUnitByCell
PlacementUnit * getPlacementUnitByCell(DesignInfo::DesignCell *curCell)
Definition: PlacementInfo.h:3120
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::scoreInSite
float scoreInSite
the evaluation score of packing for this cluster
Definition: ParallelCLBPacker.h:1715
ParallelCLBPacker::curD
float curD
current neighbor search diameter
Definition: ParallelCLBPacker.h:2996
ParallelCLBPacker::placementUnpackedCells
std::vector< PlacementInfo::PlacementUnpackedCell * > & placementUnpackedCells
Definition: ParallelCLBPacker.h:3028
ParallelCLBPacker::PackingCLBSite::getPairPinNum
unsigned int getPairPinNum(DesignInfo::DesignCell *LUTA, DesignInfo::DesignCell *LUTB)
check how many input pins will be needed if the two LUTs are packed.
Definition: ParallelCLBPacker.h:2130
ParallelCLBPacker::deviceInfo
DeviceInfo * deviceInfo
Definition: ParallelCLBPacker.h:2970
ParallelCLBPacker::PackingCLBSite::checkIsNonCLBSite
bool checkIsNonCLBSite()
Definition: ParallelCLBPacker.h:2079
ParallelCLBPacker::PackingCLBSite::best_DirectConnect
float best_DirectConnect
Definition: ParallelCLBPacker.h:2770
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::moveFFFromCS1ToCS0
void moveFFFromCS1ToCS0(DesignInfo::DesignCell *targetFF, int CSGroupId1, int CSGroupId0)
Definition: ParallelCLBPacker.h:756
ParallelCLBPacker::_siteWithScore::_siteWithScore
_siteWithScore(PackingCLBSite *site, float score)
Definition: ParallelCLBPacker.h:2786
ParallelCLBPacker::PackingCLBSite::removeInvalidPUsFromNeighborPUs
void removeInvalidPUsFromNeighborPUs()
remove invalid clusters from neighbor PlacementUnits
Definition: ParallelCLBPacker_PackingCLBSite.cc:109
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getTotalCellNum
int getTotalCellNum() const
Get the total number of cells in this cluster.
Definition: ParallelCLBPacker.h:1507
ParallelCLBPacker::packCLBsIteration
void packCLBsIteration(bool initial, bool debug=false)
update the packing cluster candidates for each CLB site and determine some mapping from elements to s...
Definition: ParallelCLBPacker.cc:129
ParallelCLBPacker::PackingCLBSite::mapMuxF8Macro
void mapMuxF8Macro(int muxF8Offset, PlacementInfo::PlacementMacro *MUXF8Macro)
map cells in MUXF8 macro to CLB slot
Definition: ParallelCLBPacker_PackingCLBSite.cc:1775
PlacementInfo.h
This header file mainly contains the definition of class PlacementInfo, including information related...
DesignInfo::DesignCell::getInputPins
std::vector< DesignPin * > & getInputPins()
Definition: DesignInfo.h:918
ParallelCLBPacker::PackingCLBSite::findMuxFromHalfCLB
int findMuxFromHalfCLB(PlacementInfo::PlacementMacro *MUXF8Macro)
find the correspdnding FF control set id for a given Mux macro (this mux macro should have been mappe...
Definition: ParallelCLBPacker_PackingCLBSite.cc:2040
ParallelCLBPacker::setPULocationToPackedSite
void setPULocationToPackedSite()
update the location of PlacementUnits according to the packing result
Definition: ParallelCLBPacker.cc:2518
ParallelCLBPacker::packingSites
std::vector< PackingCLBSite * > packingSites
Definition: ParallelCLBPacker.h:3024
ParallelCLBPacker::PackingCLBSite::refreshPrioryQueue
void refreshPrioryQueue()
sort the elements in the priority queue
Definition: ParallelCLBPacker_PackingCLBSite.cc:28
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::MuxF8SlotNames
const std::string MuxF8SlotNames[2]
Definition: ParallelCLBPacker.h:2377
ParallelCLBPacker::PackingCLBSite::updateConsistentPUsInTop
void updateConsistentPUsInTop()
update the information of consistent PUs at the top of priority queue
Definition: ParallelCLBPacker_PackingCLBSite.cc:142
ParallelCLBPacker::placementMacros
std::vector< PlacementInfo::PlacementMacro * > & placementMacros
Definition: ParallelCLBPacker.h:3029
Packing_Netcompare
Definition: ParallelCLBPacker.h:74
ParallelCLBPacker::PULocation
PULocation is a helper class to find the neighbor PlacementUnits with KD-Tree.
Definition: ParallelCLBPacker.h:2810
ParallelCLBPacker::PackingCLBSite::priorityQueue
std::vector< PackingCLBCluster * > priorityQueue
Definition: ParallelCLBPacker.h:2745
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::checkAddPU
bool checkAddPU(PlacementInfo::PlacementUnit *tmpPU)
Definition: ParallelCLBPacker.h:998
ParallelCLBPacker::PUId2PackingCLBSite
std::vector< PackingCLBSite * > PUId2PackingCLBSite
Definition: ParallelCLBPacker.h:3023
ParallelCLBPacker::timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping
int timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping()
Definition: ParallelCLBPacker.cc:993
ParallelCLBPacker::timingOptimizer
PlacementTimingOptimizer * timingOptimizer
Definition: ParallelCLBPacker.h:3017
ParallelCLBPacker::PackedControlSet::removeXthFF
void removeXthFF(int i)
remove a specify i-th FF from this PackedControlSet
Definition: ParallelCLBPacker.h:267
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::canDirectConnectInSlot
bool canDirectConnectInSlot(DesignInfo::DesignCell *targetLUT, DesignInfo::DesignCell *targetFF) const
Definition: ParallelCLBPacker.h:2222
DesignInfo
Information related to FPGA designs, including design cells and their interconnections.
Definition: DesignInfo.h:51
ParallelCLBPacker::_siteWithScore
helper struct for candidate site sorting
Definition: ParallelCLBPacker.h:2782
ParallelCLBPacker::PackingCLBSite::checkIsMuxSite
bool checkIsMuxSite()
Definition: ParallelCLBPacker.h:2084
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::maxCardinalityMatching
void maxCardinalityMatching(bool verbose=false)
conduct maximun cardinality matching algorithm to pair LUTs
Definition: ParallelCLBPacker_PackingCLBCluster.cc:28
ParallelCLBPacker::PackingCLBSite::SiteBELMapping::MuxF7SlotNames
const std::string MuxF7SlotNames[2][2]
Definition: ParallelCLBPacker.h:2378
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getPairedLUTs
const std::set< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > & getPairedLUTs() const
Get the set of the paired LUTs.
Definition: ParallelCLBPacker.h:1258
ParallelCLBPacker::PackingCLBSite
PackingCLBSite is a container for the packing information (parameters, candidates and packing status)...
Definition: ParallelCLBPacker.h:400
WirelengthOptimizer
WirelengthOptimizer builds numerical models based on the element locations and calls solvers to find ...
Definition: WirelengthOptimizer.h:54
ParallelCLBPacker::PackingCLBSite::PQSize
unsigned int PQSize
the size of priority queue (the low-priority candidates will be removed)
Definition: ParallelCLBPacker.h:2720
ParallelCLBPacker::PackedControlSet::CE
DesignInfo::DesignNet * CE
Definition: ParallelCLBPacker.h:388
ParallelCLBPacker::PackingCLBSite::getSlotMappingRef
SiteBELMapping & getSlotMappingRef()
Definition: ParallelCLBPacker.h:2580
ParallelCLBPacker::PackingCLBSite::checkDirectLUTFFConnect
int checkDirectLUTFFConnect(std::map< DesignInfo::DesignCell *, DesignInfo::DesignCell * > &FF2LUT, DesignInfo::DesignCell *tmpLUT, DesignInfo::DesignCell *tmpFF)
check whether the FF/LUT are directly connected
Definition: ParallelCLBPacker.h:2593
ParallelCLBPacker::PackingCLBSite::getCarryMacro
PlacementInfo::PlacementMacro * getCarryMacro()
Definition: ParallelCLBPacker.h:2098
ParallelCLBPacker::PackedControlSet::getFFType
DesignInfo::DesignCellType getFFType() const
Definition: ParallelCLBPacker.h:354
ParallelCLBPacker::PULocation::PU
PlacementInfo::PlacementUnit * PU
Definition: ParallelCLBPacker.h:2837
ParallelCLBPacker::PackingCLBSite::getConflictLUTs
std::set< DesignInfo::DesignCell * > & getConflictLUTs()
Get the LUTs which CANNOT be paired.
Definition: ParallelCLBPacker.h:2551
DeviceInfo::DeviceSite::Y
float Y()
Definition: DeviceInfo.h:292
PlacementInfo
Information related to FPGA placement (wirelength optimization, cell spreading, legalization,...
Definition: PlacementInfo.h:59
PlacementTimingInfo::getSimplePlacementTimingGraph
TimingGraph< DesignInfo::DesignCell > * getSimplePlacementTimingGraph()
Get the Simple Placement Timing Graph object.
Definition: PlacementTimingInfo.h:850
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::getNumMuxes
int getNumMuxes() const
Get the total number of MUX cells in this cluster.
Definition: ParallelCLBPacker.h:1517
ParallelCLBPacker::PackingCLBSite::PackingCLBCluster::hashed
bool hashed
Definition: ParallelCLBPacker.h:1725
ParallelCLBPacker::PackingCLBSite::setDebug
void setDebug()
Definition: ParallelCLBPacker.h:1980
ParallelCLBPacker::PackingCLBSite::getFFSlot
std::array< int, 3 > getFFSlot(DesignInfo::DesignCell *targetCell)
Definition: ParallelCLBPacker.h:2661
ParallelCLBPacker::PackedControlSet::getCLK
DesignInfo::DesignNet * getCLK() const
Definition: ParallelCLBPacker.h:336
ParallelCLBPacker::PackingCLBSite::PU2TopCnt
std::map< PlacementInfo::PlacementUnit *, int, Packing_PUcompare > PU2TopCnt
Definition: ParallelCLBPacker.h:2746
ParallelCLBPacker::PackingCLBSite::best_mappedLUTs
std::set< DesignInfo::DesignCell * > best_mappedLUTs
Definition: ParallelCLBPacker.h:2773