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
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
Definition: Track.h:53
size_t getSize() const
Definition: Track.h:195
virtual unsigned int getDirection() const =0
Interval expandFreeInterval(size_t &begin, size_t &end, unsigned int state, Net *) const
Definition: Track.cpp:410
RoutingPlane * getRoutingPlane() const
Definition: Track.h:190
void insert(TrackElement *)
Definition: Track.cpp:451
KiteEngine * getKiteEngine() const
Definition: Track.cpp:115
void getBeginIndex(DbU::Unit position, size_t &begin, unsigned int &state) const
Definition: Track.cpp:199
Interval getFreeInterval(DbU::Unit position, Net *net=NULL) const
Definition: Track.cpp:393
void invalidate()
Definition: Track.cpp:440
Definition: Track.h:49
std::int64_t Unit
Definition: Track.h:54
const Layer * getBlockageLayer() const
Definition: Track.cpp:127
Definition: Track.h:46
Definition: Track.h:57
virtual bool isHorizontal() const =0
void getOverlapBounds(Interval, size_t &begin, size_t &end) const
Definition: Track.cpp:259
Structure managing one routing track.
Definition: Track.h:42
const Layer * getLayer() const
Definition: Track.cpp:123
TrackElement * getNextFixed(size_t &index) const
Definition: Track.cpp:188
Definition: Track.h:58
virtual Point getPosition(DbU::Unit coordinate) const =0
Interval getOccupiedInterval(size_t &begin) const
Definition: Track.cpp:588
Definition: Track.h:51
Track * getPreviousTrack() const
Definition: Track.cpp:135
bool check(unsigned int &overlaps, const char *message=NULL) const
Definition: Track.cpp:479
void getTerminalWeight(Interval, Net *, size_t &count, unsigned int &weight) const
Definition: Track.cpp:346
DbU::Unit getSourcePosition(vector< TrackElement *>::iterator) const
Definition: Track.cpp:544
Definition: Track.h:52
Definition: Track.h:45
void doReorder()
Definition: Track.cpp:642
The Kite Tool.
Definition: KiteEngine.h:60
TrackElement * getPrevious(size_t &index, Net *) const
Definition: Track.cpp:172
DbU::Unit getMin() const
Definition: Track.h:193
Tag part of Track with a weight.
Definition: TrackMarker.h:43
Track * getNextTrack() const
Definition: Track.cpp:131
Definition: Track.h:48
Definition: Track.h:56
unsigned int getDepth() const
Definition: Track.cpp:119
Array of Tracks in one Layer.
Definition: RoutingPlane.h:34
static const size_t npos
Definition: Track.h:63
size_t find(const TrackElement *) const
Definition: Track.cpp:371
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
TrackElement * getSegment(size_t index) const
Definition: Track.cpp:142
IndexState
Definition: Track.h:45
TrackElement * getNext(size_t &index, Net *) const
Definition: Track.cpp:160
DbU::Unit getAxis() const
Definition: Track.h:192
size_t getIndex() const
Definition: Track.h:191
TrackCost getOverlapCost(Interval, Net *, size_t begin, size_t end, unsigned int flags) const
Definition: Track.cpp:282
DbU::Unit getMax() const
Definition: Track.h:194
The namespace dedicated to Kite.
Definition: Constants.h:22
DbU::Unit getMaximalPosition(size_t index, unsigned int state) const
Definition: Track.cpp:569
Definition: Track.h:47
virtual bool isVertical() const =0
DbU::Unit getMinimalPosition(size_t index, unsigned int state) const
Definition: Track.cpp:552
size_t doRemoval()
Definition: Track.cpp:624
bool isLocalAssigned() const
Definition: Track.h:189
Definition: Track.h:50
Definition: Track.h:55
void setSegment(TrackElement *, size_t)
Definition: Track.cpp:472


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