# Katabatic Documentation

# Katabatic - Routing Toolbox

Session.h
1 // -*- mode: C++; explicit-buffer-name: "Session.h<katabatic>" -*-
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 a t a b a t i c - Routing Toolbox |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./katabatic/Session.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef KATABATIC_SESSION_H
18 #define KATABATIC_SESSION_H
19
20 #include <string>
21 #include <vector>
22 #include <set>
23 #include <map>
24 #include <boost/function.hpp>
25 #include "hurricane/Commons.h"
26 #include "hurricane/DbU.h"
27 #include "crlcore/CellGauge.h"
28 #include "crlcore/RoutingGauge.h"
29 #include "katabatic/Constants.h"
30 #include "katabatic/Configuration.h"
31
32 namespace Hurricane {
33 class Layer;
34 class Technology;
35 class Net;
36 class Contact;
37 class Segment;
38 }
39
40
41 namespace Katabatic {
42
43 using std::cerr;
44 using std::endl;
45 using std::string;
46 using std::vector;
47 using std::set;
48 using std::map;
49 using std::make_pair;
50 using Hurricane::tab;
51 using Hurricane::_TName;
52 using Hurricane::Record;
53 using Hurricane::Layer;
54 using Hurricane::Technology;
55 using Hurricane::DbU;
56 using Hurricane::Net;
57 using Hurricane::Contact;
58 using Hurricane::Segment;
59 using CRL::RoutingGauge;
60
61 class AutoContact;
62 class AutoSegment;
63 class KatabaticEngine;
64
65
66 // -------------------------------------------------------------------
67 // Class : "Katabatic::Session".
68
69 class Session {
70 public:
71 // Static Methods.
72 static inline bool doDestroyBaseContact ();
73 static inline bool doDestroyBaseSegment ();
74 static inline bool doDestroyTool ();
75 static bool isInDemoMode ();
76 static bool doWarnGCellOverload ();
77 static Session* get ( const char* message=NULL );
78 static inline Technology* getTechnology ();
79 static inline KatabaticEngine* getKatabatic ();
80 static inline const Configuration* getConfiguration ();
81 static float getSaturateRatio ();
82 static size_t getSaturateRp ();
83 static inline size_t getAllowedDepth ();
84 static DbU::Unit getExtensionCap ();
85 static inline CellGauge* getCellGauge ();
86 static inline DbU::Unit getSliceHeight ();
87 static inline DbU::Unit getSliceStep ();
88 static inline RoutingGauge* getRoutingGauge ();
89 static inline RoutingLayerGauge* getLayerGauge ( size_t depth );
90 static inline size_t getDepth ();
91 static inline size_t getViaDepth ( const Layer* layer );
92 static inline size_t getLayerDepth ( const Layer* layer );
93 static inline const Layer* getRoutingLayer ( size_t );
94 static inline const Layer* getContactLayer ( size_t );
95 static unsigned int getDirection ( size_t depth );
96 static inline DbU::Unit getPitch ( size_t depth, unsigned int flags );
97 static inline DbU::Unit getOffset ( size_t depth );
98 static inline DbU::Unit getWireWidth ( size_t depth );
99 static inline DbU::Unit getViaWidth ( size_t depth );
100 static inline unsigned int getDirection ( const Layer* );
101 static inline DbU::Unit getPitch ( const Layer*, unsigned int flags );
102 static inline DbU::Unit getOffset ( const Layer* );
103 static inline DbU::Unit getWireWidth ( const Layer* );
104 static inline DbU::Unit getViaWidth ( const Layer* );
105 static inline DbU::Unit getExtensionCap ( const Layer* );
106 static inline size_t getSegmentStackSize ();
107 static inline size_t getContactStackSize ();
108 static inline const vector<AutoSegment*>& getInvalidateds ();
109 static inline const vector<AutoSegment*>& getRevalidateds ();
110 static inline const set<AutoSegment*>& getDestroyeds ();
111 static inline const vector<AutoSegment*>& getDoglegs ();
112 static inline const set<Net*>& getNetsModificateds ();
113 static Session* open ( KatabaticEngine* );
114 static void close ();
115 static void setKatabaticFlags ( unsigned int );
116 static inline void dogleg ( AutoSegment* );
117 static inline void doglegReset ();
118 static inline void revalidateTopology ();
119 static inline void setInvalidateMask ( unsigned int );
120 static inline void invalidate ( Net* );
121 static inline void invalidate ( AutoContact* );
122 static inline void invalidate ( AutoSegment* );
123 static inline size_t revalidate ();
124 static void link ( AutoContact* );
125 static void link ( AutoSegment* );
126 static void unlink ( AutoContact* );
127 static void unlink ( AutoSegment* );
128 static AutoContact* lookup ( Contact* );
129 static AutoSegment* lookup ( Segment* );
130 static inline void destroyRequest ( AutoSegment* );
131 // Methods.
132 bool _doDestroyBaseContact ();
133 bool _doDestroyBaseSegment ();
134 bool _doDestroyTool ();
135 virtual Configuration* _getConfiguration ();
136 inline void _dogleg ( AutoSegment* );
137 inline void _doglegReset ();
138 void _invalidate ( Net* );
139 inline void _invalidate ( AutoContact* );
140 inline void _invalidate ( AutoSegment* );
141 inline void _destroyRequest ( AutoSegment* );
142 void _canonize ();
143 void _revalidateTopology ();
144 size_t _revalidate ();
145 DbU::Unit _getPitch ( size_t depth, unsigned int flags ) const;
146 Record* _getRecord () const;
147 string _getString () const;
148 inline string _getTypeName () const;
149
150 protected:
151 static Session* _session;
152 KatabaticEngine* _katabatic;
153 Technology* _technology;
154 CellGauge* _cellGauge;
155 RoutingGauge* _routingGauge;
156 vector<AutoContact*> _autoContacts;
157 vector<AutoSegment*> _doglegs;
158 vector<AutoSegment*> _segmentInvalidateds;
159 vector<AutoSegment*> _segmentRevalidateds;
160 set<Net*> _netInvalidateds;
161 set<Net*> _netRevalidateds;
162 set<AutoSegment*> _destroyedSegments;
163
164 // Constructors.
165 protected:
166 Session ( KatabaticEngine* );
167 virtual ~Session ();
168 virtual void _postCreate ();
169 virtual void _preDestroy ();
170 private:
171 Session ( const Session& );
172 Session& operator= ( const Session& );
173 };
174
175
176 // Inline Functions.
177 inline Technology* Session::getTechnology () { return get("getTechnology()")->_technology; }
178 inline CellGauge* Session::getCellGauge () { return get("getCellGauge()")->_cellGauge; }
179 inline RoutingGauge* Session::getRoutingGauge () { return get("getRoutingGauge()")->_routingGauge; }
180 inline bool Session::doDestroyBaseContact () { return get("doDestroyBaseContact()")->_doDestroyBaseContact(); }
181 inline bool Session::doDestroyBaseSegment () { return get("doDestroyBaseSegment()")->_doDestroyBaseSegment(); }
182 inline bool Session::doDestroyTool () { return get("doDestroyTool()")->_doDestroyTool(); }
183 inline const Configuration* Session::getConfiguration () { return get("getConfiguration()")->_getConfiguration(); }
184 inline KatabaticEngine* Session::getKatabatic () { return get("getKatabatic()")->_katabatic; }
185 inline void Session::revalidateTopology () { return get("revalidateTopology()")->_revalidateTopology(); }
186 inline size_t Session::revalidate () { return get("revalidate()")->_revalidate(); }
187 inline size_t Session::getSegmentStackSize () { return get("getSegmentStackSize()")->_segmentInvalidateds.size(); }
188 inline size_t Session::getContactStackSize () { return get("getContactStackSize()")->_autoContacts.size(); }
189 inline const vector<AutoSegment*>& Session::getInvalidateds () { return get("getInvalidateds()")->_segmentInvalidateds; }
190 inline const vector<AutoSegment*>& Session::getRevalidateds () { return get("getRevalidateds()")->_segmentRevalidateds; }
191 inline const set<AutoSegment*>& Session::getDestroyeds () { return get("getDestroyeds()")->_destroyedSegments; }
192 inline const vector<AutoSegment*>& Session::getDoglegs () { return get("getDoglegs()")->_doglegs; }
193 inline const set<Net*>& Session::getNetsModificateds () { return get("getNetsModificateds()")->_netRevalidateds; }
194 inline void Session::doglegReset () { return get("doglegReset()")->_doglegReset (); }
195 inline void Session::invalidate ( Net* net ) { return get("invalidate(Net*)")->_invalidate(net); }
196 inline void Session::invalidate ( AutoContact* autoContact ) { return get("invalidate(AutoContact*)")->_invalidate(autoContact); }
197 inline void Session::invalidate ( AutoSegment* autoSegment ) { return get("invalidate(AutoSegment*)")->_invalidate(autoSegment); }
198 inline void Session::dogleg ( AutoSegment* autoSegment ) { return get("dogleg(AutoSegment*)")->_dogleg(autoSegment); }
199 inline void Session::destroyRequest ( AutoSegment* autoSegment ) { return get("destroyRequest(AutoSegment*)")->_destroyRequest(autoSegment); }
200
201 inline size_t Session::getAllowedDepth () { return getConfiguration()->getAllowedDepth(); }
202
203 inline DbU::Unit Session::getSliceHeight () { return getCellGauge()->getSliceHeight(); }
204 inline DbU::Unit Session::getSliceStep () { return getCellGauge()->getSliceStep(); }
205 inline RoutingLayerGauge* Session::getLayerGauge ( size_t depth ) { return getRoutingGauge()->getLayerGauge(depth); }
206 inline size_t Session::getDepth () { return getRoutingGauge()->getDepth(); }
207 inline size_t Session::getViaDepth ( const Layer* layer ) { return getRoutingGauge()->getViaDepth(layer); }
208 inline size_t Session::getLayerDepth ( const Layer* layer ) { return getRoutingGauge()->getLayerDepth(layer); }
209 inline const Layer* Session::getRoutingLayer ( size_t depth ) { return getRoutingGauge()->getRoutingLayer(depth); }
210 inline const Layer* Session::getContactLayer ( size_t depth ) { return getRoutingGauge()->getContactLayer(depth); }
211 inline DbU::Unit Session::getPitch ( size_t depth, unsigned int flags=Configuration::NoFlags ) { return get("getPitch(depth,flags)")->_getPitch( depth, flags ); }
212 inline DbU::Unit Session::getOffset ( size_t depth ) { return getRoutingGauge()->getLayerOffset(depth); }
213 inline DbU::Unit Session::getWireWidth ( size_t depth ) { return getRoutingGauge()->getLayerWireWidth(depth); }
214 inline DbU::Unit Session::getViaWidth ( size_t depth ) { return getRoutingGauge()->getViaWidth(depth); }
215 inline DbU::Unit Session::getPitch ( const Layer* layer, unsigned int flags=Configuration::NoFlags ) { return getPitch( getLayerDepth(layer), flags ); }
216 inline DbU::Unit Session::getOffset ( const Layer* layer ) { return getOffset ( getLayerDepth(layer) ); }
217 inline DbU::Unit Session::getWireWidth ( const Layer* layer ) { return getWireWidth( getLayerDepth(layer) ); }
218 inline DbU::Unit Session::getViaWidth ( const Layer* layer ) { return getViaWidth ( getViaDepth(layer) ); }
219 inline DbU::Unit Session::getExtensionCap ( const Layer* layer ) { return getConfiguration()->getExtensionCap(layer); }
220 inline unsigned int Session::getDirection ( const Layer* layer ) { return getDirection( getLayerDepth(layer) ); }
221
222 inline void Session::_dogleg ( AutoSegment* segment ) { _doglegs.push_back(segment); }
223 inline void Session::_doglegReset () { _doglegs.clear(); }
224 inline void Session::_invalidate ( AutoContact* contact ) { _autoContacts.push_back(contact); }
225 inline void Session::_invalidate ( AutoSegment* segment ) { _segmentInvalidateds.push_back(segment); }
226 inline void Session::_destroyRequest ( AutoSegment* segment ) { _destroyedSegments.insert(segment); }
227 inline string Session::_getTypeName () const { return _TName("Session"); }
228
229
230 } // Katabatic namespace.
231
232
233 INSPECTOR_P_SUPPORT(Katabatic::Session);
234
235
236 #endif // KATABATIC_SESSION_H
Katabatic::Session::revalidateTopology
static void revalidateTopology()
Definition: Session.h:185
Katabatic::Session::getNetsModificateds
static const set< Net * > & getNetsModificateds()
Definition: Session.h:193
Katabatic::Session::close
static void close()
Definition: Session.cpp:295
Katabatic::Session::getSegmentStackSize
static size_t getSegmentStackSize()
Definition: Session.h:187
Katabatic::Session::link
static void link(AutoContact *)
Definition: Session.cpp:368
Katabatic::Session::getInvalidateds
static const vector< AutoSegment * > & getInvalidateds()
Definition: Session.h:189
Katabatic::Session::getContactLayer
static const Layer * getContactLayer(size_t)
Definition: Session.h:210
Hurricane::Net
Hurricane::Contact
Hurricane::DbU::Unit
std::int64_t Unit
Hurricane::Contact
CRL::RoutingGauge
Katabatic::Session::getRevalidateds
static const vector< AutoSegment * > & getRevalidateds()
Definition: Session.h:190
Katabatic::Session
Modification Session for Katabatic.
Definition: Session.h:69
Katabatic::Session::lookup
static AutoContact * lookup(Contact *)
Definition: Session.cpp:384
Katabatic::AutoSegment
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
Katabatic::Session::getExtensionCap
static DbU::Unit getExtensionCap()
Katabatic::Session::dogleg
static void dogleg(AutoSegment *)
Definition: Session.h:198
anonymous_namespace{LoadGrByNet.cpp}::NoFlags
Definition: LoadGrByNet.cpp:405
Katabatic::Session::getSaturateRatio
static float getSaturateRatio()
Definition: Session.cpp:352
Katabatic::Session::getRoutingGauge
static RoutingGauge * getRoutingGauge()
Definition: Session.h:179
Katabatic::Session::setKatabaticFlags
static void setKatabaticFlags(unsigned int)
Definition: Session.cpp:364
Katabatic::Session::setInvalidateMask
static void setInvalidateMask(unsigned int)
CRL::RoutingGauge::getDepth
size_t getDepth() const
Katabatic::Session::getKatabatic
static KatabaticEngine * getKatabatic()
Definition: Session.h:184
Katabatic
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
Katabatic::Session::getSaturateRp
static size_t getSaturateRp()
Definition: Session.cpp:356
Katabatic::Session::getContactStackSize
static size_t getContactStackSize()
Definition: Session.h:188
Katabatic::KatabaticEngine
The Katabatic Tool.
Definition: KatabaticEngine.h:91
CRL::RoutingGauge::getLayerGauge
RoutingLayerGauge * getLayerGauge(const Layer *) const
Katabatic::Session::isInDemoMode
static bool isInDemoMode()
Definition: Session.cpp:348
Hurricane::DbU
Katabatic::Session::getConfiguration
static const Configuration * getConfiguration()
Definition: Session.h:183
Hurricane::Layer
Katabatic::Session::getTechnology
static Technology * getTechnology()
Definition: Session.h:177
Hurricane::Segment
Katabatic::Session::invalidate
static void invalidate(Net *)
Definition: Session.h:195
CRL::RoutingGauge::getContactLayer
Layer * getContactLayer(size_t depth) const
Katabatic::Session::open
static Session * open(KatabaticEngine *)
Definition: Session.cpp:277
Katabatic::Session::unlink
static void unlink(AutoContact *)
Definition: Session.cpp:376
CRL::RoutingGauge::getRoutingLayer
const Layer * getRoutingLayer(size_t depth) const
Hurricane
Katabatic::Session::getRoutingLayer
static const Layer * getRoutingLayer(size_t)
Definition: Session.h:209
Katabatic::AutoContact
Abstract base class for AutoContact.
Definition: AutoContact.h:70
Katabatic::Session::getDoglegs
static const vector< AutoSegment * > & getDoglegs()
Definition: Session.h:192
Hurricane::Net
CRL::RoutingGauge::getLayerDepth
size_t getLayerDepth(const Layer *) const
Katabatic::Session::doWarnGCellOverload
static bool doWarnGCellOverload()
Definition: Session.cpp:360
Hurricane::Technology
CRL::RoutingLayerGauge
Katabatic::Session::revalidate
static size_t revalidate()
Definition: Session.h:186