# 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 inline const AllianceLibraries& getAllianceLibraries () const;
98 void saveLibrary ( Library* );
99 void saveLibrary ( AllianceLibrary* );
100 RoutingGauge* getRoutingGauge ( const Name& name="" );
101 CellGauge* getCellGauge ( const Name& name="" );
102 CellGauge* matchCellGauge ( DbU::Unit width, DbU::Unit height ) const;
103 CellGauge* matchCellGaugeByHeight ( DbU::Unit height ) const;
104 inline const Name getDefaultCGPinLayerName () const;
105 // Modifiers.
106 RoutingGauge* setRoutingGauge ( const Name& name="" );
107 CellGauge* setCellGauge ( const Name& name="" );
108 void addRoutingGauge ( RoutingGauge* );
109 void addCellGauge ( CellGauge* );
110 void addObserver ( BaseObserver* );
111 void removeObserver ( BaseObserver* );
112 void notify ( unsigned int flags );
113 // Cell Management.
114 Cell* cellLoader ( const string& rpath );
115 Cell* getCell ( const string& name
116 , unsigned int mode
117 , unsigned int depth=(unsigned int)-1 );
118 Cell* createCell ( const string& name, AllianceLibrary* library=NULL );
119 void saveCell ( Cell* , unsigned int mode );
120 void bindLibraries ();
121 unsigned int loadLibraryCells ( Library* );
122 unsigned int loadLibraryCells ( const Name& );
123 static size_t getInstancesCount ( Cell*, unsigned int flags );
124 // Hurricane Managment.
125 void toJson ( JsonWriter* ) const;
126 virtual string _getTypeName () const;
127 virtual Record* _getRecord () const;
128
129 // Internals - Attributes.
130 protected:
131 static const Name _parentLibraryName;
132 static AllianceFramework* _singleton;
133 Observable _observers;
134 Environment _environment;
135 ParsersMap _parsers;
136 DriversMap _drivers;
137 Catalog _catalog;
138 AllianceLibraries _libraries;
139 Library* _parentLibrary;
140 map<Name,RoutingGauge*> _routingGauges;
141 RoutingGauge* _defaultRoutingGauge;
142 map<Name,CellGauge*> _cellGauges;
143 CellGauge* _defaultCellGauge;
144
145 // Internals - Constructors.
146 AllianceFramework ();
147 AllianceFramework ( const AllianceFramework& );
148 AllianceFramework& operator= ( const AllianceFramework& );
149 // Internals - Destructors.
150 ~AllianceFramework ();
151 // Internals - Methods.
152 bool _readLocate ( const string& file, unsigned int mode, bool isLib=false );
153 bool _writeLocate ( const string& file, unsigned int mode, bool isLib=false );
154 AllianceLibrary* _createLibrary ( const string& path, bool& hasCatalog );
155 };
156
157 inline bool AllianceFramework::isPOWER ( const char* name ) { return _environment.isPOWER(name); }
158 inline bool AllianceFramework::isPOWER ( const string& name ) { return isPOWER(name.c_str()); }
159 inline bool AllianceFramework::isPOWER ( const Name& name ) { return isPOWER(getString(name)); }
160 inline bool AllianceFramework::isGROUND ( const char* name ) { return _environment.isGROUND(name); }
161 inline bool AllianceFramework::isGROUND ( const string& name ) { return isGROUND(name.c_str()); }
162 inline bool AllianceFramework::isGROUND ( const Name& name ) { return isGROUND(getString(name)); }
163 inline bool AllianceFramework::isCLOCK ( const char* name ) { return _environment.isCLOCK(name); }
164 inline bool AllianceFramework::isCLOCK ( const string& name ) { return isCLOCK(name.c_str()); }
165 inline bool AllianceFramework::isCLOCK ( const Name& name ) { return isCLOCK(getString(name)); }
166 inline bool AllianceFramework::isBLOCKAGE ( const char* name ) { return _environment.isBLOCKAGE(name); }
167 inline bool AllianceFramework::isBLOCKAGE ( const string& name ) { return isBLOCKAGE(name.c_str()); }
168 inline bool AllianceFramework::isBLOCKAGE ( const Name& name ) { return isBLOCKAGE(getString(name)); }
169 inline bool AllianceFramework::isBLOCKAGE ( const Net* net ) { return isBLOCKAGE(net->getName()); }
170 inline bool AllianceFramework::isPad ( const char* name ) { return _environment.isPad(name); }
171 inline bool AllianceFramework::isPad ( const string& name ) { return isPad(name.c_str()); }
172 inline bool AllianceFramework::isPad ( const Name& name ) { return isPad(getString(name)); }
173 inline bool AllianceFramework::isPad ( const Cell* cell ) { return isPad(cell->getName()); }
174 inline Environment* AllianceFramework::getEnvironment () { return &_environment; }
175 inline Catalog* AllianceFramework::getCatalog () { return &_catalog; }
176 inline const Name& AllianceFramework::getParentLibraryName
177 () const { return _parentLibraryName; }
178 inline Library* AllianceFramework::getParentLibrary () { return _parentLibrary; }
179 inline const AllianceLibraries&
180 AllianceFramework::getAllianceLibraries () const { return _libraries; }
181 // TEMPORARY.
182 inline const Name AllianceFramework::getDefaultCGPinLayerName
183 () const { return "CALU1"; }
184
185
186 class JsonAllianceFramework : public JsonObject {
187 public:
188 static void initialize ();
189 JsonAllianceFramework( unsigned long );
190 virtual ~JsonAllianceFramework();
191 virtual string getTypeName () const;
192 virtual JsonAllianceFramework* clone ( unsigned long ) const;
193 virtual void toData ( JsonStack& );
194 private:
195 std::string _defaultRoutingGauge;
196 std::string _defaultCellGauge;
197 };
198
199
200 } // CRL namespace.
201
202
203 INSPECTOR_P_SUPPORT(CRL::AllianceFramework);
204
205 #endif // CRL_ALLIANCE_FRAMEWORK_H
CRL::Environment::isBLOCKAGE
bool isBLOCKAGE(const char *name) const
CRL::AllianceFramework::getParentLibrary
Library * getParentLibrary()
Definition: AllianceFramework.h:178
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:183
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:177
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:175
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:35
CRL::AllianceFramework::getEnvironment
Environment * getEnvironment()
Definition: AllianceFramework.h:174
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:26

Generated by doxygen 1.8.14 on Mon Apr 27 2020 | Return to top of page

Coriolis Core (CRL) | Copyright © 2008-2016 UPMC All rights reserved