# Kite - Detailed Router

Track.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@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./kite/Track.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef KITE_TRACK_H
18 #define KITE_TRACK_H
19
20 #include "hurricane/Point.h"
21 namespace Hurricane {
22 class Layer;
23 }
24
25 #include "kite/TrackCost.h"
26 #include "kite/TrackElement.h"
27
28
29 namespace Kite {
30
31 using Hurricane::Point;
32 using Hurricane::Layer;
33
34 class TrackMarker;
35 class RoutingPlane;
36 class KiteEngine;
37
38
39 // -------------------------------------------------------------------
40 // Class : "Track".
41
42 class Track {
43
44 public:
45 enum IndexState { BeginIsTrackMin = 0x00000001
46 , BeginIsSegmentMin = 0x00000002
47 , BeginIsSegmentMax = 0x00000004
48 , EndIsTrackMax = 0x00000008
49 , EndIsSegmentMin = 0x00000010
50 , EndIsNextSegmentMin = 0x00000020
51 , EndIsSegmentMax = 0x00000040
52 , BeforeFirstElement = BeginIsTrackMin |EndIsSegmentMin
53 , InsideElement = BeginIsSegmentMin|EndIsSegmentMax
54 , OutsideElement = BeginIsSegmentMax|EndIsNextSegmentMin
55 , AfterLastElement = BeginIsSegmentMax|EndIsTrackMax
56 , EmptyTrack = BeginIsTrackMin |EndIsTrackMax
57 , BeginMask = BeginIsTrackMin |BeginIsSegmentMin|BeginIsSegmentMax
58 , EndMask = EndIsTrackMax |EndIsSegmentMin |EndIsNextSegmentMin|EndIsSegmentMax
59 };
60
61 public:
62 // Static Attributes.
63 static const size_t npos;
64
65 public:
66 void destroy ();
67 virtual bool isHorizontal () const = 0;
68 virtual bool isVertical () const = 0;
69 inline bool isLocalAssigned () const;
70 inline RoutingPlane* getRoutingPlane () const;
71 KiteEngine* getKiteEngine () const;
72 virtual unsigned int getDirection () const = 0;
73 inline size_t getIndex () const;
74 unsigned int getDepth () const;
75 const Layer* getLayer () const;
76 const Layer* getBlockageLayer () const;
77 inline DbU::Unit getAxis () const;
78 inline DbU::Unit getMin () const;
79 inline DbU::Unit getMax () const;
80 Track* getNextTrack () const;
81 Track* getPreviousTrack () const;
82 inline size_t getSize () const;
83 virtual Point getPosition ( DbU::Unit coordinate ) const = 0;
84 TrackElement* getSegment ( size_t index ) const;
85 TrackElement* getSegment ( DbU::Unit position ) const;
86 TrackElement* getNext ( size_t& index, Net* ) const;
87 TrackElement* getPrevious ( size_t& index, Net* ) const;
88 TrackElement* getNextFixed ( size_t& index ) const;
89 size_t find ( const TrackElement* ) const;
90 DbU::Unit getSourcePosition ( vector<TrackElement*>::iterator ) const;
91 DbU::Unit getMinimalPosition ( size_t index, unsigned int state ) const;
92 DbU::Unit getMaximalPosition ( size_t index, unsigned int state ) const;
93 Interval getFreeInterval ( DbU::Unit position, Net* net=NULL ) const;
94 Interval getOccupiedInterval ( size_t& begin ) const;
95 Interval expandFreeInterval ( size_t& begin, size_t& end, unsigned int state, Net* ) const;
96 void getBeginIndex ( DbU::Unit position, size_t& begin, unsigned int& state ) const;
97 void getOverlapBounds ( Interval, size_t& begin, size_t& end ) const;
98 TrackCost getOverlapCost ( Interval, Net*, size_t begin, size_t end, unsigned int flags ) const;
99 TrackCost getOverlapCost ( Interval, Net*, unsigned int flags ) const;
100 TrackCost getOverlapCost ( TrackElement*, unsigned int flags ) const;
101 void getTerminalWeight ( Interval, Net*, size_t& count, unsigned int& weight ) const;
102 DbU::Unit getSourcePosition ( size_t index ) const;
103 bool check ( unsigned int& overlaps, const char* message=NULL ) const;
104 unsigned int checkOverlap ( unsigned int& overlaps ) const;
105 inline void setLocalAssigned ( bool );
106 void invalidate ();
107 void insert ( TrackElement* );
108 void insert ( TrackMarker* );
109 void setSegment ( TrackElement*, size_t );
110 size_t doRemoval ();
111 void doReorder ();
112 virtual Record* _getRecord () const;
113 virtual string _getString () const;
114 virtual string _getTypeName () const = 0;
115
116 protected:
117 // Attributes.
118 RoutingPlane* _routingPlane;
119 size_t _index;
120 DbU::Unit _axis;
121 DbU::Unit _min;
122 DbU::Unit _max;
123 vector<TrackElement*> _segments;
124 vector<TrackMarker*> _markers;
125 bool _localAssigned;
126 bool _segmentsValid;
127 bool _markersValid;
128
129 protected:
130 // Constructors & Destructors.
131 Track ( RoutingPlane*, unsigned int index );
132 virtual ~Track ();
133 virtual void _postCreate ();
134 virtual void _preDestroy ();
135 private:
136 Track ( const Track& );
137 Track& operator= ( const Track& );
138 protected:
139 // Protected functions.
140 inline unsigned int setMinimalFlags ( unsigned int& state, unsigned int flags ) const;
141 inline unsigned int setMaximalFlags ( unsigned int& state, unsigned int flags ) const;
142
143 protected:
144 // Sub-Classes.
145 struct SourceCompare {
146 public:
147 inline bool operator() ( const TrackElement* lhs , const TrackElement* rhs );
148 inline bool operator() ( DbU::Unit lhsSource, const TrackElement* rhs );
149 inline bool operator() ( const TrackElement* lhs , DbU::Unit rhsSource );
150 private:
151 inline bool lessSource ( DbU::Unit lhs , DbU::Unit rhsSource );
152 };
153 struct SegmentCompare {
154 inline bool operator() ( const TrackElement* lhs, const TrackElement* rhs );
155 };
156 };
157
158
159 // Inline Functions.
160 inline bool Track::SourceCompare::operator() ( const TrackElement* lhs, const TrackElement* rhs )
161 { return lessSource(lhs->getSourceU(),rhs->getSourceU()); }
162
163
164 inline bool Track::SourceCompare::operator() ( DbU::Unit lhsSource, const TrackElement* rhs )
165 { return lessSource(lhsSource,rhs->getSourceU()); }
166
167
168 inline bool Track::SourceCompare::operator() ( const TrackElement* lhs, DbU::Unit rhsSource )
169 { return lessSource(lhs->getSourceU(),rhsSource); }
170
171
172 inline bool Track::SourceCompare::lessSource ( DbU::Unit lhsSource, DbU::Unit rhsSource )
173 { return lhsSource < rhsSource; }
174
175
176 inline bool Track::SegmentCompare::operator() ( const TrackElement* lhs, const TrackElement* rhs )
177 {
178 if (lhs->getSourceU() < rhs->getSourceU())
179 return true;
180 else {
181 if ( (lhs->getSourceU() == rhs->getSourceU())
182 and (lhs->getTargetU() > rhs->getTargetU()) )
183 return true;
184 }
185 return false;
186 }
187
188
189 inline bool Track::isLocalAssigned () const { return _localAssigned; }
190 inline RoutingPlane* Track::getRoutingPlane () const { return _routingPlane; }
191 inline size_t Track::getIndex () const { return _index; }
192 inline DbU::Unit Track::getAxis () const { return _axis; }
193 inline DbU::Unit Track::getMin () const { return _min; }
194 inline DbU::Unit Track::getMax () const { return _max; }
195 inline size_t Track::getSize () const { return _segments.size(); }
196 inline void Track::setLocalAssigned ( bool state ) { _localAssigned=state; }
197
198 inline unsigned int Track::setMinimalFlags ( unsigned int& state, unsigned int flags ) const
199 {
200 state &= ~BeginMask;
201 state |= (flags & BeginMask);
202 return state;
203 }
204
205 inline unsigned int Track::setMaximalFlags ( unsigned int& state, unsigned int flags ) const
206 {
207 state &= ~EndMask;
208 state |= (flags & EndMask);
209 return state;
210 }
211
212
213 } // Kite namespace.
214
215
216 INSPECTOR_P_SUPPORT(Kite::Track);
217
218 #endif // KITE_TRACK_H
Kite::Track::InsideElement
Definition: Track.h:53
Kite::Track::getSize
size_t getSize() const
Definition: Track.h:195
Kite::Track::getDirection
virtual unsigned int getDirection() const =0
Kite::Track::expandFreeInterval
Interval expandFreeInterval(size_t &begin, size_t &end, unsigned int state, Net *) const
Definition: Track.cpp:410
Kite::Track::getRoutingPlane
RoutingPlane * getRoutingPlane() const
Definition: Track.h:190
Kite::Track::insert
void insert(TrackElement *)
Definition: Track.cpp:451
Kite::Track::getKiteEngine
KiteEngine * getKiteEngine() const
Definition: Track.cpp:115
Kite::Track::getBeginIndex
void getBeginIndex(DbU::Unit position, size_t &begin, unsigned int &state) const
Definition: Track.cpp:199
Kite::Track::getFreeInterval
Interval getFreeInterval(DbU::Unit position, Net *net=NULL) const
Definition: Track.cpp:393
Kite::Track::invalidate
void invalidate()
Definition: Track.cpp:440
Kite::Track::EndIsSegmentMin
Definition: Track.h:49
Hurricane::DbU::Unit
std::int64_t Unit
Kite::Track::OutsideElement
Definition: Track.h:54
Kite::Track::getBlockageLayer
const Layer * getBlockageLayer() const
Definition: Track.cpp:127
Hurricane::Point
Kite::Track::BeginIsSegmentMin
Definition: Track.h:46
Kite::Track::BeginMask
Definition: Track.h:57
Kite::Track::isHorizontal
virtual bool isHorizontal() const =0
Kite::Track::getOverlapBounds
void getOverlapBounds(Interval, size_t &begin, size_t &end) const
Definition: Track.cpp:259
Kite::Track
Structure managing one routing track.
Definition: Track.h:42
Hurricane::Interval
Kite::Track::getLayer
const Layer * getLayer() const
Definition: Track.cpp:123
Kite::Track::getNextFixed
TrackElement * getNextFixed(size_t &index) const
Definition: Track.cpp:188
Kite::Track::EndMask
Definition: Track.h:58
Kite::Track::getPosition
virtual Point getPosition(DbU::Unit coordinate) const =0
Kite::Track::getOccupiedInterval
Interval getOccupiedInterval(size_t &begin) const
Definition: Track.cpp:588
Kite::Track::EndIsSegmentMax
Definition: Track.h:51
Kite::Track::getPreviousTrack
Track * getPreviousTrack() const
Definition: Track.cpp:135
Kite::Track::check
bool check(unsigned int &overlaps, const char *message=NULL) const
Definition: Track.cpp:479
Kite::Track::getTerminalWeight
void getTerminalWeight(Interval, Net *, size_t &count, unsigned int &weight) const
Definition: Track.cpp:346
Kite::Track::getSourcePosition
DbU::Unit getSourcePosition(vector< TrackElement *>::iterator) const
Definition: Track.cpp:544
Kite::Track::BeforeFirstElement
Definition: Track.h:52
Kite::Track::BeginIsTrackMin
Definition: Track.h:45
Kite::Track::doReorder
void doReorder()
Definition: Track.cpp:642
Kite::KiteEngine
The Kite Tool.
Definition: KiteEngine.h:60
Kite::Track::getPrevious
TrackElement * getPrevious(size_t &index, Net *) const
Definition: Track.cpp:172
Kite::Track::getMin
DbU::Unit getMin() const
Definition: Track.h:193
Kite::TrackMarker
Tag part of Track with a weight.
Definition: TrackMarker.h:43
Kite::Track::getNextTrack
Track * getNextTrack() const
Definition: Track.cpp:131
Kite::Track::EndIsTrackMax
Definition: Track.h:48
Kite::Track::EmptyTrack
Definition: Track.h:56
Kite::Track::getDepth
unsigned int getDepth() const
Definition: Track.cpp:119
Hurricane::Layer
Kite::RoutingPlane
Array of Tracks in one Layer.
Definition: RoutingPlane.h:34
Kite::Track::npos
static const size_t npos
Definition: Track.h:63
Kite::Track::find
size_t find(const TrackElement *) const
Definition: Track.cpp:371
Kite::TrackElement
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
Kite::Track::getSegment
TrackElement * getSegment(size_t index) const
Definition: Track.cpp:142
Kite::Track::IndexState
IndexState
Definition: Track.h:45
Kite::Track::getNext
TrackElement * getNext(size_t &index, Net *) const
Definition: Track.cpp:160
Kite::Track::getAxis
DbU::Unit getAxis() const
Definition: Track.h:192
Kite::Track::getIndex
size_t getIndex() const
Definition: Track.h:191
Kite::Track::getOverlapCost
TrackCost getOverlapCost(Interval, Net *, size_t begin, size_t end, unsigned int flags) const
Definition: Track.cpp:282
Hurricane
Kite::Track::getMax
DbU::Unit getMax() const
Definition: Track.h:194
Kite
The namespace dedicated to Kite.
Definition: Constants.h:22
Kite::Track::getMaximalPosition
DbU::Unit getMaximalPosition(size_t index, unsigned int state) const
Definition: Track.cpp:569
Kite::Track::BeginIsSegmentMax
Definition: Track.h:47
Kite::Track::isVertical
virtual bool isVertical() const =0
Kite::Track::getMinimalPosition
DbU::Unit getMinimalPosition(size_t index, unsigned int state) const
Definition: Track.cpp:552
Kite::Track::doRemoval
size_t doRemoval()
Definition: Track.cpp:624
Kite::Track::isLocalAssigned
bool isLocalAssigned() const
Definition: Track.h:189
Hurricane::Net
Kite::Track::EndIsNextSegmentMin
Definition: Track.h:50
Kite::Track::AfterLastElement
Definition: Track.h:55
Kite::Track::setSegment
void setSegment(TrackElement *, size_t)
Definition: Track.cpp:472

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