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  typedef std::map<const Name , Hurricane::Layer*> LayerAliases;
83 
84  public:
85  // Sub-class : LayerMap.
86  class LayerMap : public IntrusiveMap<Name,Layer> {
87  public:
88  typedef IntrusiveMap<Name,Layer> Super;
89  public:
90  LayerMap ();
91  virtual Name _getKey ( Layer* ) const;
92  virtual unsigned _getHashValue ( Name ) const;
93  virtual Layer* _getNextElement ( Layer* ) const;
94  virtual void _setNextElement ( Layer* , Layer* nextLayer) const;
95  };
96 
97  public:
98  // Constructor.
99  static Technology* create ( DataBase* , const Name& );
100  // Accessors.
101  inline bool isMetal ( const Layer* ) const;
102  inline DataBase* getDataBase () const;
103  inline const Name& getName () const;
104  Layer* getLayer ( const Name& ) const;
105  BasicLayer* getBasicLayer ( const Name& ) const;
106  RegularLayer* getRegularLayer ( const Name& ) const;
107  ViaLayer* getViaLayer ( const Name& ) const;
108  Layers getLayers () const;
109  BasicLayers getBasicLayers () const;
110  BasicLayers getBasicLayers ( const Layer::Mask& ) const;
111  RegularLayers getRegularLayers () const;
112  ViaLayers getViaLayers () const;
113  Layer* getLayer ( const Layer::Mask&, bool useSymbolic=true ) const;
114  Layer* getMetalAbove ( const Layer*, bool useSymbolic=true ) const;
115  Layer* getMetalBelow ( const Layer*, bool useSymbolic=true ) const;
116  Layer* getCutAbove ( const Layer*, bool useSymbolic=true ) const;
117  Layer* getCutBelow ( const Layer*, bool useSymbolic=true ) const;
118  Layer* getViaBetween ( const Layer*, const Layer*, bool useSymbolic=true ) const;
119  Layer* getNthMetal ( int ) const;
120  Layer* getNthCut ( int ) const;
121  DeviceDescriptor* getDeviceDescriptor ( const Name& );
122  ModelDescriptor* getModelDescriptor (const Name& );
123  inline ModelDescriptors& getModelDescriptors ();
124  PhysicalRule* getUnitRule ( std::string ruleName ) const;
125  PhysicalRule* getPhysicalRule ( std::string ruleName ) const;
126  PhysicalRule* getPhysicalRule ( std::string ruleName
127  , std::string layerName ) const;
128  PhysicalRule* getPhysicalRule ( std::string ruleName
129  , std::string layer1Name
130  , std::string layer2Name ) const;
131  inline const UnitRules& getUnitRules () const;
132  inline const PhysicalRules& getNoLayerRules () const;
133  inline const OneLayerRules& getOneLayerRules () const;
134  inline const TwoLayersRules& getTwoLayersRules () const;
135  void toDtr ( std::ostream& );
136  inline void setName ( const std::string& name );
137  // Updators.
138  void setName ( const Name& );
139  bool setSymbolicLayer ( const Name& );
140  bool setSymbolicLayer ( const Layer* );
141  bool addLayerAlias ( const Name& reference, const Name& alias );
142  DeviceDescriptor* addDeviceDescriptor ( const Name& );
143  ModelDescriptor* addModelDescriptor ( const Name& name
144  , const Name& simul
145  , const Name& model
146  , std::string netlist
147  , const Name& name_n
148  , const Name& name_p
149  , bool precise );
150  PhysicalRule* addUnitRule ( std::string ruleName
151  , std::string reference );
152  PhysicalRule* addPhysicalRule ( std::string ruleName
153  , std::string reference );
154  void _addPhysicalRule ( std::string layerName
155  , PhysicalRule* );
156  PhysicalRule* addPhysicalRule ( std::string ruleName
157  , std::string layerName
158  , std::string reference);
159  PhysicalRule* addPhysicalRule ( std::string ruleName
160  , std::string layer1Name
161  , std::string layer2Name
162  , std::string reference );
163  // Others.
164  inline LayerMap& _getLayerMap ();
165  inline LayerMaskMap& _getLayerMaskMap ();
166  void _insertInLayerMaskMap ( Layer* );
167  void _removeFromLayerMaskMap ( Layer* );
168  inline Layer::Mask& _getCutMask ();
169  inline Layer::Mask& _getMetalMask ();
170  void _onDbuChange ( float scale );
171  // Hurricane Managment.
172  virtual void _toJson ( JsonWriter* ) const;
173  virtual void _toJsonCollections ( JsonWriter* ) const;
174  virtual string _getTypeName () const;
175  virtual string _getString () const;
176  virtual Record* _getRecord () const;
177 
178  private:
179  // Internal: Attributes.
180  DataBase* _dataBase;
181  Name _name;
182  LayerMap _layerMap;
183  LayerMaskMap _layerMaskMap;
184  Layer::Mask _cutMask;
185  Layer::Mask _metalMask;
186  LayerAliases _layerAliases;
187  DeviceDescriptors _deviceDescriptors;
188  ModelDescriptors _modelDescriptors;
189  UnitRules _unitRules;
190  PhysicalRules _noLayerRules;
191  OneLayerRules _oneLayerRules;
192  TwoLayersRules _twoLayersRules;
193 
194  protected:
195  // Constructors & Destructors.
196  Technology ( DataBase* , const Name& );
197  virtual void _postCreate ();
198  virtual void _preDestroy ();
199  };
200 
201 
202 // Inline Functions.
203  inline bool Technology::isMetal ( const Layer* layer ) const { return _metalMask.contains(layer->getMask()); }
204  inline DataBase* Technology::getDataBase () const { return _dataBase; }
205  inline const Name& Technology::getName () const { return _name; }
206  inline Layers Technology::getLayers () const { return getCollection(&_layerMaskMap); }
207  inline Technology::ModelDescriptors& Technology::getModelDescriptors () { return _modelDescriptors; }
208  inline Technology::LayerMap& Technology::_getLayerMap () { return _layerMap; }
209  inline Technology::LayerMaskMap& Technology::_getLayerMaskMap () { return _layerMaskMap; }
210  inline Layer::Mask& Technology::_getCutMask () { return _cutMask; }
211  inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; }
212 
213 
214 // -------------------------------------------------------------------
215 // Class : "Hurricane::JsonTechnology".
216 
217  class JsonTechnology : public JsonDBo {
218  public:
219  static void initialize ();
220  JsonTechnology ( unsigned long flags );
221  virtual ~JsonTechnology ();
222  virtual string getTypeName () const;
223  virtual JsonTechnology* clone ( unsigned long ) const;
224  virtual void toData ( JsonStack& );
225  void addBlockageRef ( const std::string&, BasicLayer* );
226  private:
227  std::map< string, vector<BasicLayer*> > _blockagesMap;
228  };
229 
230 
231 } // Hurricane namespace.
232 
233 
234 // -------------------------------------------------------------------
235 // Inspector Support for : Hurricane::Technology::LayerPair".
236 
237 template<>
238 inline std::string getString<Hurricane::Technology::LayerPair>( Hurricane::Technology::LayerPair lp )
239 { return "<LayerPair layer1=" + getString(lp.first) + ", layer2=" + getString(lp.second) + ">"; }
240 
241 
242 INSPECTOR_P_SUPPORT(Hurricane::Technology);
BasicLayer description (API)
Definition: BasicLayer.h:42
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:50
const Mask & getMask() const
Definition: Layer.h:156
Hurricane::Mask< boost::multiprecision::uint128_t > Mask
Definition: Layer.h:53
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:206
Layer * getLayer(const Name &) const
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:204
Layer * getMetalBelow(const Layer *, bool useSymbolic=true) const
const Name & getName() const
Definition: Technology.h:205
bool isMetal(const Layer *) const
Definition: Technology.h:203
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
Contains Almost Everything.
Definition: BasicLayer.h:39


Generated by doxygen 1.9.1 on Wed Nov 20 2024 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved