sc_module.cc revision 13060
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);
6413060Sgabeblack@google.com    p->dontInitialize();
6512993Sgabeblack@google.com    return p;
6612952Sgabeblack@google.com}
6712952Sgabeblack@google.com
6813035Sgabeblack@google.comUniqueNameGen nameGen;
6913035Sgabeblack@google.com
7012952Sgabeblack@google.com} // namespace sc_gem5
7112952Sgabeblack@google.com
7212837Sgabeblack@google.comnamespace sc_core
7312837Sgabeblack@google.com{
7412837Sgabeblack@google.com
7512951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
7612951Sgabeblack@google.com    _interface(&_interface), _port(nullptr)
7712951Sgabeblack@google.com{}
7812837Sgabeblack@google.com
7912951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
8012951Sgabeblack@google.com    _interface(nullptr), _port(&_port)
8112951Sgabeblack@google.com{}
8212837Sgabeblack@google.com
8312837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
8412837Sgabeblack@google.com
8512982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; }
8612837Sgabeblack@google.com
8712837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
8812837Sgabeblack@google.com
8912837Sgabeblack@google.comvoid
9012837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001,
9112837Sgabeblack@google.com                        const sc_bind_proxy &p002,
9212837Sgabeblack@google.com                        const sc_bind_proxy &p003,
9312837Sgabeblack@google.com                        const sc_bind_proxy &p004,
9412837Sgabeblack@google.com                        const sc_bind_proxy &p005,
9512837Sgabeblack@google.com                        const sc_bind_proxy &p006,
9612837Sgabeblack@google.com                        const sc_bind_proxy &p007,
9712837Sgabeblack@google.com                        const sc_bind_proxy &p008,
9812837Sgabeblack@google.com                        const sc_bind_proxy &p009,
9912837Sgabeblack@google.com                        const sc_bind_proxy &p010,
10012837Sgabeblack@google.com                        const sc_bind_proxy &p011,
10112837Sgabeblack@google.com                        const sc_bind_proxy &p012,
10212837Sgabeblack@google.com                        const sc_bind_proxy &p013,
10312837Sgabeblack@google.com                        const sc_bind_proxy &p014,
10412837Sgabeblack@google.com                        const sc_bind_proxy &p015,
10512837Sgabeblack@google.com                        const sc_bind_proxy &p016,
10612837Sgabeblack@google.com                        const sc_bind_proxy &p017,
10712837Sgabeblack@google.com                        const sc_bind_proxy &p018,
10812837Sgabeblack@google.com                        const sc_bind_proxy &p019,
10912837Sgabeblack@google.com                        const sc_bind_proxy &p020,
11012837Sgabeblack@google.com                        const sc_bind_proxy &p021,
11112837Sgabeblack@google.com                        const sc_bind_proxy &p022,
11212837Sgabeblack@google.com                        const sc_bind_proxy &p023,
11312837Sgabeblack@google.com                        const sc_bind_proxy &p024,
11412837Sgabeblack@google.com                        const sc_bind_proxy &p025,
11512837Sgabeblack@google.com                        const sc_bind_proxy &p026,
11612837Sgabeblack@google.com                        const sc_bind_proxy &p027,
11712837Sgabeblack@google.com                        const sc_bind_proxy &p028,
11812837Sgabeblack@google.com                        const sc_bind_proxy &p029,
11912837Sgabeblack@google.com                        const sc_bind_proxy &p030,
12012837Sgabeblack@google.com                        const sc_bind_proxy &p031,
12112837Sgabeblack@google.com                        const sc_bind_proxy &p032,
12212837Sgabeblack@google.com                        const sc_bind_proxy &p033,
12312837Sgabeblack@google.com                        const sc_bind_proxy &p034,
12412837Sgabeblack@google.com                        const sc_bind_proxy &p035,
12512837Sgabeblack@google.com                        const sc_bind_proxy &p036,
12612837Sgabeblack@google.com                        const sc_bind_proxy &p037,
12712837Sgabeblack@google.com                        const sc_bind_proxy &p038,
12812837Sgabeblack@google.com                        const sc_bind_proxy &p039,
12912837Sgabeblack@google.com                        const sc_bind_proxy &p040,
13012837Sgabeblack@google.com                        const sc_bind_proxy &p041,
13112837Sgabeblack@google.com                        const sc_bind_proxy &p042,
13212837Sgabeblack@google.com                        const sc_bind_proxy &p043,
13312837Sgabeblack@google.com                        const sc_bind_proxy &p044,
13412837Sgabeblack@google.com                        const sc_bind_proxy &p045,
13512837Sgabeblack@google.com                        const sc_bind_proxy &p046,
13612837Sgabeblack@google.com                        const sc_bind_proxy &p047,
13712837Sgabeblack@google.com                        const sc_bind_proxy &p048,
13812837Sgabeblack@google.com                        const sc_bind_proxy &p049,
13912837Sgabeblack@google.com                        const sc_bind_proxy &p050,
14012837Sgabeblack@google.com                        const sc_bind_proxy &p051,
14112837Sgabeblack@google.com                        const sc_bind_proxy &p052,
14212837Sgabeblack@google.com                        const sc_bind_proxy &p053,
14312837Sgabeblack@google.com                        const sc_bind_proxy &p054,
14412837Sgabeblack@google.com                        const sc_bind_proxy &p055,
14512837Sgabeblack@google.com                        const sc_bind_proxy &p056,
14612837Sgabeblack@google.com                        const sc_bind_proxy &p057,
14712837Sgabeblack@google.com                        const sc_bind_proxy &p058,
14812837Sgabeblack@google.com                        const sc_bind_proxy &p059,
14912837Sgabeblack@google.com                        const sc_bind_proxy &p060,
15012837Sgabeblack@google.com                        const sc_bind_proxy &p061,
15112837Sgabeblack@google.com                        const sc_bind_proxy &p062,
15212837Sgabeblack@google.com                        const sc_bind_proxy &p063,
15312837Sgabeblack@google.com                        const sc_bind_proxy &p064)
15412837Sgabeblack@google.com{
15512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
15612837Sgabeblack@google.com}
15712837Sgabeblack@google.com
15812837Sgabeblack@google.comconst std::vector<sc_object *> &
15912837Sgabeblack@google.comsc_module::get_child_objects() const
16012837Sgabeblack@google.com{
16112951Sgabeblack@google.com    return _gem5_module->obj()->get_child_objects();
16212837Sgabeblack@google.com}
16312837Sgabeblack@google.com
16412837Sgabeblack@google.comconst std::vector<sc_event *> &
16512837Sgabeblack@google.comsc_module::get_child_events() const
16612837Sgabeblack@google.com{
16712951Sgabeblack@google.com    return _gem5_module->obj()->get_child_events();
16812837Sgabeblack@google.com}
16912837Sgabeblack@google.com
17012951Sgabeblack@google.comsc_module::sc_module() :
17112952Sgabeblack@google.com    sc_object(sc_gem5::newModule()->name()),
17212951Sgabeblack@google.com    _gem5_module(sc_gem5::currentModule())
17312951Sgabeblack@google.com{}
17412837Sgabeblack@google.com
17512951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {}
17612951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
17712951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) :
17812951Sgabeblack@google.com    sc_module(sc_module_name(_name.c_str()))
17912951Sgabeblack@google.com{}
18012928Sgabeblack@google.com
18112837Sgabeblack@google.comvoid
18212837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool)
18312837Sgabeblack@google.com{
18412837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18512837Sgabeblack@google.com}
18612837Sgabeblack@google.com
18712837Sgabeblack@google.comvoid
18812837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool)
18912837Sgabeblack@google.com{
19012837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19112837Sgabeblack@google.com}
19212837Sgabeblack@google.com
19312837Sgabeblack@google.comvoid
19412837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool)
19512837Sgabeblack@google.com{
19612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19712837Sgabeblack@google.com}
19812837Sgabeblack@google.com
19912837Sgabeblack@google.comvoid
20012837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
20112837Sgabeblack@google.com{
20212837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20312837Sgabeblack@google.com}
20412837Sgabeblack@google.com
20512837Sgabeblack@google.com
20612837Sgabeblack@google.comvoid
20712837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool)
20812837Sgabeblack@google.com{
20912837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21012837Sgabeblack@google.com}
21112837Sgabeblack@google.com
21212837Sgabeblack@google.comvoid
21312837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
21412837Sgabeblack@google.com{
21512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21612837Sgabeblack@google.com}
21712837Sgabeblack@google.com
21812837Sgabeblack@google.comvoid
21912837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool)
22012837Sgabeblack@google.com{
22112837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
22212837Sgabeblack@google.com}
22312837Sgabeblack@google.com
22412837Sgabeblack@google.comvoid
22512837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
22612837Sgabeblack@google.com{
22712837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
22812837Sgabeblack@google.com}
22912837Sgabeblack@google.com
23012837Sgabeblack@google.com
23112837Sgabeblack@google.comvoid
23212837Sgabeblack@google.comsc_module::dont_initialize()
23312837Sgabeblack@google.com{
23412953Sgabeblack@google.com    ::sc_gem5::Process::newest()->dontInitialize();
23512837Sgabeblack@google.com}
23612837Sgabeblack@google.com
23712837Sgabeblack@google.comvoid
23812953Sgabeblack@google.comsc_module::set_stack_size(size_t size)
23912837Sgabeblack@google.com{
24012953Sgabeblack@google.com    ::sc_gem5::Process::newest()->setStackSize(size);
24112837Sgabeblack@google.com}
24212837Sgabeblack@google.com
24312837Sgabeblack@google.com
24412951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
24512951Sgabeblack@google.com
24612837Sgabeblack@google.comvoid
24712951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e)
24812837Sgabeblack@google.com{
24912951Sgabeblack@google.com    ::sc_core::next_trigger(e);
25012837Sgabeblack@google.com}
25112837Sgabeblack@google.com
25212837Sgabeblack@google.comvoid
25312951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol)
25412837Sgabeblack@google.com{
25512951Sgabeblack@google.com    ::sc_core::next_trigger(eol);
25612837Sgabeblack@google.com}
25712837Sgabeblack@google.com
25812837Sgabeblack@google.comvoid
25912951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal)
26012837Sgabeblack@google.com{
26112951Sgabeblack@google.com    ::sc_core::next_trigger(eal);
26212837Sgabeblack@google.com}
26312837Sgabeblack@google.com
26412837Sgabeblack@google.comvoid
26512951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t)
26612837Sgabeblack@google.com{
26712951Sgabeblack@google.com    ::sc_core::next_trigger(t);
26812837Sgabeblack@google.com}
26912837Sgabeblack@google.com
27012837Sgabeblack@google.comvoid
27112951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u)
27212837Sgabeblack@google.com{
27312951Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
27412837Sgabeblack@google.com}
27512837Sgabeblack@google.com
27612837Sgabeblack@google.comvoid
27712951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e)
27812837Sgabeblack@google.com{
27912951Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
28012837Sgabeblack@google.com}
28112837Sgabeblack@google.com
28212837Sgabeblack@google.comvoid
28312951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
28412837Sgabeblack@google.com{
28512951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
28612837Sgabeblack@google.com}
28712837Sgabeblack@google.com
28812837Sgabeblack@google.comvoid
28912951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
29012837Sgabeblack@google.com{
29112951Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
29212837Sgabeblack@google.com}
29312837Sgabeblack@google.com
29412837Sgabeblack@google.comvoid
29512951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
29612837Sgabeblack@google.com{
29712951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
29812837Sgabeblack@google.com}
29912837Sgabeblack@google.com
30012837Sgabeblack@google.comvoid
30112951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
30212837Sgabeblack@google.com{
30312951Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
30412837Sgabeblack@google.com}
30512837Sgabeblack@google.com
30612837Sgabeblack@google.comvoid
30712951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
30812837Sgabeblack@google.com{
30912951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
31012837Sgabeblack@google.com}
31112837Sgabeblack@google.com
31212837Sgabeblack@google.com
31312929Sgabeblack@google.combool
31412929Sgabeblack@google.comsc_module::timed_out()
31512929Sgabeblack@google.com{
31612929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
31712929Sgabeblack@google.com    return false;
31812929Sgabeblack@google.com}
31912929Sgabeblack@google.com
32012929Sgabeblack@google.com
32112837Sgabeblack@google.comvoid
32212837Sgabeblack@google.comsc_module::wait()
32312837Sgabeblack@google.com{
32412951Sgabeblack@google.com    ::sc_core::wait();
32512837Sgabeblack@google.com}
32612837Sgabeblack@google.com
32712837Sgabeblack@google.comvoid
32812951Sgabeblack@google.comsc_module::wait(int i)
32912837Sgabeblack@google.com{
33012951Sgabeblack@google.com    ::sc_core::wait(i);
33112837Sgabeblack@google.com}
33212837Sgabeblack@google.com
33312837Sgabeblack@google.comvoid
33412951Sgabeblack@google.comsc_module::wait(const sc_event &e)
33512837Sgabeblack@google.com{
33612951Sgabeblack@google.com    ::sc_core::wait(e);
33712837Sgabeblack@google.com}
33812837Sgabeblack@google.com
33912837Sgabeblack@google.comvoid
34012951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol)
34112837Sgabeblack@google.com{
34212951Sgabeblack@google.com    ::sc_core::wait(eol);
34312837Sgabeblack@google.com}
34412837Sgabeblack@google.com
34512837Sgabeblack@google.comvoid
34612951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal)
34712837Sgabeblack@google.com{
34812951Sgabeblack@google.com    ::sc_core::wait(eal);
34912837Sgabeblack@google.com}
35012837Sgabeblack@google.com
35112837Sgabeblack@google.comvoid
35212951Sgabeblack@google.comsc_module::wait(const sc_time &t)
35312837Sgabeblack@google.com{
35412951Sgabeblack@google.com    ::sc_core::wait(t);
35512837Sgabeblack@google.com}
35612837Sgabeblack@google.com
35712837Sgabeblack@google.comvoid
35812951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u)
35912837Sgabeblack@google.com{
36012951Sgabeblack@google.com    ::sc_core::wait(d, u);
36112837Sgabeblack@google.com}
36212837Sgabeblack@google.com
36312837Sgabeblack@google.comvoid
36412951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e)
36512837Sgabeblack@google.com{
36612951Sgabeblack@google.com    ::sc_core::wait(t, e);
36712837Sgabeblack@google.com}
36812837Sgabeblack@google.com
36912837Sgabeblack@google.comvoid
37012951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e)
37112837Sgabeblack@google.com{
37212951Sgabeblack@google.com    ::sc_core::wait(d, u, e);
37312837Sgabeblack@google.com}
37412837Sgabeblack@google.com
37512837Sgabeblack@google.comvoid
37612951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol)
37712837Sgabeblack@google.com{
37812951Sgabeblack@google.com    ::sc_core::wait(t, eol);
37912837Sgabeblack@google.com}
38012837Sgabeblack@google.com
38112837Sgabeblack@google.comvoid
38212951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
38312837Sgabeblack@google.com{
38412951Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
38512837Sgabeblack@google.com}
38612837Sgabeblack@google.com
38712837Sgabeblack@google.comvoid
38812951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal)
38912837Sgabeblack@google.com{
39012951Sgabeblack@google.com    ::sc_core::wait(t, eal);
39112837Sgabeblack@google.com}
39212837Sgabeblack@google.com
39312837Sgabeblack@google.comvoid
39412951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
39512837Sgabeblack@google.com{
39612951Sgabeblack@google.com    ::sc_core::wait(d, u, eal);
39712837Sgabeblack@google.com}
39812837Sgabeblack@google.com
39912837Sgabeblack@google.com
40012837Sgabeblack@google.comvoid
40112909Sgabeblack@google.comsc_module::halt()
40212909Sgabeblack@google.com{
40312951Sgabeblack@google.com    ::sc_core::halt();
40412909Sgabeblack@google.com}
40512909Sgabeblack@google.com
40612914Sgabeblack@google.comvoid
40712951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s)
40812914Sgabeblack@google.com{
40912951Sgabeblack@google.com    ::sc_core::at_posedge(s);
41012914Sgabeblack@google.com}
41112914Sgabeblack@google.com
41212914Sgabeblack@google.comvoid
41312951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
41412914Sgabeblack@google.com{
41512951Sgabeblack@google.com    ::sc_core::at_posedge(s);
41612914Sgabeblack@google.com}
41712914Sgabeblack@google.com
41812914Sgabeblack@google.comvoid
41912951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s)
42012914Sgabeblack@google.com{
42112951Sgabeblack@google.com    ::sc_core::at_negedge(s);
42212914Sgabeblack@google.com}
42312914Sgabeblack@google.com
42412914Sgabeblack@google.comvoid
42512951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
42612914Sgabeblack@google.com{
42712951Sgabeblack@google.com    ::sc_core::at_negedge(s);
42812914Sgabeblack@google.com}
42912914Sgabeblack@google.com
43012909Sgabeblack@google.com
43112909Sgabeblack@google.comvoid
43212837Sgabeblack@google.comnext_trigger()
43312837Sgabeblack@google.com{
43412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
43512958Sgabeblack@google.com    p->setDynamic(nullptr);
43612837Sgabeblack@google.com}
43712837Sgabeblack@google.com
43812837Sgabeblack@google.comvoid
43912958Sgabeblack@google.comnext_trigger(const sc_event &e)
44012837Sgabeblack@google.com{
44112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44212958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
44312837Sgabeblack@google.com}
44412837Sgabeblack@google.com
44512837Sgabeblack@google.comvoid
44612958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol)
44712837Sgabeblack@google.com{
44812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44912958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
45012837Sgabeblack@google.com}
45112837Sgabeblack@google.com
45212837Sgabeblack@google.comvoid
45312958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal)
45412837Sgabeblack@google.com{
45512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
45612958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
45712837Sgabeblack@google.com}
45812837Sgabeblack@google.com
45912837Sgabeblack@google.comvoid
46012958Sgabeblack@google.comnext_trigger(const sc_time &t)
46112837Sgabeblack@google.com{
46212958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
46312958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
46412837Sgabeblack@google.com}
46512837Sgabeblack@google.com
46612837Sgabeblack@google.comvoid
46712951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u)
46812837Sgabeblack@google.com{
46912951Sgabeblack@google.com    next_trigger(sc_time(d, u));
47012837Sgabeblack@google.com}
47112837Sgabeblack@google.com
47212837Sgabeblack@google.comvoid
47312958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e)
47412837Sgabeblack@google.com{
47512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
47612958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
47712837Sgabeblack@google.com}
47812837Sgabeblack@google.com
47912837Sgabeblack@google.comvoid
48012951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e)
48112837Sgabeblack@google.com{
48212951Sgabeblack@google.com    next_trigger(sc_time(d, u), e);
48312837Sgabeblack@google.com}
48412837Sgabeblack@google.com
48512837Sgabeblack@google.comvoid
48612958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol)
48712837Sgabeblack@google.com{
48812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
48912958Sgabeblack@google.com    p->setDynamic(
49012958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
49112837Sgabeblack@google.com}
49212837Sgabeblack@google.com
49312837Sgabeblack@google.comvoid
49412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
49512837Sgabeblack@google.com{
49612951Sgabeblack@google.com    next_trigger(sc_time(d, u), eol);
49712837Sgabeblack@google.com}
49812837Sgabeblack@google.com
49912837Sgabeblack@google.comvoid
50012958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal)
50112837Sgabeblack@google.com{
50212958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
50312958Sgabeblack@google.com    p->setDynamic(
50412958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
50512837Sgabeblack@google.com}
50612837Sgabeblack@google.com
50712837Sgabeblack@google.comvoid
50812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
50912837Sgabeblack@google.com{
51012951Sgabeblack@google.com    next_trigger(sc_time(d, u), eal);
51112837Sgabeblack@google.com}
51212837Sgabeblack@google.com
51312929Sgabeblack@google.combool
51412929Sgabeblack@google.comtimed_out()
51512929Sgabeblack@google.com{
51612929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
51712929Sgabeblack@google.com    return false;
51812929Sgabeblack@google.com}
51912929Sgabeblack@google.com
52012837Sgabeblack@google.com
52112837Sgabeblack@google.comvoid
52212837Sgabeblack@google.comwait()
52312837Sgabeblack@google.com{
52412958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
52512958Sgabeblack@google.com    p->setDynamic(nullptr);
52612958Sgabeblack@google.com    sc_gem5::scheduler.yield();
52712837Sgabeblack@google.com}
52812837Sgabeblack@google.com
52912837Sgabeblack@google.comvoid
53012958Sgabeblack@google.comwait(int n)
53112837Sgabeblack@google.com{
53212958Sgabeblack@google.com    for (int i = 0; i < n; i++)
53312958Sgabeblack@google.com        wait();
53412837Sgabeblack@google.com}
53512837Sgabeblack@google.com
53612837Sgabeblack@google.comvoid
53712958Sgabeblack@google.comwait(const sc_event &e)
53812837Sgabeblack@google.com{
53912958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54012958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
54112958Sgabeblack@google.com    sc_gem5::scheduler.yield();
54212837Sgabeblack@google.com}
54312837Sgabeblack@google.com
54412837Sgabeblack@google.comvoid
54512958Sgabeblack@google.comwait(const sc_event_or_list &eol)
54612837Sgabeblack@google.com{
54712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54812958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
54912958Sgabeblack@google.com    sc_gem5::scheduler.yield();
55012837Sgabeblack@google.com}
55112837Sgabeblack@google.com
55212837Sgabeblack@google.comvoid
55312958Sgabeblack@google.comwait(const sc_event_and_list &eal)
55412837Sgabeblack@google.com{
55512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
55612958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
55712958Sgabeblack@google.com    sc_gem5::scheduler.yield();
55812837Sgabeblack@google.com}
55912837Sgabeblack@google.com
56012837Sgabeblack@google.comvoid
56112958Sgabeblack@google.comwait(const sc_time &t)
56212837Sgabeblack@google.com{
56312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
56412958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
56512958Sgabeblack@google.com    sc_gem5::scheduler.yield();
56612837Sgabeblack@google.com}
56712837Sgabeblack@google.com
56812837Sgabeblack@google.comvoid
56912951Sgabeblack@google.comwait(double d, sc_time_unit u)
57012837Sgabeblack@google.com{
57112951Sgabeblack@google.com    wait(sc_time(d, u));
57212837Sgabeblack@google.com}
57312837Sgabeblack@google.com
57412837Sgabeblack@google.comvoid
57512958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e)
57612837Sgabeblack@google.com{
57712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
57812958Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
57912958Sgabeblack@google.com    sc_gem5::scheduler.yield();
58012837Sgabeblack@google.com}
58112837Sgabeblack@google.com
58212837Sgabeblack@google.comvoid
58312951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e)
58412837Sgabeblack@google.com{
58512951Sgabeblack@google.com    wait(sc_time(d, u), e);
58612837Sgabeblack@google.com}
58712837Sgabeblack@google.com
58812837Sgabeblack@google.comvoid
58912958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol)
59012837Sgabeblack@google.com{
59112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
59212958Sgabeblack@google.com    p->setDynamic(
59312958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
59412958Sgabeblack@google.com    sc_gem5::scheduler.yield();
59512837Sgabeblack@google.com}
59612837Sgabeblack@google.com
59712837Sgabeblack@google.comvoid
59812951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol)
59912837Sgabeblack@google.com{
60012951Sgabeblack@google.com    wait(sc_time(d, u), eol);
60112837Sgabeblack@google.com}
60212837Sgabeblack@google.com
60312837Sgabeblack@google.comvoid
60412958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal)
60512837Sgabeblack@google.com{
60612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
60712958Sgabeblack@google.com    p->setDynamic(
60812958Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
60912958Sgabeblack@google.com    sc_gem5::scheduler.yield();
61012837Sgabeblack@google.com}
61112837Sgabeblack@google.com
61212837Sgabeblack@google.comvoid
61312951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal)
61412837Sgabeblack@google.com{
61512951Sgabeblack@google.com    wait(sc_time(d, u), eal);
61612837Sgabeblack@google.com}
61712837Sgabeblack@google.com
61812909Sgabeblack@google.comvoid
61912909Sgabeblack@google.comhalt()
62012909Sgabeblack@google.com{
62112909Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62212909Sgabeblack@google.com}
62312909Sgabeblack@google.com
62412914Sgabeblack@google.comvoid
62512914Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &)
62612914Sgabeblack@google.com{
62712914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62812914Sgabeblack@google.com}
62912914Sgabeblack@google.com
63012914Sgabeblack@google.comvoid
63112914Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
63212914Sgabeblack@google.com{
63312914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63412914Sgabeblack@google.com}
63512914Sgabeblack@google.com
63612914Sgabeblack@google.comvoid
63712914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &)
63812914Sgabeblack@google.com{
63912914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64012914Sgabeblack@google.com}
64112914Sgabeblack@google.com
64212914Sgabeblack@google.comvoid
64312914Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
64412914Sgabeblack@google.com{
64512914Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64612914Sgabeblack@google.com}
64712914Sgabeblack@google.com
64812837Sgabeblack@google.comconst char *
64913035Sgabeblack@google.comsc_gen_unique_name(const char *seed)
65012837Sgabeblack@google.com{
65113035Sgabeblack@google.com    ::sc_gem5::Module *mod = ::sc_gem5::currentModule();
65213035Sgabeblack@google.com    return mod ? mod->uniqueName(seed) :
65313035Sgabeblack@google.com        ::sc_gem5::nameGen.gen(seed);
65412837Sgabeblack@google.com}
65512837Sgabeblack@google.com
65612837Sgabeblack@google.combool
65712930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name)
65812930Sgabeblack@google.com{
65912930Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
66012930Sgabeblack@google.com    return false;
66112930Sgabeblack@google.com}
66212930Sgabeblack@google.com
66312930Sgabeblack@google.combool
66412837Sgabeblack@google.comsc_start_of_simulation_invoked()
66512837Sgabeblack@google.com{
66612982Sgabeblack@google.com    return ::sc_gem5::kernel->startOfSimulationComplete();
66712837Sgabeblack@google.com}
66812837Sgabeblack@google.com
66912837Sgabeblack@google.combool
67012837Sgabeblack@google.comsc_end_of_simulation_invoked()
67112837Sgabeblack@google.com{
67212982Sgabeblack@google.com    return ::sc_gem5::kernel->endOfSimulationComplete();
67312837Sgabeblack@google.com}
67412837Sgabeblack@google.com
67512901Sgabeblack@google.comsc_module *
67612901Sgabeblack@google.comsc_module_sc_new(sc_module *mod)
67712901Sgabeblack@google.com{
67812901Sgabeblack@google.com    static std::vector<std::unique_ptr<sc_module> > modules;
67912901Sgabeblack@google.com    modules.emplace_back(mod);
68012901Sgabeblack@google.com    return mod;
68112901Sgabeblack@google.com}
68212901Sgabeblack@google.com
68312837Sgabeblack@google.com} // namespace sc_core
684