sc_module.cc revision 13284
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" 3513280Sgabeblack@google.com#include "systemc/core/event.hh" 3612982Sgabeblack@google.com#include "systemc/core/kernel.hh" 3712951Sgabeblack@google.com#include "systemc/core/module.hh" 3813280Sgabeblack@google.com#include "systemc/core/object.hh" 3912953Sgabeblack@google.com#include "systemc/core/process_types.hh" 4013260Sgabeblack@google.com#include "systemc/core/sensitivity.hh" 4113155Sgabeblack@google.com#include "systemc/ext/channel/sc_signal_in_if.hh" 4212837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh" 4312951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh" 4413155Sgabeblack@google.com#include "systemc/ext/dt/bit/sc_logic.hh" 4513135Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 4612837Sgabeblack@google.com 4712952Sgabeblack@google.comnamespace sc_gem5 4812952Sgabeblack@google.com{ 4912952Sgabeblack@google.com 5012952Sgabeblack@google.comProcess * 5112952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func) 5212952Sgabeblack@google.com{ 5313135Sgabeblack@google.com Method *p = new Method(name, func); 5413135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 5513135Sgabeblack@google.com std::string name = p->name(); 5613135Sgabeblack@google.com delete p; 5713135Sgabeblack@google.com SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 5813135Sgabeblack@google.com "simulation running", name.c_str()); 5913135Sgabeblack@google.com return nullptr; 6013135Sgabeblack@google.com } 6112993Sgabeblack@google.com scheduler.reg(p); 6212993Sgabeblack@google.com return p; 6312952Sgabeblack@google.com} 6412952Sgabeblack@google.com 6512952Sgabeblack@google.comProcess * 6612952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 6712952Sgabeblack@google.com{ 6813135Sgabeblack@google.com Thread *p = new Thread(name, func); 6913135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 7013135Sgabeblack@google.com std::string name = p->name(); 7113135Sgabeblack@google.com delete p; 7213135Sgabeblack@google.com SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 7313135Sgabeblack@google.com "simulation running", name.c_str()); 7413135Sgabeblack@google.com return nullptr; 7513135Sgabeblack@google.com } 7612993Sgabeblack@google.com scheduler.reg(p); 7712993Sgabeblack@google.com return p; 7812952Sgabeblack@google.com} 7912952Sgabeblack@google.com 8012952Sgabeblack@google.comProcess * 8112952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 8212952Sgabeblack@google.com{ 8313135Sgabeblack@google.com CThread *p = new CThread(name, func); 8413135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 8513135Sgabeblack@google.com std::string name = p->name(); 8613135Sgabeblack@google.com delete p; 8713135Sgabeblack@google.com SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 8813135Sgabeblack@google.com "simulation running", name.c_str()); 8913135Sgabeblack@google.com return nullptr; 9013135Sgabeblack@google.com } 9112993Sgabeblack@google.com scheduler.reg(p); 9213194Sgabeblack@google.com p->dontInitialize(true); 9312993Sgabeblack@google.com return p; 9412952Sgabeblack@google.com} 9512952Sgabeblack@google.com 9613035Sgabeblack@google.comUniqueNameGen nameGen; 9713035Sgabeblack@google.com 9812952Sgabeblack@google.com} // namespace sc_gem5 9912952Sgabeblack@google.com 10012837Sgabeblack@google.comnamespace sc_core 10112837Sgabeblack@google.com{ 10212837Sgabeblack@google.com 10313091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 10412951Sgabeblack@google.com _interface(&_interface), _port(nullptr) 10512951Sgabeblack@google.com{} 10612837Sgabeblack@google.com 10713091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 10812951Sgabeblack@google.com _interface(nullptr), _port(&_port) 10912951Sgabeblack@google.com{} 11012837Sgabeblack@google.com 11113091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 11212837Sgabeblack@google.com 11312982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 11412837Sgabeblack@google.com 11513091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 11612837Sgabeblack@google.com 11712837Sgabeblack@google.comvoid 11812837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 11912837Sgabeblack@google.com const sc_bind_proxy &p002, 12012837Sgabeblack@google.com const sc_bind_proxy &p003, 12112837Sgabeblack@google.com const sc_bind_proxy &p004, 12212837Sgabeblack@google.com const sc_bind_proxy &p005, 12312837Sgabeblack@google.com const sc_bind_proxy &p006, 12412837Sgabeblack@google.com const sc_bind_proxy &p007, 12512837Sgabeblack@google.com const sc_bind_proxy &p008, 12612837Sgabeblack@google.com const sc_bind_proxy &p009, 12712837Sgabeblack@google.com const sc_bind_proxy &p010, 12812837Sgabeblack@google.com const sc_bind_proxy &p011, 12912837Sgabeblack@google.com const sc_bind_proxy &p012, 13012837Sgabeblack@google.com const sc_bind_proxy &p013, 13112837Sgabeblack@google.com const sc_bind_proxy &p014, 13212837Sgabeblack@google.com const sc_bind_proxy &p015, 13312837Sgabeblack@google.com const sc_bind_proxy &p016, 13412837Sgabeblack@google.com const sc_bind_proxy &p017, 13512837Sgabeblack@google.com const sc_bind_proxy &p018, 13612837Sgabeblack@google.com const sc_bind_proxy &p019, 13712837Sgabeblack@google.com const sc_bind_proxy &p020, 13812837Sgabeblack@google.com const sc_bind_proxy &p021, 13912837Sgabeblack@google.com const sc_bind_proxy &p022, 14012837Sgabeblack@google.com const sc_bind_proxy &p023, 14112837Sgabeblack@google.com const sc_bind_proxy &p024, 14212837Sgabeblack@google.com const sc_bind_proxy &p025, 14312837Sgabeblack@google.com const sc_bind_proxy &p026, 14412837Sgabeblack@google.com const sc_bind_proxy &p027, 14512837Sgabeblack@google.com const sc_bind_proxy &p028, 14612837Sgabeblack@google.com const sc_bind_proxy &p029, 14712837Sgabeblack@google.com const sc_bind_proxy &p030, 14812837Sgabeblack@google.com const sc_bind_proxy &p031, 14912837Sgabeblack@google.com const sc_bind_proxy &p032, 15012837Sgabeblack@google.com const sc_bind_proxy &p033, 15112837Sgabeblack@google.com const sc_bind_proxy &p034, 15212837Sgabeblack@google.com const sc_bind_proxy &p035, 15312837Sgabeblack@google.com const sc_bind_proxy &p036, 15412837Sgabeblack@google.com const sc_bind_proxy &p037, 15512837Sgabeblack@google.com const sc_bind_proxy &p038, 15612837Sgabeblack@google.com const sc_bind_proxy &p039, 15712837Sgabeblack@google.com const sc_bind_proxy &p040, 15812837Sgabeblack@google.com const sc_bind_proxy &p041, 15912837Sgabeblack@google.com const sc_bind_proxy &p042, 16012837Sgabeblack@google.com const sc_bind_proxy &p043, 16112837Sgabeblack@google.com const sc_bind_proxy &p044, 16212837Sgabeblack@google.com const sc_bind_proxy &p045, 16312837Sgabeblack@google.com const sc_bind_proxy &p046, 16412837Sgabeblack@google.com const sc_bind_proxy &p047, 16512837Sgabeblack@google.com const sc_bind_proxy &p048, 16612837Sgabeblack@google.com const sc_bind_proxy &p049, 16712837Sgabeblack@google.com const sc_bind_proxy &p050, 16812837Sgabeblack@google.com const sc_bind_proxy &p051, 16912837Sgabeblack@google.com const sc_bind_proxy &p052, 17012837Sgabeblack@google.com const sc_bind_proxy &p053, 17112837Sgabeblack@google.com const sc_bind_proxy &p054, 17212837Sgabeblack@google.com const sc_bind_proxy &p055, 17312837Sgabeblack@google.com const sc_bind_proxy &p056, 17412837Sgabeblack@google.com const sc_bind_proxy &p057, 17512837Sgabeblack@google.com const sc_bind_proxy &p058, 17612837Sgabeblack@google.com const sc_bind_proxy &p059, 17712837Sgabeblack@google.com const sc_bind_proxy &p060, 17812837Sgabeblack@google.com const sc_bind_proxy &p061, 17912837Sgabeblack@google.com const sc_bind_proxy &p062, 18012837Sgabeblack@google.com const sc_bind_proxy &p063, 18112837Sgabeblack@google.com const sc_bind_proxy &p064) 18212837Sgabeblack@google.com{ 18313091Sgabeblack@google.com std::vector<const ::sc_core::sc_bind_proxy *> proxies; 18413091Sgabeblack@google.com auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 18513091Sgabeblack@google.com if (!p.port() && !p.interface()) 18613091Sgabeblack@google.com return false; 18713091Sgabeblack@google.com proxies.push_back(&p); 18813091Sgabeblack@google.com return true; 18913091Sgabeblack@google.com }; 19013091Sgabeblack@google.com insert(p001) && insert(p002) && insert(p003) && insert(p004) && 19113091Sgabeblack@google.com insert(p005) && insert(p006) && insert(p007) && insert(p008) && 19213091Sgabeblack@google.com insert(p009) && insert(p010) && insert(p011) && insert(p012) && 19313091Sgabeblack@google.com insert(p013) && insert(p014) && insert(p015) && insert(p016) && 19413091Sgabeblack@google.com insert(p017) && insert(p018) && insert(p019) && insert(p020) && 19513091Sgabeblack@google.com insert(p021) && insert(p022) && insert(p023) && insert(p024) && 19613091Sgabeblack@google.com insert(p025) && insert(p026) && insert(p027) && insert(p028) && 19713091Sgabeblack@google.com insert(p029) && insert(p030) && insert(p031) && insert(p032) && 19813091Sgabeblack@google.com insert(p033) && insert(p034) && insert(p035) && insert(p036) && 19913091Sgabeblack@google.com insert(p037) && insert(p038) && insert(p039) && insert(p040) && 20013091Sgabeblack@google.com insert(p041) && insert(p042) && insert(p043) && insert(p044) && 20113091Sgabeblack@google.com insert(p045) && insert(p046) && insert(p047) && insert(p048) && 20213091Sgabeblack@google.com insert(p049) && insert(p050) && insert(p051) && insert(p052) && 20313091Sgabeblack@google.com insert(p053) && insert(p054) && insert(p055) && insert(p056) && 20413091Sgabeblack@google.com insert(p057) && insert(p058) && insert(p059) && insert(p060) && 20513091Sgabeblack@google.com insert(p061) && insert(p062) && insert(p063) && insert(p064); 20613091Sgabeblack@google.com _gem5_module->bindPorts(proxies); 20712837Sgabeblack@google.com} 20812837Sgabeblack@google.com 20912837Sgabeblack@google.comconst std::vector<sc_object *> & 21012837Sgabeblack@google.comsc_module::get_child_objects() const 21112837Sgabeblack@google.com{ 21212951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 21312837Sgabeblack@google.com} 21412837Sgabeblack@google.com 21512837Sgabeblack@google.comconst std::vector<sc_event *> & 21612837Sgabeblack@google.comsc_module::get_child_events() const 21712837Sgabeblack@google.com{ 21812951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 21912837Sgabeblack@google.com} 22012837Sgabeblack@google.com 22112951Sgabeblack@google.comsc_module::sc_module() : 22213079Sgabeblack@google.com sc_object(sc_gem5::newModuleChecked()->name()), 22312951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 22413284Sgabeblack@google.com{ 22513284Sgabeblack@google.com if (sc_is_running()) { 22613284Sgabeblack@google.com SC_REPORT_ERROR("(E529) insert module failed", "simulation running"); 22713284Sgabeblack@google.com std::cout << "Running!\n"; 22813284Sgabeblack@google.com } 22913284Sgabeblack@google.com if (::sc_gem5::scheduler.elaborationDone()) { 23013284Sgabeblack@google.com SC_REPORT_ERROR("(E529) insert module failed", "elaboration done"); 23113284Sgabeblack@google.com std::cout << "Elaboration done!\n"; 23213284Sgabeblack@google.com } 23313284Sgabeblack@google.com} 23412837Sgabeblack@google.com 23512951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 23613191Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 23713191Sgabeblack@google.com{ 23813191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 23913191Sgabeblack@google.com SC_REPORT_WARNING("(W569) sc_module(const char*), " 24013191Sgabeblack@google.com "sc_module(const std::string&) have been deprecated, use " 24113191Sgabeblack@google.com "sc_module(const sc_module_name&)", _name); 24213191Sgabeblack@google.com} 24312951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 24412951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 24513191Sgabeblack@google.com{ 24613191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 24713191Sgabeblack@google.com SC_REPORT_WARNING("(W569) sc_module(const char*), " 24813191Sgabeblack@google.com "sc_module(const std::string&) have been deprecated, use " 24913191Sgabeblack@google.com "sc_module(const sc_module_name&)", _name.c_str()); 25013191Sgabeblack@google.com} 25113191Sgabeblack@google.com 25213191Sgabeblack@google.comvoid 25313191Sgabeblack@google.comsc_module::end_module() 25413191Sgabeblack@google.com{ 25513191Sgabeblack@google.com _gem5_module->endModule(); 25613191Sgabeblack@google.com} 25712928Sgabeblack@google.com 25812837Sgabeblack@google.comvoid 25913260Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &port, bool val) 26012837Sgabeblack@google.com{ 26113260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 26213260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, true); 26312837Sgabeblack@google.com} 26412837Sgabeblack@google.com 26512837Sgabeblack@google.comvoid 26613260Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 26712837Sgabeblack@google.com{ 26813260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 26913260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, true); 27012837Sgabeblack@google.com} 27112837Sgabeblack@google.com 27212837Sgabeblack@google.comvoid 27313260Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &port, bool val) 27412837Sgabeblack@google.com{ 27513260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 27613260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, true); 27712837Sgabeblack@google.com} 27812837Sgabeblack@google.com 27912837Sgabeblack@google.comvoid 28013260Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 28112837Sgabeblack@google.com{ 28213260Sgabeblack@google.com sc_gem5::newResetSensitivitySignal( 28313260Sgabeblack@google.com ::sc_gem5::Process::newest(), &signal, val, true); 28412837Sgabeblack@google.com} 28512837Sgabeblack@google.com 28612837Sgabeblack@google.com 28712837Sgabeblack@google.comvoid 28813260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 28912837Sgabeblack@google.com{ 29013260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 29113260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, false); 29212837Sgabeblack@google.com} 29312837Sgabeblack@google.com 29412837Sgabeblack@google.comvoid 29513260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 29612837Sgabeblack@google.com{ 29713260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 29813260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, false); 29912837Sgabeblack@google.com} 30012837Sgabeblack@google.com 30112837Sgabeblack@google.comvoid 30213260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 30312837Sgabeblack@google.com{ 30413260Sgabeblack@google.com sc_gem5::newResetSensitivityPort( 30513260Sgabeblack@google.com ::sc_gem5::Process::newest(), &port, val, false); 30612837Sgabeblack@google.com} 30712837Sgabeblack@google.com 30812837Sgabeblack@google.comvoid 30913260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 31012837Sgabeblack@google.com{ 31113260Sgabeblack@google.com sc_gem5::newResetSensitivitySignal( 31213260Sgabeblack@google.com ::sc_gem5::Process::newest(), &signal, val, false); 31312837Sgabeblack@google.com} 31412837Sgabeblack@google.com 31512837Sgabeblack@google.com 31612837Sgabeblack@google.comvoid 31712837Sgabeblack@google.comsc_module::dont_initialize() 31812837Sgabeblack@google.com{ 31913194Sgabeblack@google.com ::sc_gem5::Process::newest()->dontInitialize(true); 32012837Sgabeblack@google.com} 32112837Sgabeblack@google.com 32212837Sgabeblack@google.comvoid 32312953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 32412837Sgabeblack@google.com{ 32512953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 32612837Sgabeblack@google.com} 32712837Sgabeblack@google.com 32812837Sgabeblack@google.com 32912951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 33012951Sgabeblack@google.com 33112837Sgabeblack@google.comvoid 33212951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 33312837Sgabeblack@google.com{ 33412951Sgabeblack@google.com ::sc_core::next_trigger(e); 33512837Sgabeblack@google.com} 33612837Sgabeblack@google.com 33712837Sgabeblack@google.comvoid 33812951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 33912837Sgabeblack@google.com{ 34012951Sgabeblack@google.com ::sc_core::next_trigger(eol); 34112837Sgabeblack@google.com} 34212837Sgabeblack@google.com 34312837Sgabeblack@google.comvoid 34412951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 34512837Sgabeblack@google.com{ 34612951Sgabeblack@google.com ::sc_core::next_trigger(eal); 34712837Sgabeblack@google.com} 34812837Sgabeblack@google.com 34912837Sgabeblack@google.comvoid 35012951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 35112837Sgabeblack@google.com{ 35212951Sgabeblack@google.com ::sc_core::next_trigger(t); 35312837Sgabeblack@google.com} 35412837Sgabeblack@google.com 35512837Sgabeblack@google.comvoid 35612951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 35712837Sgabeblack@google.com{ 35812951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 35912837Sgabeblack@google.com} 36012837Sgabeblack@google.com 36112837Sgabeblack@google.comvoid 36212951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 36312837Sgabeblack@google.com{ 36412951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 36512837Sgabeblack@google.com} 36612837Sgabeblack@google.com 36712837Sgabeblack@google.comvoid 36812951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 36912837Sgabeblack@google.com{ 37012951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 37112837Sgabeblack@google.com} 37212837Sgabeblack@google.com 37312837Sgabeblack@google.comvoid 37412951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 37512837Sgabeblack@google.com{ 37612951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 37712837Sgabeblack@google.com} 37812837Sgabeblack@google.com 37912837Sgabeblack@google.comvoid 38012951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 38112837Sgabeblack@google.com{ 38212951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 38312837Sgabeblack@google.com} 38412837Sgabeblack@google.com 38512837Sgabeblack@google.comvoid 38612951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 38712837Sgabeblack@google.com{ 38812951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 38912837Sgabeblack@google.com} 39012837Sgabeblack@google.com 39112837Sgabeblack@google.comvoid 39212951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 39312837Sgabeblack@google.com{ 39412951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 39512837Sgabeblack@google.com} 39612837Sgabeblack@google.com 39712837Sgabeblack@google.com 39812929Sgabeblack@google.combool 39912929Sgabeblack@google.comsc_module::timed_out() 40012929Sgabeblack@google.com{ 40113189Sgabeblack@google.com return ::sc_core::timed_out(); 40212929Sgabeblack@google.com} 40312929Sgabeblack@google.com 40412929Sgabeblack@google.com 40512837Sgabeblack@google.comvoid 40612837Sgabeblack@google.comsc_module::wait() 40712837Sgabeblack@google.com{ 40812951Sgabeblack@google.com ::sc_core::wait(); 40912837Sgabeblack@google.com} 41012837Sgabeblack@google.com 41112837Sgabeblack@google.comvoid 41212951Sgabeblack@google.comsc_module::wait(int i) 41312837Sgabeblack@google.com{ 41412951Sgabeblack@google.com ::sc_core::wait(i); 41512837Sgabeblack@google.com} 41612837Sgabeblack@google.com 41712837Sgabeblack@google.comvoid 41812951Sgabeblack@google.comsc_module::wait(const sc_event &e) 41912837Sgabeblack@google.com{ 42012951Sgabeblack@google.com ::sc_core::wait(e); 42112837Sgabeblack@google.com} 42212837Sgabeblack@google.com 42312837Sgabeblack@google.comvoid 42412951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 42512837Sgabeblack@google.com{ 42612951Sgabeblack@google.com ::sc_core::wait(eol); 42712837Sgabeblack@google.com} 42812837Sgabeblack@google.com 42912837Sgabeblack@google.comvoid 43012951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 43112837Sgabeblack@google.com{ 43212951Sgabeblack@google.com ::sc_core::wait(eal); 43312837Sgabeblack@google.com} 43412837Sgabeblack@google.com 43512837Sgabeblack@google.comvoid 43612951Sgabeblack@google.comsc_module::wait(const sc_time &t) 43712837Sgabeblack@google.com{ 43812951Sgabeblack@google.com ::sc_core::wait(t); 43912837Sgabeblack@google.com} 44012837Sgabeblack@google.com 44112837Sgabeblack@google.comvoid 44212951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 44312837Sgabeblack@google.com{ 44412951Sgabeblack@google.com ::sc_core::wait(d, u); 44512837Sgabeblack@google.com} 44612837Sgabeblack@google.com 44712837Sgabeblack@google.comvoid 44812951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 44912837Sgabeblack@google.com{ 45012951Sgabeblack@google.com ::sc_core::wait(t, e); 45112837Sgabeblack@google.com} 45212837Sgabeblack@google.com 45312837Sgabeblack@google.comvoid 45412951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 45512837Sgabeblack@google.com{ 45612951Sgabeblack@google.com ::sc_core::wait(d, u, e); 45712837Sgabeblack@google.com} 45812837Sgabeblack@google.com 45912837Sgabeblack@google.comvoid 46012951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 46112837Sgabeblack@google.com{ 46212951Sgabeblack@google.com ::sc_core::wait(t, eol); 46312837Sgabeblack@google.com} 46412837Sgabeblack@google.com 46512837Sgabeblack@google.comvoid 46612951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 46712837Sgabeblack@google.com{ 46812951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 46912837Sgabeblack@google.com} 47012837Sgabeblack@google.com 47112837Sgabeblack@google.comvoid 47212951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 47312837Sgabeblack@google.com{ 47412951Sgabeblack@google.com ::sc_core::wait(t, eal); 47512837Sgabeblack@google.com} 47612837Sgabeblack@google.com 47712837Sgabeblack@google.comvoid 47812951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 47912837Sgabeblack@google.com{ 48012951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 48112837Sgabeblack@google.com} 48212837Sgabeblack@google.com 48312837Sgabeblack@google.com 48412837Sgabeblack@google.comvoid 48512909Sgabeblack@google.comsc_module::halt() 48612909Sgabeblack@google.com{ 48712951Sgabeblack@google.com ::sc_core::halt(); 48812909Sgabeblack@google.com} 48912909Sgabeblack@google.com 49012914Sgabeblack@google.comvoid 49112951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 49212914Sgabeblack@google.com{ 49312951Sgabeblack@google.com ::sc_core::at_posedge(s); 49412914Sgabeblack@google.com} 49512914Sgabeblack@google.com 49612914Sgabeblack@google.comvoid 49712951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 49812914Sgabeblack@google.com{ 49912951Sgabeblack@google.com ::sc_core::at_posedge(s); 50012914Sgabeblack@google.com} 50112914Sgabeblack@google.com 50212914Sgabeblack@google.comvoid 50312951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 50412914Sgabeblack@google.com{ 50512951Sgabeblack@google.com ::sc_core::at_negedge(s); 50612914Sgabeblack@google.com} 50712914Sgabeblack@google.com 50812914Sgabeblack@google.comvoid 50912951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 51012914Sgabeblack@google.com{ 51112951Sgabeblack@google.com ::sc_core::at_negedge(s); 51212914Sgabeblack@google.com} 51312914Sgabeblack@google.com 51412909Sgabeblack@google.com 51512909Sgabeblack@google.comvoid 51612837Sgabeblack@google.comnext_trigger() 51712837Sgabeblack@google.com{ 51812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 51913206Sgabeblack@google.com p->cancelTimeout(); 52013206Sgabeblack@google.com p->clearDynamic(); 52112837Sgabeblack@google.com} 52212837Sgabeblack@google.com 52312837Sgabeblack@google.comvoid 52412958Sgabeblack@google.comnext_trigger(const sc_event &e) 52512837Sgabeblack@google.com{ 52612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 52713206Sgabeblack@google.com p->cancelTimeout(); 52813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 52912837Sgabeblack@google.com} 53012837Sgabeblack@google.com 53112837Sgabeblack@google.comvoid 53212958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 53312837Sgabeblack@google.com{ 53412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53513206Sgabeblack@google.com p->cancelTimeout(); 53613207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 53712837Sgabeblack@google.com} 53812837Sgabeblack@google.com 53912837Sgabeblack@google.comvoid 54012958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 54112837Sgabeblack@google.com{ 54212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54313206Sgabeblack@google.com p->cancelTimeout(); 54413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 54512837Sgabeblack@google.com} 54612837Sgabeblack@google.com 54712837Sgabeblack@google.comvoid 54812958Sgabeblack@google.comnext_trigger(const sc_time &t) 54912837Sgabeblack@google.com{ 55012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55113206Sgabeblack@google.com p->setTimeout(t); 55213206Sgabeblack@google.com p->clearDynamic(); 55312837Sgabeblack@google.com} 55412837Sgabeblack@google.com 55512837Sgabeblack@google.comvoid 55612951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 55712837Sgabeblack@google.com{ 55812951Sgabeblack@google.com next_trigger(sc_time(d, u)); 55912837Sgabeblack@google.com} 56012837Sgabeblack@google.com 56112837Sgabeblack@google.comvoid 56212958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 56312837Sgabeblack@google.com{ 56412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56513206Sgabeblack@google.com p->setTimeout(t); 56613207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 56712837Sgabeblack@google.com} 56812837Sgabeblack@google.com 56912837Sgabeblack@google.comvoid 57012951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 57112837Sgabeblack@google.com{ 57212951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 57312837Sgabeblack@google.com} 57412837Sgabeblack@google.com 57512837Sgabeblack@google.comvoid 57612958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 57712837Sgabeblack@google.com{ 57812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 57913206Sgabeblack@google.com p->setTimeout(t); 58013207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 58112837Sgabeblack@google.com} 58212837Sgabeblack@google.com 58312837Sgabeblack@google.comvoid 58412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 58512837Sgabeblack@google.com{ 58612951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 58712837Sgabeblack@google.com} 58812837Sgabeblack@google.com 58912837Sgabeblack@google.comvoid 59012958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 59112837Sgabeblack@google.com{ 59212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 59313206Sgabeblack@google.com p->setTimeout(t); 59413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 59512837Sgabeblack@google.com} 59612837Sgabeblack@google.com 59712837Sgabeblack@google.comvoid 59812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 59912837Sgabeblack@google.com{ 60012951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 60112837Sgabeblack@google.com} 60212837Sgabeblack@google.com 60312929Sgabeblack@google.combool 60412929Sgabeblack@google.comtimed_out() 60512929Sgabeblack@google.com{ 60613189Sgabeblack@google.com ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 60713189Sgabeblack@google.com if (!p) 60813189Sgabeblack@google.com return false; 60913189Sgabeblack@google.com else 61013189Sgabeblack@google.com return p->timedOut(); 61112929Sgabeblack@google.com} 61212929Sgabeblack@google.com 61312837Sgabeblack@google.com 61413248Sgabeblack@google.comnamespace 61513248Sgabeblack@google.com{ 61613248Sgabeblack@google.com 61713248Sgabeblack@google.combool 61813248Sgabeblack@google.comwaitErrorCheck(sc_gem5::Process *p) 61913248Sgabeblack@google.com{ 62013248Sgabeblack@google.com if (p->procKind() == SC_METHOD_PROC_) { 62113248Sgabeblack@google.com SC_REPORT_ERROR( 62213248Sgabeblack@google.com "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs", 62313248Sgabeblack@google.com "\n in SC_METHODs use next_trigger() instead"); 62413248Sgabeblack@google.com return true; 62513248Sgabeblack@google.com } 62613248Sgabeblack@google.com return false; 62713248Sgabeblack@google.com} 62813248Sgabeblack@google.com 62913248Sgabeblack@google.com} // anonymous namespace 63013248Sgabeblack@google.com 63112837Sgabeblack@google.comvoid 63212837Sgabeblack@google.comwait() 63312837Sgabeblack@google.com{ 63412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 63513248Sgabeblack@google.com if (waitErrorCheck(p)) 63613248Sgabeblack@google.com return; 63713206Sgabeblack@google.com p->cancelTimeout(); 63813206Sgabeblack@google.com p->clearDynamic(); 63912958Sgabeblack@google.com sc_gem5::scheduler.yield(); 64012837Sgabeblack@google.com} 64112837Sgabeblack@google.com 64212837Sgabeblack@google.comvoid 64312958Sgabeblack@google.comwait(int n) 64412837Sgabeblack@google.com{ 64513146Sgabeblack@google.com if (n <= 0) { 64613146Sgabeblack@google.com std::string msg = csprintf("n = %d", n); 64713146Sgabeblack@google.com SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str()); 64813146Sgabeblack@google.com } 64913260Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 65013260Sgabeblack@google.com p->waitCount(n - 1); 65113260Sgabeblack@google.com wait(); 65212837Sgabeblack@google.com} 65312837Sgabeblack@google.com 65412837Sgabeblack@google.comvoid 65512958Sgabeblack@google.comwait(const sc_event &e) 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::newDynamicSensitivityEvent(p, &e); 66212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 66312837Sgabeblack@google.com} 66412837Sgabeblack@google.com 66512837Sgabeblack@google.comvoid 66612958Sgabeblack@google.comwait(const sc_event_or_list &eol) 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::newDynamicSensitivityEventOrList(p, &eol); 67312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 67412837Sgabeblack@google.com} 67512837Sgabeblack@google.com 67612837Sgabeblack@google.comvoid 67712958Sgabeblack@google.comwait(const sc_event_and_list &eal) 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->cancelTimeout(); 68313207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 68412958Sgabeblack@google.com sc_gem5::scheduler.yield(); 68512837Sgabeblack@google.com} 68612837Sgabeblack@google.com 68712837Sgabeblack@google.comvoid 68812958Sgabeblack@google.comwait(const sc_time &t) 68912837Sgabeblack@google.com{ 69012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 69113248Sgabeblack@google.com if (waitErrorCheck(p)) 69213248Sgabeblack@google.com return; 69313206Sgabeblack@google.com p->setTimeout(t); 69413206Sgabeblack@google.com p->clearDynamic(); 69512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 69612837Sgabeblack@google.com} 69712837Sgabeblack@google.com 69812837Sgabeblack@google.comvoid 69912951Sgabeblack@google.comwait(double d, sc_time_unit u) 70012837Sgabeblack@google.com{ 70112951Sgabeblack@google.com wait(sc_time(d, u)); 70212837Sgabeblack@google.com} 70312837Sgabeblack@google.com 70412837Sgabeblack@google.comvoid 70512958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 70612837Sgabeblack@google.com{ 70712958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 70813248Sgabeblack@google.com if (waitErrorCheck(p)) 70913248Sgabeblack@google.com return; 71013206Sgabeblack@google.com p->setTimeout(t); 71113207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 71212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 71312837Sgabeblack@google.com} 71412837Sgabeblack@google.com 71512837Sgabeblack@google.comvoid 71612951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 71712837Sgabeblack@google.com{ 71812951Sgabeblack@google.com wait(sc_time(d, u), e); 71912837Sgabeblack@google.com} 72012837Sgabeblack@google.com 72112837Sgabeblack@google.comvoid 72212958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 72312837Sgabeblack@google.com{ 72412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 72513248Sgabeblack@google.com if (waitErrorCheck(p)) 72613248Sgabeblack@google.com return; 72713206Sgabeblack@google.com p->setTimeout(t); 72813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 72912958Sgabeblack@google.com sc_gem5::scheduler.yield(); 73012837Sgabeblack@google.com} 73112837Sgabeblack@google.com 73212837Sgabeblack@google.comvoid 73312951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 73412837Sgabeblack@google.com{ 73512951Sgabeblack@google.com wait(sc_time(d, u), eol); 73612837Sgabeblack@google.com} 73712837Sgabeblack@google.com 73812837Sgabeblack@google.comvoid 73912958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 74012837Sgabeblack@google.com{ 74112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 74213248Sgabeblack@google.com if (waitErrorCheck(p)) 74313248Sgabeblack@google.com return; 74413206Sgabeblack@google.com p->setTimeout(t); 74513207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 74612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 74712837Sgabeblack@google.com} 74812837Sgabeblack@google.com 74912837Sgabeblack@google.comvoid 75012951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 75112837Sgabeblack@google.com{ 75212951Sgabeblack@google.com wait(sc_time(d, u), eal); 75312837Sgabeblack@google.com} 75412837Sgabeblack@google.com 75512909Sgabeblack@google.comvoid 75612909Sgabeblack@google.comhalt() 75712909Sgabeblack@google.com{ 75813175Sgabeblack@google.com ::sc_core::wait(); 75913175Sgabeblack@google.com throw ::sc_gem5::ScHalt(); 76012909Sgabeblack@google.com} 76112909Sgabeblack@google.com 76212914Sgabeblack@google.comvoid 76313155Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &s) 76412914Sgabeblack@google.com{ 76513155Sgabeblack@google.com while (s.read()) 76613155Sgabeblack@google.com wait(); 76713155Sgabeblack@google.com while (!s.read()) 76813155Sgabeblack@google.com wait(); 76912914Sgabeblack@google.com} 77012914Sgabeblack@google.com 77112914Sgabeblack@google.comvoid 77213155Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 77312914Sgabeblack@google.com{ 77413155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 77513155Sgabeblack@google.com wait(); 77613155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 77713155Sgabeblack@google.com wait(); 77812914Sgabeblack@google.com} 77912914Sgabeblack@google.com 78012914Sgabeblack@google.comvoid 78113155Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &s) 78212914Sgabeblack@google.com{ 78313155Sgabeblack@google.com while (!s.read()) 78413155Sgabeblack@google.com wait(); 78513155Sgabeblack@google.com while (s.read()) 78613155Sgabeblack@google.com wait(); 78712914Sgabeblack@google.com} 78812914Sgabeblack@google.com 78912914Sgabeblack@google.comvoid 79013155Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 79112914Sgabeblack@google.com{ 79213155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 79313155Sgabeblack@google.com wait(); 79413155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 79513155Sgabeblack@google.com wait(); 79612914Sgabeblack@google.com} 79712914Sgabeblack@google.com 79812837Sgabeblack@google.comconst char * 79913035Sgabeblack@google.comsc_gen_unique_name(const char *seed) 80012837Sgabeblack@google.com{ 80113268Sgabeblack@google.com auto mod = sc_gem5::pickParentModule(); 80213035Sgabeblack@google.com return mod ? mod->uniqueName(seed) : 80313035Sgabeblack@google.com ::sc_gem5::nameGen.gen(seed); 80412837Sgabeblack@google.com} 80512837Sgabeblack@google.com 80612837Sgabeblack@google.combool 80712930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 80812930Sgabeblack@google.com{ 80913280Sgabeblack@google.com return sc_gem5::findEvent(name) != sc_gem5::allEvents.end() || 81013280Sgabeblack@google.com ::sc_gem5::findObject(name, sc_gem5::allObjects); 81112930Sgabeblack@google.com} 81212930Sgabeblack@google.com 81312930Sgabeblack@google.combool 81412837Sgabeblack@google.comsc_start_of_simulation_invoked() 81512837Sgabeblack@google.com{ 81612982Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 81712837Sgabeblack@google.com} 81812837Sgabeblack@google.com 81912837Sgabeblack@google.combool 82012837Sgabeblack@google.comsc_end_of_simulation_invoked() 82112837Sgabeblack@google.com{ 82212982Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 82312837Sgabeblack@google.com} 82412837Sgabeblack@google.com 82512901Sgabeblack@google.comsc_module * 82612901Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 82712901Sgabeblack@google.com{ 82812901Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 82912901Sgabeblack@google.com modules.emplace_back(mod); 83012901Sgabeblack@google.com return mod; 83112901Sgabeblack@google.com} 83212901Sgabeblack@google.com 83312837Sgabeblack@google.com} // namespace sc_core 834