sc_module.hh (12952:94fca7e8120b) sc_module.hh (12982:c7966254372e)
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
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_CORE_EXT_SC_MODULE_HH__
31#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__
32
33#include <vector>
34
35#include "sc_object.hh"
36#include "sc_sensitive.hh"
37#include "sc_time.hh"
38
39namespace sc_dt
40{
41
42class sc_logic;
43
44} // namespace sc_dt
45
46namespace sc_gem5
47{
48
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
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_CORE_EXT_SC_MODULE_HH__
31#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__
32
33#include <vector>
34
35#include "sc_object.hh"
36#include "sc_sensitive.hh"
37#include "sc_time.hh"
38
39namespace sc_dt
40{
41
42class sc_logic;
43
44} // namespace sc_dt
45
46namespace sc_gem5
47{
48
49class Kernel;
49class Module;
50class Process;
51struct ProcessFuncWrapper;
52
53Process *newMethodProcess(const char *name, ProcessFuncWrapper *func);
54Process *newThreadProcess(const char *name, ProcessFuncWrapper *func);
55Process *newCThreadProcess(const char *name, ProcessFuncWrapper *func);
56
57} // namespace sc_gem5
58
59namespace sc_core
60{
61
62template <class T>
63class sc_in;
64template <class T>
65class sc_out;
66template <class T>
67class sc_inout;
68template <class T>
69class sc_signal_in_if;
70
71class sc_event;
72class sc_event_and_list;
73class sc_event_or_list;
74class sc_module_name;
75
76class sc_bind_proxy
77{
78 private:
79 const sc_interface *_interface;
80 const sc_port_base *_port;
81
82 friend class sc_module;
83
84 public:
85 sc_bind_proxy(const sc_interface &_interface);
86 sc_bind_proxy(const sc_port_base &_port);
87};
88
89extern const sc_bind_proxy SC_BIND_PROXY_NIL;
90
91class sc_module : public sc_object
92{
93 public:
50class Module;
51class Process;
52struct ProcessFuncWrapper;
53
54Process *newMethodProcess(const char *name, ProcessFuncWrapper *func);
55Process *newThreadProcess(const char *name, ProcessFuncWrapper *func);
56Process *newCThreadProcess(const char *name, ProcessFuncWrapper *func);
57
58} // namespace sc_gem5
59
60namespace sc_core
61{
62
63template <class T>
64class sc_in;
65template <class T>
66class sc_out;
67template <class T>
68class sc_inout;
69template <class T>
70class sc_signal_in_if;
71
72class sc_event;
73class sc_event_and_list;
74class sc_event_or_list;
75class sc_module_name;
76
77class sc_bind_proxy
78{
79 private:
80 const sc_interface *_interface;
81 const sc_port_base *_port;
82
83 friend class sc_module;
84
85 public:
86 sc_bind_proxy(const sc_interface &_interface);
87 sc_bind_proxy(const sc_port_base &_port);
88};
89
90extern const sc_bind_proxy SC_BIND_PROXY_NIL;
91
92class sc_module : public sc_object
93{
94 public:
95 friend class ::sc_gem5::Kernel;
96
94 virtual ~sc_module();
95
96 virtual const char *kind() const { return "sc_module"; }
97
98 void operator () (const sc_bind_proxy &p001,
99 const sc_bind_proxy &p002 = SC_BIND_PROXY_NIL,
100 const sc_bind_proxy &p003 = SC_BIND_PROXY_NIL,
101 const sc_bind_proxy &p004 = SC_BIND_PROXY_NIL,
102 const sc_bind_proxy &p005 = SC_BIND_PROXY_NIL,
103 const sc_bind_proxy &p006 = SC_BIND_PROXY_NIL,
104 const sc_bind_proxy &p007 = SC_BIND_PROXY_NIL,
105 const sc_bind_proxy &p008 = SC_BIND_PROXY_NIL,
106 const sc_bind_proxy &p009 = SC_BIND_PROXY_NIL,
107 const sc_bind_proxy &p010 = SC_BIND_PROXY_NIL,
108 const sc_bind_proxy &p011 = SC_BIND_PROXY_NIL,
109 const sc_bind_proxy &p012 = SC_BIND_PROXY_NIL,
110 const sc_bind_proxy &p013 = SC_BIND_PROXY_NIL,
111 const sc_bind_proxy &p014 = SC_BIND_PROXY_NIL,
112 const sc_bind_proxy &p015 = SC_BIND_PROXY_NIL,
113 const sc_bind_proxy &p016 = SC_BIND_PROXY_NIL,
114 const sc_bind_proxy &p017 = SC_BIND_PROXY_NIL,
115 const sc_bind_proxy &p018 = SC_BIND_PROXY_NIL,
116 const sc_bind_proxy &p019 = SC_BIND_PROXY_NIL,
117 const sc_bind_proxy &p020 = SC_BIND_PROXY_NIL,
118 const sc_bind_proxy &p021 = SC_BIND_PROXY_NIL,
119 const sc_bind_proxy &p022 = SC_BIND_PROXY_NIL,
120 const sc_bind_proxy &p023 = SC_BIND_PROXY_NIL,
121 const sc_bind_proxy &p024 = SC_BIND_PROXY_NIL,
122 const sc_bind_proxy &p025 = SC_BIND_PROXY_NIL,
123 const sc_bind_proxy &p026 = SC_BIND_PROXY_NIL,
124 const sc_bind_proxy &p027 = SC_BIND_PROXY_NIL,
125 const sc_bind_proxy &p028 = SC_BIND_PROXY_NIL,
126 const sc_bind_proxy &p029 = SC_BIND_PROXY_NIL,
127 const sc_bind_proxy &p030 = SC_BIND_PROXY_NIL,
128 const sc_bind_proxy &p031 = SC_BIND_PROXY_NIL,
129 const sc_bind_proxy &p032 = SC_BIND_PROXY_NIL,
130 const sc_bind_proxy &p033 = SC_BIND_PROXY_NIL,
131 const sc_bind_proxy &p034 = SC_BIND_PROXY_NIL,
132 const sc_bind_proxy &p035 = SC_BIND_PROXY_NIL,
133 const sc_bind_proxy &p036 = SC_BIND_PROXY_NIL,
134 const sc_bind_proxy &p037 = SC_BIND_PROXY_NIL,
135 const sc_bind_proxy &p038 = SC_BIND_PROXY_NIL,
136 const sc_bind_proxy &p039 = SC_BIND_PROXY_NIL,
137 const sc_bind_proxy &p040 = SC_BIND_PROXY_NIL,
138 const sc_bind_proxy &p041 = SC_BIND_PROXY_NIL,
139 const sc_bind_proxy &p042 = SC_BIND_PROXY_NIL,
140 const sc_bind_proxy &p043 = SC_BIND_PROXY_NIL,
141 const sc_bind_proxy &p044 = SC_BIND_PROXY_NIL,
142 const sc_bind_proxy &p045 = SC_BIND_PROXY_NIL,
143 const sc_bind_proxy &p046 = SC_BIND_PROXY_NIL,
144 const sc_bind_proxy &p047 = SC_BIND_PROXY_NIL,
145 const sc_bind_proxy &p048 = SC_BIND_PROXY_NIL,
146 const sc_bind_proxy &p049 = SC_BIND_PROXY_NIL,
147 const sc_bind_proxy &p050 = SC_BIND_PROXY_NIL,
148 const sc_bind_proxy &p051 = SC_BIND_PROXY_NIL,
149 const sc_bind_proxy &p052 = SC_BIND_PROXY_NIL,
150 const sc_bind_proxy &p053 = SC_BIND_PROXY_NIL,
151 const sc_bind_proxy &p054 = SC_BIND_PROXY_NIL,
152 const sc_bind_proxy &p055 = SC_BIND_PROXY_NIL,
153 const sc_bind_proxy &p056 = SC_BIND_PROXY_NIL,
154 const sc_bind_proxy &p057 = SC_BIND_PROXY_NIL,
155 const sc_bind_proxy &p058 = SC_BIND_PROXY_NIL,
156 const sc_bind_proxy &p059 = SC_BIND_PROXY_NIL,
157 const sc_bind_proxy &p060 = SC_BIND_PROXY_NIL,
158 const sc_bind_proxy &p061 = SC_BIND_PROXY_NIL,
159 const sc_bind_proxy &p062 = SC_BIND_PROXY_NIL,
160 const sc_bind_proxy &p063 = SC_BIND_PROXY_NIL,
161 const sc_bind_proxy &p064 = SC_BIND_PROXY_NIL);
162
163 virtual const std::vector<sc_object *> &get_child_objects() const;
164 virtual const std::vector<sc_event *> &get_child_events() const;
165
166 protected:
167 sc_module(const sc_module_name &);
168 sc_module();
169
170 // Deprecated
171 sc_module(const char *);
172 sc_module(const std::string &);
173
174 /* Deprecated, but used in the regression tests. */
175 void end_module() {}
176
177 void reset_signal_is(const sc_in<bool> &, bool);
178 void reset_signal_is(const sc_inout<bool> &, bool);
179 void reset_signal_is(const sc_out<bool> &, bool);
180 void reset_signal_is(const sc_signal_in_if<bool> &, bool);
181
182 void async_reset_signal_is(const sc_in<bool> &, bool);
183 void async_reset_signal_is(const sc_inout<bool> &, bool);
184 void async_reset_signal_is(const sc_out<bool> &, bool);
185 void async_reset_signal_is(const sc_signal_in_if<bool> &, bool);
186
187 sc_sensitive sensitive;
188
189 void dont_initialize();
190 void set_stack_size(size_t);
191
192 void next_trigger();
193 void next_trigger(const sc_event &);
194 void next_trigger(const sc_event_or_list &);
195 void next_trigger(const sc_event_and_list &);
196 void next_trigger(const sc_time &);
197 void next_trigger(double, sc_time_unit);
198 void next_trigger(const sc_time &, const sc_event &);
199 void next_trigger(double, sc_time_unit, const sc_event &);
200 void next_trigger(const sc_time &, const sc_event_or_list &);
201 void next_trigger(double, sc_time_unit, const sc_event_or_list &);
202 void next_trigger(const sc_time &, const sc_event_and_list &);
203 void next_trigger(double, sc_time_unit, const sc_event_and_list &);
204
205 // Nonstandard
206 bool timed_out();
207
208 void wait();
209 void wait(int);
210 void wait(const sc_event &);
211 void wait(const sc_event_or_list &);
212 void wait(const sc_event_and_list &);
213 void wait(const sc_time &);
214 void wait(double, sc_time_unit);
215 void wait(const sc_time &, const sc_event &);
216 void wait(double, sc_time_unit, const sc_event &);
217 void wait(const sc_time &, const sc_event_or_list &);
218 void wait(double, sc_time_unit, const sc_event_or_list &);
219 void wait(const sc_time &, const sc_event_and_list &);
220 void wait(double, sc_time_unit, const sc_event_and_list &);
221
222 // Nonstandard
223 void halt();
224 void at_posedge(const sc_signal_in_if<bool> &);
225 void at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &);
226 void at_negedge(const sc_signal_in_if<bool> &);
227 void at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &);
228
229 virtual void before_end_of_elaboration() {}
230 virtual void end_of_elaboration() {}
231 virtual void start_of_simulation() {}
232 virtual void end_of_simulation() {}
233
234 private:
235 sc_gem5::Module *_gem5_module;
236
237 // Disabled
238 sc_module(const sc_module &) : sc_object() {};
239 sc_module &operator = (const sc_module &) { return *this; }
240};
241
242void next_trigger();
243void next_trigger(const sc_event &);
244void next_trigger(const sc_event_or_list &);
245void next_trigger(const sc_event_and_list &);
246void next_trigger(const sc_time &);
247void next_trigger(double, sc_time_unit);
248void next_trigger(const sc_time &, const sc_event &);
249void next_trigger(double, sc_time_unit, const sc_event &);
250void next_trigger(const sc_time &, const sc_event_or_list &);
251void next_trigger(double, sc_time_unit, const sc_event_or_list &);
252void next_trigger(const sc_time &, const sc_event_and_list &);
253void next_trigger(double, sc_time_unit, const sc_event_and_list &);
254
255void wait();
256void wait(int);
257void wait(const sc_event &);
258void wait(const sc_event_or_list &);
259void wait(const sc_event_and_list &);
260void wait(const sc_time &);
261void wait(double, sc_time_unit);
262void wait(const sc_time &, const sc_event &);
263void wait(double, sc_time_unit, const sc_event &);
264void wait(const sc_time &, const sc_event_or_list &);
265void wait(double, sc_time_unit, const sc_event_or_list &);
266void wait(const sc_time &, const sc_event_and_list &);
267void wait(double, sc_time_unit, const sc_event_and_list &);
268
269// Nonstandard
270bool timed_out();
271
272#define SC_MODULE(name) struct name : ::sc_core::sc_module
273
274#define SC_CTOR(name) \
275 typedef name SC_CURRENT_USER_MODULE; \
276 name(::sc_core::sc_module_name)
277
278#define SC_HAS_PROCESS(name) typedef name SC_CURRENT_USER_MODULE
279
280#define SC_METHOD(name) \
281 { \
282 ::sc_gem5::Process *p = \
283 ::sc_gem5::newMethodProcess( \
284 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
285 SC_CURRENT_USER_MODULE>(this, \
286 &SC_CURRENT_USER_MODULE::name)); \
287 this->sensitive << p; \
288 }
289#define SC_THREAD(name) \
290 { \
291 ::sc_gem5::Process *p = \
292 ::sc_gem5::newThreadProcess( \
293 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
294 SC_CURRENT_USER_MODULE>(this, \
295 &SC_CURRENT_USER_MODULE::name)); \
296 this->sensitive << p; \
297 }
298#define SC_CTHREAD(name, clk) \
299 { \
300 ::sc_gem5::Process *p = \
301 ::sc_gem5::newCThreadProcess( \
302 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
303 SC_CURRENT_USER_MODULE>(this, \
304 &SC_CURRENT_USER_MODULE::name)); \
305 this->sensitive << p; \
306 this->sensitive << clk; \
307 }
308
309// Nonstandard
310// Documentation for this is very scarce, but it looks like it's supposed to
311// stop the currently executing cthread, or if a cthread isn't running report
312// an error.
313void halt();
314void at_posedge(const sc_signal_in_if<bool> &);
315void at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &);
316void at_negedge(const sc_signal_in_if<bool> &);
317void at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &);
318
319const char *sc_gen_unique_name(const char *);
320
321// Nonstandard
322bool sc_hierarchical_name_exists(const char *name);
323
324typedef sc_module sc_behavior;
325typedef sc_module sc_channel;
326
327bool sc_start_of_simulation_invoked();
328bool sc_end_of_simulation_invoked();
329
330// Nonstandard
331// Allocates a module of type x and records a pointer to it so that it gets
332// destructed automatically at the end of the simulation.
333sc_module *sc_module_sc_new(sc_module *);
334#define SC_NEW(x) ::sc_core::sc_module_sc_new(new x);
335
336// Nonstandard
337// In the Accellera implementation, this macro calls sc_set_location to record
338// the current file and line, calls wait, and then calls it again to clear the
339// file and line. We'll ignore the sc_set_location calls for now.
340#define SC_WAIT() ::sc_core::wait();
341
342// Nonstandard
343// Same as above, but passes through an argument.
344#define SC_WAITN(n) ::sc_core::wait(n);
345
346// Nonstandard
347#define SC_WAIT_UNTIL(expr) do { SC_WAIT(); } while (!(expr))
348
349} // namespace sc_core
350
351#endif //__SYSTEMC_EXT_CORE_SC_MODULE_HH__
97 virtual ~sc_module();
98
99 virtual const char *kind() const { return "sc_module"; }
100
101 void operator () (const sc_bind_proxy &p001,
102 const sc_bind_proxy &p002 = SC_BIND_PROXY_NIL,
103 const sc_bind_proxy &p003 = SC_BIND_PROXY_NIL,
104 const sc_bind_proxy &p004 = SC_BIND_PROXY_NIL,
105 const sc_bind_proxy &p005 = SC_BIND_PROXY_NIL,
106 const sc_bind_proxy &p006 = SC_BIND_PROXY_NIL,
107 const sc_bind_proxy &p007 = SC_BIND_PROXY_NIL,
108 const sc_bind_proxy &p008 = SC_BIND_PROXY_NIL,
109 const sc_bind_proxy &p009 = SC_BIND_PROXY_NIL,
110 const sc_bind_proxy &p010 = SC_BIND_PROXY_NIL,
111 const sc_bind_proxy &p011 = SC_BIND_PROXY_NIL,
112 const sc_bind_proxy &p012 = SC_BIND_PROXY_NIL,
113 const sc_bind_proxy &p013 = SC_BIND_PROXY_NIL,
114 const sc_bind_proxy &p014 = SC_BIND_PROXY_NIL,
115 const sc_bind_proxy &p015 = SC_BIND_PROXY_NIL,
116 const sc_bind_proxy &p016 = SC_BIND_PROXY_NIL,
117 const sc_bind_proxy &p017 = SC_BIND_PROXY_NIL,
118 const sc_bind_proxy &p018 = SC_BIND_PROXY_NIL,
119 const sc_bind_proxy &p019 = SC_BIND_PROXY_NIL,
120 const sc_bind_proxy &p020 = SC_BIND_PROXY_NIL,
121 const sc_bind_proxy &p021 = SC_BIND_PROXY_NIL,
122 const sc_bind_proxy &p022 = SC_BIND_PROXY_NIL,
123 const sc_bind_proxy &p023 = SC_BIND_PROXY_NIL,
124 const sc_bind_proxy &p024 = SC_BIND_PROXY_NIL,
125 const sc_bind_proxy &p025 = SC_BIND_PROXY_NIL,
126 const sc_bind_proxy &p026 = SC_BIND_PROXY_NIL,
127 const sc_bind_proxy &p027 = SC_BIND_PROXY_NIL,
128 const sc_bind_proxy &p028 = SC_BIND_PROXY_NIL,
129 const sc_bind_proxy &p029 = SC_BIND_PROXY_NIL,
130 const sc_bind_proxy &p030 = SC_BIND_PROXY_NIL,
131 const sc_bind_proxy &p031 = SC_BIND_PROXY_NIL,
132 const sc_bind_proxy &p032 = SC_BIND_PROXY_NIL,
133 const sc_bind_proxy &p033 = SC_BIND_PROXY_NIL,
134 const sc_bind_proxy &p034 = SC_BIND_PROXY_NIL,
135 const sc_bind_proxy &p035 = SC_BIND_PROXY_NIL,
136 const sc_bind_proxy &p036 = SC_BIND_PROXY_NIL,
137 const sc_bind_proxy &p037 = SC_BIND_PROXY_NIL,
138 const sc_bind_proxy &p038 = SC_BIND_PROXY_NIL,
139 const sc_bind_proxy &p039 = SC_BIND_PROXY_NIL,
140 const sc_bind_proxy &p040 = SC_BIND_PROXY_NIL,
141 const sc_bind_proxy &p041 = SC_BIND_PROXY_NIL,
142 const sc_bind_proxy &p042 = SC_BIND_PROXY_NIL,
143 const sc_bind_proxy &p043 = SC_BIND_PROXY_NIL,
144 const sc_bind_proxy &p044 = SC_BIND_PROXY_NIL,
145 const sc_bind_proxy &p045 = SC_BIND_PROXY_NIL,
146 const sc_bind_proxy &p046 = SC_BIND_PROXY_NIL,
147 const sc_bind_proxy &p047 = SC_BIND_PROXY_NIL,
148 const sc_bind_proxy &p048 = SC_BIND_PROXY_NIL,
149 const sc_bind_proxy &p049 = SC_BIND_PROXY_NIL,
150 const sc_bind_proxy &p050 = SC_BIND_PROXY_NIL,
151 const sc_bind_proxy &p051 = SC_BIND_PROXY_NIL,
152 const sc_bind_proxy &p052 = SC_BIND_PROXY_NIL,
153 const sc_bind_proxy &p053 = SC_BIND_PROXY_NIL,
154 const sc_bind_proxy &p054 = SC_BIND_PROXY_NIL,
155 const sc_bind_proxy &p055 = SC_BIND_PROXY_NIL,
156 const sc_bind_proxy &p056 = SC_BIND_PROXY_NIL,
157 const sc_bind_proxy &p057 = SC_BIND_PROXY_NIL,
158 const sc_bind_proxy &p058 = SC_BIND_PROXY_NIL,
159 const sc_bind_proxy &p059 = SC_BIND_PROXY_NIL,
160 const sc_bind_proxy &p060 = SC_BIND_PROXY_NIL,
161 const sc_bind_proxy &p061 = SC_BIND_PROXY_NIL,
162 const sc_bind_proxy &p062 = SC_BIND_PROXY_NIL,
163 const sc_bind_proxy &p063 = SC_BIND_PROXY_NIL,
164 const sc_bind_proxy &p064 = SC_BIND_PROXY_NIL);
165
166 virtual const std::vector<sc_object *> &get_child_objects() const;
167 virtual const std::vector<sc_event *> &get_child_events() const;
168
169 protected:
170 sc_module(const sc_module_name &);
171 sc_module();
172
173 // Deprecated
174 sc_module(const char *);
175 sc_module(const std::string &);
176
177 /* Deprecated, but used in the regression tests. */
178 void end_module() {}
179
180 void reset_signal_is(const sc_in<bool> &, bool);
181 void reset_signal_is(const sc_inout<bool> &, bool);
182 void reset_signal_is(const sc_out<bool> &, bool);
183 void reset_signal_is(const sc_signal_in_if<bool> &, bool);
184
185 void async_reset_signal_is(const sc_in<bool> &, bool);
186 void async_reset_signal_is(const sc_inout<bool> &, bool);
187 void async_reset_signal_is(const sc_out<bool> &, bool);
188 void async_reset_signal_is(const sc_signal_in_if<bool> &, bool);
189
190 sc_sensitive sensitive;
191
192 void dont_initialize();
193 void set_stack_size(size_t);
194
195 void next_trigger();
196 void next_trigger(const sc_event &);
197 void next_trigger(const sc_event_or_list &);
198 void next_trigger(const sc_event_and_list &);
199 void next_trigger(const sc_time &);
200 void next_trigger(double, sc_time_unit);
201 void next_trigger(const sc_time &, const sc_event &);
202 void next_trigger(double, sc_time_unit, const sc_event &);
203 void next_trigger(const sc_time &, const sc_event_or_list &);
204 void next_trigger(double, sc_time_unit, const sc_event_or_list &);
205 void next_trigger(const sc_time &, const sc_event_and_list &);
206 void next_trigger(double, sc_time_unit, const sc_event_and_list &);
207
208 // Nonstandard
209 bool timed_out();
210
211 void wait();
212 void wait(int);
213 void wait(const sc_event &);
214 void wait(const sc_event_or_list &);
215 void wait(const sc_event_and_list &);
216 void wait(const sc_time &);
217 void wait(double, sc_time_unit);
218 void wait(const sc_time &, const sc_event &);
219 void wait(double, sc_time_unit, const sc_event &);
220 void wait(const sc_time &, const sc_event_or_list &);
221 void wait(double, sc_time_unit, const sc_event_or_list &);
222 void wait(const sc_time &, const sc_event_and_list &);
223 void wait(double, sc_time_unit, const sc_event_and_list &);
224
225 // Nonstandard
226 void halt();
227 void at_posedge(const sc_signal_in_if<bool> &);
228 void at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &);
229 void at_negedge(const sc_signal_in_if<bool> &);
230 void at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &);
231
232 virtual void before_end_of_elaboration() {}
233 virtual void end_of_elaboration() {}
234 virtual void start_of_simulation() {}
235 virtual void end_of_simulation() {}
236
237 private:
238 sc_gem5::Module *_gem5_module;
239
240 // Disabled
241 sc_module(const sc_module &) : sc_object() {};
242 sc_module &operator = (const sc_module &) { return *this; }
243};
244
245void next_trigger();
246void next_trigger(const sc_event &);
247void next_trigger(const sc_event_or_list &);
248void next_trigger(const sc_event_and_list &);
249void next_trigger(const sc_time &);
250void next_trigger(double, sc_time_unit);
251void next_trigger(const sc_time &, const sc_event &);
252void next_trigger(double, sc_time_unit, const sc_event &);
253void next_trigger(const sc_time &, const sc_event_or_list &);
254void next_trigger(double, sc_time_unit, const sc_event_or_list &);
255void next_trigger(const sc_time &, const sc_event_and_list &);
256void next_trigger(double, sc_time_unit, const sc_event_and_list &);
257
258void wait();
259void wait(int);
260void wait(const sc_event &);
261void wait(const sc_event_or_list &);
262void wait(const sc_event_and_list &);
263void wait(const sc_time &);
264void wait(double, sc_time_unit);
265void wait(const sc_time &, const sc_event &);
266void wait(double, sc_time_unit, const sc_event &);
267void wait(const sc_time &, const sc_event_or_list &);
268void wait(double, sc_time_unit, const sc_event_or_list &);
269void wait(const sc_time &, const sc_event_and_list &);
270void wait(double, sc_time_unit, const sc_event_and_list &);
271
272// Nonstandard
273bool timed_out();
274
275#define SC_MODULE(name) struct name : ::sc_core::sc_module
276
277#define SC_CTOR(name) \
278 typedef name SC_CURRENT_USER_MODULE; \
279 name(::sc_core::sc_module_name)
280
281#define SC_HAS_PROCESS(name) typedef name SC_CURRENT_USER_MODULE
282
283#define SC_METHOD(name) \
284 { \
285 ::sc_gem5::Process *p = \
286 ::sc_gem5::newMethodProcess( \
287 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
288 SC_CURRENT_USER_MODULE>(this, \
289 &SC_CURRENT_USER_MODULE::name)); \
290 this->sensitive << p; \
291 }
292#define SC_THREAD(name) \
293 { \
294 ::sc_gem5::Process *p = \
295 ::sc_gem5::newThreadProcess( \
296 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
297 SC_CURRENT_USER_MODULE>(this, \
298 &SC_CURRENT_USER_MODULE::name)); \
299 this->sensitive << p; \
300 }
301#define SC_CTHREAD(name, clk) \
302 { \
303 ::sc_gem5::Process *p = \
304 ::sc_gem5::newCThreadProcess( \
305 #name, new ::sc_gem5::ProcessMemberFuncWrapper< \
306 SC_CURRENT_USER_MODULE>(this, \
307 &SC_CURRENT_USER_MODULE::name)); \
308 this->sensitive << p; \
309 this->sensitive << clk; \
310 }
311
312// Nonstandard
313// Documentation for this is very scarce, but it looks like it's supposed to
314// stop the currently executing cthread, or if a cthread isn't running report
315// an error.
316void halt();
317void at_posedge(const sc_signal_in_if<bool> &);
318void at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &);
319void at_negedge(const sc_signal_in_if<bool> &);
320void at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &);
321
322const char *sc_gen_unique_name(const char *);
323
324// Nonstandard
325bool sc_hierarchical_name_exists(const char *name);
326
327typedef sc_module sc_behavior;
328typedef sc_module sc_channel;
329
330bool sc_start_of_simulation_invoked();
331bool sc_end_of_simulation_invoked();
332
333// Nonstandard
334// Allocates a module of type x and records a pointer to it so that it gets
335// destructed automatically at the end of the simulation.
336sc_module *sc_module_sc_new(sc_module *);
337#define SC_NEW(x) ::sc_core::sc_module_sc_new(new x);
338
339// Nonstandard
340// In the Accellera implementation, this macro calls sc_set_location to record
341// the current file and line, calls wait, and then calls it again to clear the
342// file and line. We'll ignore the sc_set_location calls for now.
343#define SC_WAIT() ::sc_core::wait();
344
345// Nonstandard
346// Same as above, but passes through an argument.
347#define SC_WAITN(n) ::sc_core::wait(n);
348
349// Nonstandard
350#define SC_WAIT_UNTIL(expr) do { SC_WAIT(); } while (!(expr))
351
352} // namespace sc_core
353
354#endif //__SYSTEMC_EXT_CORE_SC_MODULE_HH__