# 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;
46 using Katabatic::AutoSegment;
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:
67 SegmentObserver ( const SegmentObserver& );
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:
103 static SegmentOverlapCostCB* setOverlapCostCB ( SegmentOverlapCostCB* );
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; }
243 inline Interval TrackElement::getCanonicalInterval () const { return Interval(getSourceU(),getTargetU()); }
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
252 inline Box TrackElement::getBoundingBox () const
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
259 inline bool TrackElement::makeDogleg ( Katabatic::GCell* gcell )
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
Kite::TrackElement::getTargetConstraints
virtual Interval getTargetConstraints() const
Definition: TrackElement.cpp:169
Kite::TrackElement::getDataNegociate
virtual DataNegociate * getDataNegociate(unsigned int flags=KtDataSelf) const
Definition: TrackElement.cpp:170
Kite::TrackElement::isSlackened
virtual bool isSlackened() const
Definition: TrackElement.cpp:147
Katabatic::GCell
Kite::TrackElement::getGCells
virtual size_t getGCells(Katabatic::GCellVector &) const
Definition: TrackElement.cpp:253
Kite::TrackElement::getBoundingBox
Box getBoundingBox() const
Definition: TrackElement.h:252
Kite::TrackElement::getParent
virtual TrackElement * getParent() const
Definition: TrackElement.cpp:167
Hurricane::DbU::lambda
static Unit lambda(double value)
Kite::TrackElement::isDogleg
virtual bool isDogleg() const
Definition: TrackElement.cpp:148
Kite::TrackElement::getPrevious
virtual TrackElement * getPrevious() const
Definition: TrackElement.cpp:236
Kite::TrackElement::isInvalidated
bool isInvalidated() const
Definition: TrackElement.h:231
Kite::SegmentOverlapCostCB
void() SegmentOverlapCostCB(const TrackElement *, TrackCost &)
Definition: TrackElement.h:56
Kite::TrackElement::canRipple
bool canRipple() const
Definition: TrackElement.h:237
Kite::TrackElement::isBipoint
virtual bool isBipoint() const
Definition: TrackElement.cpp:143
Hurricane::Net
Kite::SegmentObserver::notify
virtual void notify(unsigned int flags)
Definition: TrackElement.cpp:99
Hurricane::DbU::Unit
std::int64_t Unit
Kite::TrackElement::getFreedomDegree
virtual unsigned long getFreedomDegree() const
Definition: TrackElement.cpp:162
Kite::TrackElement::getTargetU
DbU::Unit getTargetU() const
Definition: TrackElement.h:242
Kite::SegmentObserver
Observer on the base AutoSegment.
Definition: TrackElement.h:62
Kite::TrackElement::detach
virtual void detach()
Definition: TrackElement.cpp:182
Kite::TrackElement::getLength
DbU::Unit getLength() const
Definition: TrackElement.h:240
Kite::TrackElement::revalidate
virtual void revalidate()
Definition: TrackElement.cpp:183
Kite::TrackElement::isLocal
virtual bool isLocal() const
Definition: TrackElement.cpp:141
Kite::TrackElement::setIndex
void setIndex(size_t)
Definition: TrackElement.h:244
Kite::TrackElement::getSourceDogleg
virtual TrackElement * getSourceDogleg()
Definition: TrackElement.cpp:174
Kite::TrackElement::canDogleg
virtual bool canDogleg()
Definition: TrackElement.cpp:157
Kite::TrackElement::getLayer
virtual const Layer * getLayer() const =0
Kite::Track
Structure managing one routing track.
Definition: Track.h:42
Hurricane::Interval
Kite::TrackElement::getId
virtual unsigned long getId() const
Definition: TrackElement.cpp:161
Katabatic::AutoSegment
Katabatic::AutoSegment::setFlags
void setFlags(unsigned int)
Kite::TrackElement::unsetFlags
void unsetFlags(unsigned int)
Definition: TrackElement.h:229
Kite::TrackElement::getNet
virtual Net * getNet() const =0
Kite::TrackElement::hasTargetDogleg
bool hasTargetDogleg() const
Definition: TrackElement.h:236
Kite::TrackElement::isVertical
virtual bool isVertical() const =0
Kite::TrackElement::getMaxUnderDensity
virtual float getMaxUnderDensity(unsigned int flags=0) const
Definition: TrackElement.cpp:165
Kite::KtDataSelf
Definition: Constants.h:40
Kite::TrackElement::setDoglegLevel
virtual void setDoglegLevel(unsigned int)
Definition: TrackElement.cpp:179
Kite::TrackElement::isRouted
bool isRouted() const
Definition: TrackElement.h:234
Kite::TrackElement::invalidate
virtual void invalidate()
Definition: TrackElement.cpp:172
Kite::TrackElement::getFreeInterval
virtual Interval getFreeInterval() const
Definition: TrackElement.cpp:243
Hurricane::Box
Kite::TrackElement::getTargetDogleg
virtual TrackElement * getTargetDogleg()
Definition: TrackElement.cpp:175
Kite::TrackElement::getSourceU
DbU::Unit getSourceU() const
Definition: TrackElement.h:241
Kite::TrackElement::getCanonical
virtual TrackElement * getCanonical(Interval &)
Definition: TrackElement.cpp:173
Kite::TrackElement::setTrack
virtual void setTrack(Track *)
Definition: TrackElement.cpp:177
Kite::TrackElement::setOverlapCostCB
static SegmentOverlapCostCB * setOverlapCostCB(SegmentOverlapCostCB *)
Definition: TrackElement.cpp:130
Kite::TrackElement::setFlags
void setFlags(unsigned int)
Definition: TrackElement.h:228
Kite::TrackElement::getSourceConstraints
virtual Interval getSourceConstraints() const
Definition: TrackElement.cpp:168
Kite::TrackElement::getAxis
virtual DbU::Unit getAxis() const =0
Hurricane::DbU
Kite::TrackElement::reschedule
virtual void reschedule(unsigned int level)
Definition: TrackElement.cpp:181
Kite::TrackElement::isLocked
bool isLocked() const
Definition: TrackElement.h:233
Hurricane::Layer
Kite::TrackElement::isHorizontal
virtual bool isHorizontal() const =0
Kite::TrackElement::incOverlapCost
virtual void incOverlapCost(Net *, TrackCost &) const
Definition: TrackElement.cpp:260
Kite::TrackElement::_check
virtual bool _check() const
Definition: TrackElement.cpp:197
Kite::TrackElement
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
Kite::TrackElement::getDoglegLevel
virtual unsigned int getDoglegLevel() const
Definition: TrackElement.cpp:166
Kite::TrackElement::getPerpandiculars
virtual TrackElements getPerpandiculars()
Definition: TrackElement.cpp:171
Kite::TrackElement::makeDogleg
virtual TrackElement * makeDogleg()
Definition: TrackElement.cpp:186
Kite::TrackElement::isGlobal
virtual bool isGlobal() const
Definition: TrackElement.cpp:142
Kite::TrackElement::hasSourceDogleg
bool hasSourceDogleg() const
Definition: TrackElement.h:235
Kite::TrackElement::isBlockage
bool isBlockage() const
Definition: TrackElement.h:232
Kite::TrackElement::updateFreedomDegree
virtual void updateFreedomDegree()
Definition: TrackElement.cpp:178
Kite::TrackElement::isStrap
virtual bool isStrap() const
Definition: TrackElement.cpp:146
Katabatic::Observer
Hurricane
Kite::TrackElement::isCreated
bool isCreated() const
Definition: TrackElement.h:230
Kite::TrackElement::getDirection
virtual unsigned int getDirection() const =0
Kite::TrackElement::getTrack
Track * getTrack() const
Definition: TrackElement.h:238
Kite
The namespace dedicated to Kite.
Definition: Constants.h:22
Kite::TrackElement::getIndex
size_t getIndex() const
Definition: TrackElement.h:239
Kite::TrackElement::getCanonicalInterval
Interval getCanonicalInterval() const
Definition: TrackElement.h:243
Kite::TrackElement::isTerminal
virtual bool isTerminal() const
Definition: TrackElement.cpp:144
Kite::TrackElement::swapTrack
virtual void swapTrack(TrackElement *)
Definition: TrackElement.cpp:180
Kite::TrackElement::setAxis
virtual void setAxis(DbU::Unit, unsigned int flags=Katabatic::SegAxisSet)
Definition: TrackElement.cpp:185
Kite::TrackElement::getNext
virtual TrackElement * getNext() const
Definition: TrackElement.cpp:229
Kite::TrackElement::isFixed
virtual bool isFixed() const
Definition: TrackElement.cpp:140
Kite::DataNegociate
Algorimthmic datas associated the TrackSegment.
Definition: DataNegociate.h:50
Hurricane::Net

Generated by doxygen 1.8.14 on Mon Feb 3 2020 | Return to top of page

Kite - Detailed Router | Copyright © 2008-2016 UPMC. All rights reserved