Coriolis Core (CRL) Documentation


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


Generated by doxygen 1.9.1 on Wed Nov 20 2024 Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved