sc_module.cc revision 13268
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 <string>
3212901Sgabeblack@google.com#include <vector>
3312901Sgabeblack@google.com
3412837Sgabeblack@google.com#include "base/logging.hh"
3512982Sgabeblack@google.com#include "systemc/core/kernel.hh"
3612951Sgabeblack@google.com#include "systemc/core/module.hh"
3712953Sgabeblack@google.com#include "systemc/core/process_types.hh"
3813260Sgabeblack@google.com#include "systemc/core/sensitivity.hh"
3913155Sgabeblack@google.com#include "systemc/ext/channel/sc_signal_in_if.hh"
4012837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh"
4112951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh"
4213155Sgabeblack@google.com#include "systemc/ext/dt/bit/sc_logic.hh"
4313135Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh"
4412837Sgabeblack@google.com
4512952Sgabeblack@google.comnamespace sc_gem5
4612952Sgabeblack@google.com{
4712952Sgabeblack@google.com
4812952Sgabeblack@google.comProcess *
4912952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func)
5012952Sgabeblack@google.com{
5113135Sgabeblack@google.com    Method *p = new Method(name, func);
5213135Sgabeblack@google.com    if (::sc_core::sc_is_running()) {
5313135Sgabeblack@google.com        std::string name = p->name();
5413135Sgabeblack@google.com        delete p;
5513135Sgabeblack@google.com        SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while "
5613135Sgabeblack@google.com                "simulation running", name.c_str());
5713135Sgabeblack@google.com        return nullptr;
5813135Sgabeblack@google.com    }
5912993Sgabeblack@google.com    scheduler.reg(p);
6012993Sgabeblack@google.com    return p;
6112952Sgabeblack@google.com}
6212952Sgabeblack@google.com
6312952Sgabeblack@google.comProcess *
6412952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func)
6512952Sgabeblack@google.com{
6613135Sgabeblack@google.com    Thread *p = new Thread(name, func);
6713135Sgabeblack@google.com    if (::sc_core::sc_is_running()) {
6813135Sgabeblack@google.com        std::string name = p->name();
6913135Sgabeblack@google.com        delete p;
7013135Sgabeblack@google.com        SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while "
7113135Sgabeblack@google.com                "simulation running", name.c_str());
7213135Sgabeblack@google.com        return nullptr;
7313135Sgabeblack@google.com    }
7412993Sgabeblack@google.com    scheduler.reg(p);
7512993Sgabeblack@google.com    return p;
7612952Sgabeblack@google.com}
7712952Sgabeblack@google.com
7812952Sgabeblack@google.comProcess *
7912952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func)
8012952Sgabeblack@google.com{
8113135Sgabeblack@google.com    CThread *p = new CThread(name, func);
8213135Sgabeblack@google.com    if (::sc_core::sc_is_running()) {
8313135Sgabeblack@google.com        std::string name = p->name();
8413135Sgabeblack@google.com        delete p;
8513135Sgabeblack@google.com        SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while "
8613135Sgabeblack@google.com                "simulation running", name.c_str());
8713135Sgabeblack@google.com        return nullptr;
8813135Sgabeblack@google.com    }
8912993Sgabeblack@google.com    scheduler.reg(p);
9013194Sgabeblack@google.com    p->dontInitialize(true);
9112993Sgabeblack@google.com    return p;
9212952Sgabeblack@google.com}
9312952Sgabeblack@google.com
9413035Sgabeblack@google.comUniqueNameGen nameGen;
9513035Sgabeblack@google.com
9612952Sgabeblack@google.com} // namespace sc_gem5
9712952Sgabeblack@google.com
9812837Sgabeblack@google.comnamespace sc_core
9912837Sgabeblack@google.com{
10012837Sgabeblack@google.com
10113091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_interface &_interface) :
10212951Sgabeblack@google.com    _interface(&_interface), _port(nullptr)
10312951Sgabeblack@google.com{}
10412837Sgabeblack@google.com
10513091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_port_base &_port) :
10612951Sgabeblack@google.com    _interface(nullptr), _port(&_port)
10712951Sgabeblack@google.com{}
10812837Sgabeblack@google.com
10913091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr);
11012837Sgabeblack@google.com
11112982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; }
11212837Sgabeblack@google.com
11313091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr);
11412837Sgabeblack@google.com
11512837Sgabeblack@google.comvoid
11612837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001,
11712837Sgabeblack@google.com                        const sc_bind_proxy &p002,
11812837Sgabeblack@google.com                        const sc_bind_proxy &p003,
11912837Sgabeblack@google.com                        const sc_bind_proxy &p004,
12012837Sgabeblack@google.com                        const sc_bind_proxy &p005,
12112837Sgabeblack@google.com                        const sc_bind_proxy &p006,
12212837Sgabeblack@google.com                        const sc_bind_proxy &p007,
12312837Sgabeblack@google.com                        const sc_bind_proxy &p008,
12412837Sgabeblack@google.com                        const sc_bind_proxy &p009,
12512837Sgabeblack@google.com                        const sc_bind_proxy &p010,
12612837Sgabeblack@google.com                        const sc_bind_proxy &p011,
12712837Sgabeblack@google.com                        const sc_bind_proxy &p012,
12812837Sgabeblack@google.com                        const sc_bind_proxy &p013,
12912837Sgabeblack@google.com                        const sc_bind_proxy &p014,
13012837Sgabeblack@google.com                        const sc_bind_proxy &p015,
13112837Sgabeblack@google.com                        const sc_bind_proxy &p016,
13212837Sgabeblack@google.com                        const sc_bind_proxy &p017,
13312837Sgabeblack@google.com                        const sc_bind_proxy &p018,
13412837Sgabeblack@google.com                        const sc_bind_proxy &p019,
13512837Sgabeblack@google.com                        const sc_bind_proxy &p020,
13612837Sgabeblack@google.com                        const sc_bind_proxy &p021,
13712837Sgabeblack@google.com                        const sc_bind_proxy &p022,
13812837Sgabeblack@google.com                        const sc_bind_proxy &p023,
13912837Sgabeblack@google.com                        const sc_bind_proxy &p024,
14012837Sgabeblack@google.com                        const sc_bind_proxy &p025,
14112837Sgabeblack@google.com                        const sc_bind_proxy &p026,
14212837Sgabeblack@google.com                        const sc_bind_proxy &p027,
14312837Sgabeblack@google.com                        const sc_bind_proxy &p028,
14412837Sgabeblack@google.com                        const sc_bind_proxy &p029,
14512837Sgabeblack@google.com                        const sc_bind_proxy &p030,
14612837Sgabeblack@google.com                        const sc_bind_proxy &p031,
14712837Sgabeblack@google.com                        const sc_bind_proxy &p032,
14812837Sgabeblack@google.com                        const sc_bind_proxy &p033,
14912837Sgabeblack@google.com                        const sc_bind_proxy &p034,
15012837Sgabeblack@google.com                        const sc_bind_proxy &p035,
15112837Sgabeblack@google.com                        const sc_bind_proxy &p036,
15212837Sgabeblack@google.com                        const sc_bind_proxy &p037,
15312837Sgabeblack@google.com                        const sc_bind_proxy &p038,
15412837Sgabeblack@google.com                        const sc_bind_proxy &p039,
15512837Sgabeblack@google.com                        const sc_bind_proxy &p040,
15612837Sgabeblack@google.com                        const sc_bind_proxy &p041,
15712837Sgabeblack@google.com                        const sc_bind_proxy &p042,
15812837Sgabeblack@google.com                        const sc_bind_proxy &p043,
15912837Sgabeblack@google.com                        const sc_bind_proxy &p044,
16012837Sgabeblack@google.com                        const sc_bind_proxy &p045,
16112837Sgabeblack@google.com                        const sc_bind_proxy &p046,
16212837Sgabeblack@google.com                        const sc_bind_proxy &p047,
16312837Sgabeblack@google.com                        const sc_bind_proxy &p048,
16412837Sgabeblack@google.com                        const sc_bind_proxy &p049,
16512837Sgabeblack@google.com                        const sc_bind_proxy &p050,
16612837Sgabeblack@google.com                        const sc_bind_proxy &p051,
16712837Sgabeblack@google.com                        const sc_bind_proxy &p052,
16812837Sgabeblack@google.com                        const sc_bind_proxy &p053,
16912837Sgabeblack@google.com                        const sc_bind_proxy &p054,
17012837Sgabeblack@google.com                        const sc_bind_proxy &p055,
17112837Sgabeblack@google.com                        const sc_bind_proxy &p056,
17212837Sgabeblack@google.com                        const sc_bind_proxy &p057,
17312837Sgabeblack@google.com                        const sc_bind_proxy &p058,
17412837Sgabeblack@google.com                        const sc_bind_proxy &p059,
17512837Sgabeblack@google.com                        const sc_bind_proxy &p060,
17612837Sgabeblack@google.com                        const sc_bind_proxy &p061,
17712837Sgabeblack@google.com                        const sc_bind_proxy &p062,
17812837Sgabeblack@google.com                        const sc_bind_proxy &p063,
17912837Sgabeblack@google.com                        const sc_bind_proxy &p064)
18012837Sgabeblack@google.com{
18113091Sgabeblack@google.com    std::vector<const ::sc_core::sc_bind_proxy *> proxies;
18213091Sgabeblack@google.com    auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool {
18313091Sgabeblack@google.com        if (!p.port() && !p.interface())
18413091Sgabeblack@google.com            return false;
18513091Sgabeblack@google.com        proxies.push_back(&p);
18613091Sgabeblack@google.com        return true;
18713091Sgabeblack@google.com    };
18813091Sgabeblack@google.com    insert(p001) && insert(p002) && insert(p003) && insert(p004) &&
18913091Sgabeblack@google.com    insert(p005) && insert(p006) && insert(p007) && insert(p008) &&
19013091Sgabeblack@google.com    insert(p009) && insert(p010) && insert(p011) && insert(p012) &&
19113091Sgabeblack@google.com    insert(p013) && insert(p014) && insert(p015) && insert(p016) &&
19213091Sgabeblack@google.com    insert(p017) && insert(p018) && insert(p019) && insert(p020) &&
19313091Sgabeblack@google.com    insert(p021) && insert(p022) && insert(p023) && insert(p024) &&
19413091Sgabeblack@google.com    insert(p025) && insert(p026) && insert(p027) && insert(p028) &&
19513091Sgabeblack@google.com    insert(p029) && insert(p030) && insert(p031) && insert(p032) &&
19613091Sgabeblack@google.com    insert(p033) && insert(p034) && insert(p035) && insert(p036) &&
19713091Sgabeblack@google.com    insert(p037) && insert(p038) && insert(p039) && insert(p040) &&
19813091Sgabeblack@google.com    insert(p041) && insert(p042) && insert(p043) && insert(p044) &&
19913091Sgabeblack@google.com    insert(p045) && insert(p046) && insert(p047) && insert(p048) &&
20013091Sgabeblack@google.com    insert(p049) && insert(p050) && insert(p051) && insert(p052) &&
20113091Sgabeblack@google.com    insert(p053) && insert(p054) && insert(p055) && insert(p056) &&
20213091Sgabeblack@google.com    insert(p057) && insert(p058) && insert(p059) && insert(p060) &&
20313091Sgabeblack@google.com    insert(p061) && insert(p062) && insert(p063) && insert(p064);
20413091Sgabeblack@google.com    _gem5_module->bindPorts(proxies);
20512837Sgabeblack@google.com}
20612837Sgabeblack@google.com
20712837Sgabeblack@google.comconst std::vector<sc_object *> &
20812837Sgabeblack@google.comsc_module::get_child_objects() const
20912837Sgabeblack@google.com{
21012951Sgabeblack@google.com    return _gem5_module->obj()->get_child_objects();
21112837Sgabeblack@google.com}
21212837Sgabeblack@google.com
21312837Sgabeblack@google.comconst std::vector<sc_event *> &
21412837Sgabeblack@google.comsc_module::get_child_events() const
21512837Sgabeblack@google.com{
21612951Sgabeblack@google.com    return _gem5_module->obj()->get_child_events();
21712837Sgabeblack@google.com}
21812837Sgabeblack@google.com
21912951Sgabeblack@google.comsc_module::sc_module() :
22013079Sgabeblack@google.com    sc_object(sc_gem5::newModuleChecked()->name()),
22112951Sgabeblack@google.com    _gem5_module(sc_gem5::currentModule())
22212951Sgabeblack@google.com{}
22312837Sgabeblack@google.com
22412951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {}
22513191Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name))
22613191Sgabeblack@google.com{
22713191Sgabeblack@google.com    _gem5_module->deprecatedConstructor();
22813191Sgabeblack@google.com    SC_REPORT_WARNING("(W569) sc_module(const char*), "
22913191Sgabeblack@google.com            "sc_module(const std::string&) have been deprecated, use "
23013191Sgabeblack@google.com            "sc_module(const sc_module_name&)", _name);
23113191Sgabeblack@google.com}
23212951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) :
23312951Sgabeblack@google.com    sc_module(sc_module_name(_name.c_str()))
23413191Sgabeblack@google.com{
23513191Sgabeblack@google.com    _gem5_module->deprecatedConstructor();
23613191Sgabeblack@google.com    SC_REPORT_WARNING("(W569) sc_module(const char*), "
23713191Sgabeblack@google.com            "sc_module(const std::string&) have been deprecated, use "
23813191Sgabeblack@google.com            "sc_module(const sc_module_name&)", _name.c_str());
23913191Sgabeblack@google.com}
24013191Sgabeblack@google.com
24113191Sgabeblack@google.comvoid
24213191Sgabeblack@google.comsc_module::end_module()
24313191Sgabeblack@google.com{
24413191Sgabeblack@google.com    _gem5_module->endModule();
24513191Sgabeblack@google.com}
24612928Sgabeblack@google.com
24712837Sgabeblack@google.comvoid
24813260Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &port, bool val)
24912837Sgabeblack@google.com{
25013260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
25113260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, true);
25212837Sgabeblack@google.com}
25312837Sgabeblack@google.com
25412837Sgabeblack@google.comvoid
25513260Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &port, bool val)
25612837Sgabeblack@google.com{
25713260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
25813260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, true);
25912837Sgabeblack@google.com}
26012837Sgabeblack@google.com
26112837Sgabeblack@google.comvoid
26213260Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &port, bool val)
26312837Sgabeblack@google.com{
26413260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
26513260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, true);
26612837Sgabeblack@google.com}
26712837Sgabeblack@google.com
26812837Sgabeblack@google.comvoid
26913260Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val)
27012837Sgabeblack@google.com{
27113260Sgabeblack@google.com    sc_gem5::newResetSensitivitySignal(
27213260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &signal, val, true);
27312837Sgabeblack@google.com}
27412837Sgabeblack@google.com
27512837Sgabeblack@google.com
27612837Sgabeblack@google.comvoid
27713260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &port, bool val)
27812837Sgabeblack@google.com{
27913260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
28013260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, false);
28112837Sgabeblack@google.com}
28212837Sgabeblack@google.com
28312837Sgabeblack@google.comvoid
28413260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val)
28512837Sgabeblack@google.com{
28613260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
28713260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, false);
28812837Sgabeblack@google.com}
28912837Sgabeblack@google.com
29012837Sgabeblack@google.comvoid
29113260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &port, bool val)
29212837Sgabeblack@google.com{
29313260Sgabeblack@google.com    sc_gem5::newResetSensitivityPort(
29413260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &port, val, false);
29512837Sgabeblack@google.com}
29612837Sgabeblack@google.com
29712837Sgabeblack@google.comvoid
29813260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val)
29912837Sgabeblack@google.com{
30013260Sgabeblack@google.com    sc_gem5::newResetSensitivitySignal(
30113260Sgabeblack@google.com            ::sc_gem5::Process::newest(), &signal, val, false);
30212837Sgabeblack@google.com}
30312837Sgabeblack@google.com
30412837Sgabeblack@google.com
30512837Sgabeblack@google.comvoid
30612837Sgabeblack@google.comsc_module::dont_initialize()
30712837Sgabeblack@google.com{
30813194Sgabeblack@google.com    ::sc_gem5::Process::newest()->dontInitialize(true);
30912837Sgabeblack@google.com}
31012837Sgabeblack@google.com
31112837Sgabeblack@google.comvoid
31212953Sgabeblack@google.comsc_module::set_stack_size(size_t size)
31312837Sgabeblack@google.com{
31412953Sgabeblack@google.com    ::sc_gem5::Process::newest()->setStackSize(size);
31512837Sgabeblack@google.com}
31612837Sgabeblack@google.com
31712837Sgabeblack@google.com
31812951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
31912951Sgabeblack@google.com
32012837Sgabeblack@google.comvoid
32112951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e)
32212837Sgabeblack@google.com{
32312951Sgabeblack@google.com    ::sc_core::next_trigger(e);
32412837Sgabeblack@google.com}
32512837Sgabeblack@google.com
32612837Sgabeblack@google.comvoid
32712951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol)
32812837Sgabeblack@google.com{
32912951Sgabeblack@google.com    ::sc_core::next_trigger(eol);
33012837Sgabeblack@google.com}
33112837Sgabeblack@google.com
33212837Sgabeblack@google.comvoid
33312951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal)
33412837Sgabeblack@google.com{
33512951Sgabeblack@google.com    ::sc_core::next_trigger(eal);
33612837Sgabeblack@google.com}
33712837Sgabeblack@google.com
33812837Sgabeblack@google.comvoid
33912951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t)
34012837Sgabeblack@google.com{
34112951Sgabeblack@google.com    ::sc_core::next_trigger(t);
34212837Sgabeblack@google.com}
34312837Sgabeblack@google.com
34412837Sgabeblack@google.comvoid
34512951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u)
34612837Sgabeblack@google.com{
34712951Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
34812837Sgabeblack@google.com}
34912837Sgabeblack@google.com
35012837Sgabeblack@google.comvoid
35112951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e)
35212837Sgabeblack@google.com{
35312951Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
35412837Sgabeblack@google.com}
35512837Sgabeblack@google.com
35612837Sgabeblack@google.comvoid
35712951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
35812837Sgabeblack@google.com{
35912951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
36012837Sgabeblack@google.com}
36112837Sgabeblack@google.com
36212837Sgabeblack@google.comvoid
36312951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
36412837Sgabeblack@google.com{
36512951Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
36612837Sgabeblack@google.com}
36712837Sgabeblack@google.com
36812837Sgabeblack@google.comvoid
36912951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
37012837Sgabeblack@google.com{
37112951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
37212837Sgabeblack@google.com}
37312837Sgabeblack@google.com
37412837Sgabeblack@google.comvoid
37512951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
37612837Sgabeblack@google.com{
37712951Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
37812837Sgabeblack@google.com}
37912837Sgabeblack@google.com
38012837Sgabeblack@google.comvoid
38112951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
38212837Sgabeblack@google.com{
38312951Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
38412837Sgabeblack@google.com}
38512837Sgabeblack@google.com
38612837Sgabeblack@google.com
38712929Sgabeblack@google.combool
38812929Sgabeblack@google.comsc_module::timed_out()
38912929Sgabeblack@google.com{
39013189Sgabeblack@google.com    return ::sc_core::timed_out();
39112929Sgabeblack@google.com}
39212929Sgabeblack@google.com
39312929Sgabeblack@google.com
39412837Sgabeblack@google.comvoid
39512837Sgabeblack@google.comsc_module::wait()
39612837Sgabeblack@google.com{
39712951Sgabeblack@google.com    ::sc_core::wait();
39812837Sgabeblack@google.com}
39912837Sgabeblack@google.com
40012837Sgabeblack@google.comvoid
40112951Sgabeblack@google.comsc_module::wait(int i)
40212837Sgabeblack@google.com{
40312951Sgabeblack@google.com    ::sc_core::wait(i);
40412837Sgabeblack@google.com}
40512837Sgabeblack@google.com
40612837Sgabeblack@google.comvoid
40712951Sgabeblack@google.comsc_module::wait(const sc_event &e)
40812837Sgabeblack@google.com{
40912951Sgabeblack@google.com    ::sc_core::wait(e);
41012837Sgabeblack@google.com}
41112837Sgabeblack@google.com
41212837Sgabeblack@google.comvoid
41312951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol)
41412837Sgabeblack@google.com{
41512951Sgabeblack@google.com    ::sc_core::wait(eol);
41612837Sgabeblack@google.com}
41712837Sgabeblack@google.com
41812837Sgabeblack@google.comvoid
41912951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal)
42012837Sgabeblack@google.com{
42112951Sgabeblack@google.com    ::sc_core::wait(eal);
42212837Sgabeblack@google.com}
42312837Sgabeblack@google.com
42412837Sgabeblack@google.comvoid
42512951Sgabeblack@google.comsc_module::wait(const sc_time &t)
42612837Sgabeblack@google.com{
42712951Sgabeblack@google.com    ::sc_core::wait(t);
42812837Sgabeblack@google.com}
42912837Sgabeblack@google.com
43012837Sgabeblack@google.comvoid
43112951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u)
43212837Sgabeblack@google.com{
43312951Sgabeblack@google.com    ::sc_core::wait(d, u);
43412837Sgabeblack@google.com}
43512837Sgabeblack@google.com
43612837Sgabeblack@google.comvoid
43712951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e)
43812837Sgabeblack@google.com{
43912951Sgabeblack@google.com    ::sc_core::wait(t, e);
44012837Sgabeblack@google.com}
44112837Sgabeblack@google.com
44212837Sgabeblack@google.comvoid
44312951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e)
44412837Sgabeblack@google.com{
44512951Sgabeblack@google.com    ::sc_core::wait(d, u, e);
44612837Sgabeblack@google.com}
44712837Sgabeblack@google.com
44812837Sgabeblack@google.comvoid
44912951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol)
45012837Sgabeblack@google.com{
45112951Sgabeblack@google.com    ::sc_core::wait(t, eol);
45212837Sgabeblack@google.com}
45312837Sgabeblack@google.com
45412837Sgabeblack@google.comvoid
45512951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
45612837Sgabeblack@google.com{
45712951Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
45812837Sgabeblack@google.com}
45912837Sgabeblack@google.com
46012837Sgabeblack@google.comvoid
46112951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal)
46212837Sgabeblack@google.com{
46312951Sgabeblack@google.com    ::sc_core::wait(t, eal);
46412837Sgabeblack@google.com}
46512837Sgabeblack@google.com
46612837Sgabeblack@google.comvoid
46712951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
46812837Sgabeblack@google.com{
46912951Sgabeblack@google.com    ::sc_core::wait(d, u, eal);
47012837Sgabeblack@google.com}
47112837Sgabeblack@google.com
47212837Sgabeblack@google.com
47312837Sgabeblack@google.comvoid
47412909Sgabeblack@google.comsc_module::halt()
47512909Sgabeblack@google.com{
47612951Sgabeblack@google.com    ::sc_core::halt();
47712909Sgabeblack@google.com}
47812909Sgabeblack@google.com
47912914Sgabeblack@google.comvoid
48012951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s)
48112914Sgabeblack@google.com{
48212951Sgabeblack@google.com    ::sc_core::at_posedge(s);
48312914Sgabeblack@google.com}
48412914Sgabeblack@google.com
48512914Sgabeblack@google.comvoid
48612951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
48712914Sgabeblack@google.com{
48812951Sgabeblack@google.com    ::sc_core::at_posedge(s);
48912914Sgabeblack@google.com}
49012914Sgabeblack@google.com
49112914Sgabeblack@google.comvoid
49212951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s)
49312914Sgabeblack@google.com{
49412951Sgabeblack@google.com    ::sc_core::at_negedge(s);
49512914Sgabeblack@google.com}
49612914Sgabeblack@google.com
49712914Sgabeblack@google.comvoid
49812951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
49912914Sgabeblack@google.com{
50012951Sgabeblack@google.com    ::sc_core::at_negedge(s);
50112914Sgabeblack@google.com}
50212914Sgabeblack@google.com
50312909Sgabeblack@google.com
50412909Sgabeblack@google.comvoid
50512837Sgabeblack@google.comnext_trigger()
50612837Sgabeblack@google.com{
50712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
50813206Sgabeblack@google.com    p->cancelTimeout();
50913206Sgabeblack@google.com    p->clearDynamic();
51012837Sgabeblack@google.com}
51112837Sgabeblack@google.com
51212837Sgabeblack@google.comvoid
51312958Sgabeblack@google.comnext_trigger(const sc_event &e)
51412837Sgabeblack@google.com{
51512958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
51613206Sgabeblack@google.com    p->cancelTimeout();
51713207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEvent(p, &e);
51812837Sgabeblack@google.com}
51912837Sgabeblack@google.com
52012837Sgabeblack@google.comvoid
52112958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol)
52212837Sgabeblack@google.com{
52312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
52413206Sgabeblack@google.com    p->cancelTimeout();
52513207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol);
52612837Sgabeblack@google.com}
52712837Sgabeblack@google.com
52812837Sgabeblack@google.comvoid
52912958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal)
53012837Sgabeblack@google.com{
53112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
53213206Sgabeblack@google.com    p->cancelTimeout();
53313207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal);
53412837Sgabeblack@google.com}
53512837Sgabeblack@google.com
53612837Sgabeblack@google.comvoid
53712958Sgabeblack@google.comnext_trigger(const sc_time &t)
53812837Sgabeblack@google.com{
53912958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
54013206Sgabeblack@google.com    p->setTimeout(t);
54113206Sgabeblack@google.com    p->clearDynamic();
54212837Sgabeblack@google.com}
54312837Sgabeblack@google.com
54412837Sgabeblack@google.comvoid
54512951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u)
54612837Sgabeblack@google.com{
54712951Sgabeblack@google.com    next_trigger(sc_time(d, u));
54812837Sgabeblack@google.com}
54912837Sgabeblack@google.com
55012837Sgabeblack@google.comvoid
55112958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e)
55212837Sgabeblack@google.com{
55312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
55413206Sgabeblack@google.com    p->setTimeout(t);
55513207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEvent(p, &e);
55612837Sgabeblack@google.com}
55712837Sgabeblack@google.com
55812837Sgabeblack@google.comvoid
55912951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e)
56012837Sgabeblack@google.com{
56112951Sgabeblack@google.com    next_trigger(sc_time(d, u), e);
56212837Sgabeblack@google.com}
56312837Sgabeblack@google.com
56412837Sgabeblack@google.comvoid
56512958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol)
56612837Sgabeblack@google.com{
56712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
56813206Sgabeblack@google.com    p->setTimeout(t);
56913207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol);
57012837Sgabeblack@google.com}
57112837Sgabeblack@google.com
57212837Sgabeblack@google.comvoid
57312951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
57412837Sgabeblack@google.com{
57512951Sgabeblack@google.com    next_trigger(sc_time(d, u), eol);
57612837Sgabeblack@google.com}
57712837Sgabeblack@google.com
57812837Sgabeblack@google.comvoid
57912958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal)
58012837Sgabeblack@google.com{
58112958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
58213206Sgabeblack@google.com    p->setTimeout(t);
58313207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal);
58412837Sgabeblack@google.com}
58512837Sgabeblack@google.com
58612837Sgabeblack@google.comvoid
58712951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
58812837Sgabeblack@google.com{
58912951Sgabeblack@google.com    next_trigger(sc_time(d, u), eal);
59012837Sgabeblack@google.com}
59112837Sgabeblack@google.com
59212929Sgabeblack@google.combool
59312929Sgabeblack@google.comtimed_out()
59412929Sgabeblack@google.com{
59513189Sgabeblack@google.com    ::sc_gem5::Process *p = sc_gem5::scheduler.current();
59613189Sgabeblack@google.com    if (!p)
59713189Sgabeblack@google.com        return false;
59813189Sgabeblack@google.com    else
59913189Sgabeblack@google.com        return p->timedOut();
60012929Sgabeblack@google.com}
60112929Sgabeblack@google.com
60212837Sgabeblack@google.com
60313248Sgabeblack@google.comnamespace
60413248Sgabeblack@google.com{
60513248Sgabeblack@google.com
60613248Sgabeblack@google.combool
60713248Sgabeblack@google.comwaitErrorCheck(sc_gem5::Process *p)
60813248Sgabeblack@google.com{
60913248Sgabeblack@google.com    if (p->procKind() == SC_METHOD_PROC_) {
61013248Sgabeblack@google.com        SC_REPORT_ERROR(
61113248Sgabeblack@google.com                "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs",
61213248Sgabeblack@google.com                "\n        in SC_METHODs use next_trigger() instead");
61313248Sgabeblack@google.com        return true;
61413248Sgabeblack@google.com    }
61513248Sgabeblack@google.com    return false;
61613248Sgabeblack@google.com}
61713248Sgabeblack@google.com
61813248Sgabeblack@google.com} // anonymous namespace
61913248Sgabeblack@google.com
62012837Sgabeblack@google.comvoid
62112837Sgabeblack@google.comwait()
62212837Sgabeblack@google.com{
62312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
62413248Sgabeblack@google.com    if (waitErrorCheck(p))
62513248Sgabeblack@google.com        return;
62613206Sgabeblack@google.com    p->cancelTimeout();
62713206Sgabeblack@google.com    p->clearDynamic();
62812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
62912837Sgabeblack@google.com}
63012837Sgabeblack@google.com
63112837Sgabeblack@google.comvoid
63212958Sgabeblack@google.comwait(int n)
63312837Sgabeblack@google.com{
63413146Sgabeblack@google.com    if (n <= 0) {
63513146Sgabeblack@google.com        std::string msg = csprintf("n = %d", n);
63613146Sgabeblack@google.com        SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str());
63713146Sgabeblack@google.com    }
63813260Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
63913260Sgabeblack@google.com    p->waitCount(n - 1);
64013260Sgabeblack@google.com    wait();
64112837Sgabeblack@google.com}
64212837Sgabeblack@google.com
64312837Sgabeblack@google.comvoid
64412958Sgabeblack@google.comwait(const sc_event &e)
64512837Sgabeblack@google.com{
64612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
64713248Sgabeblack@google.com    if (waitErrorCheck(p))
64813248Sgabeblack@google.com        return;
64913206Sgabeblack@google.com    p->cancelTimeout();
65013207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEvent(p, &e);
65112958Sgabeblack@google.com    sc_gem5::scheduler.yield();
65212837Sgabeblack@google.com}
65312837Sgabeblack@google.com
65412837Sgabeblack@google.comvoid
65512958Sgabeblack@google.comwait(const sc_event_or_list &eol)
65612837Sgabeblack@google.com{
65712958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
65813248Sgabeblack@google.com    if (waitErrorCheck(p))
65913248Sgabeblack@google.com        return;
66013206Sgabeblack@google.com    p->cancelTimeout();
66113207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol);
66212958Sgabeblack@google.com    sc_gem5::scheduler.yield();
66312837Sgabeblack@google.com}
66412837Sgabeblack@google.com
66512837Sgabeblack@google.comvoid
66612958Sgabeblack@google.comwait(const sc_event_and_list &eal)
66712837Sgabeblack@google.com{
66812958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
66913248Sgabeblack@google.com    if (waitErrorCheck(p))
67013248Sgabeblack@google.com        return;
67113206Sgabeblack@google.com    p->cancelTimeout();
67213207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal);
67312958Sgabeblack@google.com    sc_gem5::scheduler.yield();
67412837Sgabeblack@google.com}
67512837Sgabeblack@google.com
67612837Sgabeblack@google.comvoid
67712958Sgabeblack@google.comwait(const sc_time &t)
67812837Sgabeblack@google.com{
67912958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
68013248Sgabeblack@google.com    if (waitErrorCheck(p))
68113248Sgabeblack@google.com        return;
68213206Sgabeblack@google.com    p->setTimeout(t);
68313206Sgabeblack@google.com    p->clearDynamic();
68412958Sgabeblack@google.com    sc_gem5::scheduler.yield();
68512837Sgabeblack@google.com}
68612837Sgabeblack@google.com
68712837Sgabeblack@google.comvoid
68812951Sgabeblack@google.comwait(double d, sc_time_unit u)
68912837Sgabeblack@google.com{
69012951Sgabeblack@google.com    wait(sc_time(d, u));
69112837Sgabeblack@google.com}
69212837Sgabeblack@google.com
69312837Sgabeblack@google.comvoid
69412958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e)
69512837Sgabeblack@google.com{
69612958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
69713248Sgabeblack@google.com    if (waitErrorCheck(p))
69813248Sgabeblack@google.com        return;
69913206Sgabeblack@google.com    p->setTimeout(t);
70013207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEvent(p, &e);
70112958Sgabeblack@google.com    sc_gem5::scheduler.yield();
70212837Sgabeblack@google.com}
70312837Sgabeblack@google.com
70412837Sgabeblack@google.comvoid
70512951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e)
70612837Sgabeblack@google.com{
70712951Sgabeblack@google.com    wait(sc_time(d, u), e);
70812837Sgabeblack@google.com}
70912837Sgabeblack@google.com
71012837Sgabeblack@google.comvoid
71112958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol)
71212837Sgabeblack@google.com{
71312958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
71413248Sgabeblack@google.com    if (waitErrorCheck(p))
71513248Sgabeblack@google.com        return;
71613206Sgabeblack@google.com    p->setTimeout(t);
71713207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol);
71812958Sgabeblack@google.com    sc_gem5::scheduler.yield();
71912837Sgabeblack@google.com}
72012837Sgabeblack@google.com
72112837Sgabeblack@google.comvoid
72212951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol)
72312837Sgabeblack@google.com{
72412951Sgabeblack@google.com    wait(sc_time(d, u), eol);
72512837Sgabeblack@google.com}
72612837Sgabeblack@google.com
72712837Sgabeblack@google.comvoid
72812958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal)
72912837Sgabeblack@google.com{
73012958Sgabeblack@google.com    sc_gem5::Process *p = sc_gem5::scheduler.current();
73113248Sgabeblack@google.com    if (waitErrorCheck(p))
73213248Sgabeblack@google.com        return;
73313206Sgabeblack@google.com    p->setTimeout(t);
73413207Sgabeblack@google.com    ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal);
73512958Sgabeblack@google.com    sc_gem5::scheduler.yield();
73612837Sgabeblack@google.com}
73712837Sgabeblack@google.com
73812837Sgabeblack@google.comvoid
73912951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal)
74012837Sgabeblack@google.com{
74112951Sgabeblack@google.com    wait(sc_time(d, u), eal);
74212837Sgabeblack@google.com}
74312837Sgabeblack@google.com
74412909Sgabeblack@google.comvoid
74512909Sgabeblack@google.comhalt()
74612909Sgabeblack@google.com{
74713175Sgabeblack@google.com    ::sc_core::wait();
74813175Sgabeblack@google.com    throw ::sc_gem5::ScHalt();
74912909Sgabeblack@google.com}
75012909Sgabeblack@google.com
75112914Sgabeblack@google.comvoid
75213155Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &s)
75312914Sgabeblack@google.com{
75413155Sgabeblack@google.com    while (s.read())
75513155Sgabeblack@google.com        wait();
75613155Sgabeblack@google.com    while (!s.read())
75713155Sgabeblack@google.com        wait();
75812914Sgabeblack@google.com}
75912914Sgabeblack@google.com
76012914Sgabeblack@google.comvoid
76113155Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
76212914Sgabeblack@google.com{
76313155Sgabeblack@google.com    while (s.read() == sc_dt::Log_1)
76413155Sgabeblack@google.com        wait();
76513155Sgabeblack@google.com    while (s.read() == sc_dt::Log_0)
76613155Sgabeblack@google.com        wait();
76712914Sgabeblack@google.com}
76812914Sgabeblack@google.com
76912914Sgabeblack@google.comvoid
77013155Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &s)
77112914Sgabeblack@google.com{
77213155Sgabeblack@google.com    while (!s.read())
77313155Sgabeblack@google.com        wait();
77413155Sgabeblack@google.com    while (s.read())
77513155Sgabeblack@google.com        wait();
77612914Sgabeblack@google.com}
77712914Sgabeblack@google.com
77812914Sgabeblack@google.comvoid
77913155Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
78012914Sgabeblack@google.com{
78113155Sgabeblack@google.com    while (s.read() == sc_dt::Log_0)
78213155Sgabeblack@google.com        wait();
78313155Sgabeblack@google.com    while (s.read() == sc_dt::Log_1)
78413155Sgabeblack@google.com        wait();
78512914Sgabeblack@google.com}
78612914Sgabeblack@google.com
78712837Sgabeblack@google.comconst char *
78813035Sgabeblack@google.comsc_gen_unique_name(const char *seed)
78912837Sgabeblack@google.com{
79013268Sgabeblack@google.com    auto mod = sc_gem5::pickParentModule();
79113035Sgabeblack@google.com    return mod ? mod->uniqueName(seed) :
79213035Sgabeblack@google.com        ::sc_gem5::nameGen.gen(seed);
79312837Sgabeblack@google.com}
79412837Sgabeblack@google.com
79512837Sgabeblack@google.combool
79612930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name)
79712930Sgabeblack@google.com{
79812930Sgabeblack@google.com    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
79912930Sgabeblack@google.com    return false;
80012930Sgabeblack@google.com}
80112930Sgabeblack@google.com
80212930Sgabeblack@google.combool
80312837Sgabeblack@google.comsc_start_of_simulation_invoked()
80412837Sgabeblack@google.com{
80512982Sgabeblack@google.com    return ::sc_gem5::kernel->startOfSimulationComplete();
80612837Sgabeblack@google.com}
80712837Sgabeblack@google.com
80812837Sgabeblack@google.combool
80912837Sgabeblack@google.comsc_end_of_simulation_invoked()
81012837Sgabeblack@google.com{
81112982Sgabeblack@google.com    return ::sc_gem5::kernel->endOfSimulationComplete();
81212837Sgabeblack@google.com}
81312837Sgabeblack@google.com
81412901Sgabeblack@google.comsc_module *
81512901Sgabeblack@google.comsc_module_sc_new(sc_module *mod)
81612901Sgabeblack@google.com{
81712901Sgabeblack@google.com    static std::vector<std::unique_ptr<sc_module> > modules;
81812901Sgabeblack@google.com    modules.emplace_back(mod);
81912901Sgabeblack@google.com    return mod;
82012901Sgabeblack@google.com}
82112901Sgabeblack@google.com
82212837Sgabeblack@google.com} // namespace sc_core
823