sc_module.cc revision 13135
14661Sksewell@umich.edu/*
25222Sksewell@umich.edu * Copyright 2018 Google, Inc.
34661Sksewell@umich.edu *
44661Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
54661Sksewell@umich.edu * modification, are permitted provided that the following conditions are
64661Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
74661Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
84661Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
94661Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
104661Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
114661Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
124661Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
134661Sksewell@umich.edu * this software without specific prior written permission.
144661Sksewell@umich.edu *
154661Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
164661Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
174661Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
184661Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
194661Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
204661Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
214661Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
224661Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
234661Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
244661Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
254661Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
264661Sksewell@umich.edu *
274661Sksewell@umich.edu * Authors: Gabe Black
284661Sksewell@umich.edu */
294661Sksewell@umich.edu
304661Sksewell@umich.edu#include <memory>
314661Sksewell@umich.edu#include <string>
324661Sksewell@umich.edu#include <vector>
334661Sksewell@umich.edu
344661Sksewell@umich.edu#include "base/logging.hh"
354661Sksewell@umich.edu#include "systemc/core/kernel.hh"
364661Sksewell@umich.edu#include "systemc/core/module.hh"
374661Sksewell@umich.edu#include "systemc/core/process_types.hh"
384661Sksewell@umich.edu#include "systemc/ext/core/sc_module.hh"
394661Sksewell@umich.edu#include "systemc/ext/core/sc_module_name.hh"
404661Sksewell@umich.edu#include "systemc/ext/utils/sc_report_handler.hh"
414661Sksewell@umich.edu
424661Sksewell@umich.edunamespace sc_gem5
434661Sksewell@umich.edu{
444661Sksewell@umich.edu
454661Sksewell@umich.eduProcess *
464661Sksewell@umich.edunewMethodProcess(const char *name, ProcessFuncWrapper *func)
474661Sksewell@umich.edu{
484661Sksewell@umich.edu    Method *p = new Method(name, func);
494661Sksewell@umich.edu    if (::sc_core::sc_is_running()) {
504661Sksewell@umich.edu        std::string name = p->name();
514661Sksewell@umich.edu        delete p;
524661Sksewell@umich.edu        SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while "
534661Sksewell@umich.edu                "simulation running", name.c_str());
544661Sksewell@umich.edu        return nullptr;
554661Sksewell@umich.edu    }
564661Sksewell@umich.edu    scheduler.reg(p);
574661Sksewell@umich.edu    return p;
584661Sksewell@umich.edu}
594661Sksewell@umich.edu
604661Sksewell@umich.eduProcess *
614661Sksewell@umich.edunewThreadProcess(const char *name, ProcessFuncWrapper *func)
624661Sksewell@umich.edu{
634661Sksewell@umich.edu    Thread *p = new Thread(name, func);
644661Sksewell@umich.edu    if (::sc_core::sc_is_running()) {
654661Sksewell@umich.edu        std::string name = p->name();
664661Sksewell@umich.edu        delete p;
674661Sksewell@umich.edu        SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while "
684661Sksewell@umich.edu                "simulation running", name.c_str());
694661Sksewell@umich.edu        return nullptr;
704661Sksewell@umich.edu    }
714661Sksewell@umich.edu    scheduler.reg(p);
724661Sksewell@umich.edu    return p;
734661Sksewell@umich.edu}
744661Sksewell@umich.edu
754661Sksewell@umich.eduProcess *
764661Sksewell@umich.edunewCThreadProcess(const char *name, ProcessFuncWrapper *func)
774661Sksewell@umich.edu{
784661Sksewell@umich.edu    CThread *p = new CThread(name, func);
794661Sksewell@umich.edu    if (::sc_core::sc_is_running()) {
804661Sksewell@umich.edu        std::string name = p->name();
814661Sksewell@umich.edu        delete p;
824661Sksewell@umich.edu        SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while "
834661Sksewell@umich.edu                "simulation running", name.c_str());
844661Sksewell@umich.edu        return nullptr;
854661Sksewell@umich.edu    }
864661Sksewell@umich.edu    scheduler.reg(p);
874661Sksewell@umich.edu    p->dontInitialize();
884661Sksewell@umich.edu    return p;
894661Sksewell@umich.edu}
904661Sksewell@umich.edu
914661Sksewell@umich.eduUniqueNameGen nameGen;
924661Sksewell@umich.edu
934661Sksewell@umich.edu} // namespace sc_gem5
944661Sksewell@umich.edu
954661Sksewell@umich.edunamespace sc_core
964661Sksewell@umich.edu{
974661Sksewell@umich.edu
984661Sksewell@umich.edusc_bind_proxy::sc_bind_proxy(sc_interface &_interface) :
994661Sksewell@umich.edu    _interface(&_interface), _port(nullptr)
1004661Sksewell@umich.edu{}
1014661Sksewell@umich.edu
1024661Sksewell@umich.edusc_bind_proxy::sc_bind_proxy(sc_port_base &_port) :
1034661Sksewell@umich.edu    _interface(nullptr), _port(&_port)
1044661Sksewell@umich.edu{}
1054661Sksewell@umich.edu
1064661Sksewell@umich.educonst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr);
1074661Sksewell@umich.edu
1084661Sksewell@umich.edusc_module::~sc_module() { delete _gem5_module; }
1094661Sksewell@umich.edu
1104661Sksewell@umich.educonst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr);
1114661Sksewell@umich.edu
1124661Sksewell@umich.eduvoid
1134661Sksewell@umich.edusc_module::operator () (const sc_bind_proxy &p001,
1144661Sksewell@umich.edu                        const sc_bind_proxy &p002,
1154661Sksewell@umich.edu                        const sc_bind_proxy &p003,
1164661Sksewell@umich.edu                        const sc_bind_proxy &p004,
1174661Sksewell@umich.edu                        const sc_bind_proxy &p005,
1184661Sksewell@umich.edu                        const sc_bind_proxy &p006,
1194661Sksewell@umich.edu                        const sc_bind_proxy &p007,
1204661Sksewell@umich.edu                        const sc_bind_proxy &p008,
1214661Sksewell@umich.edu                        const sc_bind_proxy &p009,
1224661Sksewell@umich.edu                        const sc_bind_proxy &p010,
1234661Sksewell@umich.edu                        const sc_bind_proxy &p011,
1244661Sksewell@umich.edu                        const sc_bind_proxy &p012,
1254661Sksewell@umich.edu                        const sc_bind_proxy &p013,
1264661Sksewell@umich.edu                        const sc_bind_proxy &p014,
1274661Sksewell@umich.edu                        const sc_bind_proxy &p015,
1284661Sksewell@umich.edu                        const sc_bind_proxy &p016,
1294661Sksewell@umich.edu                        const sc_bind_proxy &p017,
1304661Sksewell@umich.edu                        const sc_bind_proxy &p018,
1314661Sksewell@umich.edu                        const sc_bind_proxy &p019,
1324661Sksewell@umich.edu                        const sc_bind_proxy &p020,
1334661Sksewell@umich.edu                        const sc_bind_proxy &p021,
1344661Sksewell@umich.edu                        const sc_bind_proxy &p022,
1354661Sksewell@umich.edu                        const sc_bind_proxy &p023,
1364661Sksewell@umich.edu                        const sc_bind_proxy &p024,
1374661Sksewell@umich.edu                        const sc_bind_proxy &p025,
1384661Sksewell@umich.edu                        const sc_bind_proxy &p026,
1394661Sksewell@umich.edu                        const sc_bind_proxy &p027,
1404661Sksewell@umich.edu                        const sc_bind_proxy &p028,
1414661Sksewell@umich.edu                        const sc_bind_proxy &p029,
1424661Sksewell@umich.edu                        const sc_bind_proxy &p030,
1434661Sksewell@umich.edu                        const sc_bind_proxy &p031,
1444661Sksewell@umich.edu                        const sc_bind_proxy &p032,
1454661Sksewell@umich.edu                        const sc_bind_proxy &p033,
1464661Sksewell@umich.edu                        const sc_bind_proxy &p034,
1474661Sksewell@umich.edu                        const sc_bind_proxy &p035,
1484661Sksewell@umich.edu                        const sc_bind_proxy &p036,
1494661Sksewell@umich.edu                        const sc_bind_proxy &p037,
1504661Sksewell@umich.edu                        const sc_bind_proxy &p038,
1514661Sksewell@umich.edu                        const sc_bind_proxy &p039,
1524661Sksewell@umich.edu                        const sc_bind_proxy &p040,
1534661Sksewell@umich.edu                        const sc_bind_proxy &p041,
1544661Sksewell@umich.edu                        const sc_bind_proxy &p042,
1554661Sksewell@umich.edu                        const sc_bind_proxy &p043,
1564661Sksewell@umich.edu                        const sc_bind_proxy &p044,
1574661Sksewell@umich.edu                        const sc_bind_proxy &p045,
1584661Sksewell@umich.edu                        const sc_bind_proxy &p046,
1594661Sksewell@umich.edu                        const sc_bind_proxy &p047,
1604661Sksewell@umich.edu                        const sc_bind_proxy &p048,
1614661Sksewell@umich.edu                        const sc_bind_proxy &p049,
1624661Sksewell@umich.edu                        const sc_bind_proxy &p050,
1634661Sksewell@umich.edu                        const sc_bind_proxy &p051,
1644661Sksewell@umich.edu                        const sc_bind_proxy &p052,
1654661Sksewell@umich.edu                        const sc_bind_proxy &p053,
1664661Sksewell@umich.edu                        const sc_bind_proxy &p054,
1674661Sksewell@umich.edu                        const sc_bind_proxy &p055,
1684661Sksewell@umich.edu                        const sc_bind_proxy &p056,
1694661Sksewell@umich.edu                        const sc_bind_proxy &p057,
1704661Sksewell@umich.edu                        const sc_bind_proxy &p058,
1714661Sksewell@umich.edu                        const sc_bind_proxy &p059,
1724661Sksewell@umich.edu                        const sc_bind_proxy &p060,
1734661Sksewell@umich.edu                        const sc_bind_proxy &p061,
1744661Sksewell@umich.edu                        const sc_bind_proxy &p062,
1754661Sksewell@umich.edu                        const sc_bind_proxy &p063,
1764661Sksewell@umich.edu                        const sc_bind_proxy &p064)
1774661Sksewell@umich.edu{
1784661Sksewell@umich.edu    std::vector<const ::sc_core::sc_bind_proxy *> proxies;
1794661Sksewell@umich.edu    auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool {
1804661Sksewell@umich.edu        if (!p.port() && !p.interface())
1814661Sksewell@umich.edu            return false;
1824661Sksewell@umich.edu        proxies.push_back(&p);
1834661Sksewell@umich.edu        return true;
1844661Sksewell@umich.edu    };
1854661Sksewell@umich.edu    insert(p001) && insert(p002) && insert(p003) && insert(p004) &&
1864661Sksewell@umich.edu    insert(p005) && insert(p006) && insert(p007) && insert(p008) &&
1874661Sksewell@umich.edu    insert(p009) && insert(p010) && insert(p011) && insert(p012) &&
1884661Sksewell@umich.edu    insert(p013) && insert(p014) && insert(p015) && insert(p016) &&
1894661Sksewell@umich.edu    insert(p017) && insert(p018) && insert(p019) && insert(p020) &&
1904661Sksewell@umich.edu    insert(p021) && insert(p022) && insert(p023) && insert(p024) &&
1914661Sksewell@umich.edu    insert(p025) && insert(p026) && insert(p027) && insert(p028) &&
1924661Sksewell@umich.edu    insert(p029) && insert(p030) && insert(p031) && insert(p032) &&
1934661Sksewell@umich.edu    insert(p033) && insert(p034) && insert(p035) && insert(p036) &&
1944661Sksewell@umich.edu    insert(p037) && insert(p038) && insert(p039) && insert(p040) &&
1954661Sksewell@umich.edu    insert(p041) && insert(p042) && insert(p043) && insert(p044) &&
1964661Sksewell@umich.edu    insert(p045) && insert(p046) && insert(p047) && insert(p048) &&
1974661Sksewell@umich.edu    insert(p049) && insert(p050) && insert(p051) && insert(p052) &&
1984661Sksewell@umich.edu    insert(p053) && insert(p054) && insert(p055) && insert(p056) &&
1994661Sksewell@umich.edu    insert(p057) && insert(p058) && insert(p059) && insert(p060) &&
2004661Sksewell@umich.edu    insert(p061) && insert(p062) && insert(p063) && insert(p064);
2014661Sksewell@umich.edu    _gem5_module->bindPorts(proxies);
2024661Sksewell@umich.edu}
2034661Sksewell@umich.edu
2044661Sksewell@umich.educonst std::vector<sc_object *> &
2054661Sksewell@umich.edusc_module::get_child_objects() const
2064661Sksewell@umich.edu{
2074661Sksewell@umich.edu    return _gem5_module->obj()->get_child_objects();
2084661Sksewell@umich.edu}
2094661Sksewell@umich.edu
2104661Sksewell@umich.educonst std::vector<sc_event *> &
2114661Sksewell@umich.edusc_module::get_child_events() const
2124661Sksewell@umich.edu{
2134661Sksewell@umich.edu    return _gem5_module->obj()->get_child_events();
2144661Sksewell@umich.edu}
2154661Sksewell@umich.edu
2164661Sksewell@umich.edusc_module::sc_module() :
2174661Sksewell@umich.edu    sc_object(sc_gem5::newModuleChecked()->name()),
2184661Sksewell@umich.edu    _gem5_module(sc_gem5::currentModule())
2194661Sksewell@umich.edu{}
2204661Sksewell@umich.edu
2214661Sksewell@umich.edusc_module::sc_module(const sc_module_name &) : sc_module() {}
2224661Sksewell@umich.edusc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {}
2234661Sksewell@umich.edusc_module::sc_module(const std::string &_name) :
2244661Sksewell@umich.edu    sc_module(sc_module_name(_name.c_str()))
2254661Sksewell@umich.edu{}
2264661Sksewell@umich.edu
2274661Sksewell@umich.eduvoid
2284661Sksewell@umich.edusc_module::reset_signal_is(const sc_in<bool> &, bool)
2294661Sksewell@umich.edu{
2304661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2314661Sksewell@umich.edu}
2324661Sksewell@umich.edu
2334661Sksewell@umich.eduvoid
2344661Sksewell@umich.edusc_module::reset_signal_is(const sc_inout<bool> &, bool)
2354661Sksewell@umich.edu{
2364661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2374661Sksewell@umich.edu}
2384661Sksewell@umich.edu
2394661Sksewell@umich.eduvoid
2404661Sksewell@umich.edusc_module::reset_signal_is(const sc_out<bool> &, bool)
2414661Sksewell@umich.edu{
2424661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2434661Sksewell@umich.edu}
2444661Sksewell@umich.edu
2454661Sksewell@umich.eduvoid
2464661Sksewell@umich.edusc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
2474661Sksewell@umich.edu{
2484661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2494661Sksewell@umich.edu}
2504661Sksewell@umich.edu
2514661Sksewell@umich.edu
2524661Sksewell@umich.eduvoid
2534661Sksewell@umich.edusc_module::async_reset_signal_is(const sc_in<bool> &, bool)
2544661Sksewell@umich.edu{
2554661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2564661Sksewell@umich.edu}
2574661Sksewell@umich.edu
2584661Sksewell@umich.eduvoid
2594661Sksewell@umich.edusc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
2604661Sksewell@umich.edu{
2614661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2624661Sksewell@umich.edu}
2634661Sksewell@umich.edu
2644661Sksewell@umich.eduvoid
2654661Sksewell@umich.edusc_module::async_reset_signal_is(const sc_out<bool> &, bool)
2664661Sksewell@umich.edu{
2674661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2684661Sksewell@umich.edu}
2694661Sksewell@umich.edu
2704661Sksewell@umich.eduvoid
2714661Sksewell@umich.edusc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
2724661Sksewell@umich.edu{
2734661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
2744661Sksewell@umich.edu}
2754661Sksewell@umich.edu
2764661Sksewell@umich.edu
2774661Sksewell@umich.eduvoid
2784661Sksewell@umich.edusc_module::dont_initialize()
2794661Sksewell@umich.edu{
2804661Sksewell@umich.edu    ::sc_gem5::Process::newest()->dontInitialize();
2814661Sksewell@umich.edu}
2824661Sksewell@umich.edu
2834661Sksewell@umich.eduvoid
2844661Sksewell@umich.edusc_module::set_stack_size(size_t size)
2854661Sksewell@umich.edu{
2864661Sksewell@umich.edu    ::sc_gem5::Process::newest()->setStackSize(size);
2874661Sksewell@umich.edu}
2884661Sksewell@umich.edu
2894661Sksewell@umich.edu
2904661Sksewell@umich.eduvoid sc_module::next_trigger() { ::sc_core::next_trigger(); }
2914661Sksewell@umich.edu
2924661Sksewell@umich.eduvoid
2934661Sksewell@umich.edusc_module::next_trigger(const sc_event &e)
2944661Sksewell@umich.edu{
2954661Sksewell@umich.edu    ::sc_core::next_trigger(e);
2964661Sksewell@umich.edu}
2974661Sksewell@umich.edu
2984661Sksewell@umich.eduvoid
2994661Sksewell@umich.edusc_module::next_trigger(const sc_event_or_list &eol)
3004661Sksewell@umich.edu{
3014661Sksewell@umich.edu    ::sc_core::next_trigger(eol);
3024661Sksewell@umich.edu}
3034661Sksewell@umich.edu
3044661Sksewell@umich.eduvoid
3054661Sksewell@umich.edusc_module::next_trigger(const sc_event_and_list &eal)
3064661Sksewell@umich.edu{
3074661Sksewell@umich.edu    ::sc_core::next_trigger(eal);
3084661Sksewell@umich.edu}
3094661Sksewell@umich.edu
3104661Sksewell@umich.eduvoid
3114661Sksewell@umich.edusc_module::next_trigger(const sc_time &t)
3124661Sksewell@umich.edu{
3134661Sksewell@umich.edu    ::sc_core::next_trigger(t);
3144661Sksewell@umich.edu}
3154661Sksewell@umich.edu
3164661Sksewell@umich.eduvoid
3174661Sksewell@umich.edusc_module::next_trigger(double d, sc_time_unit u)
3184661Sksewell@umich.edu{
3194661Sksewell@umich.edu    ::sc_core::next_trigger(d, u);
3204661Sksewell@umich.edu}
3214661Sksewell@umich.edu
3224661Sksewell@umich.eduvoid
3234661Sksewell@umich.edusc_module::next_trigger(const sc_time &t, const sc_event &e)
3244661Sksewell@umich.edu{
3254661Sksewell@umich.edu    ::sc_core::next_trigger(t, e);
3264661Sksewell@umich.edu}
3274661Sksewell@umich.edu
3284661Sksewell@umich.eduvoid
3294661Sksewell@umich.edusc_module::next_trigger(double d, sc_time_unit u, const sc_event &e)
3304661Sksewell@umich.edu{
3314661Sksewell@umich.edu    ::sc_core::next_trigger(d, u, e);
3324661Sksewell@umich.edu}
3334661Sksewell@umich.edu
3344661Sksewell@umich.eduvoid
3354661Sksewell@umich.edusc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol)
3364661Sksewell@umich.edu{
3374661Sksewell@umich.edu    ::sc_core::next_trigger(t, eol);
3384661Sksewell@umich.edu}
3394661Sksewell@umich.edu
3404661Sksewell@umich.eduvoid
3414661Sksewell@umich.edusc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
3424661Sksewell@umich.edu{
3434661Sksewell@umich.edu    ::sc_core::next_trigger(d, u, eol);
3444661Sksewell@umich.edu}
3454661Sksewell@umich.edu
3464661Sksewell@umich.eduvoid
3474661Sksewell@umich.edusc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal)
3484661Sksewell@umich.edu{
3494661Sksewell@umich.edu    ::sc_core::next_trigger(t, eal);
3504661Sksewell@umich.edu}
3514661Sksewell@umich.edu
3524661Sksewell@umich.eduvoid
3534661Sksewell@umich.edusc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
3544661Sksewell@umich.edu{
3554661Sksewell@umich.edu    ::sc_core::next_trigger(d, u, eal);
3564661Sksewell@umich.edu}
3574661Sksewell@umich.edu
3584661Sksewell@umich.edu
3594661Sksewell@umich.edubool
3604661Sksewell@umich.edusc_module::timed_out()
3614661Sksewell@umich.edu{
3624661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
3634661Sksewell@umich.edu    return false;
3644661Sksewell@umich.edu}
3654661Sksewell@umich.edu
3664661Sksewell@umich.edu
3674661Sksewell@umich.eduvoid
3684661Sksewell@umich.edusc_module::wait()
3694661Sksewell@umich.edu{
3704661Sksewell@umich.edu    ::sc_core::wait();
3714661Sksewell@umich.edu}
3724661Sksewell@umich.edu
3734661Sksewell@umich.eduvoid
3744661Sksewell@umich.edusc_module::wait(int i)
3754661Sksewell@umich.edu{
3764661Sksewell@umich.edu    ::sc_core::wait(i);
3774661Sksewell@umich.edu}
3784661Sksewell@umich.edu
3794661Sksewell@umich.eduvoid
3804661Sksewell@umich.edusc_module::wait(const sc_event &e)
3814661Sksewell@umich.edu{
3824661Sksewell@umich.edu    ::sc_core::wait(e);
3834661Sksewell@umich.edu}
3844661Sksewell@umich.edu
3854661Sksewell@umich.eduvoid
3864661Sksewell@umich.edusc_module::wait(const sc_event_or_list &eol)
3874661Sksewell@umich.edu{
3884661Sksewell@umich.edu    ::sc_core::wait(eol);
3894661Sksewell@umich.edu}
3904661Sksewell@umich.edu
3914661Sksewell@umich.eduvoid
3924661Sksewell@umich.edusc_module::wait(const sc_event_and_list &eal)
3934661Sksewell@umich.edu{
3944661Sksewell@umich.edu    ::sc_core::wait(eal);
3954661Sksewell@umich.edu}
3964661Sksewell@umich.edu
3974661Sksewell@umich.eduvoid
3984661Sksewell@umich.edusc_module::wait(const sc_time &t)
3994661Sksewell@umich.edu{
4004661Sksewell@umich.edu    ::sc_core::wait(t);
4014661Sksewell@umich.edu}
4024661Sksewell@umich.edu
4034661Sksewell@umich.eduvoid
4044661Sksewell@umich.edusc_module::wait(double d, sc_time_unit u)
4054661Sksewell@umich.edu{
4064661Sksewell@umich.edu    ::sc_core::wait(d, u);
4074661Sksewell@umich.edu}
4084661Sksewell@umich.edu
4094661Sksewell@umich.eduvoid
4104661Sksewell@umich.edusc_module::wait(const sc_time &t, const sc_event &e)
4114661Sksewell@umich.edu{
4124661Sksewell@umich.edu    ::sc_core::wait(t, e);
4134661Sksewell@umich.edu}
4144661Sksewell@umich.edu
4154661Sksewell@umich.eduvoid
4164661Sksewell@umich.edusc_module::wait(double d, sc_time_unit u, const sc_event &e)
4174661Sksewell@umich.edu{
4184661Sksewell@umich.edu    ::sc_core::wait(d, u, e);
4194661Sksewell@umich.edu}
4204661Sksewell@umich.edu
4214661Sksewell@umich.eduvoid
4224661Sksewell@umich.edusc_module::wait(const sc_time &t, const sc_event_or_list &eol)
4234661Sksewell@umich.edu{
4244661Sksewell@umich.edu    ::sc_core::wait(t, eol);
4254661Sksewell@umich.edu}
4264661Sksewell@umich.edu
4274661Sksewell@umich.eduvoid
4284661Sksewell@umich.edusc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
4294661Sksewell@umich.edu{
4304661Sksewell@umich.edu    ::sc_core::wait(d, u, eol);
4314661Sksewell@umich.edu}
4324661Sksewell@umich.edu
4334661Sksewell@umich.eduvoid
4344661Sksewell@umich.edusc_module::wait(const sc_time &t, const sc_event_and_list &eal)
4354661Sksewell@umich.edu{
4364661Sksewell@umich.edu    ::sc_core::wait(t, eal);
4374661Sksewell@umich.edu}
4384661Sksewell@umich.edu
4394661Sksewell@umich.eduvoid
4404661Sksewell@umich.edusc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
4414661Sksewell@umich.edu{
4424661Sksewell@umich.edu    ::sc_core::wait(d, u, eal);
4434661Sksewell@umich.edu}
4444661Sksewell@umich.edu
4454661Sksewell@umich.edu
4464661Sksewell@umich.eduvoid
4474661Sksewell@umich.edusc_module::halt()
4484661Sksewell@umich.edu{
4494661Sksewell@umich.edu    ::sc_core::halt();
4504661Sksewell@umich.edu}
4514661Sksewell@umich.edu
4524661Sksewell@umich.eduvoid
4534661Sksewell@umich.edusc_module::at_posedge(const sc_signal_in_if<bool> &s)
4544661Sksewell@umich.edu{
4554661Sksewell@umich.edu    ::sc_core::at_posedge(s);
4564661Sksewell@umich.edu}
4574661Sksewell@umich.edu
4584661Sksewell@umich.eduvoid
4594661Sksewell@umich.edusc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
4604661Sksewell@umich.edu{
4614661Sksewell@umich.edu    ::sc_core::at_posedge(s);
4624661Sksewell@umich.edu}
4634661Sksewell@umich.edu
4644661Sksewell@umich.eduvoid
4654661Sksewell@umich.edusc_module::at_negedge(const sc_signal_in_if<bool> &s)
4664661Sksewell@umich.edu{
4674661Sksewell@umich.edu    ::sc_core::at_negedge(s);
4684661Sksewell@umich.edu}
4694661Sksewell@umich.edu
4704661Sksewell@umich.eduvoid
4714661Sksewell@umich.edusc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
4724661Sksewell@umich.edu{
4734661Sksewell@umich.edu    ::sc_core::at_negedge(s);
4744661Sksewell@umich.edu}
4754661Sksewell@umich.edu
4764661Sksewell@umich.edu
4774661Sksewell@umich.eduvoid
4784661Sksewell@umich.edunext_trigger()
4794661Sksewell@umich.edu{
4804661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
4814661Sksewell@umich.edu    p->setDynamic(nullptr);
4824661Sksewell@umich.edu}
4834661Sksewell@umich.edu
4844661Sksewell@umich.eduvoid
4854661Sksewell@umich.edunext_trigger(const sc_event &e)
4864661Sksewell@umich.edu{
4874661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
4884661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
4894661Sksewell@umich.edu}
4904661Sksewell@umich.edu
4914661Sksewell@umich.eduvoid
4924661Sksewell@umich.edunext_trigger(const sc_event_or_list &eol)
4934661Sksewell@umich.edu{
4944661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
4954661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
4964661Sksewell@umich.edu}
4974661Sksewell@umich.edu
4984661Sksewell@umich.eduvoid
4994661Sksewell@umich.edunext_trigger(const sc_event_and_list &eal)
5004661Sksewell@umich.edu{
5014661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5024661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
5034661Sksewell@umich.edu}
5044661Sksewell@umich.edu
5054661Sksewell@umich.eduvoid
5064661Sksewell@umich.edunext_trigger(const sc_time &t)
5074661Sksewell@umich.edu{
5084661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5094661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
5104661Sksewell@umich.edu}
5114661Sksewell@umich.edu
5124661Sksewell@umich.eduvoid
5134661Sksewell@umich.edunext_trigger(double d, sc_time_unit u)
5144661Sksewell@umich.edu{
5154661Sksewell@umich.edu    next_trigger(sc_time(d, u));
5164661Sksewell@umich.edu}
5174661Sksewell@umich.edu
5184661Sksewell@umich.eduvoid
5194661Sksewell@umich.edunext_trigger(const sc_time &t, const sc_event &e)
5204661Sksewell@umich.edu{
5214661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5224661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
5234661Sksewell@umich.edu}
5244661Sksewell@umich.edu
5254661Sksewell@umich.eduvoid
5264661Sksewell@umich.edunext_trigger(double d, sc_time_unit u, const sc_event &e)
5274661Sksewell@umich.edu{
5284661Sksewell@umich.edu    next_trigger(sc_time(d, u), e);
5294661Sksewell@umich.edu}
5304661Sksewell@umich.edu
5314661Sksewell@umich.eduvoid
5324661Sksewell@umich.edunext_trigger(const sc_time &t, const sc_event_or_list &eol)
5334661Sksewell@umich.edu{
5344661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5354661Sksewell@umich.edu    p->setDynamic(
5364661Sksewell@umich.edu            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
5374661Sksewell@umich.edu}
5384661Sksewell@umich.edu
5394661Sksewell@umich.eduvoid
5404661Sksewell@umich.edunext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
5414661Sksewell@umich.edu{
5424661Sksewell@umich.edu    next_trigger(sc_time(d, u), eol);
5434661Sksewell@umich.edu}
5444661Sksewell@umich.edu
5454661Sksewell@umich.eduvoid
5464661Sksewell@umich.edunext_trigger(const sc_time &t, const sc_event_and_list &eal)
5474661Sksewell@umich.edu{
5484661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5494661Sksewell@umich.edu    p->setDynamic(
5504661Sksewell@umich.edu            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
5514661Sksewell@umich.edu}
5524661Sksewell@umich.edu
5534661Sksewell@umich.eduvoid
5544661Sksewell@umich.edunext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal)
5554661Sksewell@umich.edu{
5564661Sksewell@umich.edu    next_trigger(sc_time(d, u), eal);
5574661Sksewell@umich.edu}
5584661Sksewell@umich.edu
5594661Sksewell@umich.edubool
5604661Sksewell@umich.edutimed_out()
5614661Sksewell@umich.edu{
5624661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
5634661Sksewell@umich.edu    return false;
5644661Sksewell@umich.edu}
5654661Sksewell@umich.edu
5664661Sksewell@umich.edu
5674661Sksewell@umich.eduvoid
5684661Sksewell@umich.eduwait()
5694661Sksewell@umich.edu{
5704661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5714661Sksewell@umich.edu    p->setDynamic(nullptr);
5724661Sksewell@umich.edu    sc_gem5::scheduler.yield();
5734661Sksewell@umich.edu}
5744661Sksewell@umich.edu
5754661Sksewell@umich.eduvoid
5764661Sksewell@umich.eduwait(int n)
5774661Sksewell@umich.edu{
5784661Sksewell@umich.edu    for (int i = 0; i < n; i++)
5794661Sksewell@umich.edu        wait();
5804661Sksewell@umich.edu}
5814661Sksewell@umich.edu
5824661Sksewell@umich.eduvoid
5834661Sksewell@umich.eduwait(const sc_event &e)
5844661Sksewell@umich.edu{
5854661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5864661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
5874661Sksewell@umich.edu    sc_gem5::scheduler.yield();
5884661Sksewell@umich.edu}
5894661Sksewell@umich.edu
5904661Sksewell@umich.eduvoid
5914661Sksewell@umich.eduwait(const sc_event_or_list &eol)
5924661Sksewell@umich.edu{
5934661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
5944661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
5954661Sksewell@umich.edu    sc_gem5::scheduler.yield();
5964661Sksewell@umich.edu}
5974661Sksewell@umich.edu
5984661Sksewell@umich.eduvoid
5994661Sksewell@umich.eduwait(const sc_event_and_list &eal)
6004661Sksewell@umich.edu{
6014661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
6024661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
6034661Sksewell@umich.edu    sc_gem5::scheduler.yield();
6044661Sksewell@umich.edu}
6054661Sksewell@umich.edu
6064661Sksewell@umich.eduvoid
6074661Sksewell@umich.eduwait(const sc_time &t)
6084661Sksewell@umich.edu{
6094661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
6104661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
6114661Sksewell@umich.edu    sc_gem5::scheduler.yield();
6124661Sksewell@umich.edu}
6134661Sksewell@umich.edu
6144661Sksewell@umich.eduvoid
6154661Sksewell@umich.eduwait(double d, sc_time_unit u)
6164661Sksewell@umich.edu{
6174661Sksewell@umich.edu    wait(sc_time(d, u));
6184661Sksewell@umich.edu}
6194661Sksewell@umich.edu
6204661Sksewell@umich.eduvoid
6214661Sksewell@umich.eduwait(const sc_time &t, const sc_event &e)
6224661Sksewell@umich.edu{
6234661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
6244661Sksewell@umich.edu    p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
6254661Sksewell@umich.edu    sc_gem5::scheduler.yield();
6264661Sksewell@umich.edu}
6274661Sksewell@umich.edu
6284661Sksewell@umich.eduvoid
6294661Sksewell@umich.eduwait(double d, sc_time_unit u, const sc_event &e)
6304661Sksewell@umich.edu{
6314661Sksewell@umich.edu    wait(sc_time(d, u), e);
6324661Sksewell@umich.edu}
6334661Sksewell@umich.edu
6344661Sksewell@umich.eduvoid
6354661Sksewell@umich.eduwait(const sc_time &t, const sc_event_or_list &eol)
6364661Sksewell@umich.edu{
6374661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
6384661Sksewell@umich.edu    p->setDynamic(
6394661Sksewell@umich.edu            new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
6404661Sksewell@umich.edu    sc_gem5::scheduler.yield();
6414661Sksewell@umich.edu}
6424661Sksewell@umich.edu
6434661Sksewell@umich.eduvoid
6444661Sksewell@umich.eduwait(double d, sc_time_unit u, const sc_event_or_list &eol)
6454661Sksewell@umich.edu{
6464661Sksewell@umich.edu    wait(sc_time(d, u), eol);
6474661Sksewell@umich.edu}
6484661Sksewell@umich.edu
6494661Sksewell@umich.eduvoid
6504661Sksewell@umich.eduwait(const sc_time &t, const sc_event_and_list &eal)
6514661Sksewell@umich.edu{
6524661Sksewell@umich.edu    sc_gem5::Process *p = sc_gem5::scheduler.current();
6534661Sksewell@umich.edu    p->setDynamic(
6544661Sksewell@umich.edu            new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
6554661Sksewell@umich.edu    sc_gem5::scheduler.yield();
6564661Sksewell@umich.edu}
6574661Sksewell@umich.edu
6584661Sksewell@umich.eduvoid
6594661Sksewell@umich.eduwait(double d, sc_time_unit u, const sc_event_and_list &eal)
6604661Sksewell@umich.edu{
6614661Sksewell@umich.edu    wait(sc_time(d, u), eal);
6624661Sksewell@umich.edu}
6634661Sksewell@umich.edu
6644661Sksewell@umich.eduvoid
6654661Sksewell@umich.eduhalt()
6664661Sksewell@umich.edu{
6674661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
6684661Sksewell@umich.edu}
6694661Sksewell@umich.edu
6704661Sksewell@umich.eduvoid
6714661Sksewell@umich.eduat_posedge(const sc_signal_in_if<bool> &)
6724661Sksewell@umich.edu{
6734661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
6744661Sksewell@umich.edu}
6754661Sksewell@umich.edu
6764661Sksewell@umich.eduvoid
6774661Sksewell@umich.eduat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
6784661Sksewell@umich.edu{
6794661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
6804661Sksewell@umich.edu}
6814661Sksewell@umich.edu
6824661Sksewell@umich.eduvoid
6834661Sksewell@umich.eduat_negedge(const sc_signal_in_if<bool> &)
6844661Sksewell@umich.edu{
6854661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
6864661Sksewell@umich.edu}
6874661Sksewell@umich.edu
6884661Sksewell@umich.eduvoid
6894661Sksewell@umich.eduat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
6904661Sksewell@umich.edu{
6914661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
6924661Sksewell@umich.edu}
6934661Sksewell@umich.edu
6944661Sksewell@umich.educonst char *
6954661Sksewell@umich.edusc_gen_unique_name(const char *seed)
6964661Sksewell@umich.edu{
6974661Sksewell@umich.edu    ::sc_gem5::Module *mod = ::sc_gem5::currentModule();
6984661Sksewell@umich.edu    return mod ? mod->uniqueName(seed) :
6994661Sksewell@umich.edu        ::sc_gem5::nameGen.gen(seed);
7004661Sksewell@umich.edu}
7014661Sksewell@umich.edu
7024661Sksewell@umich.edubool
7034661Sksewell@umich.edusc_hierarchical_name_exists(const char *name)
7044661Sksewell@umich.edu{
7054661Sksewell@umich.edu    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
7064661Sksewell@umich.edu    return false;
7074661Sksewell@umich.edu}
7084661Sksewell@umich.edu
7094661Sksewell@umich.edubool
7104661Sksewell@umich.edusc_start_of_simulation_invoked()
7114661Sksewell@umich.edu{
7124661Sksewell@umich.edu    return ::sc_gem5::kernel->startOfSimulationComplete();
7134661Sksewell@umich.edu}
7144661Sksewell@umich.edu
7154661Sksewell@umich.edubool
7164661Sksewell@umich.edusc_end_of_simulation_invoked()
7174661Sksewell@umich.edu{
7184661Sksewell@umich.edu    return ::sc_gem5::kernel->endOfSimulationComplete();
7194661Sksewell@umich.edu}
7204661Sksewell@umich.edu
7214661Sksewell@umich.edusc_module *
7224661Sksewell@umich.edusc_module_sc_new(sc_module *mod)
7234661Sksewell@umich.edu{
7244661Sksewell@umich.edu    static std::vector<std::unique_ptr<sc_module> > modules;
7254661Sksewell@umich.edu    modules.emplace_back(mod);
7264661Sksewell@umich.edu    return mod;
7274661Sksewell@umich.edu}
7284661Sksewell@umich.edu
7294661Sksewell@umich.edu} // namespace sc_core
7304661Sksewell@umich.edu