# Katabatic - Routing Toolbox

KatabaticEngine.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC/LIP6 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/KatabaticEngine.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef KATABATIC_KATABATIC_ENGINE_H
18 #define KATABATIC_KATABATIC_ENGINE_H
19
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 #include <set>
24 #include <map>
25 #include "hurricane/DbU.h"
26 #include "hurricane/Torus.h"
27 #include "hurricane/Layer.h"
28 #include "hurricane/Net.h"
29 #include "hurricane/NetRoutingProperty.h"
30
31 namespace Hurricane {
32 class Name;
33 class Cell;
34 class Instance;
35 }
36
37 #include "crlcore/ToolEngine.h"
38
39 namespace CRL {
40 class RoutingGauge;
41 class RoutingLayerGauge;
42 }
43
44 #include "katabatic/Constants.h"
45 #include "katabatic/Configuration.h"
46 #include "katabatic/GCell.h"
47 #include "katabatic/AutoSegments.h"
48 #include "katabatic/AutoContact.h"
49 #include "katabatic/ChipTools.h"
50
51
52 namespace Katabatic {
53
54 using std::ostream;
55 using std::string;
56 using std::vector;
57 using std::set;
58 using Hurricane::Timer;
59 using Hurricane::Name;
60 using Hurricane::Layer;
61 using Hurricane::Torus;
62 using Hurricane::Net;
63 using Hurricane::Nets;
64 using Hurricane::Cell;
65 using Hurricane::Instance;
66 using Hurricane::NetRoutingExtension;
67 using Hurricane::NetRoutingState;
68 using CRL::RoutingGauge;
69 using CRL::RoutingLayerGauge;
70 using CRL::ToolEngine;
71
72 class GCellGrid;
73
74
75 // -------------------------------------------------------------------
76 // Functors.
77
78 struct NetCompareByName {
79 inline bool operator() ( const Net* lhs, const Net* rhs ) const;
80 };
81
82 inline bool NetCompareByName::operator() ( const Net* lhs, const Net* rhs ) const
83 { return lhs->getName() < rhs->getName(); }
84
85
86 // -------------------------------------------------------------------
87 // Class : "KatabaticEngine".
88
89 typedef map<Name,NetRoutingState*> NetRoutingStates;
90
91 class KatabaticEngine : public ToolEngine {
92 public:
93 typedef ToolEngine Super;
94 typedef set<Net*,NetCompareByName> NetSet;
95
96 public:
97 // Constructor.
98 static KatabaticEngine* create ( Cell* );
99 // Accessors.
100 static KatabaticEngine* get ( const Cell* );
101 static const Name& staticGetName ();
102 inline bool isGMetal ( const Layer* ) const;
103 inline bool isGContact ( const Layer* ) const;
104 inline bool isChip () const;
105 inline bool isInDemoMode () const;
106 inline bool doWarnOnGCellOverload () const;
107 inline bool doDestroyBaseContact () const;
108 inline bool doDestroyBaseSegment () const;
109 inline bool doDestroyTool () const;
110 virtual const Name& getName () const;
111 inline EngineState getState () const;
112 inline unsigned int getFlags ( unsigned int mask ) const;
113 inline Configuration* getKatabaticConfiguration ();
114 virtual Configuration* getConfiguration ();
115 inline CellGauge* getCellGauge () const;
116 inline RoutingGauge* getRoutingGauge () const;
117 inline RoutingLayerGauge* getLayerGauge ( size_t depth ) const;
118 inline const Layer* getRoutingLayer ( size_t depth ) const ;
119 inline Layer* getContactLayer ( size_t depth ) const ;
120 inline GCellGrid* getGCellGrid () const;
121 inline const NetSet& getRoutingNets () const;
122 inline DbU::Unit getGlobalThreshold () const;
123 inline float getSaturateRatio () const;
124 inline size_t getSaturateRp () const;
125 inline DbU::Unit getExtensionCap () const;
126 inline const ChipTools& getChipTools () const;
127 inline const NetRoutingStates& getNetRoutingStates () const;
128 void xmlWriteGCellGrid ( ostream& );
129 void xmlWriteGCellGrid ( const string& );
130 // Modifiers.
131 inline void setState ( EngineState state );
132 inline void setFlags ( unsigned int );
133 inline void unsetFlags ( unsigned int );
134 inline void setGlobalThreshold ( DbU::Unit );
135 inline void setSaturateRatio ( float );
136 inline void setSaturateRp ( size_t );
137 void printMeasures ( const string& ) const;
138 void refresh ( unsigned int flags=KbOpenSession );
139 virtual void createDetailedGrid ();
140 void chipPrep ();
141 void findSpecialNets ();
142 void makePowerRails ();
143 virtual void loadGlobalRouting ( unsigned int method );
144 void slackenBorder ( Box bb, Layer::Mask, unsigned int flags );
145 void slackenBlockIos ( Instance* core );
146 bool moveUpNetTrunk ( AutoSegment*, set<Net*>& globalNets, GCell::SetIndex& invalidateds );
147 bool moveUpNetTrunk2 ( AutoSegment*, set<Net*>& globalNets, GCell::SetIndex& invalidateds );
148 void moveULeft ( AutoSegment*, set<Net*>& globalNets, GCell::SetIndex& invalidateds );
149 void moveURight ( AutoSegment*, set<Net*>& globalNets, GCell::SetIndex& invalidateds );
150 void balanceGlobalDensity ();
151 void layerAssign ( unsigned int method );
152 void updateNetTopology ( Net* );
153 void computeNetConstraints ( Net* );
154 void toOptimals ( Net* );
155 virtual void finalizeLayout ();
156 // Internal Modifiers.
157 NetRoutingState* getRoutingState ( Net*, unsigned int flags=KbNoFlags );
158 void _computeNetOptimals ( Net* );
159 void _computeNetTerminals ( Net* );
160 bool _check ( const char* message=NULL ) const;
161 void _check ( Net* ) const;
162 void _gutKatabatic ();
163 void _link ( AutoContact* );
164 void _link ( AutoSegment* );
165 void _unlink ( AutoContact* );
166 void _unlink ( AutoSegment* );
167 AutoContact* _lookup ( Contact* ) const;
168 AutoSegment* _lookup ( Segment* ) const;
169 void _destroyAutoSegments ();
170 void _destroyAutoContacts ();
171 void _loadGrByNet ();
172 void _loadNetGlobalRouting ( Net* );
173 void _alignate ( Net* );
174 void _balanceGlobalDensity ( unsigned int depth );
175 void _desaturate ( unsigned int depth, set<Net*>&, unsigned long& total, unsigned long& globals );
176 void _layerAssignByLength ( unsigned long& total, unsigned long& global, set<Net*>& );
177 void _layerAssignByLength ( Net*, unsigned long& total, unsigned long& global, set<Net*>& );
178 void _layerAssignByTrunk ( unsigned long& total, unsigned long& global, set<Net*>& );
179 void _layerAssignByTrunk ( Net*, set<Net*>&, unsigned long& total, unsigned long& global );
180 void _saveNet ( Net* );
181 void _print () const;
182 void _print ( Net* ) const;
183 inline const AutoContactLut& _getAutoContactLut () const;
184 inline const AutoSegmentLut& _getAutoSegmentLut () const;
185 // Inspector Management.
186 virtual Record* _getRecord () const;
187 virtual string _getString () const;
188 virtual string _getTypeName () const;
189
190 protected:
191 // Attributes.
192 static Name _toolName;
193 EngineState _state;
194 unsigned int _flags;
195 Configuration* _configuration;
196 GCellGrid* _gcellGrid;
197 ChipTools _chipTools;
198 AutoSegmentLut _autoSegmentLut;
199 AutoContactLut _autoContactLut;
200 NetRoutingStates _netRoutingStates;
201
202 protected:
203 // Constructors & Destructors.
204 KatabaticEngine ( Cell* );
205 virtual ~KatabaticEngine ();
206 virtual void _postCreate ();
207 virtual void _preDestroy ();
208 private:
209 KatabaticEngine ( const KatabaticEngine& );
210 KatabaticEngine& operator= ( const KatabaticEngine& );
211 };
212
213
214 // Inline Functions.
215 inline bool KatabaticEngine::doDestroyBaseContact () const { return _flags & EngineDestroyBaseContact; }
216 inline bool KatabaticEngine::doDestroyBaseSegment () const { return _flags & EngineDestroyBaseSegment; }
217 inline bool KatabaticEngine::doDestroyTool () const { return _state >= EngineGutted; }
218 inline bool KatabaticEngine::doWarnOnGCellOverload () const { return _flags & EngineWarnOnGCellOverload; }
219 inline bool KatabaticEngine::isInDemoMode () const { return _flags & EngineDemoMode; }
220 inline Configuration* KatabaticEngine::getKatabaticConfiguration () { return _configuration; }
221 inline bool KatabaticEngine::isGMetal ( const Layer* layer ) const { return _configuration->isGMetal(layer); }
222 inline bool KatabaticEngine::isGContact ( const Layer* layer ) const { return _configuration->isGContact(layer); }
223 inline void KatabaticEngine::setFlags ( unsigned int flags ) { _flags |= flags; }
224 inline void KatabaticEngine::unsetFlags ( unsigned int flags ) { _flags &= ~flags; }
225 inline void KatabaticEngine::setSaturateRatio ( float ratio ) { _configuration->setSaturateRatio(ratio); }
226 inline void KatabaticEngine::setSaturateRp ( size_t threshold ) { _configuration->setSaturateRp(threshold); }
227 inline void KatabaticEngine::setGlobalThreshold ( DbU::Unit threshold ) { _configuration->setGlobalThreshold(threshold); }
228 inline unsigned int KatabaticEngine::getFlags ( unsigned int mask ) const { return _flags & mask; }
229 inline EngineState KatabaticEngine::getState () const { return _state; }
230 inline CellGauge* KatabaticEngine::getCellGauge () const { return _configuration->getCellGauge(); }
231 inline RoutingGauge* KatabaticEngine::getRoutingGauge () const { return _configuration->getRoutingGauge(); }
232 inline RoutingLayerGauge* KatabaticEngine::getLayerGauge ( size_t depth ) const { return _configuration->getLayerGauge(depth); }
233 inline const Layer* KatabaticEngine::getRoutingLayer ( size_t depth ) const { return _configuration->getRoutingLayer(depth); }
234 inline Layer* KatabaticEngine::getContactLayer ( size_t depth ) const { return _configuration->getContactLayer(depth); }
235 inline GCellGrid* KatabaticEngine::getGCellGrid () const { return _gcellGrid; }
236 inline DbU::Unit KatabaticEngine::getGlobalThreshold () const { return _configuration->getGlobalThreshold(); }
237 inline float KatabaticEngine::getSaturateRatio () const { return _configuration->getSaturateRatio(); }
238 inline size_t KatabaticEngine::getSaturateRp () const { return _configuration->getSaturateRp(); }
239 inline const AutoContactLut& KatabaticEngine::_getAutoContactLut () const { return _autoContactLut; }
240 inline const AutoSegmentLut& KatabaticEngine::_getAutoSegmentLut () const { return _autoSegmentLut; }
241 inline void KatabaticEngine::setState ( EngineState state ) { _state = state; }
242 inline bool KatabaticEngine::isChip () const { return _chipTools.isChip(); }
243 inline const ChipTools& KatabaticEngine::getChipTools () const { return _chipTools; }
244 inline const NetRoutingStates& KatabaticEngine::getNetRoutingStates () const { return _netRoutingStates; }
245
246
247 // -------------------------------------------------------------------
248 // Global Variables.
249
250
251 extern const char* missingKTBT;
252 extern const char* badMethod;
253
254
255 } // Katabatic namespace.
256
257 #endif // KATABATIC_KATABATIC_ENGINE_H
Katabatic::KatabaticEngine::getRoutingNets
const NetSet & getRoutingNets() const
Katabatic::KatabaticEngine::getRoutingLayer
const Layer * getRoutingLayer(size_t depth) const
Definition: KatabaticEngine.h:233
Katabatic::KatabaticEngine::doDestroyBaseSegment
bool doDestroyBaseSegment() const
Definition: KatabaticEngine.h:216
Katabatic::KatabaticEngine::isGMetal
bool isGMetal(const Layer *) const
Definition: KatabaticEngine.h:221
Katabatic::KatabaticEngine::isInDemoMode
bool isInDemoMode() const
Definition: KatabaticEngine.h:219
Katabatic::KatabaticEngine::NetSet
set< Net *, NetCompareByName > NetSet
Definition: KatabaticEngine.h:94
Katabatic::KatabaticEngine::makePowerRails
void makePowerRails()
Katabatic::KbOpenSession
Definition: Constants.h:23
Katabatic::KatabaticEngine::getSaturateRp
size_t getSaturateRp() const
Definition: KatabaticEngine.h:238
Katabatic::KatabaticEngine::create
static KatabaticEngine * create(Cell *)
Definition: KatabaticEngine.cpp:204
Katabatic::KatabaticEngine::loadGlobalRouting
virtual void loadGlobalRouting(unsigned int method)
Definition: KatabaticEngine.cpp:491
Hurricane::Name
Hurricane::Net
Katabatic::KatabaticEngine::getChipTools
const ChipTools & getChipTools() const
Definition: KatabaticEngine.h:243
Hurricane::Contact
Hurricane::DbU::Unit
std::int64_t Unit
Katabatic::KatabaticEngine::getSaturateRatio
float getSaturateRatio() const
Definition: KatabaticEngine.h:237
Katabatic::KatabaticEngine::doWarnOnGCellOverload
bool doWarnOnGCellOverload() const
Definition: KatabaticEngine.h:218
Hurricane::Cell
Katabatic::KatabaticEngine::slackenBlockIos
void slackenBlockIos(Instance *core)
Definition: ChipTools.cpp:180
CRL::RoutingGauge
Katabatic::KatabaticEngine::setFlags
void setFlags(unsigned int)
Definition: KatabaticEngine.h:223
Katabatic::KatabaticEngine::getKatabaticConfiguration
Configuration * getKatabaticConfiguration()
Definition: KatabaticEngine.h:220
Hurricane::Layer::Mask
Hurricane::Mask< unsigned long long > Mask
Katabatic::KatabaticEngine::getRoutingGauge
RoutingGauge * getRoutingGauge() const
Definition: KatabaticEngine.h:231
Katabatic::KatabaticEngine::doDestroyTool
bool doDestroyTool() const
Definition: KatabaticEngine.h:217
Katabatic::GCellGrid
GCell Grid.
Definition: GCellGrid.h:42
Katabatic::KatabaticEngine::staticGetName
static const Name & staticGetName()
Definition: KatabaticEngine.cpp:138
Katabatic::AutoSegment
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
Katabatic::ChipTools::isChip
bool isChip() const
Definition: ChipTools.h:84
Hurricane::GenericCollection
Katabatic::GCell::SetIndex
set< GCell *, CompareByIndex > SetIndex
Definition: GCell.h:105
Katabatic::KatabaticEngine::layerAssign
void layerAssign(unsigned int method)
Katabatic::KatabaticEngine::getGlobalThreshold
DbU::Unit getGlobalThreshold() const
Definition: KatabaticEngine.h:236
Katabatic::KatabaticEngine::setState
void setState(EngineState state)
Definition: KatabaticEngine.h:241
Katabatic::KatabaticEngine::refresh
void refresh(unsigned int flags=KbOpenSession)
Definition: KatabaticEngine.cpp:401
Katabatic
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
Hurricane::Box
Katabatic::KatabaticEngine
The Katabatic Tool.
Definition: KatabaticEngine.h:91
Hurricane::Instance
Katabatic::KatabaticEngine::setGlobalThreshold
void setGlobalThreshold(DbU::Unit)
Definition: KatabaticEngine.h:227
Katabatic::KatabaticEngine::getFlags
unsigned int getFlags(unsigned int mask) const
Definition: KatabaticEngine.h:228
Katabatic::KatabaticEngine::setSaturateRp
void setSaturateRp(size_t)
Definition: KatabaticEngine.h:226
Katabatic::KatabaticEngine::isChip
bool isChip() const
Definition: KatabaticEngine.h:242
Katabatic::KatabaticEngine::computeNetConstraints
void computeNetConstraints(Net *)
CRL::ToolEngine
Katabatic::KatabaticEngine::unsetFlags
void unsetFlags(unsigned int)
Definition: KatabaticEngine.h:224
Katabatic::KatabaticEngine::moveUpNetTrunk
bool moveUpNetTrunk(AutoSegment *, set< Net *> &globalNets, GCell::SetIndex &invalidateds)
Hurricane::Layer
Katabatic::KatabaticEngine::getLayerGauge
RoutingLayerGauge * getLayerGauge(size_t depth) const
Definition: KatabaticEngine.h:232
Hurricane::Segment
Katabatic::ChipTools
Utilities for Chip Level Design.
Definition: ChipTools.h:39
Katabatic::KatabaticEngine::xmlWriteGCellGrid
void xmlWriteGCellGrid(ostream &)
Definition: KatabaticEngine.cpp:354
Katabatic::KatabaticEngine::getConfiguration
virtual Configuration * getConfiguration()
Definition: KatabaticEngine.cpp:437
Katabatic::KatabaticEngine::getName
virtual const Name & getName() const
Definition: KatabaticEngine.cpp:142
Katabatic::KatabaticEngine::doDestroyBaseContact
bool doDestroyBaseContact() const
Definition: KatabaticEngine.h:215
Katabatic::EngineGutted
Definition: Constants.h:59
Hurricane
Katabatic::AutoContact
Abstract base class for AutoContact.
Definition: AutoContact.h:70
Katabatic::KatabaticEngine::toOptimals
void toOptimals(Net *)
Katabatic::KatabaticEngine::getExtensionCap
DbU::Unit getExtensionCap() const
Katabatic::KatabaticEngine::slackenBorder
void slackenBorder(Box bb, Layer::Mask, unsigned int flags)
Definition: ChipTools.cpp:164
Katabatic::KatabaticEngine::getState
EngineState getState() const
Definition: KatabaticEngine.h:229
Katabatic::KatabaticEngine::createDetailedGrid
virtual void createDetailedGrid()
Definition: KatabaticEngine.cpp:167
Katabatic::KatabaticEngine::setSaturateRatio
void setSaturateRatio(float)
Definition: KatabaticEngine.h:225
Katabatic::KatabaticEngine::printMeasures
void printMeasures(const string &) const
Definition: KatabaticEngine.cpp:363
Hurricane::Net
Katabatic::KatabaticEngine::getContactLayer
Layer * getContactLayer(size_t depth) const
Definition: KatabaticEngine.h:234
Katabatic::EngineState
EngineState
Definition: Constants.h:54
CRL::RoutingLayerGauge
Katabatic::KatabaticEngine::getGCellGrid
GCellGrid * getGCellGrid() const
Definition: KatabaticEngine.h:235
CRL
Katabatic::KatabaticEngine::finalizeLayout
virtual void finalizeLayout()
Definition: KatabaticEngine.cpp:514

Generated by doxygen 1.8.14 on Mon Feb 3 2020 | Return to top of page

Katabatic - Routing Toolbox | Copyright © 2008-2016 UPMC. All rights reserved