17 #ifndef KATABATIC_GCELL_H
18 #define KATABATIC_GCELL_H
25 #include "hurricane/DbU.h"
26 #include "hurricane/Point.h"
27 #include "hurricane/Box.h"
28 #include "hurricane/Interval.h"
29 #include "hurricane/ExtensionGo.h"
35 #include "crlcore/RoutingLayerGauge.h"
36 #include "katabatic/Constants.h"
37 #include "katabatic/AutoSegments.h"
46 using std::binary_function;
47 using Hurricane::_TName;
48 using Hurricane::Record;
54 using Hurricane::ExtensionGo;
62 enum GCellFunctionFlags { NoUpdate = 0x00000001 };
68 enum GCellFlag { GCellInvalidated = 0x00000001
69 , GCellSaturated = 0x00000002
70 , GCellUnderIoPad = 0x00000004
74 class GCell :
public ExtensionGo {
77 class CompareByIndex :
public binary_function<const GCell*,const GCell*,bool> {
79 bool operator() (
const GCell* lhs,
const GCell* rhs );
88 class CompareByKey :
public binary_function<const GCell*,const GCell*,bool> {
90 bool operator() (
const GCell* lhs,
const GCell* rhs );
98 inline Key (
GCell*,
unsigned int depth );
101 inline void update (
unsigned int depth );
102 friend bool operator< (
const Key&,
const Key& );
109 static bool areDensityConnex (
GCell* a,
GCell* b );
119 inline bool isUnderIoPad ()
const;
121 bool hasFreeTrack (
size_t depth,
float reserve )
const;
123 inline unsigned int getDepth ()
const;
124 inline unsigned int getIndex ()
const;
125 unsigned int getRow ()
const;
131 void getDensities (
float* )
const;
134 inline Point getCenter ()
const;
142 float getDensity (
unsigned int flags=0 )
const;
143 float getAverageHVDensity ()
const;
144 float getMaxHVDensity ()
const;
145 inline float getCDensity (
unsigned int flags=0 )
const;
146 inline float getWDensity (
unsigned int depth,
unsigned int flags=0 )
const;
151 inline const vector<AutoSegment*>&
getHSegments ()
const;
152 inline const vector<AutoSegment*>&
getVSegments ()
const;
153 inline const vector<AutoContact*>&
getContacts ()
const;
174 inline void updateKey (
unsigned int depth );
175 bool stepBalance (
unsigned int depth,
SetIndex& invalidateds );
179 ,
unsigned int flags=0 );
181 , set<Net*>& globalNets
183 inline void invalidateCt ();
184 inline void setUnderIoPad ();
185 void truncDensities ();
187 Record* _getRecord ()
const;
188 string _getString ()
const;
189 inline string _getTypeName ()
const;
190 void _xmlWrite ( ostream& o )
const;
194 static const Name _goName;
195 static size_t _allocateds;
200 vector<AutoSegment*> _vsegments;
201 vector<AutoSegment*> _hsegments;
202 vector<AutoContact*> _contacts;
209 float* _feedthroughs;
210 float* _fragmentations;
211 float* _globalsCount;
222 inline void _postCreate ();
223 inline void _preDestroy ();
239 inline bool GCell::isUnderIoPad ()
const {
return _flags&GCellUnderIoPad; }
243 inline Point GCell::getCenter ()
const {
return _box.
getCenter(); }
251 inline string GCell::_getTypeName ()
const {
return _TName(
"GCell"); }
252 inline void GCell::invalidateCt () { _flags |= GCellInvalidated; }
253 inline void GCell::setUnderIoPad() { _flags |= GCellUnderIoPad; }
279 {
return (depth<_depth) ? _blockages[depth] : 0; }
282 { invalidateCt(); _vsegments.push_back(segment); }
285 { invalidateCt(); _hsegments.push_back(segment); }
288 { invalidateCt(); _contacts.push_back(contact); }
292 inline bool GCell::CompareByIndex::operator() (
const GCell* lhs,
const GCell* rhs )
305 float difference = lhs._density - rhs._density;
306 if (difference != 0.0)
return (difference > 0.0);
320 inline bool empty ()
const;
321 inline size_t size ()
const;
322 inline const std::set<GCell*,GCell::CompareByKey>&
324 inline void insert (
GCell* );
325 inline void erase (
GCell* );
326 inline void unqueue (
GCell* );
330 std::set<GCell*,GCell::CompareByKey> _set;
347 string getVectorString (
float*,
size_t );
350 typedef std::vector<GCell*> GCellVector;
359 #endif // KATABATIC_GCELL_H
float getFeedthroughs(unsigned int depth) const
Definition: GCell.h:272
bool empty() const
Definition: GCell.h:335
GCell Density Comparison Functor.
Definition: GCell.h:81
void addContact(AutoContact *)
Definition: GCell.h:287
void insert(GCell *)
Definition: GCell.h:337
virtual void translate(const DbU::Unit &, const DbU::Unit &)
Definition: GCell.cpp:1272
AutoSegments getHStartSegments()
Definition: GCell.cpp:497
size_t getRoutingPads(set< RoutingPad * > &)
Definition: GCell.cpp:521
float getVCapacity() const
Definition: GCell.cpp:539
CompareByDensity(unsigned int depth)
Definition: GCell.cpp:271
float getWDensity(unsigned int depth, unsigned int flags=0) const
Definition: GCell.h:266
void updateContacts()
Definition: GCell.cpp:742
GCell * getRight() const
Definition: GCell.cpp:473
void rpDesaturate(set< Net * > &)
Definition: GCell.cpp:1102
AutoSegments getVStopSegments()
Definition: GCell.cpp:515
static DbU::Unit getTopRightShrink()
Definition: GCell.cpp:453
unsigned int getDepth() const
Definition: GCell.h:241
const DbU::Unit & getXMin() const
float getCDensity(unsigned int flags=0) const
Definition: GCell.h:263
AutoSegments getStopSegments(unsigned int direction)
Definition: GCell.h:260
void removeVSegment(AutoSegment *)
Definition: GCell.cpp:715
size_t updateDensity()
Definition: GCell.cpp:750
float getHCapacity() const
Definition: GCell.cpp:533
virtual const Name & getName() const
Definition: GCell.cpp:457
void erase(GCell *)
Definition: GCell.h:338
virtual Box getBoundingBox() const
Definition: GCell.cpp:1266
unsigned int getRow() const
Definition: GCell.cpp:461
GCell Grid.
Definition: GCellGrid.h:42
GCell Index Comparison Functor.
Definition: GCell.h:77
void removeContact(AutoContact *)
Definition: GCell.cpp:657
AutoSegments getStartSegments(unsigned int direction)
Definition: GCell.h:257
Routing Global Cell.
Definition: GCell.h:74
DbU::Unit getY() const
Definition: GCell.h:245
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
set< GCell *, CompareByIndex > SetIndex
Definition: GCell.h:105
bool checkEdgeSaturation(size_t hreserved, size_t vreserved) const
Definition: GCell.cpp:1034
Interval getSide(unsigned int) const
Definition: GCell.cpp:485
float getFragmentation(unsigned int depth) const
Definition: GCell.h:269
bool hasFreeTrack(size_t depth, float reserve) const
Definition: GCell.cpp:984
DbU::Unit getXMax() const
Definition: GCell.h:246
static const Name & getStaticName()
Definition: GCell.cpp:445
DbU::Unit getYMax() const
Definition: GCell.h:247
bool stepDesaturate(unsigned int depth, set< Net * > &, AutoSegment *&moved, unsigned int flags=0)
Definition: GCell.cpp:1130
AutoSegments getHStopSegments()
Definition: GCell.cpp:509
unsigned int getColumn() const
Definition: GCell.cpp:465
GCell * getDown() const
Definition: GCell.cpp:481
GCell * getUp() const
Definition: GCell.cpp:477
void update(unsigned int depth)
Definition: GCell.h:300
bool isValid() const
Definition: GCell.h:238
const DbU::Unit & getXMax() const
static size_t getAllocateds()
Definition: GCell.cpp:449
const Key & getKey() const
Definition: GCell.h:254
bool isSaturated() const
Definition: GCell.h:237
Definition: Constants.h:27
size_t checkDensity() const
Definition: GCell.cpp:938
size_t size() const
Definition: GCell.h:336
const vector< AutoSegment * > & getHSegments() const
Definition: GCell.h:249
float getDensity() const
Definition: GCell.h:298
unsigned int getIndex() const
Definition: GCell.h:242
const vector< AutoSegment * > & getVSegments() const
Definition: GCell.h:248
Key(GCell *, unsigned int depth)
Definition: GCell.h:297
void updateKey(unsigned int depth)
Definition: GCell.h:255
float getGlobalsCount(unsigned int depth) const
Definition: GCell.h:275
GCell Set, sorted by density.
Definition: GCell.h:315
GCell Key - Density Cache.
Definition: GCell.h:93
const DbU::Unit & getYMin() const
float getDensity(unsigned int flags=0) const
Definition: GCell.cpp:572
GCell * getLeft() const
Definition: GCell.cpp:469
DbU::Unit getX() const
Definition: GCell.h:244
DbU::Unit getBlockage(unsigned int depth) const
Definition: GCell.h:278
GCell * getGCell() const
Definition: GCell.h:299
const vector< AutoContact * > & getContacts() const
Definition: GCell.h:250
const std::set< GCell *, GCell::CompareByKey > & getGCells() const
Definition: GCell.h:340
GCellGrid * getGCellGrid() const
Definition: GCell.h:240
void unqueue(GCell *)
Definition: GCell.h:339
void addVSegment(AutoSegment *)
Definition: GCell.h:281
bool stepNetDesaturate(unsigned int depth, set< Net * > &globalNets, SetIndex &invalidateds)
Definition: GCell.cpp:1226
void addBlockage(unsigned int depth, DbU::Unit)
Definition: GCell.cpp:631
AutoSegments getVStartSegments()
Definition: GCell.cpp:503
void removeHSegment(AutoSegment *)
Definition: GCell.cpp:688
bool isAboveDensity(float threshold) const
Definition: GCell.cpp:400
void addHSegment(AutoSegment *)
Definition: GCell.h:284
const DbU::Unit & getYMax() const