# Hurricane Documentation

# 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);
Hurricane::Technology::getName
const Name & getName() const
Definition: Technology.h:202
Hurricane::Technology::getBasicLayer
BasicLayer * getBasicLayer(const Name &) const
Hurricane::RegularLayer
RegularLayer description (API)
Definition: RegularLayer.h:45
Hurricane::Technology::addUnitRule
PhysicalRule * addUnitRule(std::string ruleName, std::string reference)
Hurricane::Technology::getViaLayer
ViaLayer * getViaLayer(const Name &) const
Hurricane::BasicLayer
BasicLayer description (API)
Definition: BasicLayer.h:44
Hurricane::Technology::getRegularLayers
RegularLayers getRegularLayers() const
Hurricane::Technology::getBasicLayers
BasicLayers getBasicLayers() const
Hurricane::Technology::addPhysicalRule
PhysicalRule * addPhysicalRule(std::string ruleName, std::string reference)
Hurricane::Name
Name description (API)
Definition: Name.h:35
Hurricane::Technology::getUnitRule
PhysicalRule * getUnitRule(std::string ruleName) const
Hurricane::Technology::getViaLayers
ViaLayers getViaLayers() const
Hurricane::DBo
DataBase object root class (API).
Definition: DBo.h:47
Hurricane::Technology::isMetal
bool isMetal(const Layer *) const
Definition: Technology.h:200
Hurricane::Layer::Mask
Hurricane::Mask< unsigned long long > Mask
Definition: Layer.h:65
Hurricane::Technology::getLayers
Layers getLayers() const
Definition: Technology.h:204
Hurricane::GenericCollection
Generic Collection auto-pointer.
Definition: Collection.h:28
Hurricane::Technology::getLayer
Layer * getLayer(const Name &) const
Definition: Technology.h:203
Hurricane::DataBase
The whole DataBase (API).
Definition: DataBase.h:40
Hurricane::Technology::getCutBelow
Layer * getCutBelow(const Layer *, bool useSymbolic=true) const
Hurricane::Layer
Layer description (API)
Definition: Layer.h:52
Hurricane::Layer::getMask
const Mask & getMask() const
Definition: Layer.h:155
Hurricane::Technology::getDataBase
DataBase * getDataBase() const
Definition: Technology.h:201
Hurricane::Technology::getNthMetal
Layer * getNthMetal(int) const
Hurricane::PhysicalRule
Define a rule for the technology (API).
Definition: PhysicalRule.h:65
Hurricane::Technology::create
static Technology * create(DataBase *, const Name &)
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Technology::getRegularLayer
RegularLayer * getRegularLayer(const Name &) const
Hurricane::Technology::getCutAbove
Layer * getCutAbove(const Layer *, bool useSymbolic=true) const
Hurricane::Technology::getMetalBelow
Layer * getMetalBelow(const Layer *, bool useSymbolic=true) const
Hurricane::Technology
Technological rules description (API).
Definition: Technology.h:62
Hurricane::ViaLayer
ViaLayer description (API)
Definition: ViaLayer.h:46
Hurricane::Technology::getViaBetween
Layer * getViaBetween(const Layer *, const Layer *, bool useSymbolic=true) const
Hurricane::Technology::getMetalAbove
Layer * getMetalAbove(const Layer *, bool useSymbolic=true) const