00001
00002 #if !defined(oagFpgaManager_P)
00003 #define oagFpgaManager_P
00004
00005 #include "oaDesignDB.h"
00006 #include "oagFpga.h"
00007 #include "oagFpgaRtlGraph.h"
00008
00009 #include "oagAiGraph.h"
00010
00011 #include <list>
00012 #include <map>
00013 #include <set>
00014
00015 #define CACHE_LAST_MANAGER_LOOKUP
00016
00017 using namespace std;
00018
00019 namespace oagFpga {
00020
00021
00022
00023
00025
00026
00027
00028 class Manager {
00029 friend class Synthesis;
00030 friend class ModGraph;
00031 friend class OccGraph;
00032 friend class AiModGraph;
00033 friend class ModuleCompiler;
00034
00035 protected:
00036
00037 Manager(oa::oaDesign *design);
00038 ~Manager();
00039
00040 public:
00041
00042 static inline bool hasManager(oa::oaDesign *design) {
00044 assert(design);
00045
00046 return design->getAppDefs().includes(managerAppDef);
00047 }
00048 static inline Manager* get(oa::oaModule *module) {
00049 return get(module->getDesign());
00050 }
00051 static inline Manager* get(oa::oaDesign *design) {
00052 assert(design);
00053
00054 #if defined(CACHE_LAST_MANAGER_LOOKUP)
00055 if (design == lastManagerDesign) {
00056 return lastManagerObject;
00057 } else if (hasManager(design)) {
00058 lastManagerDesign = design;
00059 lastManagerObject = static_cast<Manager*>(managerAppDef->get(design));
00060 return lastManagerObject;
00061 } else {
00062 lastManagerDesign = design;
00063 lastManagerObject = create(design);
00064 return lastManagerObject;
00065 }
00066 #else
00067 if (hasManager(design)) {
00068 return static_cast<Manager*>(managerAppDef->get(design));
00069 } else {
00070 return create(design);
00071 }
00072 #endif
00073 }
00074 static Manager* create(oa::oaDesign *design);
00075 static void destroy(oa::oaDesign *design);
00076
00079
00080 static int getSerializedSize(oa::oaDesign *design);
00081 static void serialize(void* buf, oa::oaDesign *design);
00082 static int unserialize(void* buf, oa::oaDesign *design);
00083
00084
00085
00086
00091
00092
00093
00094
00095
00099
00100 bool isStructural();
00101 void print(ostream& os);
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00120
00121 public:
00122
00123 oa::oaModBitNet * getNetToBBConnection(BBRef ref);
00124 BBRef getNetToBBConnection(oa::oaModBitNet *net);
00125
00126 void setNetToBBConnection(oa::oaModBitNet *net, BBRef bbRef) ;
00127 void setNetToAiConnection(oa::oaModBitNet *net, oagAi::Ref aiRef) ;
00128
00129 oa::oaModBitNet * getNetToAiConnection(oagAi::Ref ref);
00130 oagAi::Ref getNetToAiConnection(oa::oaModBitNet *net);
00131
00132 void removeNetToAiConnection(oa::oaModBitNet *net);
00133
00134 inline const oagAi::Graph * getAiGraph() const {
00136 return &ai;
00137 }
00138 inline oagAi::Graph * getAiGraph() {
00145 return &ai;
00146 }
00147
00149
00150 protected:
00151
00152 oagAi::Graph ai;
00153 RtlGraph bbg;
00154 oa::oaDesign *design;
00155
00156
00157
00158
00159
00160
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 BBRef prepareNetToBBConnection(oa::oaModBitNet *net);
00197 BBRef prepareNetToAiConnection(oa::oaModBitNet *net);
00198
00199 #if defined(CACHE_LAST_MANAGER_LOOKUP)
00200 static oa::oaDesign *lastManagerDesign;
00201 static Manager *lastManagerObject;
00202 #endif
00203
00204
00205 };
00206
00207 }
00208
00209 #endif