Hurricane VLSI Database


Technology.h
1 // -*- C++ -*-
2 //
3 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
4 //
5 // This file is part of Hurricane.
6 //
7 // Hurricane is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
14 // TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the Lesser GNU General Public
18 // License along with Hurricane. If not, see
19 // <http://www.gnu.org/licenses/>.
20 //
21 // +-----------------------------------------------------------------+
22 // | H U R R I C A N E |
23 // | V L S I B a c k e n d D a t a - B a s e |
24 // | |
25 // | Author : Remy Escassut |
26 // | E-mail : Jean-Paul.Chaput@lip6.fr |
27 // | =============================================================== |
28 // | C++ Header : "./hurricane/Technology.h" |
29 // +-----------------------------------------------------------------+
30 
31 
32 #pragma once
33 #include <set>
34 #include <map>
35 #include "hurricane/Mask.h"
36 #include "hurricane/DBo.h"
37 #include "hurricane/Layer.h"
38 #include "hurricane/BasicLayers.h"
39 #include "hurricane/RegularLayers.h"
40 #include "hurricane/ViaLayers.h"
41 #include "hurricane/IntrusiveMap.h"
42 #include "hurricane/DeviceDescriptor.h"
43 #include "hurricane/ModelDescriptor.h"
44 #include "hurricane/Rule.h"
45 #include "hurricane/PhysicalRule.h"
46 
47 
48 namespace Hurricane {
49 
50  using std::set;
51  using std::multimap;
52 
53  class DataBase;
54  class BasicLayer;
55  class RegularLayer;
56  class ViaLayer;
57 
58 
59 // -------------------------------------------------------------------
60 // Class : "Hurricane::Technology".
61 
62  class Technology : public DBo {
63 
64  public:
65  typedef DBo Super;
66  typedef multimap<Layer::Mask,Layer*> LayerMaskMap;
67  typedef set<DeviceDescriptor*, DeviceDescriptor::DeviceDescriptorComp> DeviceDescriptors;
68  typedef set<ModelDescriptor* , ModelDescriptor::ModelDescriptorComp> ModelDescriptors;
69  public:
70  struct RuleNameCompare {
71  inline bool operator() ( const PhysicalRule* rule1 , const PhysicalRule* rule2 ) const
72  { return rule1->getName() < rule2->getName(); }
73  inline bool operator() ( const Rule* rule1 , const Rule* rule2 ) const
74  { return rule1->getName() < rule2->getName(); }
75  };
76  public:
77  typedef std::pair<const Hurricane::Layer*, const Hurricane::Layer*> LayerPair;
78  typedef std::set<PhysicalRule* , RuleNameCompare> UnitRules;
79  typedef std::set<PhysicalRule* , RuleNameCompare> PhysicalRules;
80  typedef std::map<const Hurricane::Layer* , PhysicalRules> OneLayerRules;
81  typedef std::map<LayerPair , PhysicalRules> TwoLayersRules;
82 
83  public:
84  // Sub-class : LayerMap.
85  class LayerMap : public IntrusiveMap<Name,Layer> {
86  public:
87  typedef IntrusiveMap<Name,Layer> Super;
88  public:
89  LayerMap ();
90  virtual Name _getKey ( Layer* ) const;
91  virtual unsigned _getHashValue ( Name ) const;
92  virtual Layer* _getNextElement ( Layer* ) const;
93  virtual void _setNextElement ( Layer* , Layer* nextLayer) const;
94  };
95 
96  public:
97  // Constructor.
98  static Technology* create ( DataBase* , const Name& );
99  // Accessors.
100  inline bool isMetal ( const Layer* ) const;
101  inline DataBase* getDataBase () const;
102  inline const Name& getName () const;
103  inline Layer* getLayer ( const Name& ) const;
104  BasicLayer* getBasicLayer ( const Name& ) const;
105  RegularLayer* getRegularLayer ( const Name& ) const;
106  ViaLayer* getViaLayer ( const Name& ) const;
107  inline Layers getLayers () const;
108  BasicLayers getBasicLayers () const;
109  BasicLayers getBasicLayers ( const Layer::Mask& ) const;
110  RegularLayers getRegularLayers () const;
111  ViaLayers getViaLayers () const;
112  Layer* getLayer ( const Layer::Mask&, bool useSymbolic=true ) const;
113  Layer* getMetalAbove ( const Layer*, bool useSymbolic=true ) const;
114  Layer* getMetalBelow ( const Layer*, bool useSymbolic=true ) const;
115  Layer* getCutAbove ( const Layer*, bool useSymbolic=true ) const;
116  Layer* getCutBelow ( const Layer*, bool useSymbolic=true ) const;
117  Layer* getViaBetween ( const Layer*, const Layer*, bool useSymbolic=true ) const;
118  Layer* getNthMetal ( int ) const;
119  Layer* getNthCut ( int ) const;
120  DeviceDescriptor* getDeviceDescriptor ( const Name& );
121  ModelDescriptor* getModelDescriptor (const Name& );
122  inline ModelDescriptors& getModelDescriptors ();
123  PhysicalRule* getUnitRule ( std::string ruleName ) const;
124  PhysicalRule* getPhysicalRule ( std::string ruleName ) const;
125  PhysicalRule* getPhysicalRule ( std::string ruleName
126  , std::string layerName ) const;
127  PhysicalRule* getPhysicalRule ( std::string ruleName
128  , std::string layer1Name
129  , std::string layer2Name ) const;
130  inline const UnitRules& getUnitRules () const;
131  inline const PhysicalRules& getNoLayerRules () const;
132  inline const OneLayerRules& getOneLayerRules () const;
133  inline const TwoLayersRules& getTwoLayersRules () const;
134  void toDtr ( std::ostream& );
135  inline void setName ( const std::string& name );
136  // Updators.
137  void setName ( const Name& );
138  bool setSymbolicLayer ( const Name& );
139  bool setSymbolicLayer ( const Layer* );
140  DeviceDescriptor* addDeviceDescriptor ( const Name& );
141  ModelDescriptor* addModelDescriptor ( const Name& name
142  , const Name& simul
143  , const Name& model
144  , std::string netlist
145  , const Name& name_n
146  , const Name& name_p
147  , bool precise );
148  PhysicalRule* addUnitRule ( std::string ruleName
149  , std::string reference );
150  PhysicalRule* addPhysicalRule ( std::string ruleName
151  , std::string reference );
152  void _addPhysicalRule ( std::string layerName
153  , PhysicalRule* );
154  PhysicalRule* addPhysicalRule ( std::string ruleName
155  , std::string layerName
156  , std::string reference);
157  PhysicalRule* addPhysicalRule ( std::string ruleName
158  , std::string layer1Name
159  , std::string layer2Name
160  , std::string reference );
161  // Others.
162  inline LayerMap& _getLayerMap ();
163  inline LayerMaskMap& _getLayerMaskMap ();
164  void _insertInLayerMaskMap ( Layer* );
165  void _removeFromLayerMaskMap ( Layer* );
166  inline Layer::Mask& _getCutMask ();
167  inline Layer::Mask& _getMetalMask ();
168  void _onDbuChange ( float scale );
169  // Hurricane Managment.
170  virtual void _toJson ( JsonWriter* ) const;
171  virtual void _toJsonCollections ( JsonWriter* ) const;
172  virtual string _getTypeName () const;
173  virtual string _getString () const;
174  virtual Record* _getRecord () const;
175 
176  private:
177  // Internal: Attributes.
178  DataBase* _dataBase;
179  Name _name;
180  LayerMap _layerMap;
181  LayerMaskMap _layerMaskMap;
182  Layer::Mask _cutMask;
183  Layer::Mask _metalMask;
184  DeviceDescriptors _deviceDescriptors;
185  ModelDescriptors _modelDescriptors;
186  UnitRules _unitRules;
187  PhysicalRules _noLayerRules;
188  OneLayerRules _oneLayerRules;
189  TwoLayersRules _twoLayersRules;
190 
191  protected:
192  // Constructors & Destructors.
193  Technology ( DataBase* , const Name& );
194  virtual void _postCreate ();
195  virtual void _preDestroy ();
196  };
197 
198 
199 // Inline Functions.
200  inline bool Technology::isMetal ( const Layer* layer ) const { return _metalMask.contains(layer->getMask()); }
201  inline DataBase* Technology::getDataBase () const { return _dataBase; }
202  inline const Name& Technology::getName () const { return _name; }
203  inline Layer* Technology::getLayer ( const Name& name ) const { return _layerMap.getElement(name); }
204  inline Layers Technology::getLayers () const { return getCollection(&_layerMaskMap); }
205  inline Technology::ModelDescriptors& Technology::getModelDescriptors () { return _modelDescriptors; }
206  inline Technology::LayerMap& Technology::_getLayerMap () { return _layerMap; }
207  inline Technology::LayerMaskMap& Technology::_getLayerMaskMap () { return _layerMaskMap; }
208  inline Layer::Mask& Technology::_getCutMask () { return _cutMask; }
209  inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; }
210 
211 
212 // -------------------------------------------------------------------
213 // Class : "Hurricane::JsonTechnology".
214 
215  class JsonTechnology : public JsonDBo {
216  public:
217  static void initialize ();
218  JsonTechnology ( unsigned long flags );
219  virtual ~JsonTechnology ();
220  virtual string getTypeName () const;
221  virtual JsonTechnology* clone ( unsigned long ) const;
222  virtual void toData ( JsonStack& );
223  void addBlockageRef ( const std::string&, BasicLayer* );
224  private:
225  std::map< string, vector<BasicLayer*> > _blockagesMap;
226  };
227 
228 
229 } // Hurricane namespace.
230 
231 
232 // -------------------------------------------------------------------
233 // Inspector Support for : Hurricane::Technology::LayerPair".
234 
235 template<>
236 inline std::string getString<Hurricane::Technology::LayerPair>( Hurricane::Technology::LayerPair lp )
237 { return "<LayerPair layer1=" + getString(lp.first) + ", layer2=" + getString(lp.second) + ">"; }
238 
239 
240 INSPECTOR_P_SUPPORT(Hurricane::Technology);
BasicLayer description (API)
Definition: BasicLayer.h:44
DataBase object root class (API).
Definition: DBo.h:45
The whole DataBase (API).
Definition: DataBase.h:40
Generic Collection auto-pointer.
Definition: Collection.h:235
Layer description (API)
Definition: Layer.h:52
const Mask & getMask() const
Definition: Layer.h:158
Hurricane::Mask< unsigned long long > Mask
Definition: Layer.h:65
Name description (API)
Definition: Name.h:35
Define a rule for the technology (API).
Definition: PhysicalRule.h:65
RegularLayer description (API)
Definition: RegularLayer.h:45
Technological rules description (API).
Definition: Technology.h:62
RegularLayer * getRegularLayer(const Name &) const
PhysicalRule * getPhysicalRule(std::string ruleName, std::string layerName) const
void setName(const Name &)
PhysicalRule * addPhysicalRule(std::string ruleName, std::string reference)
bool setSymbolicLayer(const Layer *)
Layer * getLayer(const Layer::Mask &, bool useSymbolic=true) const
Layer * getCutBelow(const Layer *, bool useSymbolic=true) const
PhysicalRule * addPhysicalRule(std::string ruleName, std::string layer1Name, std::string layer2Name, std::string reference)
PhysicalRule * addPhysicalRule(std::string ruleName, std::string layerName, std::string reference)
Layers getLayers() const
Definition: Technology.h:204
Layer * getLayer(const Name &) const
Definition: Technology.h:203
static Technology * create(DataBase *, const Name &)
PhysicalRule * getUnitRule(std::string ruleName) const
BasicLayers getBasicLayers() const
Layer * getNthMetal(int) const
Layer * getViaBetween(const Layer *, const Layer *, bool useSymbolic=true) const
PhysicalRule * addUnitRule(std::string ruleName, std::string reference)
BasicLayers getBasicLayers(const Layer::Mask &) const
ViaLayer * getViaLayer(const Name &) const
ViaLayers getViaLayers() const
BasicLayer * getBasicLayer(const Name &) const
RegularLayers getRegularLayers() const
Layer * getCutAbove(const Layer *, bool useSymbolic=true) const
DataBase * getDataBase() const
Definition: Technology.h:201
Layer * getMetalBelow(const Layer *, bool useSymbolic=true) const
const Name & getName() const
Definition: Technology.h:202
bool isMetal(const Layer *) const
Definition: Technology.h:200
PhysicalRule * getPhysicalRule(std::string ruleName, std::string layer1Name, std::string layer2Name) const
Layer * getMetalAbove(const Layer *, bool useSymbolic=true) const
ViaLayer description (API)
Definition: ViaLayer.h:46
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5


Generated by doxygen 1.9.1 on Thu Aug 11 2022 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved