# Coriolis Core (CRLCore) Documentation

# Coriolis Core (CRL) Documentation

AllianceFramework.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | Alliance / Hurricane Interface |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./crlcore/AllianceFramework.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef CRL_ALLIANCE_FRAMEWORK_H
18 #define CRL_ALLIANCE_FRAMEWORK_H
19
20 #include <map>
21 #include <limits>
22 #include "hurricane/Cell.h"
23 #include "crlcore/Environment.h"
24 #include "crlcore/AllianceLibrary.h"
25 #include "crlcore/Catalog.h"
26 #include "crlcore/ParsersDrivers.h"
27
28
29 namespace CRL {
30
31 using Hurricane::Observable;
32 using Hurricane::BaseObserver;
33 using Hurricane::JsonObject;
34 using Hurricane::JsonStack;
35 using Hurricane::DbU;
36 using Hurricane::Cell;
37 using Hurricane::Net;
38 class RoutingGauge;
39 class CellGauge;
40
41
42 class AllianceFramework : public DBo {
43 typedef DBo Super;
44 public:
45 enum FunctionsFlags { NoFlags = 0
46 , NoPythonInit = (1<<0)
47 };
48 enum InstancesCountFlags { Recursive = (1<<0)
49 , IgnoreFeeds = (1<<1)
50 };
51 enum LibraryFlags { CreateLibrary = (1<<0)
52 , AppendLibrary = (1<<1)
53 , HasCatalog = (1<<2)
54 };
55 enum NotifyFlags { AddedLibrary = (1<<0)
56 , RemovedLibrary = (1<<1)
57 , ConfigChanged = (1<<2)
58 };
59 public:
60 static AllianceFramework* create ( unsigned long flags=NoFlags );
61 virtual void _postCreate ();
62 virtual void _preDestroy ();
63 // Accessors.
64 static AllianceFramework* get ();
65 string getPrint () const;
66 // Predicates.
67 Catalog::State* isInCatalog ( const Name& );
68 Catalog::State* isInCatalog ( string );
69 inline bool isPOWER ( const char* name );
70 inline bool isPOWER ( const string& name );
71 inline bool isPOWER ( const Name& name );
72 inline bool isGROUND ( const char* name );
73 inline bool isGROUND ( const string& name );
74 inline bool isGROUND ( const Name& name );
75 inline bool isCLOCK ( const char* name );
76 inline bool isCLOCK ( const string& name );
77 inline bool isCLOCK ( const Name& name );
78 inline bool isBLOCKAGE ( const char* name );
79 inline bool isBLOCKAGE ( const string& name );
80 inline bool isBLOCKAGE ( const Name& name );
81 inline bool isBLOCKAGE ( const Net* net );
82 inline bool isPad ( const char* name );
83 inline bool isPad ( const string& name );
84 inline bool isPad ( const Name& name );
85 inline bool isPad ( const Cell* );
86 // Accessors.
87 inline Environment* getEnvironment ();
88 inline Catalog* getCatalog ();
89 inline const Name& getParentLibraryName () const;
90 inline Library* getParentLibrary ();
91 Library* getLibrary ( unsigned int index );
92 Library* getLibrary ( const Name& libName );
93 AllianceLibrary* getAllianceLibrary ( unsigned int index );
94 AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int flags );
95 AllianceLibrary* getAllianceLibrary ( Library* );
96 AllianceLibrary* createLibrary ( const string& path, unsigned int flags, string libName="" );
97 AllianceLibrary* wrapLibrary ( Library*, unsigned int flags );
98 inline const AllianceLibraries& getAllianceLibraries () const;
99 void saveLibrary ( Library* );
100 void saveLibrary ( AllianceLibrary* );
101 RoutingGauge* getRoutingGauge ( const Name& name="" );
102 CellGauge* getCellGauge ( const Name& name="" );
103 CellGauge* matchCellGauge ( DbU::Unit width, DbU::Unit height ) const;
104 CellGauge* matchCellGaugeByHeight ( DbU::Unit height ) const;
105 inline const Name getDefaultCGPinLayerName () const;
106 // Modifiers.
107 RoutingGauge* setRoutingGauge ( const Name& name="" );
108 CellGauge* setCellGauge ( const Name& name="" );
109 void addRoutingGauge ( RoutingGauge* );
110 void addCellGauge ( CellGauge* );
111 void addObserver ( BaseObserver* );
112 void removeObserver ( BaseObserver* );
113 void notify ( unsigned int flags );
114 // Cell Management.
115 Cell* cellLoader ( const string& rpath );
116 Cell* getCell ( const string& name
117 , unsigned int mode
118 , unsigned int depth=(unsigned int)-1 );
119 Cell* createCell ( const string& name, AllianceLibrary* library=NULL );
120 void saveCell ( Cell* , unsigned int mode );
121 void bindLibraries ();
122 unsigned int loadLibraryCells ( Library* );
123 unsigned int loadLibraryCells ( const Name& );
124 static size_t getInstancesCount ( Cell*, unsigned int flags );
125 // Hurricane Managment.
126 void toJson ( JsonWriter* ) const;
127 virtual string _getTypeName () const;
128 virtual Record* _getRecord () const;
129
130 // Internals - Attributes.
131 protected:
132 static const Name _parentLibraryName;
133 static AllianceFramework* _singleton;
134 Observable _observers;
135 Environment _environment;
136 ParsersMap _parsers;
137 DriversMap _drivers;
138 Catalog _catalog;
139 AllianceLibraries _libraries;
140 Library* _parentLibrary;
141 map<Name,RoutingGauge*> _routingGauges;
142 RoutingGauge* _defaultRoutingGauge;
143 map<Name,CellGauge*> _cellGauges;
144 CellGauge* _defaultCellGauge;
145
146 // Internals - Constructors.
147 AllianceFramework ();
148 AllianceFramework ( const AllianceFramework& );
149 AllianceFramework& operator= ( const AllianceFramework& );
150 // Internals - Destructors.
151 ~AllianceFramework ();
152 // Internals - Methods.
153 bool _readLocate ( const string& file, unsigned int mode, bool isLib=false );
154 bool _writeLocate ( const string& file, unsigned int mode, bool isLib=false );
155 AllianceLibrary* _createLibrary ( const string& path, bool& hasCatalog );
156 };
157
158 inline bool AllianceFramework::isPOWER ( const char* name ) { return _environment.isPOWER(name); }
159 inline bool AllianceFramework::isPOWER ( const string& name ) { return isPOWER(name.c_str()); }
160 inline bool AllianceFramework::isPOWER ( const Name& name ) { return isPOWER(getString(name)); }
161 inline bool AllianceFramework::isGROUND ( const char* name ) { return _environment.isGROUND(name); }
162 inline bool AllianceFramework::isGROUND ( const string& name ) { return isGROUND(name.c_str()); }
163 inline bool AllianceFramework::isGROUND ( const Name& name ) { return isGROUND(getString(name)); }
164 inline bool AllianceFramework::isCLOCK ( const char* name ) { return _environment.isCLOCK(name); }
165 inline bool AllianceFramework::isCLOCK ( const string& name ) { return isCLOCK(name.c_str()); }
166 inline bool AllianceFramework::isCLOCK ( const Name& name ) { return isCLOCK(getString(name)); }
167 inline bool AllianceFramework::isBLOCKAGE ( const char* name ) { return _environment.isBLOCKAGE(name); }
168 inline bool AllianceFramework::isBLOCKAGE ( const string& name ) { return isBLOCKAGE(name.c_str()); }
169 inline bool AllianceFramework::isBLOCKAGE ( const Name& name ) { return isBLOCKAGE(getString(name)); }
170 inline bool AllianceFramework::isBLOCKAGE ( const Net* net ) { return isBLOCKAGE(net->getName()); }
171 inline bool AllianceFramework::isPad ( const char* name ) { return _environment.isPad(name); }
172 inline bool AllianceFramework::isPad ( const string& name ) { return isPad(name.c_str()); }
173 inline bool AllianceFramework::isPad ( const Name& name ) { return isPad(getString(name)); }
174 inline bool AllianceFramework::isPad ( const Cell* cell ) { return isPad(cell->getName()); }
175 inline Environment* AllianceFramework::getEnvironment () { return &_environment; }
176 inline Catalog* AllianceFramework::getCatalog () { return &_catalog; }
177 inline const Name& AllianceFramework::getParentLibraryName
178 () const { return _parentLibraryName; }
179 inline Library* AllianceFramework::getParentLibrary () { return _parentLibrary; }
180 inline const AllianceLibraries&
181 AllianceFramework::getAllianceLibraries () const { return _libraries; }
182 // TEMPORARY.
183 inline const Name AllianceFramework::getDefaultCGPinLayerName
184 () const { return "CALU1"; }
185
186
187 class JsonAllianceFramework : public JsonObject {
188 public:
189 static void initialize ();
190 JsonAllianceFramework( unsigned long );
191 virtual ~JsonAllianceFramework();
192 virtual string getTypeName () const;
193 virtual JsonAllianceFramework* clone ( unsigned long ) const;
194 virtual void toData ( JsonStack& );
195 private:
196 std::string _defaultRoutingGauge;
197 std::string _defaultCellGauge;
198 };
199
200
201 } // CRL namespace.
202
203
204 INSPECTOR_P_SUPPORT(CRL::AllianceFramework);
205
206 #endif // CRL_ALLIANCE_FRAMEWORK_H
CRL::Environment::isBLOCKAGE
bool isBLOCKAGE(const char *name) const
CRL::AllianceFramework::getParentLibrary
Library * getParentLibrary()
Definition: AllianceFramework.h:179
CRL::Environment::isCLOCK
bool isCLOCK(const char *name) const
Hurricane::Library
CRL::AllianceFramework
A Framework to work with Alliance formats.
Definition: AllianceFramework.h:42
CRL::AllianceFramework::getDefaultCGPinLayerName
const Name getDefaultCGPinLayerName() const
Definition: AllianceFramework.h:184
CRL::Environment::isPOWER
bool isPOWER(const char *name) const
CRL::AllianceFramework::addCellGauge
void addCellGauge(CellGauge *)
Hurricane::JsonObject
CRL::AllianceFramework::InstancesCountFlags
InstancesCountFlags
Definition: AllianceFramework.h:48
Hurricane::Name
Hurricane::Net
CRL::AllianceFramework::getInstancesCount
static size_t getInstancesCount(Cell *, unsigned int flags)
Hurricane::DbU::Unit
std::int64_t Unit
Hurricane::Cell
CRL::AllianceFramework::saveCell
void saveCell(Cell *, unsigned int mode)
CRL::AllianceFramework::createLibrary
AllianceLibrary * createLibrary(const string &path, unsigned int flags, string libName="")
Hurricane::DBo
CRL::AllianceFramework::LibraryFlags
LibraryFlags
Definition: AllianceFramework.h:51
CRL::Environment::isPad
bool isPad(const char *name) const
Hurricane::JsonStack
CRL::Environment::isGROUND
bool isGROUND(const char *name) const
CRL::AllianceFramework::Recursive
Definition: AllianceFramework.h:48
CRL::AllianceFramework::getLibrary
Library * getLibrary(unsigned int index)
CRL::AllianceFramework::getParentLibraryName
const Name & getParentLibraryName() const
Definition: AllianceFramework.h:178
Hurricane::DbU
CRL::AllianceFramework::addRoutingGauge
void addRoutingGauge(RoutingGauge *)
CRL::AllianceFramework::CreateLibrary
Definition: AllianceFramework.h:51
CRL::AllianceFramework::loadLibraryCells
unsigned int loadLibraryCells(Library *)
CRL::AllianceFramework::createCell
Cell * createCell(const string &name, AllianceLibrary *library=NULL)
CRL::AllianceFramework::getCatalog
Catalog * getCatalog()
Definition: AllianceFramework.h:176
CRL::AllianceFramework::IgnoreFeeds
Definition: AllianceFramework.h:49
CRL::AllianceFramework::getRoutingGauge
RoutingGauge * getRoutingGauge(const Name &name="")
CRL::Catalog
A Registry to store Alliance Cell metadatas.
Definition: Catalog.h:56
CRL::AllianceFramework::getAllianceLibrary
AllianceLibrary * getAllianceLibrary(unsigned int index)
CRL::AllianceFramework::HasCatalog
Definition: AllianceFramework.h:53
CRL::Environment
Holds all the Alliance environment variables.
Definition: Environment.h:33
CRL::AllianceFramework::getEnvironment
Environment * getEnvironment()
Definition: AllianceFramework.h:175
CRL::AllianceFramework::getPrint
string getPrint() const
CRL::AllianceFramework::saveLibrary
void saveLibrary(Library *)
CRL::AllianceFramework::getCell
Cell * getCell(const string &name, unsigned int mode, unsigned int depth=(unsigned int) -1)
CRL::AllianceFramework::create
static AllianceFramework * create(unsigned long flags=NoFlags)
CRL
The namespace of Coriolis Core.
Definition: Environment.h:24