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;
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
const NetSet & getRoutingNets() const
const Layer * getRoutingLayer(size_t depth) const
Definition: KatabaticEngine.h:233
bool doDestroyBaseSegment() const
Definition: KatabaticEngine.h:216
bool isGMetal(const Layer *) const
Definition: KatabaticEngine.h:221
bool isInDemoMode() const
Definition: KatabaticEngine.h:219
set< Net *, NetCompareByName > NetSet
Definition: KatabaticEngine.h:94
Definition: Constants.h:23
size_t getSaturateRp() const
Definition: KatabaticEngine.h:238
static KatabaticEngine * create(Cell *)
Definition: KatabaticEngine.cpp:204
virtual void loadGlobalRouting(unsigned int method)
Definition: KatabaticEngine.cpp:491
const ChipTools & getChipTools() const
Definition: KatabaticEngine.h:243
std::int64_t Unit
float getSaturateRatio() const
Definition: KatabaticEngine.h:237
bool doWarnOnGCellOverload() const
Definition: KatabaticEngine.h:218
void slackenBlockIos(Instance *core)
Definition: ChipTools.cpp:180
void setFlags(unsigned int)
Definition: KatabaticEngine.h:223
Configuration * getKatabaticConfiguration()
Definition: KatabaticEngine.h:220
Hurricane::Mask< unsigned long long > Mask
RoutingGauge * getRoutingGauge() const
Definition: KatabaticEngine.h:231
bool doDestroyTool() const
Definition: KatabaticEngine.h:217
GCell Grid.
Definition: GCellGrid.h:42
static const Name & staticGetName()
Definition: KatabaticEngine.cpp:138
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
bool isChip() const
Definition: ChipTools.h:84
set< GCell *, CompareByIndex > SetIndex
Definition: GCell.h:105
void layerAssign(unsigned int method)
DbU::Unit getGlobalThreshold() const
Definition: KatabaticEngine.h:236
void setState(EngineState state)
Definition: KatabaticEngine.h:241
void refresh(unsigned int flags=KbOpenSession)
Definition: KatabaticEngine.cpp:401
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
The Katabatic Tool.
Definition: KatabaticEngine.h:91
void setGlobalThreshold(DbU::Unit)
Definition: KatabaticEngine.h:227
unsigned int getFlags(unsigned int mask) const
Definition: KatabaticEngine.h:228
void setSaturateRp(size_t)
Definition: KatabaticEngine.h:226
bool isChip() const
Definition: KatabaticEngine.h:242
void computeNetConstraints(Net *)
void unsetFlags(unsigned int)
Definition: KatabaticEngine.h:224
bool moveUpNetTrunk(AutoSegment *, set< Net *> &globalNets, GCell::SetIndex &invalidateds)
RoutingLayerGauge * getLayerGauge(size_t depth) const
Definition: KatabaticEngine.h:232
Utilities for Chip Level Design.
Definition: ChipTools.h:39
void xmlWriteGCellGrid(ostream &)
Definition: KatabaticEngine.cpp:354
virtual Configuration * getConfiguration()
Definition: KatabaticEngine.cpp:437
virtual const Name & getName() const
Definition: KatabaticEngine.cpp:142
bool doDestroyBaseContact() const
Definition: KatabaticEngine.h:215
Definition: Constants.h:59
Abstract base class for AutoContact.
Definition: AutoContact.h:70
DbU::Unit getExtensionCap() const
void slackenBorder(Box bb, Layer::Mask, unsigned int flags)
Definition: ChipTools.cpp:164
EngineState getState() const
Definition: KatabaticEngine.h:229
virtual void createDetailedGrid()
Definition: KatabaticEngine.cpp:167
void setSaturateRatio(float)
Definition: KatabaticEngine.h:225
void printMeasures(const string &) const
Definition: KatabaticEngine.cpp:363
Layer * getContactLayer(size_t depth) const
Definition: KatabaticEngine.h:234
EngineState
Definition: Constants.h:54
GCellGrid * getGCellGrid() const
Definition: KatabaticEngine.h:235
virtual void finalizeLayout()
Definition: KatabaticEngine.cpp:514


Generated by doxygen 1.8.14 on Sun May 26 2019 Return to top of page
Katabatic - Routing Toolbox Copyright © 2008-2016 UPMC. All rights reserved