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

Generated by doxygen 1.8.14 on Mon Apr 27 2020 | Return to top of page

Coriolis Core (CRL) | Copyright © 2008-2016 UPMC All rights reserved