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


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