Kite - Detailed Router


TrackElement.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 i t e - D e t a i l e d R o u t e r |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./kite/TrackElement.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #ifndef KITE_TRACK_ELEMENT_H
18 #define KITE_TRACK_ELEMENT_H
19 
20 #include <string>
21 #include <map>
22 
23 #include "hurricane/Interval.h"
24 namespace Hurricane {
25  class Record;
26  class Net;
27  class Layer;
28 }
29 
30 #include "katabatic/AutoSegment.h"
31 #include "kite/Constants.h"
32 #include "kite/Session.h"
33 #include "kite/TrackElements.h"
34 
35 
36 namespace Kite {
37 
38  using std::string;
39  using std::map;
40  using Hurricane::Record;
41  using Hurricane::Interval;
42  using Hurricane::DbU;
43  using Hurricane::Box;
44  using Hurricane::Net;
45  using Hurricane::Layer;
47  using Katabatic::Observer;
48  using Katabatic::KbNoFlags;
49 
50  class DataNegociate;
51  class Track;
52  class TrackCost;
53 
54 
55  typedef map<Segment*,TrackElement*> TrackElementLut;
56  typedef void (SegmentOverlapCostCB)( const TrackElement*, TrackCost& );
57 
58 
59 // -------------------------------------------------------------------
60 // Class : "SegmentObserver".
61 
62  class SegmentObserver : public Observer<TrackElement> {
63  public:
64  inline SegmentObserver ( TrackElement* );
65  virtual void notify ( unsigned int flags );
66  private:
68  };
69 
70 
71  inline SegmentObserver::SegmentObserver ( TrackElement* owner )
72  : Observer<TrackElement>(owner)
73  { }
74 
75 
76 // -------------------------------------------------------------------
77 // Class : "TrackElement".
78 
79  enum TrackElementFlags { TElemCreated =0x00000001
80  , TElemBlockage =0x00000002
81  , TElemFixed =0x00000004
82  , TElemLocked =0x00000008
83  , TElemRouted =0x00000010
84  , TElemSourceDogleg=0x00000020
85  , TElemTargetDogleg=0x00000040
86  , TElemRipple =0x00000080
87  , TElemInvalidated =0x00000100
88  };
89 
90 
91  struct Compare {
92  bool operator() ( TrackElement* lhs, TrackElement* rhs );
93  };
94 
95  struct CompareByPosition {
96  bool operator() ( const TrackElement* lhs, const TrackElement* rhs ) const;
97  };
98 
99 
100  class TrackElement {
101 
102  public:
104  public:
105  void destroy ();
106  virtual AutoSegment* base () const;
107  // Wrapped AutoSegment Functions (when applicable).
108  virtual bool isFixed () const;
109  virtual bool isHorizontal () const = 0;
110  virtual bool isVertical () const = 0;
111  virtual bool isLocal () const;
112  virtual bool isGlobal () const;
113  virtual bool isBipoint () const;
114  virtual bool isTerminal () const;
115  virtual bool isStrongTerminal ( unsigned int flags=0 ) const;
116  virtual bool isStrap () const;
117  virtual bool isSlackened () const;
118  virtual bool isDogleg () const;
119  virtual bool isReduced () const;
120  virtual bool isUTurn () const;
121  virtual bool isUserDefined () const;
122  // Predicates.
123  inline bool isCreated () const;
124  inline bool isInvalidated () const;
125  inline bool isBlockage () const;
126  inline bool isLocked () const;
127  inline bool isRouted () const;
128  inline bool hasSourceDogleg () const;
129  inline bool hasTargetDogleg () const;
130  inline bool canRipple () const;
131  virtual bool canSlacken () const;
132  virtual bool canPivotUp ( float reserve ) const;
133  virtual bool canPivotDown ( float reserve ) const;
134  virtual bool canMoveUp ( float reserve, unsigned int flags=KbWithPerpands ) const;
135  virtual bool canDogleg ();
136  virtual bool canDogleg ( Interval );
137  virtual bool canDogleg ( Katabatic::GCell*, unsigned int flags=0 );
138  // Accessors
139  inline SegmentObserver* getObserver ();
140  virtual unsigned long getId () const;
141  virtual unsigned int getDirection () const = 0;
142  virtual Net* getNet () const = 0;
143  virtual const Layer* getLayer () const = 0;
144  virtual DbU::Unit getPitch () const;
145  virtual DbU::Unit getPPitch () const;
146  inline Track* getTrack () const;
147  inline size_t getIndex () const;
148  virtual unsigned long getFreedomDegree () const;
149  virtual float getMaxUnderDensity ( unsigned int flags=0 ) const;
150  inline Box getBoundingBox () const;
151  virtual TrackElement* getNext () const;
152  virtual TrackElement* getPrevious () const;
153  virtual DbU::Unit getAxis () const = 0;
154  inline DbU::Unit getSourceU () const;
155  inline DbU::Unit getTargetU () const;
156  inline DbU::Unit getLength () const;
157  inline Interval getCanonicalInterval () const;
158  virtual Interval getFreeInterval () const;
159  virtual Interval getSourceConstraints () const;
160  virtual Interval getTargetConstraints () const;
161  virtual DataNegociate* getDataNegociate ( unsigned int flags=KtDataSelf ) const;
162  virtual TrackElement* getCanonical ( Interval& );
163  virtual size_t getGCells ( Katabatic::GCellVector& ) const;
164  virtual TrackElement* getParent () const;
165  virtual unsigned int getDoglegLevel () const;
166  virtual TrackElement* getSourceDogleg ();
167  virtual TrackElement* getTargetDogleg ();
168  virtual TrackElements getPerpandiculars ();
169  // Mutators.
170  inline void setFlags ( unsigned int );
171  inline void unsetFlags ( unsigned int );
172  inline void setRouted ();
173  virtual void setTrack ( Track* );
174  inline void setIndex ( size_t );
175  virtual void updateFreedomDegree ();
176  virtual void setDoglegLevel ( unsigned int );
177  virtual void swapTrack ( TrackElement* );
178  virtual void reschedule ( unsigned int level );
179  virtual void detach ();
180  virtual void invalidate ();
181  virtual void revalidate ();
182  virtual void updatePPitch ();
183  virtual void incOverlapCost ( Net*, TrackCost& ) const;
184  virtual void setAxis ( DbU::Unit, unsigned int flags=Katabatic::SegAxisSet );
185  virtual TrackElement* makeDogleg ();
186  inline bool makeDogleg ( Katabatic::GCell* );
187  virtual TrackElement* makeDogleg ( Katabatic::GCell*, TrackElement*& perpandicular, TrackElement*& parallel );
188  virtual TrackElement* makeDogleg ( Interval, unsigned int& flags );
189  virtual void _postDoglegs ( TrackElement*& perpandicular, TrackElement*& parallel );
190  virtual bool moveAside ( unsigned int flags );
191  virtual bool slacken ( unsigned int flags=KbNoFlags );
192  virtual bool moveUp ( unsigned int flags );
193  virtual bool moveDown ( unsigned int flags );
194 #if THIS_IS_DISABLED
195  virtual void desalignate ();
196 #endif
197  virtual bool _check () const;
198  virtual Record* _getRecord () const;
199  virtual string _getString () const;
200  virtual string _getTypeName () const;
201 
202  protected:
203  // Static Attributes.
204  static SegmentOverlapCostCB* _overlapCostCallback;
205  // Attributes.
206  unsigned int _flags;
207  Track* _track;
208  size_t _index;
209  DbU::Unit _sourceU;
210  DbU::Unit _targetU;
211  SegmentObserver _observer;
212 
213  protected:
214  // Constructors & Destructors.
215  TrackElement ( Track* ) ;
216  virtual ~TrackElement ();
217  virtual void _postCreate ();
218  virtual void _preDestroy ();
219  private:
220  TrackElement ( const TrackElement& );
221  TrackElement& operator= ( const TrackElement& );
222 
223  };
224 
225 
226 // Inline functions.
227  inline SegmentObserver* TrackElement::getObserver () { return &_observer; }
228  inline void TrackElement::setFlags ( unsigned int flags ) { _flags|= flags; }
229  inline void TrackElement::unsetFlags ( unsigned int flags ) { _flags&=~flags; }
230  inline bool TrackElement::isCreated () const { return _flags & TElemCreated; }
231  inline bool TrackElement::isInvalidated () const { return _flags & TElemInvalidated; }
232  inline bool TrackElement::isBlockage () const { return _flags & TElemBlockage; }
233  inline bool TrackElement::isLocked () const { return _flags & TElemLocked; }
234  inline bool TrackElement::isRouted () const { return _flags & TElemRouted; }
235  inline bool TrackElement::hasSourceDogleg () const { return _flags & TElemSourceDogleg; }
236  inline bool TrackElement::hasTargetDogleg () const { return _flags & TElemTargetDogleg; }
237  inline bool TrackElement::canRipple () const { return _flags & TElemRipple; }
238  inline Track* TrackElement::getTrack () const { return _track; }
239  inline size_t TrackElement::getIndex () const { return _index; }
240  inline DbU::Unit TrackElement::getLength () const { return getTargetU() - getSourceU(); }
241  inline DbU::Unit TrackElement::getSourceU () const { return _sourceU; }
242  inline DbU::Unit TrackElement::getTargetU () const { return _targetU; }
244  inline void TrackElement::setIndex ( size_t index ) { _index=index; }
245 
246  inline void TrackElement::setRouted()
247  {
248  _flags |= TElemRouted;
249  if (base()) base()->setFlags( Katabatic::SegFixed );
250  }
251 
253  {
254  if (getDirection() == KbHorizontal)
255  return Box( getSourceU(), getAxis()-DbU::lambda(1.0), getTargetU(), getAxis()+DbU::lambda(1.0) );
256  return Box( getAxis()-DbU::lambda(1.0), getSourceU(), getAxis()+DbU::lambda(1.0), getTargetU() );
257  }
258 
260  {
261  TrackElement* perpandicular = NULL;
262  TrackElement* parallel = NULL;
263 
264  makeDogleg( gcell, perpandicular, parallel );
265 
266  return (perpandicular != NULL);
267  }
268 
269 
270 } // Kite namespace.
271 
272 
273 INSPECTOR_P_SUPPORT(Kite::TrackElement);
274 
275 #endif
virtual Interval getTargetConstraints() const
Definition: TrackElement.cpp:169
virtual DataNegociate * getDataNegociate(unsigned int flags=KtDataSelf) const
Definition: TrackElement.cpp:170
virtual bool isSlackened() const
Definition: TrackElement.cpp:147
virtual size_t getGCells(Katabatic::GCellVector &) const
Definition: TrackElement.cpp:253
Box getBoundingBox() const
Definition: TrackElement.h:252
virtual TrackElement * getParent() const
Definition: TrackElement.cpp:167
static Unit lambda(double value)
virtual bool isDogleg() const
Definition: TrackElement.cpp:148
virtual TrackElement * getPrevious() const
Definition: TrackElement.cpp:236
bool isInvalidated() const
Definition: TrackElement.h:231
void() SegmentOverlapCostCB(const TrackElement *, TrackCost &)
Definition: TrackElement.h:56
bool canRipple() const
Definition: TrackElement.h:237
virtual bool isBipoint() const
Definition: TrackElement.cpp:143
virtual void notify(unsigned int flags)
Definition: TrackElement.cpp:99
std::int64_t Unit
virtual unsigned long getFreedomDegree() const
Definition: TrackElement.cpp:162
DbU::Unit getTargetU() const
Definition: TrackElement.h:242
Observer on the base AutoSegment.
Definition: TrackElement.h:62
virtual void detach()
Definition: TrackElement.cpp:182
DbU::Unit getLength() const
Definition: TrackElement.h:240
virtual void revalidate()
Definition: TrackElement.cpp:183
virtual bool isLocal() const
Definition: TrackElement.cpp:141
void setIndex(size_t)
Definition: TrackElement.h:244
virtual TrackElement * getSourceDogleg()
Definition: TrackElement.cpp:174
virtual bool canDogleg()
Definition: TrackElement.cpp:157
virtual const Layer * getLayer() const =0
Structure managing one routing track.
Definition: Track.h:42
virtual unsigned long getId() const
Definition: TrackElement.cpp:161
void setFlags(unsigned int)
void unsetFlags(unsigned int)
Definition: TrackElement.h:229
virtual Net * getNet() const =0
bool hasTargetDogleg() const
Definition: TrackElement.h:236
virtual bool isVertical() const =0
virtual float getMaxUnderDensity(unsigned int flags=0) const
Definition: TrackElement.cpp:165
Definition: Constants.h:40
virtual void setDoglegLevel(unsigned int)
Definition: TrackElement.cpp:179
bool isRouted() const
Definition: TrackElement.h:234
virtual void invalidate()
Definition: TrackElement.cpp:172
virtual Interval getFreeInterval() const
Definition: TrackElement.cpp:243
virtual TrackElement * getTargetDogleg()
Definition: TrackElement.cpp:175
DbU::Unit getSourceU() const
Definition: TrackElement.h:241
virtual TrackElement * getCanonical(Interval &)
Definition: TrackElement.cpp:173
virtual void setTrack(Track *)
Definition: TrackElement.cpp:177
static SegmentOverlapCostCB * setOverlapCostCB(SegmentOverlapCostCB *)
Definition: TrackElement.cpp:130
void setFlags(unsigned int)
Definition: TrackElement.h:228
virtual Interval getSourceConstraints() const
Definition: TrackElement.cpp:168
virtual DbU::Unit getAxis() const =0
virtual void reschedule(unsigned int level)
Definition: TrackElement.cpp:181
bool isLocked() const
Definition: TrackElement.h:233
virtual bool isHorizontal() const =0
virtual void incOverlapCost(Net *, TrackCost &) const
Definition: TrackElement.cpp:260
virtual bool _check() const
Definition: TrackElement.cpp:197
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
virtual unsigned int getDoglegLevel() const
Definition: TrackElement.cpp:166
virtual TrackElements getPerpandiculars()
Definition: TrackElement.cpp:171
virtual TrackElement * makeDogleg()
Definition: TrackElement.cpp:186
virtual bool isGlobal() const
Definition: TrackElement.cpp:142
bool hasSourceDogleg() const
Definition: TrackElement.h:235
bool isBlockage() const
Definition: TrackElement.h:232
virtual void updateFreedomDegree()
Definition: TrackElement.cpp:178
virtual bool isStrap() const
Definition: TrackElement.cpp:146
bool isCreated() const
Definition: TrackElement.h:230
virtual unsigned int getDirection() const =0
Track * getTrack() const
Definition: TrackElement.h:238
The namespace dedicated to Kite.
Definition: Constants.h:22
size_t getIndex() const
Definition: TrackElement.h:239
Interval getCanonicalInterval() const
Definition: TrackElement.h:243
virtual bool isTerminal() const
Definition: TrackElement.cpp:144
virtual void swapTrack(TrackElement *)
Definition: TrackElement.cpp:180
virtual void setAxis(DbU::Unit, unsigned int flags=Katabatic::SegAxisSet)
Definition: TrackElement.cpp:185
virtual TrackElement * getNext() const
Definition: TrackElement.cpp:229
virtual bool isFixed() const
Definition: TrackElement.cpp:140
Algorimthmic datas associated the TrackSegment.
Definition: DataNegociate.h:50


Generated by doxygen 1.8.14 on Fri Oct 1 2021 Return to top of page
Kite - Detailed Router Copyright © 2008-2020 Sorbonne Universite. All rights reserved