sc_module.cc revision 13035
112837Sgabeblack@google.com/*
212837Sgabeblack@google.com * Copyright 2018 Google, Inc.
312837Sgabeblack@google.com *
412837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
512837Sgabeblack@google.com * modification, are permitted provided that the following conditions are
612837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
712837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
812837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
912837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1012837Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1112837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1212837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1312837Sgabeblack@google.com * this software without specific prior written permission.
1412837Sgabeblack@google.com *
1512837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012837Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112837Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212837Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312837Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412837Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612837Sgabeblack@google.com *
2712837Sgabeblack@google.com * Authors: Gabe Black
2812837Sgabeblack@google.com */
2912837Sgabeblack@google.com
3012901Sgabeblack@google.com#include <memory>
3112901Sgabeblack@google.com#include <vector>
3212901Sgabeblack@google.com
3312837Sgabeblack@google.com#include "base/logging.hh"
3412982Sgabeblack@google.com#include "systemc/core/kernel.hh"
3512951Sgabeblack@google.com#include "systemc/core/module.hh"
3612953Sgabeblack@google.com#include "systemc/core/process_types.hh"
3712837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh"
3812951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh"
3912837Sgabeblack@google.com
4012952Sgabeblack@google.comnamespace sc_gem5
4112952Sgabeblack@google.com{
4212952Sgabeblack@google.com
4312952Sgabeblack@google.comProcess *
4412952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func)
4512952Sgabeblack@google.com{
4612993Sgabeblack@google.com    Process *p = new Method(name, func);
4712993Sgabeblack@google.com    scheduler.reg(p);
4812993Sgabeblack@google.com    return p;
4912952Sgabeblack@google.com}
5012952Sgabeblack@google.com
5112952Sgabeblack@google.comProcess *
5212952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func)
5312952Sgabeblack@google.com{
5412993Sgabeblack@google.com    Process *p = new Thread(name, func);
5512993Sgabeblack@google.com    scheduler.reg(p);
5612993Sgabeblack@google.com    return p;
5712952Sgabeblack@google.com}
5812952Sgabeblack@google.com
5912952Sgabeblack@google.comProcess *
6012952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func)
6112952Sgabeblack@google.com{
6212993Sgabeblack@google.com    Process *p = new CThread(name, func);
6312993Sgabeblack@google.com    scheduler.reg(p);
6412993Sgabeblack@google.com    return p;
6512952Sgabeblack@google.com}
6612952Sgabeblack@google.com
6713035Sgabeblack@google.comUniqueNameGen nameGen;
6813035Sgabeblack@google.com
6912952Sgabeblack@google.com} // namespace sc_gem5
7012952Sgabeblack@google.com
7112837Sgabeblack@google.comnamespace sc_core
7212837Sgabeblack@google.com{
7312837Sgabeblack@google.com
7412951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
7512951Sgabeblack@google.com    _interface(&_interface), _port(nullptr)
7612951Sgabeblack@google.com{}
7712837Sgabeblack@google.com
7812951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
7912951Sgabeblack@google.com    _interface(nullptr), _port(&_port)
8012951Sgabeblack@google.com{}
8112837Sgabeblack@google.com
8212837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
8312837Sgabeblack@google.com
8412982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; }
8512837Sgabeblack@google.com
8612837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
8712837Sgabeblack@google.com
8812837Sgabeblack@google.comvoid
8912837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001,
9012837Sgabeblack@google.com                        const sc_bind_proxy &p002,
9112837Sgabeblack@google.com                        const sc_bind_proxy &p003,
9212837Sgabeblack@google.com                        const sc_bind_proxy &p004,
9312837Sgabeblack@google.com                        const sc_bind_proxy &p005,
9412837Sgabeblack@google.com                        const sc_bind_proxy &p006,
9512837Sgabeblack@google.com                        const sc_bind_proxy &p007,
9612837Sgabeblack@google.com                        const sc_bind_proxy &p008,
9712837Sgabeblack@google.com                        const sc_bind_proxy &p009,
9812837Sgabeblack@google.com                        const sc_bind_proxy &p010,
9912837Sgabeblack@google.com                        const sc_bind_proxy &p011,
10012837Sgabeblack@google.com                        const sc_bind_proxy &p012,
10112837Sgabeblack@google.com                        const sc_bind_proxy &p013,
10212837Sgabeblack@google.com                        const sc_bind_proxy &p014,
10312837Sgabeblack@google.com                        const sc_bind_proxy &p015,
10412837Sgabeblack@google.com                        const sc_bind_proxy &p016,
10512837Sgabeblack@google.com                        const sc_bind_proxy &p017,
10612837Sgabeblack@google.com                        const sc_bind_proxy &p018,
10712837Sgabeblack@google.com                        const sc_bind_proxy &p019,
10812837Sgabeblack@google.com                        const sc_bind_proxy &p020,
10912837Sgabeblack@google.com                        const sc_bind_proxy &p021,
11012837Sgabeblack@google.com                        const sc_bind_proxy &p022,
11112837Sgabeblack@google.com                        const sc_bind_proxy &p023,
11212837Sgabeblack@google.com                        const sc_bind_proxy &p024,
11312837Sgabeblack@google.com                        const sc_bind_proxy &p025,
11412837Sgabeblack@google.com                        const sc_bind_proxy &p026,
11512837Sgabeblack@google.com                        const sc_bind_proxy &p027,
11612837Sgabeblack@google.com                        const sc_bind_proxy &p028,
11712837Sgabeblack@google.com                        const sc_bind_proxy &p029,
11812837Sgabeblack@google.com                        const sc_bind_proxy &p030,
11912837Sgabeblack@google.com                        const sc_bind_proxy &p031,
12012837Sgabeblack@google.com                        const sc_bind_proxy &p032,
12112837Sgabeblack@google.com                        const sc_bind_proxy &p033,
12212837Sgabeblack@google.com                        const sc_bind_proxy &p034,
12312837Sgabeblack@google.com                        const sc_bind_proxy &p035,
12412837Sgabeblack@google.com                        const sc_bind_proxy &p036,
12512837Sgabeblack@google.com                        const sc_bind_proxy &p037,
12612837Sgabeblack@google.com                        const sc_bind_proxy &p038,
12712837Sgabeblack@google.com                        const sc_bind_proxy &p039,
12812837Sgabeblack@google.com                        const sc_bind_proxy &p040,
12912837Sgabeblack@google.com                        const sc_bind_proxy &p041,
13012837Sgabeblack@google.com                        const sc_bind_proxy &p042,
13112837Sgabeblack@google.com                        const sc_bind_proxy &p043,
13212837Sgabeblack@google.com                        const sc_bind_proxy &p044,
13312837Sgabeblack@google.com                        const sc_bind_proxy &p045,
13412837Sgabeblack@google.com                        const sc_bind_proxy &p046,
13512837Sgabeblack@google.com                        const sc_bind_proxy &p047,
13612837Sgabeblack@google.com                        const sc_bind_proxy &p048,
13712837Sgabeblack@google.com                        const sc_bind_proxy &p049,
13812837Sgabeblack@google.com                        const sc_bind_proxy &p050,
13912837Sgabeblack@google.com                        const sc_bind_proxy &p051,
14012837Sgabeblack@google.com                        const sc_bind_proxy &p052,
14112837Sgabeblack@google.com                        const sc_bind_proxy &p053,
14212837Sgabeblack@google.com                        const sc_bind_proxy &p054,
14312837Sgabeblack@google.com                        const sc_bind_proxy &p055,
14412837Sgabeblack@google.com                        const sc_bind_proxy &p056,
14512837Sgabeblack@google.com                        const sc_bind_proxy &p057,
14612837Sgabeblack@google.com                        const sc_bind_proxy &p058,
14712837Sgabeblack@google.com                        const sc_bind_proxy &p059,
14812837Sgabeblack@google.com                        const sc_bind_proxy &p060,
14912837Sgabeblack@google.com                        const sc_bind_proxy &p061,
15012837Sgabeblack@google.com                        const sc_bind_proxy &p062,
15112837Sgabeblack@google.com                        const sc_bind_proxy &p063,
15212837Sgabeblack@google.com                        const sc_bind_proxy &p064)
15312837Sgabeblack@google.com{
15412837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
15512837Sgabeblack@google.com}
15612837Sgabeblack@google.com
15712837Sgabeblack@google.comconst std::vector<sc_object *> &
15812837Sgabeblack@google.comsc_module::get_child_objects() const
15912837Sgabeblack@google.com{
16012951Sgabeblack@google.com    return _gem5_module->obj()->get_child_objects();
16112837Sgabeblack@google.com}
16212837Sgabeblack@google.com
16312837Sgabeblack@google.comconst std::vector<sc_event *> &
16412837Sgabeblack@google.comsc_module::get_child_events() const
16512837Sgabeblack@google.com{
16612951Sgabeblack@google.com    return _gem5_module->obj()->get_child_events();
16712837Sgabeblack@google.com}
16812837Sgabeblack@google.com
16912951Sgabeblack@google.comsc_module::sc_module() :
17012952Sgabeblack@google.com    sc_object(sc_gem5::newModule()->name()),
17112951Sgabeblack@google.com    _gem5_module(sc_gem5::currentModule())
17212951Sgabeblack@google.com{}
17312837Sgabeblack@google.com
17412951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {}
17512951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
17612951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) :
17712951Sgabeblack@google.com    sc_module(sc_module_name(_name.c_str()))
17812951Sgabeblack@google.com{}
17912928Sgabeblack@google.com
18012837Sgabeblack@google.comvoid
18112837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool)
18212837Sgabeblack@google.com{
18312837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18412837Sgabeblack@google.com}
18512837Sgabeblack@google.com
18612837Sgabeblack@google.comvoid
18712837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool)
18812837Sgabeblack@google.com{
18912837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19012837Sgabeblack@google.com}
19112837Sgabeblack@google.com
19212837Sgabeblack@google.comvoid
19312837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool)
19412837Sgabeblack@google.com{
19512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19612837Sgabeblack@google.com}
19712837Sgabeblack@google.com
19812837Sgabeblack@google.comvoid
19912837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
20012837Sgabeblack@google.com{
20112837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20212837Sgabeblack@google.com}
20312837Sgabeblack@google.com
20412837Sgabeblack@google.com
20512837Sgabeblack@google.comvoid
20612837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool)
20712837Sgabeblack@google.com{
20812837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20912837Sgabeblack@google.com}
21012837Sgabeblack@google.com
21112837Sgabeblack@google.comvoid
21212837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
21312837Sgabeblack@google.com{
21412837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21512837Sgabeblack@google.com}
21612837Sgabeblack@google.com
21712837Sgabeblack@google.comvoid
21812837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool)
21912837Sgabeblack@google.com{
22012837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
22112837Sgabeblack@google.com}
22212837Sgabeblack@google.com
22312837Sgabeblack@google.comvoid
22412837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
22512837Sgabeblack@google.com{
22612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
22712837Sgabeblack@google.com}
22812837Sgabeblack@google.com
22912837Sgabeblack@google.com
23012837Sgabeblack@google.comvoid
23112837Sgabeblack@google.comsc_module::dont_initialize()
23212837Sgabeblack@google.com{
23312953Sgabeblack@google.com    ::sc_gem5::Process::newest()->dontInitialize();
23412837Sgabeblack@google.com}
23512837Sgabeblack@google.com
23612837Sgabeblack@google.comvoid
23712953Sgabeblack@google.comsc_module::set_stack_size(size_t size)
23812837Sgabeblack@google.com{
23912953Sgabeblack@google.com    ::sc_gem5::Process::newest()->setStackSize(size);
24012837Sgabeblack@google.com}
24112837Sgabeblack@google.com
24212837Sgabeblack@google.com
24312951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
24412951Sgabeblack@google.com
24512837Sgabeblack@google.comvoid
24612951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e)
24712837Sgabeblack@google.com{
24812951Sgabeblack@google.com    ::sc_core::next_trigger(e);
24912837Sgabeblack@google.com}
25012837Sgabeblack@google.com
25112837Sgabeblack@google.comvoid
25212951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol)
25312837Sgabeblack@google.com{
25412951Sgabeblack@google.com    ::sc_core::next_trigger(eol);
25512837Sgabeblack@google.com}
25612837Sgabeblack@google.com
25712837Sgabeblack@google.comvoid
25812951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal)
25912837Sgabeblack@google.com{
26012951Sgabeblack@google.com    ::sc_core::next_trigger(eal);
26112837Sgabeblack@google.com}
26212837Sgabeblack@google.com
26312837Sgabeblack@google.comvoid
26412951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t)
26512837Sgabeblack@google.com{
26612951Sgabeblack@google.com    ::sc_core::next_trigger(t);
26712837Sgabeblack@google.com}
26812837Sgabeblack@google.com
26912837Sgabeblack@google.comvoid
27012951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u)
27112837Sgabeblack@google.com{
27212951Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
27312837Sgabeblack@google.com}
27412837Sgabeblack@google.com
27512837Sgabeblack@google.comvoid
27612951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e)
27712837Sgabeblack@google.com{
27812951Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
27912837Sgabeblack@google.com}
28012837Sgabeblack@google.com
28112837Sgabeblack@google.comvoid
28212951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
28312837Sgabeblack@google.com{
28412951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
28512837Sgabeblack@google.com}
28612837Sgabeblack@google.com
28712837Sgabeblack@google.comvoid
28812951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
28912837Sgabeblack@google.com{
29012951Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
29112837Sgabeblack@google.com}
29212837Sgabeblack@google.com
29312837Sgabeblack@google.comvoid
29412951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
29512837Sgabeblack@google.com{
29612951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
29712837Sgabeblack@google.com}
29812837Sgabeblack@google.com
29912837Sgabeblack@google.comvoid
30012951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
30112837Sgabeblack@google.com{
30212951Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
30312837Sgabeblack@google.com}
30412837Sgabeblack@google.com
30512837Sgabeblack@google.comvoid
30612951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
30712837Sgabeblack@google.com{
30812951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
30912837Sgabeblack@google.com}
31012837Sgabeblack@google.com
31112837Sgabeblack@google.com
31212929Sgabeblack@google.combool
31312929Sgabeblack@google.comsc_module::timed_out()
31412929Sgabeblack@google.com{
31512929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
31612929Sgabeblack@google.com    return false;
31712929Sgabeblack@google.com}
31812929Sgabeblack@google.com
31912929Sgabeblack@google.com
32012837Sgabeblack@google.comvoid
32112837Sgabeblack@google.comsc_module::wait()
32212837Sgabeblack@google.com{
32312951Sgabeblack@google.com    ::sc_core::wait();
32412837Sgabeblack@google.com}
32512837Sgabeblack@google.com
32612837Sgabeblack@google.comvoid
32712951Sgabeblack@google.comsc_module::wait(int i)
32812837Sgabeblack@google.com{
32912951Sgabeblack@google.com    ::sc_core::wait(i);
33012837Sgabeblack@google.com}
33112837Sgabeblack@google.com
33212837Sgabeblack@google.comvoid
33312951Sgabeblack@google.comsc_module::wait(const sc_event &e)
33412837Sgabeblack@google.com{
33512951Sgabeblack@google.com    ::sc_core::wait(e);
33612837Sgabeblack@google.com}
33712837Sgabeblack@google.com
33812837Sgabeblack@google.comvoid
33912951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol)
34012837Sgabeblack@google.com{
34112951Sgabeblack@google.com    ::sc_core::wait(eol);
34212837Sgabeblack@google.com}
34312837Sgabeblack@google.com
34412837Sgabeblack@google.comvoid
34512951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal)
34612837Sgabeblack@google.com{
34712951Sgabeblack@google.com    ::sc_core::wait(eal);
34812837Sgabeblack@google.com}
34912837Sgabeblack@google.com
35012837Sgabeblack@google.comvoid
35112951Sgabeblack@google.comsc_module::wait(const sc_time &t)
35212837Sgabeblack@google.com{
35312951Sgabeblack@google.com    ::sc_core::wait(t);
35412837Sgabeblack@google.com}
35512837Sgabeblack@google.com
35612837Sgabeblack@google.comvoid
35712951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u)
35812837Sgabeblack@google.com{
35912951Sgabeblack@google.com    ::sc_core::wait(d, u);
36012837Sgabeblack@google.com}
36112837Sgabeblack@google.com
36212837Sgabeblack@google.comvoid
36312951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e)
36412837Sgabeblack@google.com{
36512951Sgabeblack@google.com    ::sc_core::wait(t, e);
36612837Sgabeblack@google.com}
36712837Sgabeblack@google.com
36812837Sgabeblack@google.comvoid
36912951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e)
37012837Sgabeblack@google.com{
37112951Sgabeblack@google.com    ::sc_core::wait(d, u, e);
37212837Sgabeblack@google.com}
37312837Sgabeblack@google.com
37412837Sgabeblack@google.comvoid
37512951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol)
37612837Sgabeblack@google.com{
37712951Sgabeblack@google.com    ::sc_core::wait(t, eol);
37812837Sgabeblack@google.com}
37912837Sgabeblack@google.com
38012837Sgabeblack@google.comvoid
38112951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
38212837Sgabeblack@google.com{
38312951Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
38412837Sgabeblack@google.com}
38512837Sgabeblack@google.com
38612837Sgabeblack@google.comvoid
38712951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal)
38812837Sgabeblack@google.com{
38912951Sgabeblack@google.com    ::sc_core::wait(t, eal);
39012837Sgabeblack@google.com}
39112837Sgabeblack@google.com
39212837Sgabeblack@google.comvoid
39312951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
39412837Sgabeblack@google.com{
39512951Sgabeblack@google.com    ::sc_core::wait(d, u, eal);
39612837Sgabeblack@google.com}
39712837Sgabeblack@google.com
39812837Sgabeblack@google.com
39912837Sgabeblack@google.comvoid
40012909Sgabeblack@google.comsc_module::halt()
40112909Sgabeblack@google.com{
40212951Sgabeblack@google.com    ::sc_core::halt();
40312909Sgabeblack@google.com}
40412909Sgabeblack@google.com
40512914Sgabeblack@google.comvoid
40612951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s)
40712914Sgabeblack@google.com{
40812951Sgabeblack@google.com    ::sc_core::at_posedge(s);
40912914Sgabeblack@google.com}
41012914Sgabeblack@google.com
41112914Sgabeblack@google.comvoid
41212951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
41312914Sgabeblack@google.com{
41412951Sgabeblack@google.com    ::sc_core::at_posedge(s);
41512914Sgabeblack@google.com}
41612914Sgabeblack@google.com
41712914Sgabeblack@google.comvoid
41812951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s)
41912914Sgabeblack@google.com{
42012951Sgabeblack@google.com    ::sc_core::at_negedge(s);
42112914Sgabeblack@google.com}
42212914Sgabeblack@google.com
42312914Sgabeblack@google.comvoid
42412951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
42512914Sgabeblack@google.com{
42612951Sgabeblack@google.com    ::sc_core::at_negedge(s);
42712914Sgabeblack@google.com}
42812914Sgabeblack@google.com
42912909Sgabeblack@google.com
43012909Sgabeblack@google.comvoid
43112837Sgabeblack@google.comnext_trigger()
43212837Sgabeblack@google.com{
43312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
43412958Sgabeblack@google.com    p->setDynamic(nullptr);
43512837Sgabeblack@google.com}
43612837Sgabeblack@google.com
43712837Sgabeblack@google.comvoid
43812958Sgabeblack@google.comnext_trigger(const sc_event &e)
43912837Sgabeblack@google.com{
44012958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44112958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
44212837Sgabeblack@google.com}
44312837Sgabeblack@google.com
44412837Sgabeblack@google.comvoid
44512958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol)
44612837Sgabeblack@google.com{
44712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44812958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
44912837Sgabeblack@google.com}
45012837Sgabeblack@google.com
45112837Sgabeblack@google.comvoid
45212958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal)
45312837Sgabeblack@google.com{
45412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
45512958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
45612837Sgabeblack@google.com}
45712837Sgabeblack@google.com
45812837Sgabeblack@google.comvoid
45912958Sgabeblack@google.comnext_trigger(const sc_time &t)
46012837Sgabeblack@google.com{
46112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
46212958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
46312837Sgabeblack@google.com}
46412837Sgabeblack@google.com
46512837Sgabeblack@google.comvoid
46612951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u)
46712837Sgabeblack@google.com{
46812951Sgabeblack@google.com    next_trigger(sc_time(d, u));
46912837Sgabeblack@google.com}
47012837Sgabeblack@google.com
47112837Sgabeblack@google.comvoid
47212958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e)
47312837Sgabeblack@google.com{
47412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
47512958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
47612837Sgabeblack@google.com}
47712837Sgabeblack@google.com
47812837Sgabeblack@google.comvoid
47912951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e)
48012837Sgabeblack@google.com{
48112951Sgabeblack@google.com    next_trigger(sc_time(d, u), e);
48212837Sgabeblack@google.com}
48312837Sgabeblack@google.com
48412837Sgabeblack@google.comvoid
48512958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol)
48612837Sgabeblack@google.com{
48712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
48812958Sgabeblack@google.com    p->setDynamic(
48912958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
49012837Sgabeblack@google.com}
49112837Sgabeblack@google.com
49212837Sgabeblack@google.comvoid
49312951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
49412837Sgabeblack@google.com{
49512951Sgabeblack@google.com    next_trigger(sc_time(d, u), eol);
49612837Sgabeblack@google.com}
49712837Sgabeblack@google.com
49812837Sgabeblack@google.comvoid
49912958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal)
50012837Sgabeblack@google.com{
50112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
50212958Sgabeblack@google.com    p->setDynamic(
50312958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
50412837Sgabeblack@google.com}
50512837Sgabeblack@google.com
50612837Sgabeblack@google.comvoid
50712951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
50812837Sgabeblack@google.com{
50912951Sgabeblack@google.com    next_trigger(sc_time(d, u), eal);
51012837Sgabeblack@google.com}
51112837Sgabeblack@google.com
51212929Sgabeblack@google.combool
51312929Sgabeblack@google.comtimed_out()
51412929Sgabeblack@google.com{
51512929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
51612929Sgabeblack@google.com    return false;
51712929Sgabeblack@google.com}
51812929Sgabeblack@google.com
51912837Sgabeblack@google.com
52012837Sgabeblack@google.comvoid
52112837Sgabeblack@google.comwait()
52212837Sgabeblack@google.com{
52312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
52412958Sgabeblack@google.com    p->setDynamic(nullptr);
52512958Sgabeblack@google.com    sc_gem5::scheduler.yield();
52612837Sgabeblack@google.com}
52712837Sgabeblack@google.com
52812837Sgabeblack@google.comvoid
52912958Sgabeblack@google.comwait(int n)
53012837Sgabeblack@google.com{
53112958Sgabeblack@google.com    for (int i = 0; i < n; i++)
53212958Sgabeblack@google.com        wait();
53312837Sgabeblack@google.com}
53412837Sgabeblack@google.com
53512837Sgabeblack@google.comvoid
53612958Sgabeblack@google.comwait(const sc_event &e)
53712837Sgabeblack@google.com{
53812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53912958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
54012958Sgabeblack@google.com    sc_gem5::scheduler.yield();
54112837Sgabeblack@google.com}
54212837Sgabeblack@google.com
54312837Sgabeblack@google.comvoid
54412958Sgabeblack@google.comwait(const sc_event_or_list &eol)
54512837Sgabeblack@google.com{
54612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54712958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
54812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
54912837Sgabeblack@google.com}
55012837Sgabeblack@google.com
55112837Sgabeblack@google.comvoid
55212958Sgabeblack@google.comwait(const sc_event_and_list &eal)
55312837Sgabeblack@google.com{
55412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
55512958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
55612958Sgabeblack@google.com    sc_gem5::scheduler.yield();
55712837Sgabeblack@google.com}
55812837Sgabeblack@google.com
55912837Sgabeblack@google.comvoid
56012958Sgabeblack@google.comwait(const sc_time &t)
56112837Sgabeblack@google.com{
56212958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
56312958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
56412958Sgabeblack@google.com    sc_gem5::scheduler.yield();
56512837Sgabeblack@google.com}
56612837Sgabeblack@google.com
56712837Sgabeblack@google.comvoid
56812951Sgabeblack@google.comwait(double d, sc_time_unit u)
56912837Sgabeblack@google.com{
57012951Sgabeblack@google.com    wait(sc_time(d, u));
57112837Sgabeblack@google.com}
57212837Sgabeblack@google.com
57312837Sgabeblack@google.comvoid
57412958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e)
57512837Sgabeblack@google.com{
57612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
57712958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
57812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
57912837Sgabeblack@google.com}
58012837Sgabeblack@google.com
58112837Sgabeblack@google.comvoid
58212951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e)
58312837Sgabeblack@google.com{
58412951Sgabeblack@google.com    wait(sc_time(d, u), e);
58512837Sgabeblack@google.com}
58612837Sgabeblack@google.com
58712837Sgabeblack@google.comvoid
58812958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol)
58912837Sgabeblack@google.com{
59012958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
59112958Sgabeblack@google.com    p->setDynamic(
59212958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
59312958Sgabeblack@google.com    sc_gem5::scheduler.yield();
59412837Sgabeblack@google.com}
59512837Sgabeblack@google.com
59612837Sgabeblack@google.comvoid
59712951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol)
59812837Sgabeblack@google.com{
59912951Sgabeblack@google.com    wait(sc_time(d, u), eol);
60012837Sgabeblack@google.com}
60112837Sgabeblack@google.com
60212837Sgabeblack@google.comvoid
60312958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal)
60412837Sgabeblack@google.com{
60512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
60612958Sgabeblack@google.com    p->setDynamic(
60712958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
60812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
60912837Sgabeblack@google.com}
61012837Sgabeblack@google.com
61112837Sgabeblack@google.comvoid
61212951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal)
61312837Sgabeblack@google.com{
61412951Sgabeblack@google.com    wait(sc_time(d, u), eal);
61512837Sgabeblack@google.com}
61612837Sgabeblack@google.com
61712909Sgabeblack@google.comvoid
61812909Sgabeblack@google.comhalt()
61912909Sgabeblack@google.com{
62012909Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62112909Sgabeblack@google.com}
62212909Sgabeblack@google.com
62312914Sgabeblack@google.comvoid
62412914Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &)
62512914Sgabeblack@google.com{
62612914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62712914Sgabeblack@google.com}
62812914Sgabeblack@google.com
62912914Sgabeblack@google.comvoid
63012914Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
63112914Sgabeblack@google.com{
63212914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63312914Sgabeblack@google.com}
63412914Sgabeblack@google.com
63512914Sgabeblack@google.comvoid
63612914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &)
63712914Sgabeblack@google.com{
63812914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63912914Sgabeblack@google.com}
64012914Sgabeblack@google.com
64112914Sgabeblack@google.comvoid
64212914Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
64312914Sgabeblack@google.com{
64412914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64512914Sgabeblack@google.com}
64612914Sgabeblack@google.com
64712837Sgabeblack@google.comconst char *
64813035Sgabeblack@google.comsc_gen_unique_name(const char *seed)
64912837Sgabeblack@google.com{
65013035Sgabeblack@google.com    ::sc_gem5::Module *mod = ::sc_gem5::currentModule();
65113035Sgabeblack@google.com    return mod ? mod->uniqueName(seed) :
65213035Sgabeblack@google.com        ::sc_gem5::nameGen.gen(seed);
65312837Sgabeblack@google.com}
65412837Sgabeblack@google.com
65512837Sgabeblack@google.combool
65612930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name)
65712930Sgabeblack@google.com{
65812930Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
65912930Sgabeblack@google.com    return false;
66012930Sgabeblack@google.com}
66112930Sgabeblack@google.com
66212930Sgabeblack@google.combool
66312837Sgabeblack@google.comsc_start_of_simulation_invoked()
66412837Sgabeblack@google.com{
66512982Sgabeblack@google.com    return ::sc_gem5::kernel->startOfSimulationComplete();
66612837Sgabeblack@google.com}
66712837Sgabeblack@google.com
66812837Sgabeblack@google.combool
66912837Sgabeblack@google.comsc_end_of_simulation_invoked()
67012837Sgabeblack@google.com{
67112982Sgabeblack@google.com    return ::sc_gem5::kernel->endOfSimulationComplete();
67212837Sgabeblack@google.com}
67312837Sgabeblack@google.com
67412901Sgabeblack@google.comsc_module *
67512901Sgabeblack@google.comsc_module_sc_new(sc_module *mod)
67612901Sgabeblack@google.com{
67712901Sgabeblack@google.com    static std::vector<std::unique_ptr<sc_module> > modules;
67812901Sgabeblack@google.com    modules.emplace_back(mod);
67912901Sgabeblack@google.com    return mod;
68012901Sgabeblack@google.com}
68112901Sgabeblack@google.com
68212837Sgabeblack@google.com} // namespace sc_core
683