module.hh (13191:a2254693aa5b) module.hh (13268:9802f3e0a6ae)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 66 unchanged lines hidden (view full) ---

75 sc_core::sc_module *_sc_mod;
76 Object *_obj;
77 bool _ended;
78 bool _deprecatedConstructor;
79
80 UniqueNameGen nameGen;
81
82 public:
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 66 unchanged lines hidden (view full) ---

75 sc_core::sc_module *_sc_mod;
76 Object *_obj;
77 bool _ended;
78 bool _deprecatedConstructor;
79
80 UniqueNameGen nameGen;
81
82 public:
83
84 Module(const char *name);
85 ~Module();
86
83 Module(const char *name);
84 ~Module();
85
86 static Module *
87 fromScModule(::sc_core::sc_module *mod)
88 {
89 return mod->_gem5_module;
90 }
91
87 void finish(Object *this_obj);
88
89 const char *name() const { return _name; }
90 void endModule() { _ended = true; }
91 void deprecatedConstructor() { _deprecatedConstructor = true; }
92
93 sc_core::sc_module *
94 sc_mod() const

--- 30 unchanged lines hidden (view full) ---

125 void startOfSimulation();
126 void endOfSimulation();
127};
128
129Module *currentModule();
130Module *newModuleChecked();
131Module *newModule();
132
92 void finish(Object *this_obj);
93
94 const char *name() const { return _name; }
95 void endModule() { _ended = true; }
96 void deprecatedConstructor() { _deprecatedConstructor = true; }
97
98 sc_core::sc_module *
99 sc_mod() const

--- 30 unchanged lines hidden (view full) ---

130 void startOfSimulation();
131 void endOfSimulation();
132};
133
134Module *currentModule();
135Module *newModuleChecked();
136Module *newModule();
137
133void callbackModule(Module *m);
134Module *callbackModule();
138static inline Module *
139pickParentModule()
140{
141 ::sc_core::sc_object *obj = pickParentObj();
142 auto mod = dynamic_cast<::sc_core::sc_module *>(obj);
143 if (!mod)
144 return nullptr;
145 return Module::fromScModule(mod);
146}
147static inline void
148pushParentModule(Module *m)
149{
150 pushParentObj(m->obj()->sc_obj());
151}
152static inline void
153popParentModule()
154{
155 assert(pickParentModule());
156 popParentObj();
157}
135
136extern std::list<Module *> allModules;
137
138} // namespace sc_gem5
139
140#endif //__SYSTEMC_CORE_MODULE_HH__
158
159extern std::list<Module *> allModules;
160
161} // namespace sc_gem5
162
163#endif //__SYSTEMC_CORE_MODULE_HH__