Coriolis Core (CRL) Documentation


RoutingLayerGauge.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 // | C o r e L i b r a r y |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./RoutingLayerGauge.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #pragma once
18 #include <map>
19 #include "hurricane/Commons.h"
20 #include "hurricane/Error.h"
21 #include "hurricane/DbU.h"
22 #include "hurricane/Collection.h"
23 #include "hurricane/Slot.h"
24 #include "crlcore/Utilities.h"
25 
26 namespace Hurricane {
27  class Layer;
28 }
29 
30 
31 namespace Constant {
32 
33  enum Direction { Horizontal = (1<<0)
34  , Vertical = (1<<1)
35  };
36 
37  enum LayerGaugeType { Default = (1<<0)
38  , PinOnly = (1<<1)
39  , PowerSupply = (1<<2)
40  };
41 
42  enum Round { Superior = (1<<2)
43  , Inferior = (1<<3)
44  , Nearest = (1<<4)
45  , Exact = (1<<5)
46  };
47 
48  Direction perpandicular ( unsigned int );
49 
50 }
51 
52 
53 
54 namespace CRL {
55 
56  using std::map;
63  using Hurricane::Record;
64  using Hurricane::DbU;
65  using Hurricane::Layer;
66 
67 
68  class RoutingGauge;
69 
70 
71 // -------------------------------------------------------------------
72 // Class : "RoutingLayerGauge".
73 
74 
76 
77  public:
78  // Constructors & Destructors.
79  static RoutingLayerGauge* create ( const Layer* layer
80  , Constant::Direction direction
82  , unsigned int depth
83  , double density
84  , DbU::Unit offset
85  , DbU::Unit pitch
86  , DbU::Unit wireWidth
87  , DbU::Unit pwireWidth
88  , DbU::Unit viaWidth
89  , DbU::Unit obsDw );
90  virtual void destroy ();
91  // Accessors.
92  inline bool isHorizontal () const;
93  inline bool isVertical () const;
94  inline const Layer* getLayer () const;
95  inline const Layer* getBlockageLayer () const;
96  inline unsigned int getDepth () const;
97  inline Constant::Direction getDirection () const;
98  inline Constant::LayerGaugeType getType () const;
99  inline double getDensity () const;
100  inline DbU::Unit getOffset () const;
101  inline DbU::Unit getPitch () const;
102  inline DbU::Unit getHalfPitch () const;
103  inline DbU::Unit getWireWidth () const;
104  inline DbU::Unit getPWireWidth () const;
105  inline DbU::Unit getHalfWireWidth () const;
106  inline DbU::Unit getViaWidth () const;
107  inline DbU::Unit getHalfViaWidth () const;
108  inline DbU::Unit getObstacleDw () const;
109  void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const;
110  unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const;
111  long getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const;
112  inline DbU::Unit getTrackPosition ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const;
113  DbU::Unit getTrackPosition ( DbU::Unit start, long index ) const;
114  inline void setPWireWidth ( DbU::Unit );
115  inline void setType ( uint32_t );
116  // Hurricane Managment.
117  void toJson ( JsonWriter* ) const;
118  virtual string _getTypeName () const;
119  virtual string _getString () const;
120  virtual Record* _getRecord () const;
121 
122  protected:
123  // Internal - Attributes.
124  const Layer* _layer;
125  const Layer* _blockageLayer;
126  Constant::Direction _direction;
128  unsigned int _depth;
129  double _density;
130  DbU::Unit _offset;
131  DbU::Unit _pitch;
132  DbU::Unit _wireWidth;
133  DbU::Unit _pwireWidth;
134  DbU::Unit _viaWidth;
135  DbU::Unit _obstacleDw;
136 
137  // Internal - Constructors & Destructors.
138  RoutingLayerGauge ( const Layer* layer
139  , Constant::Direction direction
141  , unsigned int depth
142  , double density
143  , DbU::Unit offset
144  , DbU::Unit pitch
145  , DbU::Unit wireWidth
146  , DbU::Unit pwireWidth
147  , DbU::Unit viaWidth
148  , DbU::Unit obsDw );
149  RoutingLayerGauge ( const RoutingLayerGauge& ) = delete;
150  virtual ~RoutingLayerGauge ();
151  virtual void _preDestroy();
152  RoutingLayerGauge& operator= ( const RoutingLayerGauge& ) = delete;
153 
154  // Friends.
155  friend class RoutingGauge;
156  };
157 
158 
159  // New Types.
160  typedef map<Layer*,RoutingLayerGauge*> RoutingLayerGaugeMap;
161 
162 
163 // -------------------------------------------------------------------
164 // Collection : "RoutingLayerGauges".
165 
169 
170 
171 // -------------------------------------------------------------------
172 // Inline Functions.
173 
174  inline bool RoutingLayerGauge::isHorizontal () const { return (_direction == Constant::Direction::Horizontal); }
175  inline bool RoutingLayerGauge::isVertical () const { return (_direction == Constant::Direction::Vertical); }
176  inline const Layer* RoutingLayerGauge::getLayer () const { return _layer; }
177  inline const Layer* RoutingLayerGauge::getBlockageLayer () const { return _blockageLayer; }
178  inline Constant::Direction RoutingLayerGauge::getDirection () const { return _direction; }
179  inline Constant::LayerGaugeType RoutingLayerGauge::getType () const { return _type; }
180  inline unsigned int RoutingLayerGauge::getDepth () const { return _depth; }
181  inline double RoutingLayerGauge::getDensity () const { return _density; }
182  inline DbU::Unit RoutingLayerGauge::getOffset () const { return _offset; }
183  inline DbU::Unit RoutingLayerGauge::getPitch () const { return _pitch; }
184  inline DbU::Unit RoutingLayerGauge::getHalfPitch () const { return _pitch>>1; }
185  inline DbU::Unit RoutingLayerGauge::getWireWidth () const { return _wireWidth; }
186  inline DbU::Unit RoutingLayerGauge::getPWireWidth () const { return (_pwireWidth) ? _pwireWidth : _wireWidth; }
187  inline DbU::Unit RoutingLayerGauge::getHalfWireWidth () const { return _wireWidth>>1; }
188  inline DbU::Unit RoutingLayerGauge::getViaWidth () const { return _viaWidth; }
189  inline DbU::Unit RoutingLayerGauge::getHalfViaWidth () const { return _viaWidth>>1; }
190  inline DbU::Unit RoutingLayerGauge::getObstacleDw () const { return _obstacleDw; }
191  inline DbU::Unit RoutingLayerGauge::getTrackPosition ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const
192  { return getTrackPosition( start, getTrackIndex(start,stop,position,mode) ); }
193  inline void RoutingLayerGauge::setPWireWidth ( DbU::Unit pwidth ) { _pwireWidth = pwidth; }
194  inline void RoutingLayerGauge::setType ( uint32_t type ) { _type = (Constant::LayerGaugeType)type; }
195 
196 
197 // -------------------------------------------------------------------
198 // Class : "JsonRoutingLayerGauge".
199 
200  class JsonRoutingLayerGauge : public JsonObject {
201  public:
202  static void initialize ();
203  JsonRoutingLayerGauge ( unsigned long flags );
204  virtual string getTypeName () const;
205  virtual JsonRoutingLayerGauge* clone ( unsigned long flags ) const;
206  virtual void toData ( JsonStack& );
207  };
208 
209 
210 } // CRL namespace.
211 
212 
213 INSPECTOR_P_SUPPORT(CRL::RoutingLayerGauge);
214 
215 
216 // -------------------------------------------------------------------
217 // Inspector Support for : "const ::Constant::Direction*".
218 
219 
220 inline void from ( Constant::Direction& direction, const std::string& s )
221 {
222  if (s == "Vertical") direction = Constant::Vertical;
223  else {
224  if (s != "Horizontal")
225  std::cerr << Hurricane::Error( "::from(Direction&,string&): Unknown value \"%s\"."
226  , s.c_str() ) << std::endl;
227  direction = Constant::Horizontal;
228  }
229 }
230 
231 
232 template<>
233 inline std::string getString<const Constant::Direction*>
234  ( const Constant::Direction* direction )
235 {
236  switch ( *direction ) {
237  case Constant::Horizontal: return "Horizontal";
238  case Constant::Vertical: return "Vertical";
239  }
240  return "Unknown Constant::Direction";
241 }
242 
243 
244 template<>
245 inline std::string getString<Constant::Direction>
246  ( Constant::Direction direction )
247 {
248  switch ( direction ) {
249  case Constant::Horizontal: return "Horizontal";
250  case Constant::Vertical: return "Vertical";
251  }
252  return "Unknown Constant::Direction";
253 }
254 
255 
256 IOSTREAM_POINTER_SUPPORT(Constant::Direction);
257 
258 
259 // -------------------------------------------------------------------
260 // Inspector Support for : "const Constant::LayerGaugeType*".
261 
262 
263 inline void from ( Constant::LayerGaugeType& type, const std::string& s )
264 {
265  if (s == "PinOnly") type = Constant::PinOnly;
266  else {
267  if (s != "Default")
268  std::cerr << Hurricane::Error( "::from(LayerGaugeType&,string&): Unknown value \"%s\"."
269  , s.c_str() ) << std::endl;
270  type = Constant::Default;
271  }
272 }
273 
274 
275 template<>
276 inline std::string getString<const Constant::LayerGaugeType*>
277  ( const Constant::LayerGaugeType* layerGaugeType )
278 {
279  switch ( *layerGaugeType ) {
280  case Constant::Default: return "Default";
281  case Constant::PinOnly: return "PinOnly";
282  case Constant::PowerSupply: return "PowerSupply";
283  }
284  return "Unknown Constant::LayerGaugeType";
285 }
286 
287 
288 template<>
289 inline std::string getString<Constant::LayerGaugeType*>
290  ( Constant::LayerGaugeType* layerGaugeType )
291 { return getString<const Constant::LayerGaugeType*>(layerGaugeType); }
292 
293 
294 template<>
295 inline std::string getString<const Constant::LayerGaugeType>
296  ( const Constant::LayerGaugeType layerGaugeType )
297 {
298  switch ( layerGaugeType ) {
299  case Constant::Default: return "Default";
300  case Constant::PinOnly: return "PinOnly";
301  case Constant::PowerSupply: return "PowerSupply";
302  }
303  return "Unknown Constant::LayerGaugeType";
304 }
305 
306 
307 template<>
308 inline std::string getString<Constant::LayerGaugeType>
309  ( Constant::LayerGaugeType layerGaugeType )
310 { return getString<const Constant::LayerGaugeType>(layerGaugeType); }
311 
312 
313 IOSTREAM_POINTER_SUPPORT(Constant::LayerGaugeType);
Store various constants.
Definition: RoutingLayerGauge.h:31
DbU::Unit getViaWidth() const
Definition: RoutingLayerGauge.h:188
virtual void destroy()
const Layer * getLayer() const
Definition: RoutingLayerGauge.h:176
Round
Definition: RoutingLayerGauge.h:42
DbU::Unit getPitch() const
Definition: RoutingLayerGauge.h:183
long getTrackIndex(DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode) const
DbU::Unit getWireWidth() const
Definition: RoutingLayerGauge.h:185
std::int64_t Unit
unsigned int getTrackNumber(DbU::Unit start, DbU::Unit stop) const
Direction
Definition: RoutingLayerGauge.h:33
Gauge for the detailed routing.
Definition: RoutingGauge.h:48
Constant::Direction getDirection() const
Definition: RoutingLayerGauge.h:178
Definition: RoutingLayerGauge.h:38
Definition: RoutingLayerGauge.h:44
Definition: RoutingLayerGauge.h:37
unsigned int getDepth() const
Definition: RoutingLayerGauge.h:180
DbU::Unit getOffset() const
Definition: RoutingLayerGauge.h:182
Constant::LayerGaugeType getType() const
Definition: RoutingLayerGauge.h:179
const Layer * getBlockageLayer() const
Definition: RoutingLayerGauge.h:177
Definition: RoutingLayerGauge.h:43
LayerGaugeType
Definition: RoutingLayerGauge.h:37
DbU::Unit getHalfViaWidth() const
Definition: RoutingLayerGauge.h:189
DbU::Unit getHalfWireWidth() const
Definition: RoutingLayerGauge.h:187
void divide(DbU::Unit dividend, long &quotient, long &modulo) const
double getDensity() const
Definition: RoutingLayerGauge.h:181
static RoutingLayerGauge * create(const Layer *layer, Constant::Direction direction, Constant::LayerGaugeType type, unsigned int depth, double density, DbU::Unit offset, DbU::Unit pitch, DbU::Unit wireWidth, DbU::Unit pwireWidth, DbU::Unit viaWidth, DbU::Unit obsDw)
DbU::Unit getHalfPitch() const
Definition: RoutingLayerGauge.h:184
Definition: RoutingLayerGauge.h:42
Definition: RoutingLayerGauge.h:34
Definition: RoutingLayerGauge.h:33
Gauge of a Layer for the detailed routing.
Definition: RoutingLayerGauge.h:75
Definition: RoutingLayerGauge.h:45
The namespace of Coriolis Core.
Definition: Environment.h:24


Generated by doxygen 1.8.14 on Sun Nov 21 2021 Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved