AMF-Placer  2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
IncrementalBELPacker.h
Go to the documentation of this file.
1 
27 #ifndef _INCREMENTALBELPACKER
28 #define _INCREMENTALBELPACKER
29 
30 #include "DesignInfo.h"
31 #include "DeviceInfo.h"
32 #include "KDTree/KDTree.h"
33 #include "PlacementInfo.h"
35 #include <assert.h>
36 #include <fstream>
37 #include <iostream>
38 #include <map>
39 #include <set>
40 #include <sstream>
41 #include <string>
42 #include <vector>
43 
50 {
51  public:
61  std::map<std::string, std::string> &JSONCfg)
63  compatiblePlacementTable(placementInfo->getCompatiblePlacementTable()),
64  placementUnits(placementInfo->getPlacementUnits()),
65  placementUnpackedCells(placementInfo->getPlacementUnpackedCells()),
66  placementMacros(placementInfo->getPlacementMacros()),
67  fixedPlacementUnits(placementInfo->getFixedPlacementUnits()), cellInMacros(placementInfo->getCellInMacros()),
68  cellId2PlacementUnit(placementInfo->getCellId2PlacementUnit()),
69  cellId2PlacementUnitVec(placementInfo->getCellId2PlacementUnitVec()), JSONCfg(JSONCfg)
70  {
71  if (JSONCfg.find("y2xRatio") != JSONCfg.end())
72  {
73  y2xRatio = std::stof(JSONCfg["y2xRatio"]);
74  }
75  }
76 
84 
91  void LUTFFPairing(float disThreshold);
92 
99  void FFPairing(float disThreshold);
100 
101  void dumpPairedLUTFF();
102 
104  {
105  return fabs(A.X - B.X) + y2xRatio * fabs(A.Y - B.Y);
106  }
107 
113  class FFLocation : public std::array<float, 2>
114  {
115  public:
116  // dimension of the Point
117  static const int DIM = 2;
119  {
120  assert(false);
121  }
123  {
124  (*this)[0] = unpackedCell->X();
125  (*this)[1] = unpackedCell->Y();
126  }
127 
129  {
130  return unpackedCell;
131  }
132 
133  private:
135  };
136 
137  private:
138  typedef struct _PUWithScore
139  {
141  float score;
142 
144  {
145  }
147 
148  typedef struct _CellWithScore
149  {
151  float score;
152 
154  {
155  }
157 
162  std::vector<PlacementInfo::PlacementUnit *> &placementUnits;
163  std::vector<PlacementInfo::PlacementUnpackedCell *> &placementUnpackedCells;
164  std::vector<PlacementInfo::PlacementMacro *> &placementMacros;
165  std::vector<PlacementInfo::PlacementUnit *> &fixedPlacementUnits;
166  std::set<DesignInfo::DesignCell *> &cellInMacros;
167  std::map<int, PlacementInfo::PlacementUnit *> &cellId2PlacementUnit;
168  std::vector<PlacementInfo::PlacementUnit *> &cellId2PlacementUnitVec;
169  std::map<std::string, std::string> &JSONCfg;
171 
172  std::vector<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> LUTFFPairs;
173  std::vector<std::pair<DesignInfo::DesignCell *, DesignInfo::DesignCell *>> FF_FFPairs;
175  float y2xRatio = 1.0;
176 };
177 
178 #endif
PlacementInfo::Location
Definition: PlacementInfo.h:3595
IncrementalBELPacker::_CellWithScore::cell
DesignInfo::DesignCell * cell
Definition: IncrementalBELPacker.h:150
PlacementTimingOptimizer.h
IncrementalBELPacker::_CellWithScore
Definition: IncrementalBELPacker.h:149
IncrementalBELPacker::CellWithScore
struct IncrementalBELPacker::_CellWithScore CellWithScore
DesignInfo::DesignCell
a DesignCell in design netlist, DesignPin objects of which might connect to DesignNet objects
Definition: DesignInfo.h:782
IncrementalBELPacker::LUTFFPairing
void LUTFFPairing(float disThreshold)
try to pair LUTs/FFs in the design netlist which are neighbors according to a given threshold and con...
Definition: IncrementalBELPacker.cc:44
IncrementalBELPacker::FFLocation::DIM
static const int DIM
Definition: IncrementalBELPacker.h:117
IncrementalBELPacker::y2xRatio
float y2xRatio
Definition: IncrementalBELPacker.h:175
IncrementalBELPacker::_PUWithScore::score
float score
Definition: IncrementalBELPacker.h:141
PlacementInfo::PlacementUnit::Y
float Y()
Definition: PlacementInfo.h:1029
IncrementalBELPacker::compatiblePlacementTable
PlacementInfo::CompatiblePlacementTable * compatiblePlacementTable
Definition: IncrementalBELPacker.h:161
IncrementalBELPacker::JSONCfg
std::map< std::string, std::string > & JSONCfg
Definition: IncrementalBELPacker.h:169
IncrementalBELPacker::_PUWithScore::PU
PlacementInfo::PlacementUnit * PU
Definition: IncrementalBELPacker.h:140
IncrementalBELPacker::fixedPlacementUnits
std::vector< PlacementInfo::PlacementUnit * > & fixedPlacementUnits
Definition: IncrementalBELPacker.h:165
DesignInfo.h
This header file contains the classes of data for a standalone design netlist.
PlacementInfo::PlacementUnit::X
float X()
Definition: PlacementInfo.h:1024
IncrementalBELPacker
IncrementalBELPacker incrementally packs some LUTs/FFs during global placement based on their distanc...
Definition: IncrementalBELPacker.h:50
IncrementalBELPacker::placementMacros
std::vector< PlacementInfo::PlacementMacro * > & placementMacros
Definition: IncrementalBELPacker.h:164
IncrementalBELPacker::FFLocation::unpackedCell
PlacementInfo::PlacementUnpackedCell * unpackedCell
Definition: IncrementalBELPacker.h:134
DeviceInfo.h
This header file contains the classes of data for a standalone device.
PlacementInfo::Location::X
float X
Definition: PlacementInfo.h:3596
IncrementalBELPacker::FFLocation
FFLocation records the FF cell pointer and the location of the FF cell for kdt::KDTree construction w...
Definition: IncrementalBELPacker.h:114
IncrementalBELPacker::placementUnits
std::vector< PlacementInfo::PlacementUnit * > & placementUnits
Definition: IncrementalBELPacker.h:162
delayVisualization.A
A
Definition: delayVisualization.py:85
PlacementInfo::CompatiblePlacementTable
describes the type mapping from design to device, where a cell can be placed (which BEL in which site...
Definition: PlacementInfo.h:94
IncrementalBELPacker::_PUWithScore::_PUWithScore
_PUWithScore(PlacementInfo::PlacementUnit *PU, float score)
Definition: IncrementalBELPacker.h:143
IncrementalBELPacker::dumpPairedLUTFF
void dumpPairedLUTFF()
Definition: IncrementalBELPacker.cc:419
IncrementalBELPacker::placementUnpackedCells
std::vector< PlacementInfo::PlacementUnpackedCell * > & placementUnpackedCells
Definition: IncrementalBELPacker.h:163
IncrementalBELPacker::cellInMacros
std::set< DesignInfo::DesignCell * > & cellInMacros
Definition: IncrementalBELPacker.h:166
IncrementalBELPacker::cellId2PlacementUnitVec
std::vector< PlacementInfo::PlacementUnit * > & cellId2PlacementUnitVec
Definition: IncrementalBELPacker.h:168
PlacementInfo::PlacementUnit
a movement unit in placement with information of location and resource demand
Definition: PlacementInfo.h:1010
IncrementalBELPacker::PUWithScore
struct IncrementalBELPacker::_PUWithScore PUWithScore
IncrementalBELPacker::_CellWithScore::_CellWithScore
_CellWithScore(DesignInfo::DesignCell *cell, float score)
Definition: IncrementalBELPacker.h:153
IncrementalBELPacker::LUTFFPairDumpCnt
int LUTFFPairDumpCnt
Definition: IncrementalBELPacker.h:174
IncrementalBELPacker::isLUTsPackable
void isLUTsPackable(PlacementInfo::PlacementUnpackedCell *LUTA, PlacementInfo::PlacementUnpackedCell *LUTB)
check whether two LUTs can be packed to share one BEL
Definition: IncrementalBELPacker.cc:35
DeviceInfo
Information class related to FPGA device, including the details of BEL/Site/Tile/ClockRegion.
Definition: DeviceInfo.h:43
IncrementalBELPacker::FFLocation::getUnpackedCell
PlacementInfo::PlacementUnpackedCell * getUnpackedCell()
Definition: IncrementalBELPacker.h:128
IncrementalBELPacker::getCellDistance
float getCellDistance(PlacementInfo::Location &A, PlacementInfo::Location &B)
Definition: IncrementalBELPacker.h:103
IncrementalBELPacker::_CellWithScore::score
float score
Definition: IncrementalBELPacker.h:151
PlacementInfo::PlacementUnpackedCell
the smallest, indivisible, representable component. It will include only one standard cell
Definition: PlacementInfo.h:1447
IncrementalBELPacker::FFLocation::FFLocation
FFLocation(PlacementInfo::PlacementUnpackedCell *unpackedCell)
Definition: IncrementalBELPacker.h:122
IncrementalBELPacker::LUTFFPairs
std::vector< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > LUTFFPairs
Definition: IncrementalBELPacker.h:172
IncrementalBELPacker::FFLocation::FFLocation
FFLocation()
Definition: IncrementalBELPacker.h:118
PlacementInfo.h
This header file mainly contains the definition of class PlacementInfo, including information related...
IncrementalBELPacker::designInfo
DesignInfo * designInfo
Definition: IncrementalBELPacker.h:158
IncrementalBELPacker::placementInfo
PlacementInfo * placementInfo
Definition: IncrementalBELPacker.h:160
IncrementalBELPacker::FF_FFPairs
std::vector< std::pair< DesignInfo::DesignCell *, DesignInfo::DesignCell * > > FF_FFPairs
Definition: IncrementalBELPacker.h:173
IncrementalBELPacker::deviceInfo
DeviceInfo * deviceInfo
Definition: IncrementalBELPacker.h:159
IncrementalBELPacker::FFPairing
void FFPairing(float disThreshold)
try to pair FFs in the design netlist which are neighbors according to a given threshold and the cont...
Definition: IncrementalBELPacker.cc:253
IncrementalBELPacker::_PUWithScore
Definition: IncrementalBELPacker.h:139
DesignInfo
Information related to FPGA designs, including design cells and their interconnections.
Definition: DesignInfo.h:51
IncrementalBELPacker::placementNetId2LUTPlacementUnitId
std::vector< int > placementNetId2LUTPlacementUnitId
Definition: IncrementalBELPacker.h:170
PlacementInfo::Location::Y
float Y
Definition: PlacementInfo.h:3597
IncrementalBELPacker::IncrementalBELPacker
IncrementalBELPacker(DesignInfo *designInfo, DeviceInfo *deviceInfo, PlacementInfo *placementInfo, std::map< std::string, std::string > &JSONCfg)
Construct a new Incremental BEL Packer object.
Definition: IncrementalBELPacker.h:60
IncrementalBELPacker::cellId2PlacementUnit
std::map< int, PlacementInfo::PlacementUnit * > & cellId2PlacementUnit
Definition: IncrementalBELPacker.h:167
PlacementInfo
Information related to FPGA placement (wirelength optimization, cell spreading, legalization,...
Definition: PlacementInfo.h:59