sc_module.cc (13035:bafbdba2352a) sc_module.cc (13060:a5465580f647)
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#include <memory>
31#include <vector>
32
33#include "base/logging.hh"
34#include "systemc/core/kernel.hh"
35#include "systemc/core/module.hh"
36#include "systemc/core/process_types.hh"
37#include "systemc/ext/core/sc_module.hh"
38#include "systemc/ext/core/sc_module_name.hh"
39
40namespace sc_gem5
41{
42
43Process *
44newMethodProcess(const char *name, ProcessFuncWrapper *func)
45{
46 Process *p = new Method(name, func);
47 scheduler.reg(p);
48 return p;
49}
50
51Process *
52newThreadProcess(const char *name, ProcessFuncWrapper *func)
53{
54 Process *p = new Thread(name, func);
55 scheduler.reg(p);
56 return p;
57}
58
59Process *
60newCThreadProcess(const char *name, ProcessFuncWrapper *func)
61{
62 Process *p = new CThread(name, func);
63 scheduler.reg(p);
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#include <memory>
31#include <vector>
32
33#include "base/logging.hh"
34#include "systemc/core/kernel.hh"
35#include "systemc/core/module.hh"
36#include "systemc/core/process_types.hh"
37#include "systemc/ext/core/sc_module.hh"
38#include "systemc/ext/core/sc_module_name.hh"
39
40namespace sc_gem5
41{
42
43Process *
44newMethodProcess(const char *name, ProcessFuncWrapper *func)
45{
46 Process *p = new Method(name, func);
47 scheduler.reg(p);
48 return p;
49}
50
51Process *
52newThreadProcess(const char *name, ProcessFuncWrapper *func)
53{
54 Process *p = new Thread(name, func);
55 scheduler.reg(p);
56 return p;
57}
58
59Process *
60newCThreadProcess(const char *name, ProcessFuncWrapper *func)
61{
62 Process *p = new CThread(name, func);
63 scheduler.reg(p);
64 p->dontInitialize();
64 return p;
65}
66
67UniqueNameGen nameGen;
68
69} // namespace sc_gem5
70
71namespace sc_core
72{
73
74sc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
75 _interface(&_interface), _port(nullptr)
76{}
77
78sc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
79 _interface(nullptr), _port(&_port)
80{}
81
82const sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
83
84sc_module::~sc_module() { delete _gem5_module; }
85
86const sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
87
88void
89sc_module::operator () (const sc_bind_proxy &p001,
90 const sc_bind_proxy &p002,
91 const sc_bind_proxy &p003,
92 const sc_bind_proxy &p004,
93 const sc_bind_proxy &p005,
94 const sc_bind_proxy &p006,
95 const sc_bind_proxy &p007,
96 const sc_bind_proxy &p008,
97 const sc_bind_proxy &p009,
98 const sc_bind_proxy &p010,
99 const sc_bind_proxy &p011,
100 const sc_bind_proxy &p012,
101 const sc_bind_proxy &p013,
102 const sc_bind_proxy &p014,
103 const sc_bind_proxy &p015,
104 const sc_bind_proxy &p016,
105 const sc_bind_proxy &p017,
106 const sc_bind_proxy &p018,
107 const sc_bind_proxy &p019,
108 const sc_bind_proxy &p020,
109 const sc_bind_proxy &p021,
110 const sc_bind_proxy &p022,
111 const sc_bind_proxy &p023,
112 const sc_bind_proxy &p024,
113 const sc_bind_proxy &p025,
114 const sc_bind_proxy &p026,
115 const sc_bind_proxy &p027,
116 const sc_bind_proxy &p028,
117 const sc_bind_proxy &p029,
118 const sc_bind_proxy &p030,
119 const sc_bind_proxy &p031,
120 const sc_bind_proxy &p032,
121 const sc_bind_proxy &p033,
122 const sc_bind_proxy &p034,
123 const sc_bind_proxy &p035,
124 const sc_bind_proxy &p036,
125 const sc_bind_proxy &p037,
126 const sc_bind_proxy &p038,
127 const sc_bind_proxy &p039,
128 const sc_bind_proxy &p040,
129 const sc_bind_proxy &p041,
130 const sc_bind_proxy &p042,
131 const sc_bind_proxy &p043,
132 const sc_bind_proxy &p044,
133 const sc_bind_proxy &p045,
134 const sc_bind_proxy &p046,
135 const sc_bind_proxy &p047,
136 const sc_bind_proxy &p048,
137 const sc_bind_proxy &p049,
138 const sc_bind_proxy &p050,
139 const sc_bind_proxy &p051,
140 const sc_bind_proxy &p052,
141 const sc_bind_proxy &p053,
142 const sc_bind_proxy &p054,
143 const sc_bind_proxy &p055,
144 const sc_bind_proxy &p056,
145 const sc_bind_proxy &p057,
146 const sc_bind_proxy &p058,
147 const sc_bind_proxy &p059,
148 const sc_bind_proxy &p060,
149 const sc_bind_proxy &p061,
150 const sc_bind_proxy &p062,
151 const sc_bind_proxy &p063,
152 const sc_bind_proxy &p064)
153{
154 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
155}
156
157const std::vector<sc_object *> &
158sc_module::get_child_objects() const
159{
160 return _gem5_module->obj()->get_child_objects();
161}
162
163const std::vector<sc_event *> &
164sc_module::get_child_events() const
165{
166 return _gem5_module->obj()->get_child_events();
167}
168
169sc_module::sc_module() :
170 sc_object(sc_gem5::newModule()->name()),
171 _gem5_module(sc_gem5::currentModule())
172{}
173
174sc_module::sc_module(const sc_module_name &) : sc_module() {}
175sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
176sc_module::sc_module(const std::string &_name) :
177 sc_module(sc_module_name(_name.c_str()))
178{}
179
180void
181sc_module::reset_signal_is(const sc_in<bool> &, bool)
182{
183 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
184}
185
186void
187sc_module::reset_signal_is(const sc_inout<bool> &, bool)
188{
189 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
190}
191
192void
193sc_module::reset_signal_is(const sc_out<bool> &, bool)
194{
195 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
196}
197
198void
199sc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
200{
201 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
202}
203
204
205void
206sc_module::async_reset_signal_is(const sc_in<bool> &, bool)
207{
208 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
209}
210
211void
212sc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
213{
214 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
215}
216
217void
218sc_module::async_reset_signal_is(const sc_out<bool> &, bool)
219{
220 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
221}
222
223void
224sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
225{
226 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
227}
228
229
230void
231sc_module::dont_initialize()
232{
233 ::sc_gem5::Process::newest()->dontInitialize();
234}
235
236void
237sc_module::set_stack_size(size_t size)
238{
239 ::sc_gem5::Process::newest()->setStackSize(size);
240}
241
242
243void sc_module::next_trigger() { ::sc_core::next_trigger(); }
244
245void
246sc_module::next_trigger(const sc_event &e)
247{
248 ::sc_core::next_trigger(e);
249}
250
251void
252sc_module::next_trigger(const sc_event_or_list &eol)
253{
254 ::sc_core::next_trigger(eol);
255}
256
257void
258sc_module::next_trigger(const sc_event_and_list &eal)
259{
260 ::sc_core::next_trigger(eal);
261}
262
263void
264sc_module::next_trigger(const sc_time &t)
265{
266 ::sc_core::next_trigger(t);
267}
268
269void
270sc_module::next_trigger(double d, sc_time_unit u)
271{
272 ::sc_core::next_trigger(d, u);
273}
274
275void
276sc_module::next_trigger(const sc_time &t, const sc_event &e)
277{
278 ::sc_core::next_trigger(t, e);
279}
280
281void
282sc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
283{
284 ::sc_core::next_trigger(d, u, e);
285}
286
287void
288sc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
289{
290 ::sc_core::next_trigger(t, eol);
291}
292
293void
294sc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
295{
296 ::sc_core::next_trigger(d, u, eol);
297}
298
299void
300sc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
301{
302 ::sc_core::next_trigger(t, eal);
303}
304
305void
306sc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
307{
308 ::sc_core::next_trigger(d, u, eal);
309}
310
311
312bool
313sc_module::timed_out()
314{
315 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
316 return false;
317}
318
319
320void
321sc_module::wait()
322{
323 ::sc_core::wait();
324}
325
326void
327sc_module::wait(int i)
328{
329 ::sc_core::wait(i);
330}
331
332void
333sc_module::wait(const sc_event &e)
334{
335 ::sc_core::wait(e);
336}
337
338void
339sc_module::wait(const sc_event_or_list &eol)
340{
341 ::sc_core::wait(eol);
342}
343
344void
345sc_module::wait(const sc_event_and_list &eal)
346{
347 ::sc_core::wait(eal);
348}
349
350void
351sc_module::wait(const sc_time &t)
352{
353 ::sc_core::wait(t);
354}
355
356void
357sc_module::wait(double d, sc_time_unit u)
358{
359 ::sc_core::wait(d, u);
360}
361
362void
363sc_module::wait(const sc_time &t, const sc_event &e)
364{
365 ::sc_core::wait(t, e);
366}
367
368void
369sc_module::wait(double d, sc_time_unit u, const sc_event &e)
370{
371 ::sc_core::wait(d, u, e);
372}
373
374void
375sc_module::wait(const sc_time &t, const sc_event_or_list &eol)
376{
377 ::sc_core::wait(t, eol);
378}
379
380void
381sc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
382{
383 ::sc_core::wait(d, u, eol);
384}
385
386void
387sc_module::wait(const sc_time &t, const sc_event_and_list &eal)
388{
389 ::sc_core::wait(t, eal);
390}
391
392void
393sc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
394{
395 ::sc_core::wait(d, u, eal);
396}
397
398
399void
400sc_module::halt()
401{
402 ::sc_core::halt();
403}
404
405void
406sc_module::at_posedge(const sc_signal_in_if<bool> &s)
407{
408 ::sc_core::at_posedge(s);
409}
410
411void
412sc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
413{
414 ::sc_core::at_posedge(s);
415}
416
417void
418sc_module::at_negedge(const sc_signal_in_if<bool> &s)
419{
420 ::sc_core::at_negedge(s);
421}
422
423void
424sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
425{
426 ::sc_core::at_negedge(s);
427}
428
429
430void
431next_trigger()
432{
433 sc_gem5::Process *p = sc_gem5::scheduler.current();
434 p->setDynamic(nullptr);
435}
436
437void
438next_trigger(const sc_event &e)
439{
440 sc_gem5::Process *p = sc_gem5::scheduler.current();
441 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
442}
443
444void
445next_trigger(const sc_event_or_list &eol)
446{
447 sc_gem5::Process *p = sc_gem5::scheduler.current();
448 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
449}
450
451void
452next_trigger(const sc_event_and_list &eal)
453{
454 sc_gem5::Process *p = sc_gem5::scheduler.current();
455 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
456}
457
458void
459next_trigger(const sc_time &t)
460{
461 sc_gem5::Process *p = sc_gem5::scheduler.current();
462 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
463}
464
465void
466next_trigger(double d, sc_time_unit u)
467{
468 next_trigger(sc_time(d, u));
469}
470
471void
472next_trigger(const sc_time &t, const sc_event &e)
473{
474 sc_gem5::Process *p = sc_gem5::scheduler.current();
475 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
476}
477
478void
479next_trigger(double d, sc_time_unit u, const sc_event &e)
480{
481 next_trigger(sc_time(d, u), e);
482}
483
484void
485next_trigger(const sc_time &t, const sc_event_or_list &eol)
486{
487 sc_gem5::Process *p = sc_gem5::scheduler.current();
488 p->setDynamic(
489 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
490}
491
492void
493next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
494{
495 next_trigger(sc_time(d, u), eol);
496}
497
498void
499next_trigger(const sc_time &t, const sc_event_and_list &eal)
500{
501 sc_gem5::Process *p = sc_gem5::scheduler.current();
502 p->setDynamic(
503 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
504}
505
506void
507next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
508{
509 next_trigger(sc_time(d, u), eal);
510}
511
512bool
513timed_out()
514{
515 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
516 return false;
517}
518
519
520void
521wait()
522{
523 sc_gem5::Process *p = sc_gem5::scheduler.current();
524 p->setDynamic(nullptr);
525 sc_gem5::scheduler.yield();
526}
527
528void
529wait(int n)
530{
531 for (int i = 0; i < n; i++)
532 wait();
533}
534
535void
536wait(const sc_event &e)
537{
538 sc_gem5::Process *p = sc_gem5::scheduler.current();
539 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
540 sc_gem5::scheduler.yield();
541}
542
543void
544wait(const sc_event_or_list &eol)
545{
546 sc_gem5::Process *p = sc_gem5::scheduler.current();
547 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
548 sc_gem5::scheduler.yield();
549}
550
551void
552wait(const sc_event_and_list &eal)
553{
554 sc_gem5::Process *p = sc_gem5::scheduler.current();
555 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
556 sc_gem5::scheduler.yield();
557}
558
559void
560wait(const sc_time &t)
561{
562 sc_gem5::Process *p = sc_gem5::scheduler.current();
563 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
564 sc_gem5::scheduler.yield();
565}
566
567void
568wait(double d, sc_time_unit u)
569{
570 wait(sc_time(d, u));
571}
572
573void
574wait(const sc_time &t, const sc_event &e)
575{
576 sc_gem5::Process *p = sc_gem5::scheduler.current();
577 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
578 sc_gem5::scheduler.yield();
579}
580
581void
582wait(double d, sc_time_unit u, const sc_event &e)
583{
584 wait(sc_time(d, u), e);
585}
586
587void
588wait(const sc_time &t, const sc_event_or_list &eol)
589{
590 sc_gem5::Process *p = sc_gem5::scheduler.current();
591 p->setDynamic(
592 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
593 sc_gem5::scheduler.yield();
594}
595
596void
597wait(double d, sc_time_unit u, const sc_event_or_list &eol)
598{
599 wait(sc_time(d, u), eol);
600}
601
602void
603wait(const sc_time &t, const sc_event_and_list &eal)
604{
605 sc_gem5::Process *p = sc_gem5::scheduler.current();
606 p->setDynamic(
607 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
608 sc_gem5::scheduler.yield();
609}
610
611void
612wait(double d, sc_time_unit u, const sc_event_and_list &eal)
613{
614 wait(sc_time(d, u), eal);
615}
616
617void
618halt()
619{
620 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
621}
622
623void
624at_posedge(const sc_signal_in_if<bool> &)
625{
626 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
627}
628
629void
630at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
631{
632 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
633}
634
635void
636at_negedge(const sc_signal_in_if<bool> &)
637{
638 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
639}
640
641void
642at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
643{
644 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
645}
646
647const char *
648sc_gen_unique_name(const char *seed)
649{
650 ::sc_gem5::Module *mod = ::sc_gem5::currentModule();
651 return mod ? mod->uniqueName(seed) :
652 ::sc_gem5::nameGen.gen(seed);
653}
654
655bool
656sc_hierarchical_name_exists(const char *name)
657{
658 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
659 return false;
660}
661
662bool
663sc_start_of_simulation_invoked()
664{
665 return ::sc_gem5::kernel->startOfSimulationComplete();
666}
667
668bool
669sc_end_of_simulation_invoked()
670{
671 return ::sc_gem5::kernel->endOfSimulationComplete();
672}
673
674sc_module *
675sc_module_sc_new(sc_module *mod)
676{
677 static std::vector<std::unique_ptr<sc_module> > modules;
678 modules.emplace_back(mod);
679 return mod;
680}
681
682} // namespace sc_core
65 return p;
66}
67
68UniqueNameGen nameGen;
69
70} // namespace sc_gem5
71
72namespace sc_core
73{
74
75sc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
76 _interface(&_interface), _port(nullptr)
77{}
78
79sc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
80 _interface(nullptr), _port(&_port)
81{}
82
83const sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
84
85sc_module::~sc_module() { delete _gem5_module; }
86
87const sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
88
89void
90sc_module::operator () (const sc_bind_proxy &p001,
91 const sc_bind_proxy &p002,
92 const sc_bind_proxy &p003,
93 const sc_bind_proxy &p004,
94 const sc_bind_proxy &p005,
95 const sc_bind_proxy &p006,
96 const sc_bind_proxy &p007,
97 const sc_bind_proxy &p008,
98 const sc_bind_proxy &p009,
99 const sc_bind_proxy &p010,
100 const sc_bind_proxy &p011,
101 const sc_bind_proxy &p012,
102 const sc_bind_proxy &p013,
103 const sc_bind_proxy &p014,
104 const sc_bind_proxy &p015,
105 const sc_bind_proxy &p016,
106 const sc_bind_proxy &p017,
107 const sc_bind_proxy &p018,
108 const sc_bind_proxy &p019,
109 const sc_bind_proxy &p020,
110 const sc_bind_proxy &p021,
111 const sc_bind_proxy &p022,
112 const sc_bind_proxy &p023,
113 const sc_bind_proxy &p024,
114 const sc_bind_proxy &p025,
115 const sc_bind_proxy &p026,
116 const sc_bind_proxy &p027,
117 const sc_bind_proxy &p028,
118 const sc_bind_proxy &p029,
119 const sc_bind_proxy &p030,
120 const sc_bind_proxy &p031,
121 const sc_bind_proxy &p032,
122 const sc_bind_proxy &p033,
123 const sc_bind_proxy &p034,
124 const sc_bind_proxy &p035,
125 const sc_bind_proxy &p036,
126 const sc_bind_proxy &p037,
127 const sc_bind_proxy &p038,
128 const sc_bind_proxy &p039,
129 const sc_bind_proxy &p040,
130 const sc_bind_proxy &p041,
131 const sc_bind_proxy &p042,
132 const sc_bind_proxy &p043,
133 const sc_bind_proxy &p044,
134 const sc_bind_proxy &p045,
135 const sc_bind_proxy &p046,
136 const sc_bind_proxy &p047,
137 const sc_bind_proxy &p048,
138 const sc_bind_proxy &p049,
139 const sc_bind_proxy &p050,
140 const sc_bind_proxy &p051,
141 const sc_bind_proxy &p052,
142 const sc_bind_proxy &p053,
143 const sc_bind_proxy &p054,
144 const sc_bind_proxy &p055,
145 const sc_bind_proxy &p056,
146 const sc_bind_proxy &p057,
147 const sc_bind_proxy &p058,
148 const sc_bind_proxy &p059,
149 const sc_bind_proxy &p060,
150 const sc_bind_proxy &p061,
151 const sc_bind_proxy &p062,
152 const sc_bind_proxy &p063,
153 const sc_bind_proxy &p064)
154{
155 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
156}
157
158const std::vector<sc_object *> &
159sc_module::get_child_objects() const
160{
161 return _gem5_module->obj()->get_child_objects();
162}
163
164const std::vector<sc_event *> &
165sc_module::get_child_events() const
166{
167 return _gem5_module->obj()->get_child_events();
168}
169
170sc_module::sc_module() :
171 sc_object(sc_gem5::newModule()->name()),
172 _gem5_module(sc_gem5::currentModule())
173{}
174
175sc_module::sc_module(const sc_module_name &) : sc_module() {}
176sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
177sc_module::sc_module(const std::string &_name) :
178 sc_module(sc_module_name(_name.c_str()))
179{}
180
181void
182sc_module::reset_signal_is(const sc_in<bool> &, bool)
183{
184 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
185}
186
187void
188sc_module::reset_signal_is(const sc_inout<bool> &, bool)
189{
190 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
191}
192
193void
194sc_module::reset_signal_is(const sc_out<bool> &, bool)
195{
196 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
197}
198
199void
200sc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
201{
202 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
203}
204
205
206void
207sc_module::async_reset_signal_is(const sc_in<bool> &, bool)
208{
209 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
210}
211
212void
213sc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
214{
215 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
216}
217
218void
219sc_module::async_reset_signal_is(const sc_out<bool> &, bool)
220{
221 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
222}
223
224void
225sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
226{
227 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
228}
229
230
231void
232sc_module::dont_initialize()
233{
234 ::sc_gem5::Process::newest()->dontInitialize();
235}
236
237void
238sc_module::set_stack_size(size_t size)
239{
240 ::sc_gem5::Process::newest()->setStackSize(size);
241}
242
243
244void sc_module::next_trigger() { ::sc_core::next_trigger(); }
245
246void
247sc_module::next_trigger(const sc_event &e)
248{
249 ::sc_core::next_trigger(e);
250}
251
252void
253sc_module::next_trigger(const sc_event_or_list &eol)
254{
255 ::sc_core::next_trigger(eol);
256}
257
258void
259sc_module::next_trigger(const sc_event_and_list &eal)
260{
261 ::sc_core::next_trigger(eal);
262}
263
264void
265sc_module::next_trigger(const sc_time &t)
266{
267 ::sc_core::next_trigger(t);
268}
269
270void
271sc_module::next_trigger(double d, sc_time_unit u)
272{
273 ::sc_core::next_trigger(d, u);
274}
275
276void
277sc_module::next_trigger(const sc_time &t, const sc_event &e)
278{
279 ::sc_core::next_trigger(t, e);
280}
281
282void
283sc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
284{
285 ::sc_core::next_trigger(d, u, e);
286}
287
288void
289sc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
290{
291 ::sc_core::next_trigger(t, eol);
292}
293
294void
295sc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
296{
297 ::sc_core::next_trigger(d, u, eol);
298}
299
300void
301sc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
302{
303 ::sc_core::next_trigger(t, eal);
304}
305
306void
307sc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
308{
309 ::sc_core::next_trigger(d, u, eal);
310}
311
312
313bool
314sc_module::timed_out()
315{
316 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
317 return false;
318}
319
320
321void
322sc_module::wait()
323{
324 ::sc_core::wait();
325}
326
327void
328sc_module::wait(int i)
329{
330 ::sc_core::wait(i);
331}
332
333void
334sc_module::wait(const sc_event &e)
335{
336 ::sc_core::wait(e);
337}
338
339void
340sc_module::wait(const sc_event_or_list &eol)
341{
342 ::sc_core::wait(eol);
343}
344
345void
346sc_module::wait(const sc_event_and_list &eal)
347{
348 ::sc_core::wait(eal);
349}
350
351void
352sc_module::wait(const sc_time &t)
353{
354 ::sc_core::wait(t);
355}
356
357void
358sc_module::wait(double d, sc_time_unit u)
359{
360 ::sc_core::wait(d, u);
361}
362
363void
364sc_module::wait(const sc_time &t, const sc_event &e)
365{
366 ::sc_core::wait(t, e);
367}
368
369void
370sc_module::wait(double d, sc_time_unit u, const sc_event &e)
371{
372 ::sc_core::wait(d, u, e);
373}
374
375void
376sc_module::wait(const sc_time &t, const sc_event_or_list &eol)
377{
378 ::sc_core::wait(t, eol);
379}
380
381void
382sc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
383{
384 ::sc_core::wait(d, u, eol);
385}
386
387void
388sc_module::wait(const sc_time &t, const sc_event_and_list &eal)
389{
390 ::sc_core::wait(t, eal);
391}
392
393void
394sc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
395{
396 ::sc_core::wait(d, u, eal);
397}
398
399
400void
401sc_module::halt()
402{
403 ::sc_core::halt();
404}
405
406void
407sc_module::at_posedge(const sc_signal_in_if<bool> &s)
408{
409 ::sc_core::at_posedge(s);
410}
411
412void
413sc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
414{
415 ::sc_core::at_posedge(s);
416}
417
418void
419sc_module::at_negedge(const sc_signal_in_if<bool> &s)
420{
421 ::sc_core::at_negedge(s);
422}
423
424void
425sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
426{
427 ::sc_core::at_negedge(s);
428}
429
430
431void
432next_trigger()
433{
434 sc_gem5::Process *p = sc_gem5::scheduler.current();
435 p->setDynamic(nullptr);
436}
437
438void
439next_trigger(const sc_event &e)
440{
441 sc_gem5::Process *p = sc_gem5::scheduler.current();
442 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
443}
444
445void
446next_trigger(const sc_event_or_list &eol)
447{
448 sc_gem5::Process *p = sc_gem5::scheduler.current();
449 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
450}
451
452void
453next_trigger(const sc_event_and_list &eal)
454{
455 sc_gem5::Process *p = sc_gem5::scheduler.current();
456 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
457}
458
459void
460next_trigger(const sc_time &t)
461{
462 sc_gem5::Process *p = sc_gem5::scheduler.current();
463 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
464}
465
466void
467next_trigger(double d, sc_time_unit u)
468{
469 next_trigger(sc_time(d, u));
470}
471
472void
473next_trigger(const sc_time &t, const sc_event &e)
474{
475 sc_gem5::Process *p = sc_gem5::scheduler.current();
476 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
477}
478
479void
480next_trigger(double d, sc_time_unit u, const sc_event &e)
481{
482 next_trigger(sc_time(d, u), e);
483}
484
485void
486next_trigger(const sc_time &t, const sc_event_or_list &eol)
487{
488 sc_gem5::Process *p = sc_gem5::scheduler.current();
489 p->setDynamic(
490 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
491}
492
493void
494next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
495{
496 next_trigger(sc_time(d, u), eol);
497}
498
499void
500next_trigger(const sc_time &t, const sc_event_and_list &eal)
501{
502 sc_gem5::Process *p = sc_gem5::scheduler.current();
503 p->setDynamic(
504 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
505}
506
507void
508next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
509{
510 next_trigger(sc_time(d, u), eal);
511}
512
513bool
514timed_out()
515{
516 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
517 return false;
518}
519
520
521void
522wait()
523{
524 sc_gem5::Process *p = sc_gem5::scheduler.current();
525 p->setDynamic(nullptr);
526 sc_gem5::scheduler.yield();
527}
528
529void
530wait(int n)
531{
532 for (int i = 0; i < n; i++)
533 wait();
534}
535
536void
537wait(const sc_event &e)
538{
539 sc_gem5::Process *p = sc_gem5::scheduler.current();
540 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
541 sc_gem5::scheduler.yield();
542}
543
544void
545wait(const sc_event_or_list &eol)
546{
547 sc_gem5::Process *p = sc_gem5::scheduler.current();
548 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
549 sc_gem5::scheduler.yield();
550}
551
552void
553wait(const sc_event_and_list &eal)
554{
555 sc_gem5::Process *p = sc_gem5::scheduler.current();
556 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
557 sc_gem5::scheduler.yield();
558}
559
560void
561wait(const sc_time &t)
562{
563 sc_gem5::Process *p = sc_gem5::scheduler.current();
564 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
565 sc_gem5::scheduler.yield();
566}
567
568void
569wait(double d, sc_time_unit u)
570{
571 wait(sc_time(d, u));
572}
573
574void
575wait(const sc_time &t, const sc_event &e)
576{
577 sc_gem5::Process *p = sc_gem5::scheduler.current();
578 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
579 sc_gem5::scheduler.yield();
580}
581
582void
583wait(double d, sc_time_unit u, const sc_event &e)
584{
585 wait(sc_time(d, u), e);
586}
587
588void
589wait(const sc_time &t, const sc_event_or_list &eol)
590{
591 sc_gem5::Process *p = sc_gem5::scheduler.current();
592 p->setDynamic(
593 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
594 sc_gem5::scheduler.yield();
595}
596
597void
598wait(double d, sc_time_unit u, const sc_event_or_list &eol)
599{
600 wait(sc_time(d, u), eol);
601}
602
603void
604wait(const sc_time &t, const sc_event_and_list &eal)
605{
606 sc_gem5::Process *p = sc_gem5::scheduler.current();
607 p->setDynamic(
608 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
609 sc_gem5::scheduler.yield();
610}
611
612void
613wait(double d, sc_time_unit u, const sc_event_and_list &eal)
614{
615 wait(sc_time(d, u), eal);
616}
617
618void
619halt()
620{
621 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
622}
623
624void
625at_posedge(const sc_signal_in_if<bool> &)
626{
627 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
628}
629
630void
631at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
632{
633 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
634}
635
636void
637at_negedge(const sc_signal_in_if<bool> &)
638{
639 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
640}
641
642void
643at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
644{
645 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
646}
647
648const char *
649sc_gen_unique_name(const char *seed)
650{
651 ::sc_gem5::Module *mod = ::sc_gem5::currentModule();
652 return mod ? mod->uniqueName(seed) :
653 ::sc_gem5::nameGen.gen(seed);
654}
655
656bool
657sc_hierarchical_name_exists(const char *name)
658{
659 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
660 return false;
661}
662
663bool
664sc_start_of_simulation_invoked()
665{
666 return ::sc_gem5::kernel->startOfSimulationComplete();
667}
668
669bool
670sc_end_of_simulation_invoked()
671{
672 return ::sc_gem5::kernel->endOfSimulationComplete();
673}
674
675sc_module *
676sc_module_sc_new(sc_module *mod)
677{
678 static std::vector<std::unique_ptr<sc_module> > modules;
679 modules.emplace_back(mod);
680 return mod;
681}
682
683} // namespace sc_core