sc_module.cc revision 12958:a8188f40f342
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>
3113135Sgabeblack@google.com#include <vector>
3212901Sgabeblack@google.com
3312901Sgabeblack@google.com#include "base/logging.hh"
3413785Sgabeblack@google.com#include "systemc/core/module.hh"
3513280Sgabeblack@google.com#include "systemc/core/process_types.hh"
3612982Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh"
3712951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh"
3813280Sgabeblack@google.com
3913288Sgabeblack@google.comnamespace sc_gem5
4012953Sgabeblack@google.com{
4113260Sgabeblack@google.com
4213288Sgabeblack@google.comProcess *
4313288Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func)
4413288Sgabeblack@google.com{
4513155Sgabeblack@google.com    return new Method(name, func);
4613317Sgabeblack@google.com}
4712837Sgabeblack@google.com
4812951Sgabeblack@google.comProcess *
4913155Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func)
5013135Sgabeblack@google.com{
5112837Sgabeblack@google.com    return new Thread(name, func);
5212952Sgabeblack@google.com}
5312952Sgabeblack@google.com
5412952Sgabeblack@google.comProcess *
5512952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func)
5612952Sgabeblack@google.com{
5712952Sgabeblack@google.com    return new CThread(name, func);
5813135Sgabeblack@google.com}
5913135Sgabeblack@google.com
6013135Sgabeblack@google.com} // namespace sc_gem5
6113135Sgabeblack@google.com
6213317Sgabeblack@google.comnamespace sc_core
6313317Sgabeblack@google.com{
6413135Sgabeblack@google.com
6513135Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) :
6612993Sgabeblack@google.com    _interface(&_interface), _port(nullptr)
6712993Sgabeblack@google.com{}
6812952Sgabeblack@google.com
6912952Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) :
7012952Sgabeblack@google.com    _interface(nullptr), _port(&_port)
7112952Sgabeblack@google.com{}
7212952Sgabeblack@google.com
7313135Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr);
7413135Sgabeblack@google.com
7513135Sgabeblack@google.comsc_module::~sc_module() {}
7613135Sgabeblack@google.com
7713317Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr);
7813317Sgabeblack@google.com
7913135Sgabeblack@google.comvoid
8013135Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001,
8112993Sgabeblack@google.com                        const sc_bind_proxy &p002,
8212993Sgabeblack@google.com                        const sc_bind_proxy &p003,
8312952Sgabeblack@google.com                        const sc_bind_proxy &p004,
8412952Sgabeblack@google.com                        const sc_bind_proxy &p005,
8512952Sgabeblack@google.com                        const sc_bind_proxy &p006,
8612952Sgabeblack@google.com                        const sc_bind_proxy &p007,
8712952Sgabeblack@google.com                        const sc_bind_proxy &p008,
8813135Sgabeblack@google.com                        const sc_bind_proxy &p009,
8913135Sgabeblack@google.com                        const sc_bind_proxy &p010,
9013135Sgabeblack@google.com                        const sc_bind_proxy &p011,
9113135Sgabeblack@google.com                        const sc_bind_proxy &p012,
9213317Sgabeblack@google.com                        const sc_bind_proxy &p013,
9313317Sgabeblack@google.com                        const sc_bind_proxy &p014,
9413135Sgabeblack@google.com                        const sc_bind_proxy &p015,
9513135Sgabeblack@google.com                        const sc_bind_proxy &p016,
9612993Sgabeblack@google.com                        const sc_bind_proxy &p017,
9713194Sgabeblack@google.com                        const sc_bind_proxy &p018,
9812993Sgabeblack@google.com                        const sc_bind_proxy &p019,
9912952Sgabeblack@google.com                        const sc_bind_proxy &p020,
10012952Sgabeblack@google.com                        const sc_bind_proxy &p021,
10112952Sgabeblack@google.com                        const sc_bind_proxy &p022,
10212952Sgabeblack@google.com                        const sc_bind_proxy &p023,
10312837Sgabeblack@google.com                        const sc_bind_proxy &p024,
10412837Sgabeblack@google.com                        const sc_bind_proxy &p025,
10512837Sgabeblack@google.com                        const sc_bind_proxy &p026,
10613382Sgabeblack@google.com                        const sc_bind_proxy &p027,
10713382Sgabeblack@google.com                        const sc_bind_proxy &p028,
10813091Sgabeblack@google.com                        const sc_bind_proxy &p029,
10912951Sgabeblack@google.com                        const sc_bind_proxy &p030,
11012951Sgabeblack@google.com                        const sc_bind_proxy &p031,
11112837Sgabeblack@google.com                        const sc_bind_proxy &p032,
11213091Sgabeblack@google.com                        const sc_bind_proxy &p033,
11312951Sgabeblack@google.com                        const sc_bind_proxy &p034,
11412951Sgabeblack@google.com                        const sc_bind_proxy &p035,
11512837Sgabeblack@google.com                        const sc_bind_proxy &p036,
11613382Sgabeblack@google.com                        const sc_bind_proxy &p037,
11712837Sgabeblack@google.com                        const sc_bind_proxy &p038,
11813785Sgabeblack@google.com                        const sc_bind_proxy &p039,
11913785Sgabeblack@google.com                        const sc_bind_proxy &p040,
12013785Sgabeblack@google.com                        const sc_bind_proxy &p041,
12113785Sgabeblack@google.com                        const sc_bind_proxy &p042,
12213785Sgabeblack@google.com                        const sc_bind_proxy &p043,
12313785Sgabeblack@google.com                        const sc_bind_proxy &p044,
12412982Sgabeblack@google.com                        const sc_bind_proxy &p045,
12512837Sgabeblack@google.com                        const sc_bind_proxy &p046,
12612837Sgabeblack@google.com                        const sc_bind_proxy &p047,
12712837Sgabeblack@google.com                        const sc_bind_proxy &p048,
12812837Sgabeblack@google.com                        const sc_bind_proxy &p049,
12912837Sgabeblack@google.com                        const sc_bind_proxy &p050,
13012837Sgabeblack@google.com                        const sc_bind_proxy &p051,
13112837Sgabeblack@google.com                        const sc_bind_proxy &p052,
13212837Sgabeblack@google.com                        const sc_bind_proxy &p053,
13312837Sgabeblack@google.com                        const sc_bind_proxy &p054,
13412837Sgabeblack@google.com                        const sc_bind_proxy &p055,
13512837Sgabeblack@google.com                        const sc_bind_proxy &p056,
13612837Sgabeblack@google.com                        const sc_bind_proxy &p057,
13712837Sgabeblack@google.com                        const sc_bind_proxy &p058,
13812837Sgabeblack@google.com                        const sc_bind_proxy &p059,
13912837Sgabeblack@google.com                        const sc_bind_proxy &p060,
14012837Sgabeblack@google.com                        const sc_bind_proxy &p061,
14112837Sgabeblack@google.com                        const sc_bind_proxy &p062,
14212837Sgabeblack@google.com                        const sc_bind_proxy &p063,
14312837Sgabeblack@google.com                        const sc_bind_proxy &p064)
14412837Sgabeblack@google.com{
14512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
14612837Sgabeblack@google.com}
14712837Sgabeblack@google.com
14812837Sgabeblack@google.comconst std::vector<sc_object *> &
14912837Sgabeblack@google.comsc_module::get_child_objects() const
15012837Sgabeblack@google.com{
15112837Sgabeblack@google.com    return _gem5_module->obj()->get_child_objects();
15212837Sgabeblack@google.com}
15312837Sgabeblack@google.com
15412837Sgabeblack@google.comconst std::vector<sc_event *> &
15512837Sgabeblack@google.comsc_module::get_child_events() const
15612837Sgabeblack@google.com{
15712837Sgabeblack@google.com    return _gem5_module->obj()->get_child_events();
15812837Sgabeblack@google.com}
15912837Sgabeblack@google.com
16012837Sgabeblack@google.comsc_module::sc_module() :
16112837Sgabeblack@google.com    sc_object(sc_gem5::newModule()->name()),
16212837Sgabeblack@google.com    _gem5_module(sc_gem5::currentModule())
16312837Sgabeblack@google.com{}
16412837Sgabeblack@google.com
16512837Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {}
16612837Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
16712837Sgabeblack@google.comsc_module::sc_module(const std::string &_name) :
16812837Sgabeblack@google.com    sc_module(sc_module_name(_name.c_str()))
16912837Sgabeblack@google.com{}
17012837Sgabeblack@google.com
17112837Sgabeblack@google.comvoid
17212837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool)
17312837Sgabeblack@google.com{
17412837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
17512837Sgabeblack@google.com}
17612837Sgabeblack@google.com
17712837Sgabeblack@google.comvoid
17812837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool)
17912837Sgabeblack@google.com{
18012837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18112837Sgabeblack@google.com}
18212837Sgabeblack@google.com
18312837Sgabeblack@google.comvoid
18412837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool)
18512837Sgabeblack@google.com{
18612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
18712837Sgabeblack@google.com}
18812837Sgabeblack@google.com
18912837Sgabeblack@google.comvoid
19012837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
19112837Sgabeblack@google.com{
19213091Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
19313091Sgabeblack@google.com}
19413091Sgabeblack@google.com
19513091Sgabeblack@google.com
19613091Sgabeblack@google.comvoid
19713091Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool)
19813091Sgabeblack@google.com{
19913091Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20013091Sgabeblack@google.com}
20113091Sgabeblack@google.com
20213091Sgabeblack@google.comvoid
20313091Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
20413091Sgabeblack@google.com{
20513091Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
20613091Sgabeblack@google.com}
20713091Sgabeblack@google.com
20813091Sgabeblack@google.comvoid
20913091Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool)
21013091Sgabeblack@google.com{
21113091Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21213091Sgabeblack@google.com}
21313091Sgabeblack@google.com
21413091Sgabeblack@google.comvoid
21513091Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
21612837Sgabeblack@google.com{
21712837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
21813292Sgabeblack@google.com}
21913292Sgabeblack@google.com
22013292Sgabeblack@google.com
22113292Sgabeblack@google.comvoid
22213292Sgabeblack@google.comsc_module::dont_initialize()
22313292Sgabeblack@google.com{
22413292Sgabeblack@google.com    ::sc_gem5::Process::newest()->dontInitialize();
22513292Sgabeblack@google.com}
22613292Sgabeblack@google.com
22713292Sgabeblack@google.comvoid
22813292Sgabeblack@google.comsc_module::set_stack_size(size_t size)
22913292Sgabeblack@google.com{
23013292Sgabeblack@google.com    ::sc_gem5::Process::newest()->setStackSize(size);
23113292Sgabeblack@google.com}
23213292Sgabeblack@google.com
23313292Sgabeblack@google.com
23413292Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
23513292Sgabeblack@google.com
23613292Sgabeblack@google.comvoid
23713292Sgabeblack@google.comsc_module::next_trigger(const sc_event &e)
23813292Sgabeblack@google.com{
23913292Sgabeblack@google.com    ::sc_core::next_trigger(e);
24013292Sgabeblack@google.com}
24113292Sgabeblack@google.com
24213292Sgabeblack@google.comvoid
24313292Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol)
24413292Sgabeblack@google.com{
24513292Sgabeblack@google.com    ::sc_core::next_trigger(eol);
24612837Sgabeblack@google.com}
24712837Sgabeblack@google.com
24812837Sgabeblack@google.comvoid
24912951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal)
25012837Sgabeblack@google.com{
25112837Sgabeblack@google.com    ::sc_core::next_trigger(eal);
25212837Sgabeblack@google.com}
25312837Sgabeblack@google.com
25412837Sgabeblack@google.comvoid
25512951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t)
25612837Sgabeblack@google.com{
25712837Sgabeblack@google.com    ::sc_core::next_trigger(t);
25812951Sgabeblack@google.com}
25913079Sgabeblack@google.com
26012951Sgabeblack@google.comvoid
26113284Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u)
26213317Sgabeblack@google.com{
26313317Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
26413317Sgabeblack@google.com}
26513317Sgabeblack@google.com
26613284Sgabeblack@google.comvoid
26712837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e)
26812951Sgabeblack@google.com{
26913191Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
27013191Sgabeblack@google.com}
27113191Sgabeblack@google.com
27213317Sgabeblack@google.comvoid
27313191Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
27412951Sgabeblack@google.com{
27512951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
27613191Sgabeblack@google.com}
27713191Sgabeblack@google.com
27813317Sgabeblack@google.comvoid
27913191Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
28013191Sgabeblack@google.com{
28113191Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
28213191Sgabeblack@google.com}
28313191Sgabeblack@google.com
28413191Sgabeblack@google.comvoid
28513191Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
28612928Sgabeblack@google.com{
28712837Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
28813260Sgabeblack@google.com}
28912837Sgabeblack@google.com
29013288Sgabeblack@google.comvoid
29112837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
29212837Sgabeblack@google.com{
29312837Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
29413260Sgabeblack@google.com}
29512837Sgabeblack@google.com
29613288Sgabeblack@google.comvoid
29712837Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
29812837Sgabeblack@google.com{
29912837Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
30013260Sgabeblack@google.com}
30112837Sgabeblack@google.com
30213288Sgabeblack@google.com
30312837Sgabeblack@google.combool
30412837Sgabeblack@google.comsc_module::timed_out()
30512837Sgabeblack@google.com{
30613260Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
30712837Sgabeblack@google.com    return false;
30813288Sgabeblack@google.com}
30912837Sgabeblack@google.com
31012837Sgabeblack@google.com
31112837Sgabeblack@google.comvoid
31212837Sgabeblack@google.comsc_module::wait()
31313260Sgabeblack@google.com{
31412837Sgabeblack@google.com    ::sc_core::wait();
31513288Sgabeblack@google.com}
31612837Sgabeblack@google.com
31712837Sgabeblack@google.comvoid
31812837Sgabeblack@google.comsc_module::wait(int i)
31913260Sgabeblack@google.com{
32012837Sgabeblack@google.com    ::sc_core::wait(i);
32113288Sgabeblack@google.com}
32212837Sgabeblack@google.com
32312837Sgabeblack@google.comvoid
32412837Sgabeblack@google.comsc_module::wait(const sc_event &e)
32513260Sgabeblack@google.com{
32612837Sgabeblack@google.com    ::sc_core::wait(e);
32713288Sgabeblack@google.com}
32812837Sgabeblack@google.com
32912837Sgabeblack@google.comvoid
33012837Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol)
33113260Sgabeblack@google.com{
33212837Sgabeblack@google.com    ::sc_core::wait(eol);
33313288Sgabeblack@google.com}
33412837Sgabeblack@google.com
33512837Sgabeblack@google.comvoid
33612837Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal)
33712837Sgabeblack@google.com{
33812837Sgabeblack@google.com    ::sc_core::wait(eal);
33912837Sgabeblack@google.com}
34013315Sgabeblack@google.com
34113317Sgabeblack@google.comvoid
34213317Sgabeblack@google.comsc_module::wait(const sc_time &t)
34313315Sgabeblack@google.com{
34412837Sgabeblack@google.com    ::sc_core::wait(t);
34512837Sgabeblack@google.com}
34612837Sgabeblack@google.com
34712953Sgabeblack@google.comvoid
34812837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u)
34912953Sgabeblack@google.com{
35012837Sgabeblack@google.com    ::sc_core::wait(d, u);
35112837Sgabeblack@google.com}
35212837Sgabeblack@google.com
35312951Sgabeblack@google.comvoid
35412951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e)
35512837Sgabeblack@google.com{
35612951Sgabeblack@google.com    ::sc_core::wait(t, e);
35712837Sgabeblack@google.com}
35812951Sgabeblack@google.com
35912837Sgabeblack@google.comvoid
36012837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e)
36112837Sgabeblack@google.com{
36212951Sgabeblack@google.com    ::sc_core::wait(d, u, e);
36312837Sgabeblack@google.com}
36412951Sgabeblack@google.com
36512837Sgabeblack@google.comvoid
36612837Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol)
36712837Sgabeblack@google.com{
36812951Sgabeblack@google.com    ::sc_core::wait(t, eol);
36912837Sgabeblack@google.com}
37012951Sgabeblack@google.com
37112837Sgabeblack@google.comvoid
37212837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
37312837Sgabeblack@google.com{
37412951Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
37512837Sgabeblack@google.com}
37612951Sgabeblack@google.com
37712837Sgabeblack@google.comvoid
37812837Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal)
37912837Sgabeblack@google.com{
38012951Sgabeblack@google.com    ::sc_core::wait(t, eal);
38112837Sgabeblack@google.com}
38212951Sgabeblack@google.com
38312837Sgabeblack@google.comvoid
38412837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
38512837Sgabeblack@google.com{
38612951Sgabeblack@google.com    ::sc_core::wait(d, u, eal);
38712837Sgabeblack@google.com}
38812951Sgabeblack@google.com
38912837Sgabeblack@google.com
39012837Sgabeblack@google.comvoid
39112837Sgabeblack@google.comsc_module::halt()
39212951Sgabeblack@google.com{
39312837Sgabeblack@google.com    ::sc_core::halt();
39412951Sgabeblack@google.com}
39512837Sgabeblack@google.com
39612837Sgabeblack@google.comvoid
39712837Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s)
39812951Sgabeblack@google.com{
39912837Sgabeblack@google.com    ::sc_core::at_posedge(s);
40012951Sgabeblack@google.com}
40112837Sgabeblack@google.com
40212837Sgabeblack@google.comvoid
40312837Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
40412951Sgabeblack@google.com{
40512837Sgabeblack@google.com    ::sc_core::at_posedge(s);
40612951Sgabeblack@google.com}
40712837Sgabeblack@google.com
40812837Sgabeblack@google.comvoid
40912837Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s)
41012951Sgabeblack@google.com{
41112837Sgabeblack@google.com    ::sc_core::at_negedge(s);
41212951Sgabeblack@google.com}
41312837Sgabeblack@google.com
41412837Sgabeblack@google.comvoid
41512837Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
41612951Sgabeblack@google.com{
41712837Sgabeblack@google.com    ::sc_core::at_negedge(s);
41812951Sgabeblack@google.com}
41912837Sgabeblack@google.com
42012837Sgabeblack@google.com
42112837Sgabeblack@google.comvoid
42212929Sgabeblack@google.comnext_trigger()
42312929Sgabeblack@google.com{
42412929Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
42513189Sgabeblack@google.com    p->setDynamic(nullptr);
42612929Sgabeblack@google.com}
42712929Sgabeblack@google.com
42812929Sgabeblack@google.comvoid
42912837Sgabeblack@google.comnext_trigger(const sc_event &e)
43012837Sgabeblack@google.com{
43112837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
43212951Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
43312837Sgabeblack@google.com}
43412837Sgabeblack@google.com
43512837Sgabeblack@google.comvoid
43612951Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol)
43712837Sgabeblack@google.com{
43812951Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
43912837Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
44012837Sgabeblack@google.com}
44112837Sgabeblack@google.com
44212951Sgabeblack@google.comvoid
44312837Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal)
44412951Sgabeblack@google.com{
44512837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
44612837Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
44712837Sgabeblack@google.com}
44812951Sgabeblack@google.com
44912837Sgabeblack@google.comvoid
45012951Sgabeblack@google.comnext_trigger(const sc_time &t)
45112837Sgabeblack@google.com{
45212837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
45312837Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
45412951Sgabeblack@google.com}
45512837Sgabeblack@google.com
45612951Sgabeblack@google.comvoid
45712837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u)
45812837Sgabeblack@google.com{
45912837Sgabeblack@google.com    next_trigger(sc_time(d, u));
46012951Sgabeblack@google.com}
46112837Sgabeblack@google.com
46212951Sgabeblack@google.comvoid
46312837Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e)
46412837Sgabeblack@google.com{
46512837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
46612951Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
46712837Sgabeblack@google.com}
46812951Sgabeblack@google.com
46912837Sgabeblack@google.comvoid
47012837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e)
47112837Sgabeblack@google.com{
47212951Sgabeblack@google.com    next_trigger(sc_time(d, u), e);
47312837Sgabeblack@google.com}
47412951Sgabeblack@google.com
47512837Sgabeblack@google.comvoid
47612837Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol)
47712837Sgabeblack@google.com{
47812951Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
47912837Sgabeblack@google.com    p->setDynamic(
48012951Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
48112837Sgabeblack@google.com}
48212837Sgabeblack@google.com
48312837Sgabeblack@google.comvoid
48412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
48512837Sgabeblack@google.com{
48612951Sgabeblack@google.com    next_trigger(sc_time(d, u), eol);
48712837Sgabeblack@google.com}
48812837Sgabeblack@google.com
48912837Sgabeblack@google.comvoid
49012951Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal)
49112837Sgabeblack@google.com{
49212951Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
49312837Sgabeblack@google.com    p->setDynamic(
49412837Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
49512837Sgabeblack@google.com}
49612951Sgabeblack@google.com
49712837Sgabeblack@google.comvoid
49812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
49912837Sgabeblack@google.com{
50012837Sgabeblack@google.com    next_trigger(sc_time(d, u), eal);
50112837Sgabeblack@google.com}
50212951Sgabeblack@google.com
50312837Sgabeblack@google.combool
50412951Sgabeblack@google.comtimed_out()
50512837Sgabeblack@google.com{
50612837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
50712837Sgabeblack@google.com    return false;
50812837Sgabeblack@google.com}
50912909Sgabeblack@google.com
51012909Sgabeblack@google.com
51112951Sgabeblack@google.comvoid
51212909Sgabeblack@google.comwait()
51312909Sgabeblack@google.com{
51412914Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
51512951Sgabeblack@google.com    p->setDynamic(nullptr);
51612914Sgabeblack@google.com    sc_gem5::scheduler.yield();
51712951Sgabeblack@google.com}
51812914Sgabeblack@google.com
51912914Sgabeblack@google.comvoid
52012914Sgabeblack@google.comwait(int n)
52112951Sgabeblack@google.com{
52212914Sgabeblack@google.com    for (int i = 0; i < n; i++)
52312951Sgabeblack@google.com        wait();
52412914Sgabeblack@google.com}
52512914Sgabeblack@google.com
52612914Sgabeblack@google.comvoid
52712951Sgabeblack@google.comwait(const sc_event &e)
52812914Sgabeblack@google.com{
52912951Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53012914Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
53112914Sgabeblack@google.com    sc_gem5::scheduler.yield();
53212914Sgabeblack@google.com}
53312951Sgabeblack@google.com
53412914Sgabeblack@google.comvoid
53512951Sgabeblack@google.comwait(const sc_event_or_list &eol)
53612914Sgabeblack@google.com{
53712914Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53812909Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
53912909Sgabeblack@google.com    sc_gem5::scheduler.yield();
54012837Sgabeblack@google.com}
54112837Sgabeblack@google.com
54212958Sgabeblack@google.comvoid
54313206Sgabeblack@google.comwait(const sc_event_and_list &eal)
54413206Sgabeblack@google.com{
54512837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54612837Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
54712837Sgabeblack@google.com    sc_gem5::scheduler.yield();
54812958Sgabeblack@google.com}
54912837Sgabeblack@google.com
55012958Sgabeblack@google.comvoid
55113206Sgabeblack@google.comwait(const sc_time &t)
55213207Sgabeblack@google.com{
55312837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
55412837Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
55512837Sgabeblack@google.com    sc_gem5::scheduler.yield();
55612958Sgabeblack@google.com}
55712837Sgabeblack@google.com
55812958Sgabeblack@google.comvoid
55913206Sgabeblack@google.comwait(double d, sc_time_unit u)
56013207Sgabeblack@google.com{
56112837Sgabeblack@google.com    wait(sc_time(d, u));
56212837Sgabeblack@google.com}
56312837Sgabeblack@google.com
56412958Sgabeblack@google.comvoid
56512837Sgabeblack@google.comwait(const sc_time &t, const sc_event &e)
56612958Sgabeblack@google.com{
56713206Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
56813207Sgabeblack@google.com    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
56912837Sgabeblack@google.com    sc_gem5::scheduler.yield();
57012837Sgabeblack@google.com}
57112837Sgabeblack@google.com
57212958Sgabeblack@google.comvoid
57312837Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e)
57412958Sgabeblack@google.com{
57513206Sgabeblack@google.com    wait(sc_time(d, u), e);
57613206Sgabeblack@google.com}
57712837Sgabeblack@google.com
57812837Sgabeblack@google.comvoid
57912837Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol)
58012951Sgabeblack@google.com{
58112837Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
58212951Sgabeblack@google.com    p->setDynamic(
58312837Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
58412837Sgabeblack@google.com    sc_gem5::scheduler.yield();
58512837Sgabeblack@google.com}
58612958Sgabeblack@google.com
58712837Sgabeblack@google.comvoid
58812958Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol)
58913206Sgabeblack@google.com{
59013207Sgabeblack@google.com    wait(sc_time(d, u), eol);
59112837Sgabeblack@google.com}
59212837Sgabeblack@google.com
59312837Sgabeblack@google.comvoid
59412951Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal)
59512837Sgabeblack@google.com{
59612951Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
59712837Sgabeblack@google.com    p->setDynamic(
59812837Sgabeblack@google.com            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
59912837Sgabeblack@google.com    sc_gem5::scheduler.yield();
60012958Sgabeblack@google.com}
60112837Sgabeblack@google.com
60212958Sgabeblack@google.comvoid
60313206Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal)
60413207Sgabeblack@google.com{
60512837Sgabeblack@google.com    wait(sc_time(d, u), eal);
60612837Sgabeblack@google.com}
60712837Sgabeblack@google.com
60812951Sgabeblack@google.comvoid
60912837Sgabeblack@google.comhalt()
61012951Sgabeblack@google.com{
61112837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
61212837Sgabeblack@google.com}
61312837Sgabeblack@google.com
61412958Sgabeblack@google.comvoid
61512837Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &)
61612958Sgabeblack@google.com{
61713206Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
61813207Sgabeblack@google.com}
61912837Sgabeblack@google.com
62012837Sgabeblack@google.comvoid
62112837Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
62212951Sgabeblack@google.com{
62312837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
62412951Sgabeblack@google.com}
62512837Sgabeblack@google.com
62612837Sgabeblack@google.comvoid
62712929Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &)
62812929Sgabeblack@google.com{
62912929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63013189Sgabeblack@google.com}
63113189Sgabeblack@google.com
63213189Sgabeblack@google.comvoid
63313189Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
63413189Sgabeblack@google.com{
63512929Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
63612929Sgabeblack@google.com}
63712837Sgabeblack@google.com
63813248Sgabeblack@google.comconst char *
63913248Sgabeblack@google.comsc_gen_unique_name(const char *)
64013248Sgabeblack@google.com{
64113248Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64213248Sgabeblack@google.com    return "";
64313248Sgabeblack@google.com}
64413248Sgabeblack@google.com
64513317Sgabeblack@google.combool
64613248Sgabeblack@google.comsc_hierarchical_name_exists(const char *name)
64713248Sgabeblack@google.com{
64813248Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
64913248Sgabeblack@google.com    return false;
65013248Sgabeblack@google.com}
65113248Sgabeblack@google.com
65213248Sgabeblack@google.combool
65313248Sgabeblack@google.comsc_start_of_simulation_invoked()
65412837Sgabeblack@google.com{
65512837Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
65612837Sgabeblack@google.com    return false;
65712958Sgabeblack@google.com}
65813248Sgabeblack@google.com
65913248Sgabeblack@google.combool
66013206Sgabeblack@google.comsc_end_of_simulation_invoked()
66113206Sgabeblack@google.com{
66212958Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
66312837Sgabeblack@google.com    return false;
66412837Sgabeblack@google.com}
66512837Sgabeblack@google.com
66612958Sgabeblack@google.comsc_module *
66712837Sgabeblack@google.comsc_module_sc_new(sc_module *mod)
66813146Sgabeblack@google.com{
66913146Sgabeblack@google.com    static std::vector<std::unique_ptr<sc_module> > modules;
67013317Sgabeblack@google.com    modules.emplace_back(mod);
67113146Sgabeblack@google.com    return mod;
67213260Sgabeblack@google.com}
67313260Sgabeblack@google.com
67413260Sgabeblack@google.com} // namespace sc_core
67512837Sgabeblack@google.com