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


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