torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Placement.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the Placement class.
18 
19 #ifndef TORC_PLACER_PLACEMENT_HPP
20 #define TORC_PLACER_PLACEMENT_HPP
21 
22 //#include "torc/placer/PlacerNetlist.hpp"
23 #include "torc/physical/Design.hpp"
28 #include <boost/timer.hpp>
29 
30 #include <boost/random/mersenne_twister.hpp>
31 #include <boost/random/uniform_int.hpp>
32 #include <boost/random/variate_generator.hpp>
33 
34 namespace torc {
35 namespace placer {
36 
37  /// \brief Wrapper of the Design for placing the design.
38 
39  class Placement {
40  protected:
41  //types
45  typedef std::vector<const Site*> SitePtrVector;
46  typedef std::vector<SitePtrVector> SitePtrVectorVector;
47 
49  typedef boost::uint32_t uint32;
50  typedef boost::uint64_t uint64;
51 
57  typedef std::vector<InstanceSharedPtrVector> InstanceSharedPtrVectorVector;
60 
61  typedef boost::unordered_map<const Site*, uint32> SitePtrToIntMap;
62  typedef boost::unordered_map<const Site*, InstanceSharedPtr> SitePtrToInstanceSharedPtrMap;
63  typedef boost::unordered_map<InstanceSharedPtr, Site*> InstanceSharedPtrToSitePtrMap;
64 
65  typedef boost::mt19937 mt19937;
66  typedef boost::uniform_int<uint32> uinform_range;
67  typedef boost::variate_generator<mt19937&, uinform_range> random_generator;
68 
69  //typedef std::set<SiteSharedPtr> SiteSharedPtrSet;
70  //typedef std::vector<SiteSharedPtrSet> SiteSharedPtrSetVector;
71 
72  // THE DEVICE:
74 
75  // THE HEURISTIC - REPLACES DEVICE
76  //PlacerHeuristicBase& mHeuristic;
77 
78  // THE DESIGN
79  DesignSharedPtr mDesign; // the master design shared pointer of the design
80  //PlacerNetlist mNetlist;
81 
82 
83  // INTERNAL STRUCTURES
84 
85  // the sites
88  SitePtrVectorVector mCandidatesByType; // extend to group? yes
90 
91  // site assignment
93 
94  // instances
97 
98  // nets
100 
101  // instance assignment
102  //InstanceSharedPtrToSitePtrMap mInstanceAssigment; // don't want to go this route...
103 
104  // RANDOM STUFF
105  boost::mt19937 mRandomSource;
106  boost::uniform_int<uint32> mUniformInstanceRange;
107  boost::variate_generator<mt19937&, boost::uniform_int<uint32> > mInstanceRandomGen;
108 
109  std::vector<boost::uniform_int<uint32> > mUniformTypeRanges;
110  // these much be pointers because they're not assignable...
111  std::vector<boost::variate_generator<mt19937&,
112  boost::uniform_int<uint32> >* > mTypeRandomGen;
113 
115  //uint32 mOldCost;
116 
117  bool mDebug;
118 
119  // MOVE RELATED MEMBERS
124 
125  public:
127  : mDevice(inDevice), mDesign(inDesign), mAllSites(mDevice.mSites.getSites()),
128  mRandomSource(42), mUniformInstanceRange(0, mDesign->getInstanceCount() - 1),
130  mCost(0), mDebug(false) {
131 std::cout << "PLACEMENT CONSTRUCTOR" << std::endl;
132  // type preparation
133  for (uint32 t = 0; t < mDevice.mSites.getSiteTypeCount(); t++) {
134  mAllSitesByType.push_back(SitePtrVector());
135  mCandidatesByType.push_back(SitePtrVector());
137  }
138 std::cout << "Prepped for " << mDevice.mSites.getSiteTypeCount() << " types" << std::endl;
139 
140 
141  // instance setup
142  InstanceSharedPtrVector::iterator p = mDesign->instancesBegin();
143  InstanceSharedPtrVector::iterator e = mDesign->instancesEnd();
144  for ( ; p != e; p++) {
145  InstanceSharedPtr instance = *p;
146  uint32 typeIndex = mDevice.mTypeMapping.getTypeIndex(instance->getType());
147  instance->setAnnotation(ePlacerInstanceTypeIndex, typeIndex);
148 
149  mAllInstances.push_back(instance);
150  mAllInstancesByType[typeIndex].push_back(instance);
151  }
152 
153  // net setup
154  NetSharedPtrVector::iterator q = mDesign->netsBegin();
155  NetSharedPtrVector::iterator f = mDesign->netsEnd();
156  for ( ; q != f; q++) {
157  NetSharedPtr net = *q;
158  mAllNets.push_back(net);
159  }
160 
161  uint32 a = 0;
162  for (uint32 i = 0; i < mAllInstancesByType.size(); i++) {
163  uint32 b = mAllInstancesByType[i].size();
164  if (b != 0)
165  std::cout << mDevice.mTypeMapping.getName(i) << ": " << b << std::endl;
166  a += b;
167 
168  }
169  std::cout << "Summary INSTANCES: " << a << " = " << mAllInstances.size() << std::endl;
170 
171  // site population
172 std::cout << "There are " << mAllSites.getSize() << " sites" << std::endl;
173  for (uint32 i = 0; i < mAllSites.getSize(); i++) {
174 
175  const architecture::Site& site = mAllSites[i];
176  //SiteSharedPtr ssp(site);
177  const architecture::PrimitiveDef* siteType = site.getPrimitiveDefPtr();
178  uint32 typeIndex = mDevice.mTypeMapping.getTypeIndex(siteType->getName());
179  std::vector<uint32>& map = mDevice.mTypeMapping.getLegalInstancesForSite(typeIndex);
180 
181  //mAllSites.push_back(site);
182  mAllSitesByType[typeIndex].push_back(&site);
183  mSiteTypeLookup[&site] = typeIndex;
184 
185  // for each instance type that can map to this site, put it in as a candidate
186  for (uint32 j = 0; j < map.size(); j++) {
187  mCandidatesByType[map[j]].push_back(&site);
188  }
189  }
190 
191  //mRandomSource, mUniformInstanceRange, mInstanceRandomGen already set up in init list
192  for (uint32 i = 0; i < mCandidatesByType.size(); i++) {
193  uint32 x = mCandidatesByType[i].size();
194  mUniformTypeRanges.push_back(boost::uniform_int<uint32>(0, x - 1));
195 
196  mTypeRandomGen.push_back(new boost::variate_generator<mt19937&,
197  boost::uniform_int<uint32> >(mRandomSource, mUniformTypeRanges[i]));
198  }
199 
200  for (uint32 t = 0; t < mDevice.mSites.getSiteTypeCount(); t++) {
201  std::cout << mDevice.mTypeMapping.getName(t) << " has "
202  << mAllSitesByType[t].size() << " sites, " << mCandidatesByType[t].size()
203  << " is the candidate count for this type" << std::endl;
204  }
205 
207 
208  }
210  }
212  std::cout << "INITIAL PLACEMENT" << std::endl;
213 
214  boost::mt19937 gen;
215 
216  // first place all the instances on
217  // check there are enough
218  // place all instance of site of same type
219  // for overage, check for
220 
221  //std::vector<std::map<uint32, const Site*> > sitesByType;
222  std::vector<std::vector<const Site*> > sitesByType;
223 
224  for (uint32 t = 0; t < mAllSitesByType.size(); t++) {
225  sitesByType.push_back(std::vector<const Site*>());
226  for (uint32 i = 0; i < mAllSitesByType[t].size(); i++) {
227  sitesByType[t].push_back(mAllSitesByType[t][i]);
228  }
229  }
230 
231  // now have a structure with all sites available by type, with easy removal.
232  // THIS IS NOT GOING TO WORK RIGHT FOR VERY FULL DESIGNS!
233  for (uint32 i = 0; i < mAllInstances.size(); i++) {
234  // place each instance
235  InstanceSharedPtr instance = mAllInstances[i];
236 std::cout << "Placing instance: " << instance->getName() << std::endl;
237  //uint32 typeIndex = boost::any_cast<uint32>(
238  // instance->getAnnotation(ePlacerInstanceTypeIndex));
239  uint32 typeIndex = getInstanceTypeIndex(instance);
240 
241 std::cout << "\tInstance type index: " << typeIndex << " ("
242  << mDevice.mTypeMapping.getName(typeIndex) << ")" << std::endl;
243 
244  // check if the instance type index has any sites available, otherwise select from
245  // another site type
246  uint32 siteTypeIndex = typeIndex;
247  if (sitesByType[siteTypeIndex].size() == 0) {
248  //try different legal types until a match is found
249  std::vector<uint32>& map = mDevice.mTypeMapping.getLegalSitesForInstance(
250  siteTypeIndex);
251  for (uint32 j = 0; j < map.size(); j++) {
252  siteTypeIndex = map[j];
253  if (sitesByType[siteTypeIndex].size() > 0) break;
254  }
255  }
256 std::cout << "\tSite type index: " << siteTypeIndex << " ("
257  << mDevice.mTypeMapping.getName(siteTypeIndex) << ")" << std::endl;
258 
259 
260  // get the candidate type indices
261 
262  boost::uniform_int<uint32> range(0, sitesByType[siteTypeIndex].size() - 1);
263  boost::variate_generator<mt19937&, boost::uniform_int<uint32> > random(gen, range);
264 
265  uint32 r = random();
266 std::cout << "\tSelected index " << r << " from " << sitesByType[siteTypeIndex].size() << std::endl;
267 
268  const Site* selectedSite = sitesByType[siteTypeIndex][r];
269 
270 std::cout << "\tSelected Site: " << selectedSite->getName() << std::endl;
271 
272  instance->setAnnotation(ePlacerInstanceSitePtr, selectedSite);
273  mAssignedSites[selectedSite] = instance;
274 //std::cout << "\tSetting: " << instance->getName() << " " << selectedSite->getName() << std::endl;
275 
276 //std::cout << "\tSiteByType size before: " << sitesByType[typeIndex].size() << " ";
277  //sitesByType[siteTypeIndex].erase(r);
278  sitesByType[siteTypeIndex].erase(sitesByType[siteTypeIndex].begin() + r);
279 //std::cout << " and after: " << sitesByType[typeIndex].size() << std::endl;
280 
281  }
282 
283  }
285  std::cout << "WRITING PLACEMENT TO DESIGN" << std::endl;
286  for (uint32 i = 0; i < mAllInstances.size(); i++) {
287  InstanceSharedPtr instance = mAllInstances[i];
288 //std::cout << "Recording: " << instance->getName() << " ";
289  const Site* site = boost::any_cast<const Site*>(
290  instance->getAnnotation(ePlacerInstanceSitePtr));
291  std::string siteName = site->getName();
293  site->getTileIndex()).getName();
294 //std::cout << siteName << " " << tileName << std::endl;
295  instance->setSite(siteName);
296  instance->setTile(tileName);
297 
298  }
299  }
301  return mCost;
302  }
303  void updateCostFull(bool debug) {
304 
305  mCost = 0;
306  for (uint32 i = 0; i < mAllNets.size(); i++) {
307  NetSharedPtr net = mAllNets[i];
308  if (debug) std::cout << "net : " << net->getName() << std::endl;
309  if (net->getSourceCount() != 1 || net->getSinkCount() < 1) {
310  if (debug) std::cout << "\tEmpty!" << std::endl;
311  continue;
312  }
313  if (net->getNetType() != physical::eNetTypeNormal) {
314  //std::cout << "Net is not a normal net" << std::endl;
315  continue;
316  }
317  InstancePinSharedPtr pinPtr = *net->sourcesBegin();
318  InstanceSharedPtr instance = pinPtr->getInstancePtr().lock();
319  if (debug) std::cout << "\tsource instance: " << instance->getName() << std::endl;
320  const Site* site = boost::any_cast<const Site*>(instance->getAnnotation(
322  if (site == NULL) {
323  std::cout << instance->getName() << " doesn't have a site." << std::endl;
324  continue;
325  }
326  if (debug) std::cout << "\t\tsource instance site: " << site->getName()
327  << std::endl;
328 
329  uint32 sum = 0;
330 
331  // semiperimeter of bounding rectangle
332  uint32 row1 = mDevice.mDB.getTiles().getTileInfo(site->getTileIndex()).getRow();
333  uint32 col1 = mDevice.mDB.getTiles().getTileInfo(site->getTileIndex()).getCol();
334  uint32 row2 = row1;
335  uint32 col2 = col1;
336  InstancePinSharedPtrVector::iterator p = net->sinksBegin();
337  InstancePinSharedPtrVector::iterator e = net->sinksEnd();
338  for ( ; p != e; p++) {
339  instance = (*p)->getInstancePtr().lock();
340  if (debug) std::cout << "\tsink instance: " << instance->getName() << std::endl;
341  const Site* sinkSite = boost::any_cast<const Site*>(instance->getAnnotation(
343  if (sinkSite == NULL) {
344  std::cout << instance->getName() << " doesn't have a site (sink)."
345  << std::endl;
346  return;
347  }
348 
349  uint32 trow =
350  mDevice.mDB.getTiles().getTileInfo(sinkSite->getTileIndex()).getRow();
351  uint32 tcol =
352  mDevice.mDB.getTiles().getTileInfo(sinkSite->getTileIndex()).getCol();
353  if (trow < row1) row1 = trow;
354  if (tcol < col1) col1 = tcol;
355  if (trow > row2) row2 = trow;
356  if (tcol > col2) col2 = tcol;
357  }
358  if (debug) std::cout << "\t\tcost reported: " << sum << " / " << net->getSinkCount()
359  << " = " << ((float)sum / (float)net->getSinkCount()) << std::endl;
360  mCost += (row2 - row1) + (col2 - col1);
361  if (debug) std::cout << "\t\t" << mCost << std::endl;
362  }
363  std::cout << "updateCostFull: " << mCost << std::endl;
364  }
365  bool randomMove(bool debug) {
366  if (debug) std::cout << "randomMove: " << std::endl;
367  // pick a random instance - this will later be weighted
370  if (debug) std::cout << "\tselected inst: "
371  << mSelectedInstance->getName() << std::endl;
372  mDepartureSite = const_cast<Site*>(boost::any_cast<const Site*>(
373  mSelectedInstance->getAnnotation(ePlacerInstanceSitePtr)));
374  if (debug) std::cout << "\tdeparture site: " << mDepartureSite->getName() << std::endl;
376  if (debug) std::cout << "\tinstance type: " << instanceType << std::endl;
377  uint32 s = (*mTypeRandomGen[instanceType])();
378  if (debug) std::cout << "\tselected: " << s << " of "
379  << mCandidatesByType[instanceType].size() << std::endl;
380  mTargetSite = const_cast<Site*>(mCandidatesByType[instanceType][s]);
381  if (debug) std::cout << "\ttarget site: " << mTargetSite->getName() << std::endl;
382  SitePtrToInstanceSharedPtrMap::iterator p = mAssignedSites.find(mTargetSite);
384  if (p != mAssignedSites.end()) {
385  mEvictedInstance = p->second;
386  // we have an evicted instance and it needs to be checked for legal placement
388  uint32 departureSiteType = mSiteTypeLookup[mDepartureSite];
389  bool illegalMapping = true;
390  std::vector<uint32>& v = mDevice.mTypeMapping.getLegalSitesForInstance(evictedType);
391  for (uint32 i = 0; i < v.size(); i++) {
392  if (departureSiteType == v[i]) illegalMapping = false;
393  }
394  if (illegalMapping) return false;
395  }
396  if (debug) mEvictedInstance == 0 ? std::cout << "\tEMPTY " << std::endl
397  : std::cout << "\t" << mEvictedInstance->getName() << std::endl;
398 
399  // 4 things to update
400  if (debug) std::cout << "\tCost before move: " << mCost << std::endl;
402  if (debug) std::cout << "\tCost without instance nets: " << mCost << std::endl;
403 
405  const_cast<const Site*>(mTargetSite));
407  if (mEvictedInstance != 0) {
409  const_cast<const Site*>(mDepartureSite));
411  } else {
413  }
414 
416  if (debug) std::cout << "\tCost after move: " << mCost << std::endl;
417  return true;
418  }
419  void undoMove(bool debug) {
420  if (debug) {
421  std::cout << "undoMove: " << std::endl;
422  std::cout << "\tinstance: " << mSelectedInstance->getName() << std::endl;
423  std::cout << "\tdeparturesite: " << mDepartureSite->getName() << std::endl;
424  std::cout << "\ttargetsite: " << mTargetSite->getName() << std::endl;
425  if (mEvictedInstance != 0) std::cout << "\tevictedinstance: "
426  << mEvictedInstance->getName() << std::endl;
427  }
428 
430 
432  const_cast<const Site*>(mDepartureSite));
434 
435  if (mEvictedInstance != 0) {
437  const_cast<const Site*>(mTargetSite));
439  } else {
441  }
442 
444  }
445 
447  // remove cost contributed by all nets touched by the specified instances
448  updateCostHelper(inInstances, false);
449  }
451  // remove cost contributed by all nets touched by the specified instances
452  updateCostHelper(inInstance1, inInstance2, false);
453  }
455  // add cost contributed by all nets touched by the specified instances
456  updateCostHelper(inInstances, true);
457  }
458  void updateCostAddPair(InstanceSharedPtr inInstance1, InstanceSharedPtr inInstance2) {
459  // remove cost contributed by all nets touched by the specified instances
460  updateCostHelper(inInstance1, inInstance2, true);
461  }
462 
463  void updateCostHelper(InstanceSharedPtrVector& inInstances, bool addCost) {
466 
467  std::set<NetSharedPtr> modifiedNets;
468 
469  for ( ; p != e; p++) {
470  if ((*p) != 0) {
473  for ( ; q != f; q++) {
474  NetSharedPtr n = (*q).second->getParentWeakPtr().lock();
475  modifiedNets.insert(n);
476  }
477  }
478  }
479 
480  std::set<NetSharedPtr>::iterator r = modifiedNets.begin();
481  std::set<NetSharedPtr>::iterator g = modifiedNets.end();
482  for ( ; r != g; r++) {
483  addCost ? mCost += getNetCost(*r) : mCost -= getNetCost(*r);
484  }
485  }
486  void updateCostHelper(InstanceSharedPtr inInstance1, InstanceSharedPtr inInstance2,
487  bool addCost) {
488 
489  std::set<NetSharedPtr> modifiedNets;
490 
493 
494  if (inInstance1 != 0) {
495  q = inInstance1->pinsBegin();
496  f = inInstance1->pinsEnd();
497  for ( ; q != f; q++) {
498  NetSharedPtr n = (*q).second->getParentWeakPtr().lock();
499  modifiedNets.insert(n);
500  }
501  }
502  if (inInstance2 != 0) {
503  q = inInstance2->pinsBegin();
504  f = inInstance2->pinsEnd();
505  for ( ; q != f; q++) {
506  NetSharedPtr n = (*q).second->getParentWeakPtr().lock();
507  modifiedNets.insert(n);
508  }
509  }
510  std::set<NetSharedPtr>::iterator r = modifiedNets.begin();
511  std::set<NetSharedPtr>::iterator g = modifiedNets.end();
512  for ( ; r != g; r++) {
513  addCost ? mCost += getNetCost(*r) : mCost -= getNetCost(*r);
514  }
515  }
516 
518  uint32 returnCost = 0;
519 
520  if (mDebug) std::cout << "getNetCost - net : " << inNet->getName() << std::endl;
521  if (inNet->getSourceCount() != 1 || inNet->getSinkCount() < 1) {
522  if (mDebug) std::cout << "\tEmpty!" << std::endl;
523  return returnCost;
524  }
525  if (inNet->getNetType() != physical::eNetTypeNormal) {
526  //std::cout << "Net is not a normal net" << std::endl;
527  return returnCost;
528  }
529  InstancePinSharedPtr pinPtr = *inNet->sourcesBegin();
530  InstanceSharedPtr instance = pinPtr->getInstancePtr().lock();
531  if (mDebug) std::cout << "\tsource instance: " << instance->getName() << std::endl;
532  const Site* site = boost::any_cast<const Site*>(instance->getAnnotation(
534  if (site == NULL) {
535  std::cout << instance->getName() << " doesn't have a site." << std::endl;
536  return returnCost;
537  }
538  if (mDebug) std::cout << "\t\tsource instance site: " << site->getName()
539  << std::endl;
540 
541  uint32 sum = 0;
542 
543  // semiperimeter of bounding rectangle
544  uint32 row1 = mDevice.mDB.getTiles().getTileInfo(site->getTileIndex()).getRow();
545  uint32 col1 = mDevice.mDB.getTiles().getTileInfo(site->getTileIndex()).getCol();
546  uint32 row2 = row1;
547  uint32 col2 = col1;
548  InstancePinSharedPtrVector::iterator p = inNet->sinksBegin();
549  InstancePinSharedPtrVector::iterator e = inNet->sinksEnd();
550  for ( ; p != e; p++) {
551  instance = (*p)->getInstancePtr().lock();
552  if (mDebug) std::cout << "\tsink instance: " << instance->getName() << std::endl;
553  const Site* sinkSite = boost::any_cast<const Site*>(instance->getAnnotation(
555  if (sinkSite == NULL) {
556  std::cout << instance->getName() << " doesn't have a site (sink)."
557  << std::endl;
558  return returnCost;
559  }
560 
561  uint32 trow =
562  mDevice.mDB.getTiles().getTileInfo(sinkSite->getTileIndex()).getRow();
563  uint32 tcol =
564  mDevice.mDB.getTiles().getTileInfo(sinkSite->getTileIndex()).getCol();
565  if (trow < row1) row1 = trow;
566  if (tcol < col1) col1 = tcol;
567  if (trow > row2) row2 = trow;
568  if (tcol > col2) col2 = tcol;
569  }
570  if (mDebug) std::cout << "\t\tcost reported: " << sum << " / " << inNet->getSinkCount()
571  << " = " << ((float)sum / (float)inNet->getSinkCount()) << std::endl;
572  returnCost = (row2 - row1) + (col2 - col1);
573  if (mDebug) std::cout << "\t\t" << mCost << std::endl;
574 
575  return returnCost;
576  }
577 
578  }; // class Placement
579 } // namespace placer
580 } // namespace torc
581 
582 #endif // TORC_PLACER_PLACEMENT_HPP
ENetType
Enumeration of net power types.
Placement(DeviceWrapper &inDevice, DesignSharedPtr inDesign)
Definition: Placement.hpp:126
void updateCostRemoveInstances(InstanceSharedPtrVector &inInstances)
Definition: Placement.hpp:446
std::vector< InstanceSharedPtr > InstanceSharedPtrVector
Vector of Instance shared pointers.
boost::uint64_t uint64
Definition: Placement.hpp:50
std::vector< boost::uniform_int< uint32 > > mUniformTypeRanges
Definition: Placement.hpp:109
void updateCostAddInstances(InstanceSharedPtrVector &inInstances)
Definition: Placement.hpp:454
const PrimitiveDef * getPrimitiveDefPtr(void) const
Returns a pointer to the associated primitive definition.
Definition: Site.hpp:81
Header for Placer helper functions.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
physical::ENetType ENetType
Definition: Placement.hpp:52
Wrapper of the device database for placing the design.
architecture::DDB DDB
Definition: Placement.hpp:42
const Tiles & getTiles(void) const
Returns a constant reference to the family and device tile data.
Definition: DDB.hpp:146
std::vector< SitePtrVector > SitePtrVectorVector
Definition: Placement.hpp:46
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
DesignSharedPtr mDesign
Definition: Placement.hpp:79
InstancePinMap::iterator InstancePinSharedPtrIterator
Non-constant iterator to InstancePin shared pointers.
Encapsulation of primitive site definition, with associated connections, elements, and pins.
const std::string & getName(uint32 inIndex)
physical::NetSharedPtrVector NetSharedPtrVector
Definition: Placement.hpp:54
std::vector< uint32 > & getLegalInstancesForSite(uint32 inSiteTypeIndex)
std::vector< InstancePinSharedPtr > InstancePinSharedPtrVector
Vector of InstancePin shared pointers.
Wrapper of the Design for placing the design.
Definition: Placement.hpp:39
SitePtrVectorVector mCandidatesByType
Definition: Placement.hpp:88
physical::NetSharedPtr NetSharedPtr
Definition: Placement.hpp:53
uint32 getNetCost(NetSharedPtr inNet)
Definition: Placement.hpp:517
std::vector< InstanceSharedPtrVector > InstanceSharedPtrVectorVector
Definition: Placement.hpp:57
boost::uint32_t uint32
Definition: Placement.hpp:49
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
InstanceSharedPtr mSelectedInstance
Definition: Placement.hpp:120
boost::mt19937 mRandomSource
Definition: Placement.hpp:105
std::string string
boost::uniform_int< uint32 > mUniformInstanceRange
Definition: Placement.hpp:106
boost::variate_generator< mt19937 &, uinform_range > random_generator
Definition: Placement.hpp:67
InstanceSharedPtr mEvictedInstance
Definition: Placement.hpp:121
Encapsulation of a device logic site.
Definition: Site.hpp:30
physical::DesignSharedPtr DesignSharedPtr
Definition: Placement.hpp:48
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Header for the Design class.
physical::InstancePinSharedPtrVector InstancePinSharedPtrVector
Definition: Placement.hpp:59
const string & getName(void) const
Returns the site name.
Definition: Site.hpp:79
void updateCostFull(bool debug)
Definition: Placement.hpp:303
boost::unordered_map< InstanceSharedPtr, Site * > InstanceSharedPtrToSitePtrMap
Definition: Placement.hpp:63
std::vector< NetSharedPtr > NetSharedPtrVector
Vector of Net shared pointers.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
physical::InstanceSharedPtr InstanceSharedPtr
Definition: Placement.hpp:55
TileIndex getTileIndex(void) const
Returns the index of the containing tile.
Definition: Site.hpp:83
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
SiteTypeCount getSiteTypeCount(void) const
Returns the site type count for this family.
Definition: Sites.hpp:123
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
void updateCostRemovePair(InstanceSharedPtr inInstance1, InstanceSharedPtr inInstance2)
Definition: Placement.hpp:450
Header for the Placer related annotations.
physical::InstanceSharedPtrVector InstanceSharedPtrVector
Definition: Placement.hpp:56
boost::unordered_map< const Site *, InstanceSharedPtr > SitePtrToInstanceSharedPtrMap
Definition: Placement.hpp:62
SitePtrToInstanceSharedPtrMap mAssignedSites
Definition: Placement.hpp:92
SitePtrVectorVector mAllSitesByType
Definition: Placement.hpp:87
InstanceSharedPtrVector mAllInstances
Definition: Placement.hpp:95
SitePtrToIntMap mSiteTypeLookup
Definition: Placement.hpp:89
void updateCostAddPair(InstanceSharedPtr inInstance1, InstanceSharedPtr inInstance2)
Definition: Placement.hpp:458
architecture::Site Site
Definition: Placement.hpp:44
boost::uniform_int< uint32 > uinform_range
Definition: Placement.hpp:66
Header for the Placer class.
physical::InstancePinSharedPtr InstancePinSharedPtr
Definition: Placement.hpp:58
std::vector< const Site * > SitePtrVector
Definition: Placement.hpp:45
boost::unordered_map< const Site *, uint32 > SitePtrToIntMap
Definition: Placement.hpp:61
const architecture::Array< const Site > & mAllSites
Definition: Placement.hpp:86
InstanceSharedPtrVectorVector mAllInstancesByType
Definition: Placement.hpp:96
std::vector< boost::variate_generator< mt19937 &, boost::uniform_int< uint32 > > * > mTypeRandomGen
Definition: Placement.hpp:112
boost::mt19937 mt19937
Definition: Placement.hpp:65
const char * getName(void) const
Returns the name for this tile.
Definition: TileInfo.hpp:98
DeviceWrapper & mDevice
Definition: Placement.hpp:73
uint32 getTypeIndex(const std::string &inType)
Get the type index for a given type name, creates a new entry if not found.
void updateCostHelper(InstanceSharedPtr inInstance1, InstanceSharedPtr inInstance2, bool addCost)
Definition: Placement.hpp:486
PlacementSiteTypeMapping & mTypeMapping
boost::variate_generator< mt19937 &, boost::uniform_int< uint32 > > mInstanceRandomGen
Definition: Placement.hpp:107
Header for the DeviceWrapper class.
void undoMove(bool debug)
Definition: Placement.hpp:419
std::vector< uint32 > & getLegalSitesForInstance(uint32 inInstanceTypeIndex)
architecture::Sites Sites
Definition: Placement.hpp:43
Encapsulation of a static array.
Definition: Array.hpp:39
void updateCostHelper(InstanceSharedPtrVector &inInstances, bool addCost)
Definition: Placement.hpp:463
NetSharedPtrVector mAllNets
Definition: Placement.hpp:99
InstanceSharedPtrVector::iterator InstanceSharedPtrIterator
Non-constant iterator to Instance shared pointers.
Definition: Circuit.hpp:74
bool randomMove(bool debug)
Definition: Placement.hpp:365
boost::uint32_t getInstanceTypeIndex(physical::InstanceSharedPtr inInstance)
const string & getName(void) const
Returns the name of the primitive.