# Katabatic - Routing Toolbox

AutoSegment.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | K a t a b a t i c - Routing Toolbox |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./katabatic/AutoSegment.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef KATABATIC_AUTOSEGMENT_H
18 #define KATABATIC_AUTOSEGMENT_H
19
20 #include <set>
21 #include <iostream>
22 #include <functional>
23 #include "hurricane/Interval.h"
24 #include "hurricane/Segment.h"
25 #include "hurricane/Components.h"
26 #include "hurricane/Contact.h"
27 namespace Hurricane {
28 class Layer;
29 class Horizontal;
30 class Vertical;
31 class Cell;
32 }
33 #include "crlcore/RoutingGauge.h"
34 #include "katabatic/Constants.h"
35 #include "katabatic/Observer.h"
36 #include "katabatic/GCell.h"
37 #include "katabatic/AutoSegments.h"
38 #include "katabatic/Session.h"
39
40
41 namespace Katabatic {
42
43
44 using std::set;
45 using std::cerr;
46 using std::endl;
47 using std::binary_function;
48 using Hurricane::tab;
49 using Hurricane::Interval;
50 using Hurricane::Layer;
51 using Hurricane::Components;
52 using Hurricane::Horizontal;
53 using Hurricane::Vertical;
54 using Hurricane::Cell;
55 using CRL::RoutingGauge;
56
57 class AutoHorizontal;
58 class AutoVertical;
59
60 // -------------------------------------------------------------------
61 // Class : "AutoSegment".
62
63 enum AutoSegmentFlag { SegNoFlags = 0x0
64 , SegHorizontal = (1<< 0)
65 , SegFixed = (1<< 1)
66 , SegGlobal = (1<< 2)
67 , SegWeakGlobal = (1<< 3)
68 , SegCanonical = (1<< 4)
69 , SegBipoint = (1<< 5)
70 , SegDogleg = (1<< 6)
71 , SegStrap = (1<< 7)
72 , SegSourceTop = (1<< 8)
73 , SegSourceBottom = (1<< 9)
74 , SegTargetTop = (1<<10)
75 , SegTargetBottom = (1<<11)
76 , SegIsReduced = (1<<12)
77 , SegLayerChange = (1<<13)
78 , SegSourceTerminal = (1<<14) // Replace Terminal.
79 , SegTargetTerminal = (1<<15) // Replace Terminal.
80 , SegStrongTerminal = SegSourceTerminal|SegTargetTerminal
81 , SegWeakTerminal1 = (1<<16) // Replace TopologicalEnd.
82 , SegWeakTerminal2 = (1<<17) // Replace TopologicalEnd.
83 , SegNotSourceAligned = (1<<18)
84 , SegNotTargetAligned = (1<<19)
85 , SegUnbound = (1<<20)
86 , SegHalfSlackened = (1<<21)
87 , SegSlackened = (1<<22)
88 , SegAxisSet = (1<<23)
89 , SegInvalidated = (1<<24)
90 , SegInvalidatedSource = (1<<25)
91 , SegInvalidatedTarget = (1<<26)
92 , SegInvalidatedLayer = (1<<27)
93 , SegCreated = (1<<28)
94 , SegUserDefined = (1<<29)
95 // Masks.
96 , SegWeakTerminal = SegStrongTerminal|SegWeakTerminal1|SegWeakTerminal2
97 , SegNotAligned = SegNotSourceAligned|SegNotTargetAligned
98 , SegSpinTop = SegSourceTop |SegTargetTop
99 , SegSpinBottom = SegSourceBottom |SegTargetBottom
100 , SegDepthSpin = SegSpinTop |SegSpinBottom
101 };
102
103
104 class AutoSegment {
105 friend class AutoHorizontal;
106 friend class AutoVertical;
107
108 public:
109 enum ObserverFlag { Create = 0x000000001
110 , Destroy = 0x000000002
111 , Invalidate = 0x000000004
112 , Revalidate = 0x000000008
113 , RevalidatePPitch = 0x000000010
114 };
115 public:
116 typedef std::function< void(AutoSegment*) > RevalidateCb_t;
117 public:
118 static void setDestroyMode ( bool );
119 static AutoSegment* create ( AutoContact* source
120 , AutoContact* target
121 , Segment* hurricaneSegment
122 );
123 static AutoSegment* create ( AutoContact* source
124 , AutoContact* target
125 , unsigned int dir
126 , size_t depth=RoutingGauge::nlayerdepth
127 );
128 void destroy ();
129 // Wrapped Segment Functions.
130 virtual Segment* base () const = 0;
131 virtual Segment* base () = 0;
132 virtual Horizontal* getHorizontal () { return NULL; };
133 virtual Vertical* getVertical () { return NULL; };
134 inline Cell* getCell () const;
135 inline Net* getNet () const;
136 inline const Layer* getLayer () const;
137 inline Box getBoundingBox () const;
138 inline Hook* getSourceHook ();
139 inline Hook* getTargetHook ();
140 inline Contact* getSource () const;
141 inline Contact* getTarget () const;
142 inline Component* getOppositeAnchor ( Component* ) const;
143 inline Components getAnchors () const;
144 virtual DbU::Unit getX () const;
145 virtual DbU::Unit getY () const;
146 inline DbU::Unit getWidth () const;
147 inline DbU::Unit getLength () const;
148 inline DbU::Unit getSourcePosition () const;
149 inline DbU::Unit getTargetPosition () const;
150 inline DbU::Unit getSourceX () const;
151 inline DbU::Unit getSourceY () const;
152 inline DbU::Unit getTargetX () const;
153 inline DbU::Unit getTargetY () const;
154 inline void invert ();
155 inline void setLayer ( const Layer* );
156 // Predicates.
157 inline bool isHorizontal () const;
158 inline bool isVertical () const;
159 inline bool isGlobal () const;
160 inline bool isWeakGlobal () const;
161 inline bool isLocal () const;
162 inline bool isFixed () const;
163 inline bool isBipoint () const;
164 inline bool isWeakTerminal () const;
165 inline bool isWeakTerminal1 () const;
166 inline bool isWeakTerminal2 () const;
167 inline bool isTerminal () const;
168 inline bool isNotSourceAligned () const;
169 inline bool isNotTargetAligned () const;
170 inline bool isNotAligned () const;
171 bool isStrongTerminal ( unsigned int flags=0 ) const;
172 inline bool isSourceTerminal () const;
173 inline bool isTargetTerminal () const;
174 inline bool isLayerChange () const;
175 inline bool isSpinTop () const;
176 inline bool isSpinBottom () const;
177 inline bool isSpinTopOrBottom () const;
178 inline bool isReduced () const;
179 inline bool isStrap () const;
180 inline bool isDogleg () const;
181 inline bool isUnbound () const;
182 inline bool isInvalidated () const;
183 inline bool isInvalidatedLayer () const;
184 inline bool isCreated () const;
185 inline bool isCanonical () const;
186 inline bool isUnsetAxis () const;
187 inline bool isSlackened () const;
188 inline bool isUserDefined () const;
189 bool isReduceCandidate () const;
190 bool isUTurn () const;
191 virtual bool _canSlacken () const = 0;
192 bool canReduce () const;
193 bool mustRaise () const;
194 unsigned int canDogleg ( Interval );
195 virtual bool canMoveULeft ( float reserve=0.0 ) const = 0;
196 virtual bool canMoveURight ( float reserve=0.0 ) const = 0;
197 bool canMoveUp ( float reserve=0.0, unsigned int flags=0 ) const;
198 bool canPivotUp ( float reserve=0.0, unsigned int flags=0 ) const;
199 bool canPivotDown ( float reserve=0.0, unsigned int flags=0 ) const;
200 bool canSlacken ( unsigned int flags=0 ) const;
201 virtual bool checkPositions () const = 0;
202 virtual bool checkConstraints () const = 0;
203 bool checkDepthSpin () const;
204 // Accessors.
205 template< typename T >
206 inline T* getObserver ();
207 inline unsigned long getId () const;
208 inline unsigned int getFlags () const;
209 virtual unsigned int getDirection () const = 0;
210 inline GCell* getGCell () const;
211 virtual size_t getGCells ( vector<GCell*>& ) const = 0;
212 inline AutoContact* getAutoSource () const;
213 inline AutoContact* getAutoTarget () const;
214 AutoContact* getOppositeAnchor ( AutoContact* ) const;
215 size_t getPerpandicularsBound ( set<AutoSegment*>& );
216 inline AutoSegment* getParent () const;
217 inline unsigned int getDepth () const;
218 inline DbU::Unit getPitch () const;
219 DbU::Unit getPPitch () const;
220 inline DbU::Unit getAxis () const;
221 virtual DbU::Unit getSourceU () const = 0;
222 virtual DbU::Unit getTargetU () const = 0;
223 virtual DbU::Unit getDuSource () const = 0;
224 virtual DbU::Unit getDuTarget () const = 0;
225 inline DbU::Unit getOrigin () const;
226 inline DbU::Unit getExtremity () const;
227 virtual Interval getSpanU () const = 0;
228 Interval getMinSpanU () const;
229 virtual Interval getSourceConstraints ( unsigned int flags=0 ) const = 0;
230 virtual Interval getTargetConstraints ( unsigned int flags=0 ) const = 0;
231 virtual bool getConstraints ( DbU::Unit& min, DbU::Unit& max ) const = 0;
232 inline bool getConstraints ( Interval& i ) const;
233 inline const Interval& getUserConstraints () const;
234 virtual DbU::Unit getSlack () const;
235 inline DbU::Unit getOptimalMin () const;
236 inline DbU::Unit getOptimalMax () const;
237 Interval& getOptimal ( Interval& i ) const;
238 virtual DbU::Unit getCost ( DbU::Unit axis ) const;
239 virtual AutoSegment* getCanonical ( DbU::Unit& min , DbU::Unit& max );
240 inline AutoSegment* getCanonical ( Interval& i );
241 float getMaxUnderDensity ( unsigned int flags );
242 // Modifiers.
243 inline void addObserver ( BaseObserver* );
244 inline void removeObserver ( BaseObserver* );
245 inline void unsetFlags ( unsigned int );
246 inline void setFlags ( unsigned int );
247 void setFlagsOnAligneds ( unsigned int );
248 inline void incReduceds ();
249 inline void decReduceds ();
250 virtual void setDuSource ( DbU::Unit du ) = 0;
251 virtual void setDuTarget ( DbU::Unit du ) = 0;
252 void computeTerminal ();
253 virtual void updateOrient () = 0;
254 virtual void updatePositions () = 0;
255 void updateSourceSpin ();
256 void updateTargetSpin ();
257 void sourceDetach ();
258 void targetDetach ();
259 void sourceAttach ( AutoContact* );
260 void targetAttach ( AutoContact* );
261 //inline void mergeUserConstraints ( const Interval& );
262 void mergeUserConstraints ( const Interval& );
263 inline void resetUserConstraints ();
264 inline void setOptimalMin ( DbU::Unit min );
265 inline void setOptimalMax ( DbU::Unit max );
266 bool checkNotInvalidated () const;
267 inline void setParent ( AutoSegment* );
268 void revalidate ();
269 AutoSegment* makeDogleg ( AutoContact* );
270 unsigned int makeDogleg ( Interval, unsigned int flags=KbNoFlags );
271 unsigned int makeDogleg ( GCell*, unsigned int flags=KbNoFlags );
272 virtual unsigned int _makeDogleg ( GCell*, unsigned int flags ) = 0;
273 virtual bool moveULeft () = 0;
274 virtual bool moveURight () = 0;
275 bool slacken ( unsigned int flags );
276 virtual bool _slacken ( unsigned int flags ) = 0;
277 void _changeDepth ( unsigned int depth, unsigned int flags );
278 void changeDepth ( unsigned int depth, unsigned int flags );
279 bool moveUp ( unsigned int flags=KbNoFlags );
280 bool moveDown ( unsigned int flags=KbNoFlags );
281 bool reduceDoglegLayer ();
282 bool reduce ();
283 bool raise ();
284 // Canonical Modifiers.
285 AutoSegment* canonize ( unsigned int flags=KbNoFlags );
286 virtual void invalidate ( unsigned int flags=KbPropagate );
287 void invalidate ( AutoContact* );
288 void computeOptimal ( set<AutoSegment*>& processeds );
289 void setAxis ( DbU::Unit, unsigned int flags=KbNoFlags );
290 bool toConstraintAxis ( unsigned int flags=KbRealignate );
291 bool toOptimalAxis ( unsigned int flags=KbRealignate );
292 // Collections & Filters.
293 AutoSegments getOnSourceContact ( unsigned int direction );
294 AutoSegments getOnTargetContact ( unsigned int direction );
295 AutoSegments getCachedOnSourceContact ( unsigned int direction );
296 AutoSegments getCachedOnTargetContact ( unsigned int direction );
297 AutoSegments getAligneds ( unsigned int flags=KbNoFlags );
298 AutoSegments getPerpandiculars ();
299 size_t getAlignedContacts ( map<AutoContact*,int>& ) const ;
300 // Inspector Management.
301 virtual Record* _getRecord () const = 0;
302 virtual string _getString () const = 0;
303 virtual string _getTypeName () const = 0;
304 // Non-reviewed atomic modifiers.
305 bool _check () const;
306 #if THIS_IS_DISABLED
307 virtual void desalignate ( AutoContact* ) = 0;
308 bool shearUp ( GCell*
309 , AutoSegment*& movedUp
310 , float reserve
311 , unsigned int flags );
312 #endif
313
314 protected:
315 // Internal: Static Attributes.
316 static size_t _allocateds;
317 static size_t _globalsCount;
318 static bool _destroyBase;
319 static bool _destroyTool;
320 static unsigned long _maxId;
321 // Internal: Attributes.
322 GCell* _gcell;
323 const unsigned long _id;
324 unsigned int _flags;
325 unsigned int _depth : 8;
326 unsigned int _optimalMin : 8;
327 unsigned int _optimalMax : 8;
328 unsigned int _reduceds : 2;
329 DbU::Unit _sourcePosition;
330 DbU::Unit _targetPosition;
331 Interval _userConstraints;
332 AutoSegment* _parent;
333 Observable _observers;
334
335 // Internal: Constructors & Destructors.
336 protected:
337 AutoSegment ( Segment* segment );
338 virtual ~AutoSegment ();
339 static void _preCreate ( AutoContact* source, AutoContact* target );
340 virtual void _postCreate ();
341 virtual void _preDestroy ();
342 private:
343 AutoSegment ( const AutoSegment& );
344 AutoSegment& operator= ( const AutoSegment& );
345 protected:
346 void _invalidate ();
347 inline unsigned int _getFlags () const;
348 std::string _getStringFlags () const;
349 virtual void _setAxis ( DbU::Unit ) = 0;
350
351 public:
352 struct CompareId : public binary_function<AutoSegment*,AutoSegment*,bool> {
353 inline bool operator() ( const AutoSegment* lhs, const AutoSegment* rhs ) const;
354 };
355 public:
356 struct CompareByDepthLength : public binary_function<AutoSegment*,AutoSegment*,bool> {
357 bool operator() ( AutoSegment* lhs, AutoSegment* rhs ) const;
358 };
359 public:
360 struct CompareByDepthAxis : public binary_function<AutoSegment*,AutoSegment*,bool> {
361 bool operator() ( AutoSegment* lhs, AutoSegment* rhs ) const;
362 };
363 public:
364 typedef std::set<AutoSegment*,CompareByDepthLength> DepthLengthSet;
365
366 // Static Utilities.
367 public:
368 static inline bool areAlignedsAndDiffLayer ( AutoSegment*, AutoSegment* );
369 static bool isTopologicalBound ( AutoSegment* seed, unsigned int flags );
370 static inline bool arePerpandiculars ( AutoSegment* a, AutoSegment* b );
371 static inline bool arePerpandiculars ( bool isHorizontalA, AutoSegment* b );
372 static inline bool areAligneds ( AutoSegment* a, AutoSegment* b );
373 static unsigned int getPerpandicularState ( AutoContact* contact
374 , AutoSegment* source
375 , AutoSegment* current
376 , bool isHorizontalMaster
377 , const Layer* masterLayer=NULL
378 );
379 static inline unsigned int getPerpandicularState ( AutoContact* contact
380 , AutoSegment* source
381 , AutoSegment* current
382 , AutoSegment* master
383 );
384 static void getTopologicalInfos ( AutoSegment* seed
385 , vector<AutoSegment*>& collapseds
386 , vector<AutoSegment*>& perpandiculars
387 , DbU::Unit& leftBound
388 , DbU::Unit& rightBound
389 );
390 static int getTerminalCount ( AutoSegment* seed
391 , vector<AutoSegment*>& collapseds
392 );
393 static inline int getTerminalCount ( AutoSegment* seed );
394 static inline size_t getGlobalsCount ();
395 static inline size_t getAllocateds ();
396 static inline unsigned long getMaxId ();
397 };
398
399
400 // Inline Functions.
401 inline void AutoSegment::addObserver ( BaseObserver* observer ) { _observers.addObserver(observer); }
402 inline void AutoSegment::removeObserver ( BaseObserver* observer ) { _observers.removeObserver(observer); }
403 inline unsigned long AutoSegment::getId () const { return _id; }
404 inline Cell* AutoSegment::getCell () const { return base()->getCell(); }
405 inline Net* AutoSegment::getNet () const { return base()->getNet(); }
406 inline const Layer* AutoSegment::getLayer () const { return base()->getLayer(); }
407 inline Box AutoSegment::getBoundingBox () const { return base()->getBoundingBox(); }
408 inline Hook* AutoSegment::getSourceHook () { return base()->getSourceHook(); }
409 inline Hook* AutoSegment::getTargetHook () { return base()->getTargetHook(); }
410 inline Contact* AutoSegment::getSource () const { return static_cast<Contact*>(base()->getSource()); }
411 inline Contact* AutoSegment::getTarget () const { return static_cast<Contact*>(base()->getTarget()); }
412 inline Component* AutoSegment::getOppositeAnchor ( Component* anchor ) const { return base()->getOppositeAnchor(anchor); };
413 inline AutoSegment* AutoSegment::getParent () const { return _parent; }
414 inline DbU::Unit AutoSegment::getSourcePosition () const { return _sourcePosition; }
415 inline DbU::Unit AutoSegment::getTargetPosition () const { return _targetPosition; }
416 inline DbU::Unit AutoSegment::getSourceX () const { return base()->getSourceX(); }
417 inline DbU::Unit AutoSegment::getSourceY () const { return base()->getSourceY(); }
418 inline DbU::Unit AutoSegment::getTargetX () const { return base()->getTargetX(); }
419 inline DbU::Unit AutoSegment::getTargetY () const { return base()->getTargetY(); }
420 inline DbU::Unit AutoSegment::getWidth () const { return base()->getWidth(); }
421 inline DbU::Unit AutoSegment::getLength () const { return base()->getLength(); }
422 inline void AutoSegment::invert () { base()->invert(); }
423 inline GCell* AutoSegment::getGCell () const { return _gcell; }
424 inline AutoContact* AutoSegment::getAutoSource () const { return Session::lookup(getSource()); }
425 inline AutoContact* AutoSegment::getAutoTarget () const { return Session::lookup(getTarget()); }
426 inline bool AutoSegment::getConstraints ( Interval& i ) const { return getConstraints(i.getVMin(),i.getVMax()); }
427 inline AutoSegment* AutoSegment::getCanonical ( Interval& i ) { return getCanonical(i.getVMin(),i.getVMax()); }
428 inline unsigned int AutoSegment::getDepth () const { return _depth; }
429 inline DbU::Unit AutoSegment::getPitch () const { return Session::getPitch(getDepth(),Configuration::NoFlags); }
430 inline DbU::Unit AutoSegment::getAxis () const { return isHorizontal()?base()->getY():base()->getX(); }
431 inline DbU::Unit AutoSegment::getOrigin () const { return isHorizontal()?_gcell->getY():_gcell->getX(); }
432 inline DbU::Unit AutoSegment::getExtremity () const { return isHorizontal()?_gcell->getYMax():_gcell->getXMax(); }
433 inline DbU::Unit AutoSegment::getOptimalMin () const { return DbU::lambda(_optimalMin) + getOrigin(); }
434 inline DbU::Unit AutoSegment::getOptimalMax () const { return DbU::lambda(_optimalMax) + getOrigin(); }
435 inline const Interval& AutoSegment::getUserConstraints () const { return _userConstraints; }
436
437 inline bool AutoSegment::isHorizontal () const { return _flags & SegHorizontal; }
438 inline bool AutoSegment::isVertical () const { return not (_flags & SegHorizontal); }
439 inline bool AutoSegment::isFixed () const { return _flags & SegFixed; }
440 inline bool AutoSegment::isGlobal () const { return _flags & SegGlobal; }
441 inline bool AutoSegment::isWeakGlobal () const { return _flags & SegWeakGlobal; }
442 inline bool AutoSegment::isLocal () const { return not (_flags & SegGlobal); }
443 inline bool AutoSegment::isBipoint () const { return _flags & SegBipoint; }
444 inline bool AutoSegment::isWeakTerminal () const { return _flags & SegWeakTerminal; }
445 inline bool AutoSegment::isWeakTerminal1 () const { return _flags & SegWeakTerminal1; }
446 inline bool AutoSegment::isWeakTerminal2 () const { return _flags & SegWeakTerminal2; }
447 inline bool AutoSegment::isSourceTerminal () const { return _flags & SegSourceTerminal; }
448 inline bool AutoSegment::isTargetTerminal () const { return _flags & SegTargetTerminal; }
449 inline bool AutoSegment::isTerminal () const { return _flags & SegStrongTerminal; }
450 inline bool AutoSegment::isNotSourceAligned () const { return _flags & SegNotSourceAligned; }
451 inline bool AutoSegment::isNotTargetAligned () const { return _flags & SegNotTargetAligned; }
452 inline bool AutoSegment::isNotAligned () const { return (_flags & SegNotAligned) == SegNotAligned; }
453 inline bool AutoSegment::isDogleg () const { return _flags & SegDogleg ; }
454 inline bool AutoSegment::isUnbound () const { return _flags & SegUnbound ; }
455 inline bool AutoSegment::isStrap () const { return _flags & SegStrap; }
456 inline bool AutoSegment::isLayerChange () const { return _flags & SegLayerChange; }
457 inline bool AutoSegment::isSpinTop () const { return ((_flags & SegSpinTop ) == SegSpinTop); }
458 inline bool AutoSegment::isSpinBottom () const { return ((_flags & SegSpinBottom) == SegSpinBottom); }
459 inline bool AutoSegment::isSpinTopOrBottom () const { return isSpinTop() or isSpinBottom(); }
460 inline bool AutoSegment::isReduced () const { return _flags & SegIsReduced; }
461 inline bool AutoSegment::isSlackened () const { return _flags & SegSlackened; }
462 inline bool AutoSegment::isCanonical () const { return _flags & SegCanonical; }
463 inline bool AutoSegment::isUnsetAxis () const { return not (_flags & SegAxisSet); }
464 inline bool AutoSegment::isInvalidated () const { return _flags & SegInvalidated; }
465 inline bool AutoSegment::isInvalidatedLayer () const { return _flags & SegInvalidatedLayer; }
466 inline bool AutoSegment::isCreated () const { return _flags & SegCreated; }
467 inline bool AutoSegment::isUserDefined () const { return _flags & SegUserDefined; }
468 inline void AutoSegment::setFlags ( unsigned int flags ) { _flags |= flags; }
469 inline void AutoSegment::unsetFlags ( unsigned int flags ) { _flags &= ~flags; }
470
471 inline unsigned int AutoSegment::getFlags () const { return _flags; }
472 inline unsigned int AutoSegment::_getFlags () const { return _flags; }
473 inline void AutoSegment::incReduceds () { if (_reduceds<3) ++_reduceds; }
474 inline void AutoSegment::decReduceds () { if (_reduceds>0) --_reduceds; }
475 inline void AutoSegment::setLayer ( const Layer* layer ) { base()->setLayer(layer); _depth=Session::getLayerDepth(layer); }
476 inline void AutoSegment::setOptimalMin ( DbU::Unit min ) { _optimalMin = (unsigned int)DbU::getLambda(min-getOrigin()); }
477 inline void AutoSegment::setOptimalMax ( DbU::Unit max ) { _optimalMax = (unsigned int)DbU::getLambda(max-getOrigin()); }
478 //inline void AutoSegment::mergeUserConstraints ( const Interval& constraints ) { _userConstraints.intersection(constraints); }
479 inline void AutoSegment::resetUserConstraints () { _userConstraints = Interval(false); }
480
481 inline void AutoSegment::setParent ( AutoSegment* parent )
482 {
483 if ( parent == this ) {
484 cerr << "Parentage Looping: " << parent->_getString() << endl;
485 }
486 _parent = parent;
487 }
488
489 template< typename T >
490 inline T* AutoSegment::getObserver () { return _observers.getObserver<T>(); }
491
492
493 inline bool AutoSegment::CompareId::operator() ( const AutoSegment* lhs, const AutoSegment* rhs ) const
494 { return lhs->getId() < rhs->getId(); }
495
496 inline unsigned long AutoSegment::getMaxId ()
497 { return _maxId; }
498
499 inline bool AutoSegment::areAlignedsAndDiffLayer ( AutoSegment* s1, AutoSegment* s2 )
500 { return s1 and s2
501 and (s1->isHorizontal() == s2->isHorizontal())
502 and (s1->getLayer() != s2->getLayer()); }
503
504 inline bool AutoSegment::arePerpandiculars ( AutoSegment* a, AutoSegment* b )
505 { return a and b and (a->isHorizontal() != b->isHorizontal()); }
506
507 inline bool AutoSegment::arePerpandiculars ( bool isHorizontalA, AutoSegment* b )
508 { return b and (isHorizontalA != b->isHorizontal()); }
509
510 inline bool AutoSegment::areAligneds ( AutoSegment* a, AutoSegment* b )
511 { return a and b and (a->isHorizontal() == b->isHorizontal()); }
512
513 inline unsigned int AutoSegment::getPerpandicularState ( AutoContact* contact
514 , AutoSegment* source
515 , AutoSegment* current
516 , AutoSegment* master )
517 {
518 return getPerpandicularState ( contact, source, current, master->isHorizontal(), master->getLayer() );
519 }
520
521
522 inline int AutoSegment::getTerminalCount ( AutoSegment* seed )
523 {
524 cdebug_log(145,0) << "getTerminalCount() - " << seed << endl;
525
526 vector<AutoSegment*> collapseds;
527 vector<AutoSegment*> perpandiculars;
528 DbU::Unit leftBound;
529 DbU::Unit rightBound;
530
531 getTopologicalInfos ( seed
532 , collapseds
533 , perpandiculars
534 , leftBound
535 , rightBound
536 );
537
538 return getTerminalCount ( seed, collapseds );
539 }
540
541
542 inline size_t AutoSegment::getGlobalsCount () { return _globalsCount; }
543 inline size_t AutoSegment::getAllocateds () { return _allocateds; }
544
545
546 } // End of Katabatic namespace.
547
548
549 INSPECTOR_P_SUPPORT(Katabatic::AutoSegment);
550
551
552 # endif // KATABATIC_AUTOSEGMENT_H
Katabatic::AutoSegment::getPerpandicularsBound
size_t getPerpandicularsBound(set< AutoSegment *> &)
Definition: AutoSegment.cpp:1130
Katabatic::Observable::removeObserver
void removeObserver(BaseObserver *)
Definition: Observer.h:103
Katabatic::AutoSegment::isSlackened
bool isSlackened() const
Definition: AutoSegment.h:461
Katabatic::GCell::getY
DbU::Unit getY() const
Definition: GCell.h:245
Hurricane::Interval::getVMax
const DbU::Unit & getVMax() const
Katabatic::AutoSegment::isInvalidated
bool isInvalidated() const
Definition: AutoSegment.h:464
Katabatic::AutoSegment::slacken
bool slacken(unsigned int flags)
Definition: AutoSegment.cpp:1346
Katabatic::AutoSegment::getNet
Net * getNet() const
Definition: AutoSegment.h:405
Katabatic::AutoSegment::getOrigin
DbU::Unit getOrigin() const
Definition: AutoSegment.h:431
Katabatic::AutoSegment::canSlacken
bool canSlacken(unsigned int flags=0) const
Definition: AutoSegment.cpp:1329
Katabatic::SegGlobal
Definition: AutoSegment.h:66
Katabatic::AutoSegment::getVertical
virtual Vertical * getVertical()
Definition: AutoSegment.h:133
Katabatic::AutoSegment::isDogleg
bool isDogleg() const
Definition: AutoSegment.h:453
Hurricane::Interval::getVMin
const DbU::Unit & getVMin() const
Katabatic::KbRealignate
Definition: Constants.h:24
Katabatic::AutoSegment::reduceDoglegLayer
bool reduceDoglegLayer()
Definition: AutoSegment.cpp:1596
Katabatic::AutoSegment::base
virtual Segment * base() const =0
Katabatic::SegTargetBottom
Definition: AutoSegment.h:75
Hurricane::Segment::getSourceX
virtual DbU::Unit getSourceX() const=0
Hurricane::Component::getNet
Net * getNet() const
Katabatic::AutoSegment::getSourceX
DbU::Unit getSourceX() const
Definition: AutoSegment.h:416
Hurricane::DbU::lambda
static Unit lambda(double value)
Hurricane::Segment::getTargetY
virtual DbU::Unit getTargetY() const=0
Hurricane::Segment::getTarget
Component * getTarget() const
Katabatic::AutoSegment::getSourceHook
Hook * getSourceHook()
Definition: AutoSegment.h:408
Katabatic::AutoSegment::isSpinBottom
bool isSpinBottom() const
Definition: AutoSegment.h:458
Katabatic::AutoSegment::moveULeft
virtual bool moveULeft()=0
Katabatic::AutoSegment::_getFlags
unsigned int _getFlags() const
Definition: AutoSegment.h:472
Katabatic::AutoSegment::moveURight
virtual bool moveURight()=0
Hurricane::Component
Katabatic::AutoSegment::setLayer
void setLayer(const Layer *)
Definition: AutoSegment.h:475
Katabatic::AutoSegment::canPivotUp
bool canPivotUp(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1398
Katabatic::AutoSegment::getSource
Contact * getSource() const
Definition: AutoSegment.h:410
Katabatic::AutoSegment::_makeDogleg
virtual unsigned int _makeDogleg(GCell *, unsigned int flags)=0
Hurricane::Component::getX
virtual DbU::Unit getX() const=0
Katabatic::AutoSegment::isCreated
bool isCreated() const
Definition: AutoSegment.h:466
Katabatic::SegSlackened
Definition: AutoSegment.h:87
Katabatic::AutoSegment::getUserConstraints
const Interval & getUserConstraints() const
Definition: AutoSegment.h:435
Hurricane::Segment::setLayer
void setLayer(const Layer *layer)
Katabatic::AutoHorizontal
Concrete Horizontal AutoSegment.
Definition: AutoHorizontal.h:31
Hurricane::Segment::getSourceHook
Hook * getSourceHook()
Katabatic::AutoSegment::toOptimalAxis
bool toOptimalAxis(unsigned int flags=KbRealignate)
Definition: AutoSegment.cpp:804
Hurricane::Segment::getSource
Component * getSource() const
Katabatic::AutoSegment::getOptimal
Interval & getOptimal(Interval &i) const
Definition: AutoSegment.cpp:399
Katabatic::AutoSegment::isUnsetAxis
bool isUnsetAxis() const
Definition: AutoSegment.h:463
Katabatic::AutoSegment::getWidth
DbU::Unit getWidth() const
Definition: AutoSegment.h:420
Hurricane::Component::getLayer
virtual const Layer * getLayer() const=0
Katabatic::AutoSegment::resetUserConstraints
void resetUserConstraints()
Definition: AutoSegment.h:479
Katabatic::AutoSegment::getOppositeAnchor
Component * getOppositeAnchor(Component *) const
Definition: AutoSegment.h:412
Hurricane::Contact
Katabatic::AutoSegment::create
static AutoSegment * create(AutoContact *source, AutoContact *target, Segment *hurricaneSegment)
Definition: AutoSegment.cpp:1988
Hurricane::DbU::Unit
std::int64_t Unit
Katabatic::AutoSegment::isSpinTop
bool isSpinTop() const
Definition: AutoSegment.h:457
Katabatic::AutoSegment::getSpanU
virtual Interval getSpanU() const =0
Katabatic::SegNotTargetAligned
Definition: AutoSegment.h:84
Katabatic::AutoSegment::getTargetPosition
DbU::Unit getTargetPosition() const
Definition: AutoSegment.h:415
Katabatic::AutoSegmentFlag
AutoSegmentFlag
Definition: AutoSegment.h:63
Katabatic::AutoSegment::getTargetY
DbU::Unit getTargetY() const
Definition: AutoSegment.h:419
Katabatic::SegIsReduced
Definition: AutoSegment.h:76
Hurricane::Segment::invert
void invert()
Hurricane::Cell
CRL::RoutingGauge
Hurricane::Horizontal
Katabatic::AutoSegment::revalidate
void revalidate()
Definition: AutoSegment.cpp:457
Katabatic::AutoSegment::canMoveUp
bool canMoveUp(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1493
Katabatic::AutoSegment::invalidate
virtual void invalidate(unsigned int flags=KbPropagate)
Definition: AutoSegment.cpp:416
Katabatic::AutoSegment::canMoveULeft
virtual bool canMoveULeft(float reserve=0.0) const =0
Katabatic::AutoSegment::getTargetConstraints
virtual Interval getTargetConstraints(unsigned int flags=0) const =0
Katabatic::AutoSegment::isInvalidatedLayer
bool isInvalidatedLayer() const
Definition: AutoSegment.h:465
Katabatic::Observable
Observer Design Pattern, Subject part.
Definition: Observer.h:69
Katabatic::AutoSegment::isStrongTerminal
bool isStrongTerminal(unsigned int flags=0) const
Definition: AutoSegment.cpp:513
Katabatic::AutoSegment::AutoSegment
AutoSegment(Segment *segment)
Definition: AutoSegment.cpp:311
Katabatic::SegNotSourceAligned
Definition: AutoSegment.h:83
Katabatic::AutoSegment::checkPositions
virtual bool checkPositions() const =0
Katabatic::SegInvalidated
Definition: AutoSegment.h:89
Hurricane::Vertical
Hurricane::Interval
Katabatic::AutoSegment::getOnSourceContact
AutoSegments getOnSourceContact(unsigned int direction)
Definition: AutoSegment.cpp:610
Katabatic::AutoSegment::~AutoSegment
virtual ~AutoSegment()
Definition: AutoSegment.cpp:380
Katabatic::AutoSegment::getId
unsigned long getId() const
Definition: AutoSegment.h:403
Katabatic::AutoSegment::getCell
Cell * getCell() const
Definition: AutoSegment.h:404
Katabatic::SegNotAligned
Definition: AutoSegment.h:97
Katabatic::AutoSegment::getSourceConstraints
virtual Interval getSourceConstraints(unsigned int flags=0) const =0
Katabatic::SegWeakGlobal
Definition: AutoSegment.h:67
Katabatic::Session::lookup
static AutoContact * lookup(Contact *)
Definition: Session.cpp:384
Katabatic::SegCanonical
Definition: AutoSegment.h:68
Katabatic::GCell
Routing Global Cell.
Definition: GCell.h:74
Katabatic::AutoSegment
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
Katabatic::SegInvalidatedLayer
Definition: AutoSegment.h:92
Hurricane::GenericCollection
Katabatic::AutoSegment::setDuSource
virtual void setDuSource(DbU::Unit du)=0
Katabatic::AutoSegment::_preCreate
static void _preCreate(AutoContact *source, AutoContact *target)
Definition: AutoSegment.cpp:343
Katabatic::AutoSegment::setFlags
void setFlags(unsigned int)
Definition: AutoSegment.h:468
Katabatic::AutoSegment::isLocal
bool isLocal() const
Definition: AutoSegment.h:442
anonymous_namespace{LoadGrByNet.cpp}::NoFlags
Definition: LoadGrByNet.cpp:405
Hurricane::Segment::getSourceY
virtual DbU::Unit getSourceY() const=0
Katabatic::SegSourceBottom
Definition: AutoSegment.h:73
Katabatic::KbPropagate
Definition: Constants.h:38
Katabatic::SegDogleg
Definition: AutoSegment.h:70
Hurricane::Component::getY
virtual DbU::Unit getY() const=0
Katabatic::AutoSegment::_preDestroy
virtual void _preDestroy()
Definition: AutoSegment.cpp:368
Katabatic::AutoSegment::getLength
DbU::Unit getLength() const
Definition: AutoSegment.h:421
Katabatic::AutoSegment::getGCells
virtual size_t getGCells(vector< GCell *> &) const =0
Katabatic::AutoSegment::toConstraintAxis
bool toConstraintAxis(unsigned int flags=KbRealignate)
Definition: AutoSegment.cpp:766
Katabatic::AutoSegment::getTargetHook
Hook * getTargetHook()
Definition: AutoSegment.h:409
Hurricane::Hook
Katabatic::AutoSegment::canPivotDown
bool canPivotDown(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1446
Katabatic
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
Katabatic::AutoSegment::mustRaise
bool mustRaise() const
Definition: AutoSegment.cpp:1233
Katabatic::AutoSegment::computeOptimal
void computeOptimal(set< AutoSegment *> &processeds)
Definition: AutoSegment.cpp:903
Katabatic::AutoSegment::getDuTarget
virtual DbU::Unit getDuTarget() const =0
Katabatic::AutoSegment::reduce
bool reduce()
Definition: AutoSegment.cpp:1218
Katabatic::AutoSegment::mergeUserConstraints
void mergeUserConstraints(const Interval &)
Definition: AutoSegment.cpp:758
Katabatic::AutoSegment::getCanonical
virtual AutoSegment * getCanonical(DbU::Unit &min, DbU::Unit &max)
Definition: AutoSegment.cpp:559
Katabatic::SegWeakTerminal
Definition: AutoSegment.h:96
Hurricane::Box
Katabatic::AutoSegment::getAnchors
Components getAnchors() const
Katabatic::SegTargetTop
Definition: AutoSegment.h:74
Katabatic::AutoSegment::getSourcePosition
DbU::Unit getSourcePosition() const
Definition: AutoSegment.h:414
Katabatic::AutoSegment::computeTerminal
void computeTerminal()
Definition: AutoSegment.cpp:862
Katabatic::AutoSegment::getHorizontal
virtual Horizontal * getHorizontal()
Definition: AutoSegment.h:132
Katabatic::GCell::getXMax
DbU::Unit getXMax() const
Definition: GCell.h:246
Katabatic::AutoSegment::getBoundingBox
Box getBoundingBox() const
Definition: AutoSegment.h:407
Katabatic::AutoSegment::invert
void invert()
Definition: AutoSegment.h:422
Katabatic::AutoSegment::canonize
AutoSegment * canonize(unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:1018
Katabatic::SegAxisSet
Definition: AutoSegment.h:88
Katabatic::AutoSegment::isBipoint
bool isBipoint() const
Definition: AutoSegment.h:443
Katabatic::AutoSegment::isGlobal
bool isGlobal() const
Definition: AutoSegment.h:440
Hurricane::Component::getBoundingBox
virtual Box getBoundingBox(const BasicLayer *) const=0
Katabatic::SegStrap
Definition: AutoSegment.h:71
Katabatic::AutoSegment::getCost
virtual DbU::Unit getCost(DbU::Unit axis) const
Definition: AutoSegment.cpp:547
Katabatic::AutoSegment::getConstraints
virtual bool getConstraints(DbU::Unit &min, DbU::Unit &max) const =0
Katabatic::AutoSegment::getX
virtual DbU::Unit getX() const
Definition: AutoSegment.cpp:387
Katabatic::AutoSegment::getTarget
Contact * getTarget() const
Definition: AutoSegment.h:411
Hurricane::Layer
Katabatic::AutoSegment::getSourceU
virtual DbU::Unit getSourceU() const =0
Katabatic::AutoSegment::getTargetX
DbU::Unit getTargetX() const
Definition: AutoSegment.h:418
Katabatic::AutoSegment::_canSlacken
virtual bool _canSlacken() const =0
Hurricane::Segment
Katabatic::AutoSegment::getGCell
GCell * getGCell() const
Definition: AutoSegment.h:423
Katabatic::SegWeakTerminal2
Definition: AutoSegment.h:82
Katabatic::AutoSegment::setOptimalMin
void setOptimalMin(DbU::Unit min)
Definition: AutoSegment.h:476
Katabatic::SegSourceTop
Definition: AutoSegment.h:72
Katabatic::SegFixed
Definition: AutoSegment.h:65
Katabatic::AutoSegment::getOnTargetContact
AutoSegments getOnTargetContact(unsigned int direction)
Definition: AutoSegment.cpp:617
Katabatic::SegLayerChange
Definition: AutoSegment.h:77
Katabatic::AutoSegment::checkConstraints
virtual bool checkConstraints() const =0
Katabatic::SegBipoint
Definition: AutoSegment.h:69
Katabatic::AutoSegment::isSpinTopOrBottom
bool isSpinTopOrBottom() const
Definition: AutoSegment.h:459
Katabatic::AutoSegment::updatePositions
virtual void updatePositions()=0
Katabatic::AutoSegment::getY
virtual DbU::Unit getY() const
Definition: AutoSegment.cpp:391
Katabatic::Observable::addObserver
void addObserver(BaseObserver *)
Definition: Observer.h:96
Katabatic::BaseObserver
Observer Design Pattern, Observer part.
Definition: Observer.h:29
Katabatic::AutoSegment::setOptimalMax
void setOptimalMax(DbU::Unit max)
Definition: AutoSegment.h:477
Katabatic::AutoSegment::getAutoTarget
AutoContact * getAutoTarget() const
Definition: AutoSegment.h:425
Katabatic::GCell::getYMax
DbU::Unit getYMax() const
Definition: GCell.h:247
Katabatic::AutoVertical
Concrete Vertical AutoSegment.
Definition: AutoVertical.h:32
Katabatic::SegStrongTerminal
Definition: AutoSegment.h:80
Katabatic::AutoSegment::setDuTarget
virtual void setDuTarget(DbU::Unit du)=0
Katabatic::AutoSegment::isCanonical
bool isCanonical() const
Definition: AutoSegment.h:462
Katabatic::AutoSegment::getAxis
DbU::Unit getAxis() const
Definition: AutoSegment.h:430
Katabatic::AutoSegment::getOptimalMax
DbU::Unit getOptimalMax() const
Definition: AutoSegment.h:434
Katabatic::AutoSegment::isLayerChange
bool isLayerChange() const
Definition: AutoSegment.h:456
Hurricane::Entity::getCell
virtual Cell * getCell() const=0
Katabatic::AutoSegment::getExtremity
DbU::Unit getExtremity() const
Definition: AutoSegment.h:432
Hurricane
Katabatic::AutoSegment::getLayer
const Layer * getLayer() const
Definition: AutoSegment.h:406
Katabatic::AutoSegment::getSlack
virtual DbU::Unit getSlack() const
Definition: AutoSegment.cpp:536
Katabatic::AutoSegment::getMinSpanU
Interval getMinSpanU() const
Definition: AutoSegment.cpp:1104
Katabatic::AutoSegment::getPerpandiculars
AutoSegments getPerpandiculars()
Definition: AutoSegment.cpp:639
Katabatic::AutoSegment::updateOrient
virtual void updateOrient()=0
Katabatic::AutoContact
Abstract base class for AutoContact.
Definition: AutoContact.h:70
Hurricane::Segment::getWidth
const DbU::Unit & getWidth() const
Katabatic::SegHorizontal
Definition: AutoSegment.h:64
Katabatic::SegWeakTerminal1
Definition: AutoSegment.h:81
Katabatic::SegCreated
Definition: AutoSegment.h:93
Katabatic::AutoSegment::getTargetU
virtual DbU::Unit getTargetU() const =0
Katabatic::AutoSegment::getAligneds
AutoSegments getAligneds(unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:632
Katabatic::AutoSegment::isReduced
bool isReduced() const
Definition: AutoSegment.h:460
Katabatic::AutoSegment::_invalidate
void _invalidate()
Definition: AutoSegment.cpp:437
Katabatic::GCell::getX
DbU::Unit getX() const
Definition: GCell.h:244
Hurricane::DbU::getLambda
static double getLambda(Unit u)
Katabatic::AutoSegment::isHorizontal
bool isHorizontal() const
Definition: AutoSegment.h:437
Katabatic::Observable::getObserver
T * getObserver()
Definition: Observer.h:90
Hurricane::Segment::getTargetHook
Hook * getTargetHook()
Katabatic::AutoSegment::isWeakTerminal
bool isWeakTerminal() const
Definition: AutoSegment.h:444
Katabatic::AutoSegment::canMoveURight
virtual bool canMoveURight(float reserve=0.0) const =0
Hurricane::Net
Katabatic::AutoSegment::getOptimalMin
DbU::Unit getOptimalMin() const
Definition: AutoSegment.h:433
Katabatic::AutoSegment::unsetFlags
void unsetFlags(unsigned int)
Definition: AutoSegment.h:469
Katabatic::AutoSegment::getDirection
virtual unsigned int getDirection() const =0
Katabatic::AutoSegment::getSourceY
DbU::Unit getSourceY() const
Definition: AutoSegment.h:417
Katabatic::AutoSegment::canReduce
bool canReduce() const
Definition: AutoSegment.cpp:1193
Katabatic::AutoSegment::getAutoSource
AutoContact * getAutoSource() const
Definition: AutoSegment.h:424
Hurricane::Segment::getOppositeAnchor
Component * getOppositeAnchor(Component *anchor) const
Constant::Vertical
Vertical
Katabatic::AutoSegment::isVertical
bool isVertical() const
Definition: AutoSegment.h:438
Katabatic::AutoSegment::isFixed
bool isFixed() const
Definition: AutoSegment.h:439
Constant::Horizontal
Horizontal
Katabatic::AutoSegment::setAxis
void setAxis(DbU::Unit, unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:837
Hurricane::Segment::getLength
virtual DbU::Unit getLength() const=0
Katabatic::AutoSegment::makeDogleg
AutoSegment * makeDogleg(AutoContact *)
Definition: AutoSegment.cpp:1727
Katabatic::AutoSegment::isStrap
bool isStrap() const
Definition: AutoSegment.h:455
Hurricane::Segment::getTargetX
virtual DbU::Unit getTargetX() const=0
Katabatic::AutoSegment::getDuSource
virtual DbU::Unit getDuSource() const =0
Katabatic::AutoSegment::getParent
AutoSegment * getParent() const
Definition: AutoSegment.h:413
Katabatic::AutoSegment::_postCreate
virtual void _postCreate()
Definition: AutoSegment.cpp:356
Katabatic::AutoSegment::canDogleg
unsigned int canDogleg(Interval)
Definition: AutoSegment.cpp:1696

Generated by doxygen 1.8.14 on Mon Apr 27 2020 | Return to top of page

Katabatic - Routing Toolbox | Copyright © 2008-2016 UPMC. All rights reserved