sc_module.cc revision 12982
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{
4612952Sgabeblack@google.com    return new Method(name, func);
4712952Sgabeblack@google.com}
4812952Sgabeblack@google.com
4912952Sgabeblack@google.comProcess *
5012952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func)
5112952Sgabeblack@google.com{
5212952Sgabeblack@google.com    return new Thread(name, func);
5312952Sgabeblack@google.com}
5412952Sgabeblack@google.com
5512952Sgabeblack@google.comProcess *
5612952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func)
5712952Sgabeblack@google.com{
5812952Sgabeblack@google.com    return new CThread(name, func);
5912952Sgabeblack@google.com}
6012952Sgabeblack@google.com
6112952Sgabeblack@google.com} // namespace sc_gem5
6212952Sgabeblack@google.com
6312837Sgabeblack@google.comnamespace sc_core
6412837Sgabeblack@google.com{
6512837Sgabeblack@google.com
6612951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
6712951Sgabeblack@google.com    _interface(&_interface), _port(nullptr)
6812951Sgabeblack@google.com{}
6912837Sgabeblack@google.com
7012951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
7112951Sgabeblack@google.com    _interface(nullptr), _port(&_port)
7212951Sgabeblack@google.com{}
7312837Sgabeblack@google.com
7412837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
7512837Sgabeblack@google.com
7612982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; }
7712837Sgabeblack@google.com
7812837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
7912837Sgabeblack@google.com
8012837Sgabeblack@google.comvoid
8112837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001,
8212837Sgabeblack@google.com                        const sc_bind_proxy &p002,
8312837Sgabeblack@google.com                        const sc_bind_proxy &p003,
8412837Sgabeblack@google.com                        const sc_bind_proxy &p004,
8512837Sgabeblack@google.com                        const sc_bind_proxy &p005,
8612837Sgabeblack@google.com                        const sc_bind_proxy &p006,
8712837Sgabeblack@google.com                        const sc_bind_proxy &p007,
8812837Sgabeblack@google.com                        const sc_bind_proxy &p008,
8912837Sgabeblack@google.com                        const sc_bind_proxy &p009,
9012837Sgabeblack@google.com                        const sc_bind_proxy &p010,
9112837Sgabeblack@google.com                        const sc_bind_proxy &p011,
9212837Sgabeblack@google.com                        const sc_bind_proxy &p012,
9312837Sgabeblack@google.com                        const sc_bind_proxy &p013,
9412837Sgabeblack@google.com                        const sc_bind_proxy &p014,
9512837Sgabeblack@google.com                        const sc_bind_proxy &p015,
9612837Sgabeblack@google.com                        const sc_bind_proxy &p016,
9712837Sgabeblack@google.com                        const sc_bind_proxy &p017,
9812837Sgabeblack@google.com                        const sc_bind_proxy &p018,
9912837Sgabeblack@google.com                        const sc_bind_proxy &p019,
10012837Sgabeblack@google.com                        const sc_bind_proxy &p020,
10112837Sgabeblack@google.com                        const sc_bind_proxy &p021,
10212837Sgabeblack@google.com                        const sc_bind_proxy &p022,
10312837Sgabeblack@google.com                        const sc_bind_proxy &p023,
10412837Sgabeblack@google.com                        const sc_bind_proxy &p024,
10512837Sgabeblack@google.com                        const sc_bind_proxy &p025,
10612837Sgabeblack@google.com                        const sc_bind_proxy &p026,
10712837Sgabeblack@google.com                        const sc_bind_proxy &p027,
10812837Sgabeblack@google.com                        const sc_bind_proxy &p028,
10912837Sgabeblack@google.com                        const sc_bind_proxy &p029,
11012837Sgabeblack@google.com                        const sc_bind_proxy &p030,
11112837Sgabeblack@google.com                        const sc_bind_proxy &p031,
11212837Sgabeblack@google.com                        const sc_bind_proxy &p032,
11312837Sgabeblack@google.com                        const sc_bind_proxy &p033,
11412837Sgabeblack@google.com                        const sc_bind_proxy &p034,
11512837Sgabeblack@google.com                        const sc_bind_proxy &p035,
11612837Sgabeblack@google.com                        const sc_bind_proxy &p036,
11712837Sgabeblack@google.com                        const sc_bind_proxy &p037,
11812837Sgabeblack@google.com                        const sc_bind_proxy &p038,
11912837Sgabeblack@google.com                        const sc_bind_proxy &p039,
12012837Sgabeblack@google.com                        const sc_bind_proxy &p040,
12112837Sgabeblack@google.com                        const sc_bind_proxy &p041,
12212837Sgabeblack@google.com                        const sc_bind_proxy &p042,
12312837Sgabeblack@google.com                        const sc_bind_proxy &p043,
12412837Sgabeblack@google.com                        const sc_bind_proxy &p044,
12512837Sgabeblack@google.com                        const sc_bind_proxy &p045,
12612837Sgabeblack@google.com                        const sc_bind_proxy &p046,
12712837Sgabeblack@google.com                        const sc_bind_proxy &p047,
12812837Sgabeblack@google.com                        const sc_bind_proxy &p048,
12912837Sgabeblack@google.com                        const sc_bind_proxy &p049,
13012837Sgabeblack@google.com                        const sc_bind_proxy &p050,
13112837Sgabeblack@google.com                        const sc_bind_proxy &p051,
13212837Sgabeblack@google.com                        const sc_bind_proxy &p052,
13312837Sgabeblack@google.com                        const sc_bind_proxy &p053,
13412837Sgabeblack@google.com                        const sc_bind_proxy &p054,
13512837Sgabeblack@google.com                        const sc_bind_proxy &p055,
13612837Sgabeblack@google.com                        const sc_bind_proxy &p056,
13712837Sgabeblack@google.com                        const sc_bind_proxy &p057,
13812837Sgabeblack@google.com                        const sc_bind_proxy &p058,
13912837Sgabeblack@google.com                        const sc_bind_proxy &p059,
14012837Sgabeblack@google.com                        const sc_bind_proxy &p060,
14112837Sgabeblack@google.com                        const sc_bind_proxy &p061,
14212837Sgabeblack@google.com                        const sc_bind_proxy &p062,
14312837Sgabeblack@google.com                        const sc_bind_proxy &p063,
14412837Sgabeblack@google.com                        const sc_bind_proxy &p064)
14512837Sgabeblack@google.com{
14612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
14712837Sgabeblack@google.com}
14812837Sgabeblack@google.com
14912837Sgabeblack@google.comconst std::vector<sc_object *> &
15012837Sgabeblack@google.comsc_module::get_child_objects() const
15112837Sgabeblack@google.com{
15212951Sgabeblack@google.com    return _gem5_module->obj()->get_child_objects();
15312837Sgabeblack@google.com}
15412837Sgabeblack@google.com
15512837Sgabeblack@google.comconst std::vector<sc_event *> &
15612837Sgabeblack@google.comsc_module::get_child_events() const
15712837Sgabeblack@google.com{
15812951Sgabeblack@google.com    return _gem5_module->obj()->get_child_events();
15912837Sgabeblack@google.com}
16012837Sgabeblack@google.com
16112951Sgabeblack@google.comsc_module::sc_module() :
16212952Sgabeblack@google.com    sc_object(sc_gem5::newModule()->name()),
16312951Sgabeblack@google.com    _gem5_module(sc_gem5::currentModule())
16412951Sgabeblack@google.com{}
16512837Sgabeblack@google.com
16612951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {}
16712951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
16812951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) :
16912951Sgabeblack@google.com    sc_module(sc_module_name(_name.c_str()))
17012951Sgabeblack@google.com{}
17112928Sgabeblack@google.com
17212837Sgabeblack@google.comvoid
17312837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool)
17412837Sgabeblack@google.com{
17512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
17612837Sgabeblack@google.com}
17712837Sgabeblack@google.com
17812837Sgabeblack@google.comvoid
17912837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool)
18012837Sgabeblack@google.com{
18112837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18212837Sgabeblack@google.com}
18312837Sgabeblack@google.com
18412837Sgabeblack@google.comvoid
18512837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool)
18612837Sgabeblack@google.com{
18712837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18812837Sgabeblack@google.com}
18912837Sgabeblack@google.com
19012837Sgabeblack@google.comvoid
19112837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
19212837Sgabeblack@google.com{
19312837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19412837Sgabeblack@google.com}
19512837Sgabeblack@google.com
19612837Sgabeblack@google.com
19712837Sgabeblack@google.comvoid
19812837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool)
19912837Sgabeblack@google.com{
20012837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20112837Sgabeblack@google.com}
20212837Sgabeblack@google.com
20312837Sgabeblack@google.comvoid
20412837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
20512837Sgabeblack@google.com{
20612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20712837Sgabeblack@google.com}
20812837Sgabeblack@google.com
20912837Sgabeblack@google.comvoid
21012837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool)
21112837Sgabeblack@google.com{
21212837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21312837Sgabeblack@google.com}
21412837Sgabeblack@google.com
21512837Sgabeblack@google.comvoid
21612837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
21712837Sgabeblack@google.com{
21812837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21912837Sgabeblack@google.com}
22012837Sgabeblack@google.com
22112837Sgabeblack@google.com
22212837Sgabeblack@google.comvoid
22312837Sgabeblack@google.comsc_module::dont_initialize()
22412837Sgabeblack@google.com{
22512953Sgabeblack@google.com    ::sc_gem5::Process::newest()->dontInitialize();
22612837Sgabeblack@google.com}
22712837Sgabeblack@google.com
22812837Sgabeblack@google.comvoid
22912953Sgabeblack@google.comsc_module::set_stack_size(size_t size)
23012837Sgabeblack@google.com{
23112953Sgabeblack@google.com    ::sc_gem5::Process::newest()->setStackSize(size);
23212837Sgabeblack@google.com}
23312837Sgabeblack@google.com
23412837Sgabeblack@google.com
23512951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
23612951Sgabeblack@google.com
23712837Sgabeblack@google.comvoid
23812951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e)
23912837Sgabeblack@google.com{
24012951Sgabeblack@google.com    ::sc_core::next_trigger(e);
24112837Sgabeblack@google.com}
24212837Sgabeblack@google.com
24312837Sgabeblack@google.comvoid
24412951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol)
24512837Sgabeblack@google.com{
24612951Sgabeblack@google.com    ::sc_core::next_trigger(eol);
24712837Sgabeblack@google.com}
24812837Sgabeblack@google.com
24912837Sgabeblack@google.comvoid
25012951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal)
25112837Sgabeblack@google.com{
25212951Sgabeblack@google.com    ::sc_core::next_trigger(eal);
25312837Sgabeblack@google.com}
25412837Sgabeblack@google.com
25512837Sgabeblack@google.comvoid
25612951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t)
25712837Sgabeblack@google.com{
25812951Sgabeblack@google.com    ::sc_core::next_trigger(t);
25912837Sgabeblack@google.com}
26012837Sgabeblack@google.com
26112837Sgabeblack@google.comvoid
26212951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u)
26312837Sgabeblack@google.com{
26412951Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
26512837Sgabeblack@google.com}
26612837Sgabeblack@google.com
26712837Sgabeblack@google.comvoid
26812951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e)
26912837Sgabeblack@google.com{
27012951Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
27112837Sgabeblack@google.com}
27212837Sgabeblack@google.com
27312837Sgabeblack@google.comvoid
27412951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
27512837Sgabeblack@google.com{
27612951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
27712837Sgabeblack@google.com}
27812837Sgabeblack@google.com
27912837Sgabeblack@google.comvoid
28012951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
28112837Sgabeblack@google.com{
28212951Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
28312837Sgabeblack@google.com}
28412837Sgabeblack@google.com
28512837Sgabeblack@google.comvoid
28612951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
28712837Sgabeblack@google.com{
28812951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
28912837Sgabeblack@google.com}
29012837Sgabeblack@google.com
29112837Sgabeblack@google.comvoid
29212951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
29312837Sgabeblack@google.com{
29412951Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
29512837Sgabeblack@google.com}
29612837Sgabeblack@google.com
29712837Sgabeblack@google.comvoid
29812951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
29912837Sgabeblack@google.com{
30012951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
30112837Sgabeblack@google.com}
30212837Sgabeblack@google.com
30312837Sgabeblack@google.com
30412929Sgabeblack@google.combool
30512929Sgabeblack@google.comsc_module::timed_out()
30612929Sgabeblack@google.com{
30712929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
30812929Sgabeblack@google.com    return false;
30912929Sgabeblack@google.com}
31012929Sgabeblack@google.com
31112929Sgabeblack@google.com
31212837Sgabeblack@google.comvoid
31312837Sgabeblack@google.comsc_module::wait()
31412837Sgabeblack@google.com{
31512951Sgabeblack@google.com    ::sc_core::wait();
31612837Sgabeblack@google.com}
31712837Sgabeblack@google.com
31812837Sgabeblack@google.comvoid
31912951Sgabeblack@google.comsc_module::wait(int i)
32012837Sgabeblack@google.com{
32112951Sgabeblack@google.com    ::sc_core::wait(i);
32212837Sgabeblack@google.com}
32312837Sgabeblack@google.com
32412837Sgabeblack@google.comvoid
32512951Sgabeblack@google.comsc_module::wait(const sc_event &e)
32612837Sgabeblack@google.com{
32712951Sgabeblack@google.com    ::sc_core::wait(e);
32812837Sgabeblack@google.com}
32912837Sgabeblack@google.com
33012837Sgabeblack@google.comvoid
33112951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol)
33212837Sgabeblack@google.com{
33312951Sgabeblack@google.com    ::sc_core::wait(eol);
33412837Sgabeblack@google.com}
33512837Sgabeblack@google.com
33612837Sgabeblack@google.comvoid
33712951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal)
33812837Sgabeblack@google.com{
33912951Sgabeblack@google.com    ::sc_core::wait(eal);
34012837Sgabeblack@google.com}
34112837Sgabeblack@google.com
34212837Sgabeblack@google.comvoid
34312951Sgabeblack@google.comsc_module::wait(const sc_time &t)
34412837Sgabeblack@google.com{
34512951Sgabeblack@google.com    ::sc_core::wait(t);
34612837Sgabeblack@google.com}
34712837Sgabeblack@google.com
34812837Sgabeblack@google.comvoid
34912951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u)
35012837Sgabeblack@google.com{
35112951Sgabeblack@google.com    ::sc_core::wait(d, u);
35212837Sgabeblack@google.com}
35312837Sgabeblack@google.com
35412837Sgabeblack@google.comvoid
35512951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e)
35612837Sgabeblack@google.com{
35712951Sgabeblack@google.com    ::sc_core::wait(t, e);
35812837Sgabeblack@google.com}
35912837Sgabeblack@google.com
36012837Sgabeblack@google.comvoid
36112951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e)
36212837Sgabeblack@google.com{
36312951Sgabeblack@google.com    ::sc_core::wait(d, u, e);
36412837Sgabeblack@google.com}
36512837Sgabeblack@google.com
36612837Sgabeblack@google.comvoid
36712951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol)
36812837Sgabeblack@google.com{
36912951Sgabeblack@google.com    ::sc_core::wait(t, eol);
37012837Sgabeblack@google.com}
37112837Sgabeblack@google.com
37212837Sgabeblack@google.comvoid
37312951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
37412837Sgabeblack@google.com{
37512951Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
37612837Sgabeblack@google.com}
37712837Sgabeblack@google.com
37812837Sgabeblack@google.comvoid
37912951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal)
38012837Sgabeblack@google.com{
38112951Sgabeblack@google.com    ::sc_core::wait(t, eal);
38212837Sgabeblack@google.com}
38312837Sgabeblack@google.com
38412837Sgabeblack@google.comvoid
38512951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
38612837Sgabeblack@google.com{
38712951Sgabeblack@google.com    ::sc_core::wait(d, u, eal);
38812837Sgabeblack@google.com}
38912837Sgabeblack@google.com
39012837Sgabeblack@google.com
39112837Sgabeblack@google.comvoid
39212909Sgabeblack@google.comsc_module::halt()
39312909Sgabeblack@google.com{
39412951Sgabeblack@google.com    ::sc_core::halt();
39512909Sgabeblack@google.com}
39612909Sgabeblack@google.com
39712914Sgabeblack@google.comvoid
39812951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s)
39912914Sgabeblack@google.com{
40012951Sgabeblack@google.com    ::sc_core::at_posedge(s);
40112914Sgabeblack@google.com}
40212914Sgabeblack@google.com
40312914Sgabeblack@google.comvoid
40412951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
40512914Sgabeblack@google.com{
40612951Sgabeblack@google.com    ::sc_core::at_posedge(s);
40712914Sgabeblack@google.com}
40812914Sgabeblack@google.com
40912914Sgabeblack@google.comvoid
41012951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s)
41112914Sgabeblack@google.com{
41212951Sgabeblack@google.com    ::sc_core::at_negedge(s);
41312914Sgabeblack@google.com}
41412914Sgabeblack@google.com
41512914Sgabeblack@google.comvoid
41612951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
41712914Sgabeblack@google.com{
41812951Sgabeblack@google.com    ::sc_core::at_negedge(s);
41912914Sgabeblack@google.com}
42012914Sgabeblack@google.com
42112909Sgabeblack@google.com
42212909Sgabeblack@google.comvoid
42312837Sgabeblack@google.comnext_trigger()
42412837Sgabeblack@google.com{
42512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
42612958Sgabeblack@google.com    p->setDynamic(nullptr);
42712837Sgabeblack@google.com}
42812837Sgabeblack@google.com
42912837Sgabeblack@google.comvoid
43012958Sgabeblack@google.comnext_trigger(const sc_event &e)
43112837Sgabeblack@google.com{
43212958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
43312958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
43412837Sgabeblack@google.com}
43512837Sgabeblack@google.com
43612837Sgabeblack@google.comvoid
43712958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol)
43812837Sgabeblack@google.com{
43912958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44012958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
44112837Sgabeblack@google.com}
44212837Sgabeblack@google.com
44312837Sgabeblack@google.comvoid
44412958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal)
44512837Sgabeblack@google.com{
44612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44712958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
44812837Sgabeblack@google.com}
44912837Sgabeblack@google.com
45012837Sgabeblack@google.comvoid
45112958Sgabeblack@google.comnext_trigger(const sc_time &t)
45212837Sgabeblack@google.com{
45312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
45412958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
45512837Sgabeblack@google.com}
45612837Sgabeblack@google.com
45712837Sgabeblack@google.comvoid
45812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u)
45912837Sgabeblack@google.com{
46012951Sgabeblack@google.com    next_trigger(sc_time(d, u));
46112837Sgabeblack@google.com}
46212837Sgabeblack@google.com
46312837Sgabeblack@google.comvoid
46412958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e)
46512837Sgabeblack@google.com{
46612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
46712958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
46812837Sgabeblack@google.com}
46912837Sgabeblack@google.com
47012837Sgabeblack@google.comvoid
47112951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e)
47212837Sgabeblack@google.com{
47312951Sgabeblack@google.com    next_trigger(sc_time(d, u), e);
47412837Sgabeblack@google.com}
47512837Sgabeblack@google.com
47612837Sgabeblack@google.comvoid
47712958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol)
47812837Sgabeblack@google.com{
47912958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
48012958Sgabeblack@google.com    p->setDynamic(
48112958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
48212837Sgabeblack@google.com}
48312837Sgabeblack@google.com
48412837Sgabeblack@google.comvoid
48512951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
48612837Sgabeblack@google.com{
48712951Sgabeblack@google.com    next_trigger(sc_time(d, u), eol);
48812837Sgabeblack@google.com}
48912837Sgabeblack@google.com
49012837Sgabeblack@google.comvoid
49112958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal)
49212837Sgabeblack@google.com{
49312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
49412958Sgabeblack@google.com    p->setDynamic(
49512958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
49612837Sgabeblack@google.com}
49712837Sgabeblack@google.com
49812837Sgabeblack@google.comvoid
49912951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
50012837Sgabeblack@google.com{
50112951Sgabeblack@google.com    next_trigger(sc_time(d, u), eal);
50212837Sgabeblack@google.com}
50312837Sgabeblack@google.com
50412929Sgabeblack@google.combool
50512929Sgabeblack@google.comtimed_out()
50612929Sgabeblack@google.com{
50712929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
50812929Sgabeblack@google.com    return false;
50912929Sgabeblack@google.com}
51012929Sgabeblack@google.com
51112837Sgabeblack@google.com
51212837Sgabeblack@google.comvoid
51312837Sgabeblack@google.comwait()
51412837Sgabeblack@google.com{
51512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
51612958Sgabeblack@google.com    p->setDynamic(nullptr);
51712958Sgabeblack@google.com    sc_gem5::scheduler.yield();
51812837Sgabeblack@google.com}
51912837Sgabeblack@google.com
52012837Sgabeblack@google.comvoid
52112958Sgabeblack@google.comwait(int n)
52212837Sgabeblack@google.com{
52312958Sgabeblack@google.com    for (int i = 0; i < n; i++)
52412958Sgabeblack@google.com        wait();
52512837Sgabeblack@google.com}
52612837Sgabeblack@google.com
52712837Sgabeblack@google.comvoid
52812958Sgabeblack@google.comwait(const sc_event &e)
52912837Sgabeblack@google.com{
53012958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53112958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
53212958Sgabeblack@google.com    sc_gem5::scheduler.yield();
53312837Sgabeblack@google.com}
53412837Sgabeblack@google.com
53512837Sgabeblack@google.comvoid
53612958Sgabeblack@google.comwait(const sc_event_or_list &eol)
53712837Sgabeblack@google.com{
53812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53912958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
54012958Sgabeblack@google.com    sc_gem5::scheduler.yield();
54112837Sgabeblack@google.com}
54212837Sgabeblack@google.com
54312837Sgabeblack@google.comvoid
54412958Sgabeblack@google.comwait(const sc_event_and_list &eal)
54512837Sgabeblack@google.com{
54612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54712958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
54812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
54912837Sgabeblack@google.com}
55012837Sgabeblack@google.com
55112837Sgabeblack@google.comvoid
55212958Sgabeblack@google.comwait(const sc_time &t)
55312837Sgabeblack@google.com{
55412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
55512958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
55612958Sgabeblack@google.com    sc_gem5::scheduler.yield();
55712837Sgabeblack@google.com}
55812837Sgabeblack@google.com
55912837Sgabeblack@google.comvoid
56012951Sgabeblack@google.comwait(double d, sc_time_unit u)
56112837Sgabeblack@google.com{
56212951Sgabeblack@google.com    wait(sc_time(d, u));
56312837Sgabeblack@google.com}
56412837Sgabeblack@google.com
56512837Sgabeblack@google.comvoid
56612958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e)
56712837Sgabeblack@google.com{
56812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
56912958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
57012958Sgabeblack@google.com    sc_gem5::scheduler.yield();
57112837Sgabeblack@google.com}
57212837Sgabeblack@google.com
57312837Sgabeblack@google.comvoid
57412951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e)
57512837Sgabeblack@google.com{
57612951Sgabeblack@google.com    wait(sc_time(d, u), e);
57712837Sgabeblack@google.com}
57812837Sgabeblack@google.com
57912837Sgabeblack@google.comvoid
58012958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol)
58112837Sgabeblack@google.com{
58212958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
58312958Sgabeblack@google.com    p->setDynamic(
58412958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
58512958Sgabeblack@google.com    sc_gem5::scheduler.yield();
58612837Sgabeblack@google.com}
58712837Sgabeblack@google.com
58812837Sgabeblack@google.comvoid
58912951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol)
59012837Sgabeblack@google.com{
59112951Sgabeblack@google.com    wait(sc_time(d, u), eol);
59212837Sgabeblack@google.com}
59312837Sgabeblack@google.com
59412837Sgabeblack@google.comvoid
59512958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal)
59612837Sgabeblack@google.com{
59712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
59812958Sgabeblack@google.com    p->setDynamic(
59912958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
60012958Sgabeblack@google.com    sc_gem5::scheduler.yield();
60112837Sgabeblack@google.com}
60212837Sgabeblack@google.com
60312837Sgabeblack@google.comvoid
60412951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal)
60512837Sgabeblack@google.com{
60612951Sgabeblack@google.com    wait(sc_time(d, u), eal);
60712837Sgabeblack@google.com}
60812837Sgabeblack@google.com
60912909Sgabeblack@google.comvoid
61012909Sgabeblack@google.comhalt()
61112909Sgabeblack@google.com{
61212909Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
61312909Sgabeblack@google.com}
61412909Sgabeblack@google.com
61512914Sgabeblack@google.comvoid
61612914Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &)
61712914Sgabeblack@google.com{
61812914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
61912914Sgabeblack@google.com}
62012914Sgabeblack@google.com
62112914Sgabeblack@google.comvoid
62212914Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
62312914Sgabeblack@google.com{
62412914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62512914Sgabeblack@google.com}
62612914Sgabeblack@google.com
62712914Sgabeblack@google.comvoid
62812914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &)
62912914Sgabeblack@google.com{
63012914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63112914Sgabeblack@google.com}
63212914Sgabeblack@google.com
63312914Sgabeblack@google.comvoid
63412914Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
63512914Sgabeblack@google.com{
63612914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63712914Sgabeblack@google.com}
63812914Sgabeblack@google.com
63912837Sgabeblack@google.comconst char *
64012837Sgabeblack@google.comsc_gen_unique_name(const char *)
64112837Sgabeblack@google.com{
64212837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64312837Sgabeblack@google.com    return "";
64412837Sgabeblack@google.com}
64512837Sgabeblack@google.com
64612837Sgabeblack@google.combool
64712930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name)
64812930Sgabeblack@google.com{
64912930Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
65012930Sgabeblack@google.com    return false;
65112930Sgabeblack@google.com}
65212930Sgabeblack@google.com
65312930Sgabeblack@google.combool
65412837Sgabeblack@google.comsc_start_of_simulation_invoked()
65512837Sgabeblack@google.com{
65612982Sgabeblack@google.com    return ::sc_gem5::kernel->startOfSimulationComplete();
65712837Sgabeblack@google.com}
65812837Sgabeblack@google.com
65912837Sgabeblack@google.combool
66012837Sgabeblack@google.comsc_end_of_simulation_invoked()
66112837Sgabeblack@google.com{
66212982Sgabeblack@google.com    return ::sc_gem5::kernel->endOfSimulationComplete();
66312837Sgabeblack@google.com}
66412837Sgabeblack@google.com
66512901Sgabeblack@google.comsc_module *
66612901Sgabeblack@google.comsc_module_sc_new(sc_module *mod)
66712901Sgabeblack@google.com{
66812901Sgabeblack@google.com    static std::vector<std::unique_ptr<sc_module> > modules;
66912901Sgabeblack@google.com    modules.emplace_back(mod);
67012901Sgabeblack@google.com    return mod;
67112901Sgabeblack@google.com}
67212901Sgabeblack@google.com
67312837Sgabeblack@google.com} // namespace sc_core
674