sc_module.cc revision 13292
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" 3913288Sgabeblack@google.com#include "systemc/core/port.hh" 4012953Sgabeblack@google.com#include "systemc/core/process_types.hh" 4113260Sgabeblack@google.com#include "systemc/core/sensitivity.hh" 4213288Sgabeblack@google.com#include "systemc/ext/channel/sc_in.hh" 4313288Sgabeblack@google.com#include "systemc/ext/channel/sc_inout.hh" 4413288Sgabeblack@google.com#include "systemc/ext/channel/sc_out.hh" 4513155Sgabeblack@google.com#include "systemc/ext/channel/sc_signal_in_if.hh" 4612837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh" 4712951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh" 4813155Sgabeblack@google.com#include "systemc/ext/dt/bit/sc_logic.hh" 4913135Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 5012837Sgabeblack@google.com 5112952Sgabeblack@google.comnamespace sc_gem5 5212952Sgabeblack@google.com{ 5312952Sgabeblack@google.com 5412952Sgabeblack@google.comProcess * 5512952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func) 5612952Sgabeblack@google.com{ 5713135Sgabeblack@google.com Method *p = new Method(name, func); 5813135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 5913135Sgabeblack@google.com std::string name = p->name(); 6013135Sgabeblack@google.com delete p; 6113135Sgabeblack@google.com SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 6213135Sgabeblack@google.com "simulation running", name.c_str()); 6313135Sgabeblack@google.com return nullptr; 6413135Sgabeblack@google.com } 6512993Sgabeblack@google.com scheduler.reg(p); 6612993Sgabeblack@google.com return p; 6712952Sgabeblack@google.com} 6812952Sgabeblack@google.com 6912952Sgabeblack@google.comProcess * 7012952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 7112952Sgabeblack@google.com{ 7213135Sgabeblack@google.com Thread *p = new Thread(name, func); 7313135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 7413135Sgabeblack@google.com std::string name = p->name(); 7513135Sgabeblack@google.com delete p; 7613135Sgabeblack@google.com SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 7713135Sgabeblack@google.com "simulation running", name.c_str()); 7813135Sgabeblack@google.com return nullptr; 7913135Sgabeblack@google.com } 8012993Sgabeblack@google.com scheduler.reg(p); 8112993Sgabeblack@google.com return p; 8212952Sgabeblack@google.com} 8312952Sgabeblack@google.com 8412952Sgabeblack@google.comProcess * 8512952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 8612952Sgabeblack@google.com{ 8713135Sgabeblack@google.com CThread *p = new CThread(name, func); 8813135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 8913135Sgabeblack@google.com std::string name = p->name(); 9013135Sgabeblack@google.com delete p; 9113135Sgabeblack@google.com SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 9213135Sgabeblack@google.com "simulation running", name.c_str()); 9313135Sgabeblack@google.com return nullptr; 9413135Sgabeblack@google.com } 9512993Sgabeblack@google.com scheduler.reg(p); 9613194Sgabeblack@google.com p->dontInitialize(true); 9712993Sgabeblack@google.com return p; 9812952Sgabeblack@google.com} 9912952Sgabeblack@google.com 10013035Sgabeblack@google.comUniqueNameGen nameGen; 10113035Sgabeblack@google.com 10212952Sgabeblack@google.com} // namespace sc_gem5 10312952Sgabeblack@google.com 10412837Sgabeblack@google.comnamespace sc_core 10512837Sgabeblack@google.com{ 10612837Sgabeblack@google.com 10713091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 10812951Sgabeblack@google.com _interface(&_interface), _port(nullptr) 10912951Sgabeblack@google.com{} 11012837Sgabeblack@google.com 11113091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 11212951Sgabeblack@google.com _interface(nullptr), _port(&_port) 11312951Sgabeblack@google.com{} 11412837Sgabeblack@google.com 11513091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 11612837Sgabeblack@google.com 11712982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 11812837Sgabeblack@google.com 11913091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 12012837Sgabeblack@google.com 12112837Sgabeblack@google.comvoid 12212837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 12312837Sgabeblack@google.com const sc_bind_proxy &p002, 12412837Sgabeblack@google.com const sc_bind_proxy &p003, 12512837Sgabeblack@google.com const sc_bind_proxy &p004, 12612837Sgabeblack@google.com const sc_bind_proxy &p005, 12712837Sgabeblack@google.com const sc_bind_proxy &p006, 12812837Sgabeblack@google.com const sc_bind_proxy &p007, 12912837Sgabeblack@google.com const sc_bind_proxy &p008, 13012837Sgabeblack@google.com const sc_bind_proxy &p009, 13112837Sgabeblack@google.com const sc_bind_proxy &p010, 13212837Sgabeblack@google.com const sc_bind_proxy &p011, 13312837Sgabeblack@google.com const sc_bind_proxy &p012, 13412837Sgabeblack@google.com const sc_bind_proxy &p013, 13512837Sgabeblack@google.com const sc_bind_proxy &p014, 13612837Sgabeblack@google.com const sc_bind_proxy &p015, 13712837Sgabeblack@google.com const sc_bind_proxy &p016, 13812837Sgabeblack@google.com const sc_bind_proxy &p017, 13912837Sgabeblack@google.com const sc_bind_proxy &p018, 14012837Sgabeblack@google.com const sc_bind_proxy &p019, 14112837Sgabeblack@google.com const sc_bind_proxy &p020, 14212837Sgabeblack@google.com const sc_bind_proxy &p021, 14312837Sgabeblack@google.com const sc_bind_proxy &p022, 14412837Sgabeblack@google.com const sc_bind_proxy &p023, 14512837Sgabeblack@google.com const sc_bind_proxy &p024, 14612837Sgabeblack@google.com const sc_bind_proxy &p025, 14712837Sgabeblack@google.com const sc_bind_proxy &p026, 14812837Sgabeblack@google.com const sc_bind_proxy &p027, 14912837Sgabeblack@google.com const sc_bind_proxy &p028, 15012837Sgabeblack@google.com const sc_bind_proxy &p029, 15112837Sgabeblack@google.com const sc_bind_proxy &p030, 15212837Sgabeblack@google.com const sc_bind_proxy &p031, 15312837Sgabeblack@google.com const sc_bind_proxy &p032, 15412837Sgabeblack@google.com const sc_bind_proxy &p033, 15512837Sgabeblack@google.com const sc_bind_proxy &p034, 15612837Sgabeblack@google.com const sc_bind_proxy &p035, 15712837Sgabeblack@google.com const sc_bind_proxy &p036, 15812837Sgabeblack@google.com const sc_bind_proxy &p037, 15912837Sgabeblack@google.com const sc_bind_proxy &p038, 16012837Sgabeblack@google.com const sc_bind_proxy &p039, 16112837Sgabeblack@google.com const sc_bind_proxy &p040, 16212837Sgabeblack@google.com const sc_bind_proxy &p041, 16312837Sgabeblack@google.com const sc_bind_proxy &p042, 16412837Sgabeblack@google.com const sc_bind_proxy &p043, 16512837Sgabeblack@google.com const sc_bind_proxy &p044, 16612837Sgabeblack@google.com const sc_bind_proxy &p045, 16712837Sgabeblack@google.com const sc_bind_proxy &p046, 16812837Sgabeblack@google.com const sc_bind_proxy &p047, 16912837Sgabeblack@google.com const sc_bind_proxy &p048, 17012837Sgabeblack@google.com const sc_bind_proxy &p049, 17112837Sgabeblack@google.com const sc_bind_proxy &p050, 17212837Sgabeblack@google.com const sc_bind_proxy &p051, 17312837Sgabeblack@google.com const sc_bind_proxy &p052, 17412837Sgabeblack@google.com const sc_bind_proxy &p053, 17512837Sgabeblack@google.com const sc_bind_proxy &p054, 17612837Sgabeblack@google.com const sc_bind_proxy &p055, 17712837Sgabeblack@google.com const sc_bind_proxy &p056, 17812837Sgabeblack@google.com const sc_bind_proxy &p057, 17912837Sgabeblack@google.com const sc_bind_proxy &p058, 18012837Sgabeblack@google.com const sc_bind_proxy &p059, 18112837Sgabeblack@google.com const sc_bind_proxy &p060, 18212837Sgabeblack@google.com const sc_bind_proxy &p061, 18312837Sgabeblack@google.com const sc_bind_proxy &p062, 18412837Sgabeblack@google.com const sc_bind_proxy &p063, 18512837Sgabeblack@google.com const sc_bind_proxy &p064) 18612837Sgabeblack@google.com{ 18713091Sgabeblack@google.com std::vector<const ::sc_core::sc_bind_proxy *> proxies; 18813091Sgabeblack@google.com auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 18913091Sgabeblack@google.com if (!p.port() && !p.interface()) 19013091Sgabeblack@google.com return false; 19113091Sgabeblack@google.com proxies.push_back(&p); 19213091Sgabeblack@google.com return true; 19313091Sgabeblack@google.com }; 19413091Sgabeblack@google.com insert(p001) && insert(p002) && insert(p003) && insert(p004) && 19513091Sgabeblack@google.com insert(p005) && insert(p006) && insert(p007) && insert(p008) && 19613091Sgabeblack@google.com insert(p009) && insert(p010) && insert(p011) && insert(p012) && 19713091Sgabeblack@google.com insert(p013) && insert(p014) && insert(p015) && insert(p016) && 19813091Sgabeblack@google.com insert(p017) && insert(p018) && insert(p019) && insert(p020) && 19913091Sgabeblack@google.com insert(p021) && insert(p022) && insert(p023) && insert(p024) && 20013091Sgabeblack@google.com insert(p025) && insert(p026) && insert(p027) && insert(p028) && 20113091Sgabeblack@google.com insert(p029) && insert(p030) && insert(p031) && insert(p032) && 20213091Sgabeblack@google.com insert(p033) && insert(p034) && insert(p035) && insert(p036) && 20313091Sgabeblack@google.com insert(p037) && insert(p038) && insert(p039) && insert(p040) && 20413091Sgabeblack@google.com insert(p041) && insert(p042) && insert(p043) && insert(p044) && 20513091Sgabeblack@google.com insert(p045) && insert(p046) && insert(p047) && insert(p048) && 20613091Sgabeblack@google.com insert(p049) && insert(p050) && insert(p051) && insert(p052) && 20713091Sgabeblack@google.com insert(p053) && insert(p054) && insert(p055) && insert(p056) && 20813091Sgabeblack@google.com insert(p057) && insert(p058) && insert(p059) && insert(p060) && 20913091Sgabeblack@google.com insert(p061) && insert(p062) && insert(p063) && insert(p064); 21013091Sgabeblack@google.com _gem5_module->bindPorts(proxies); 21112837Sgabeblack@google.com} 21212837Sgabeblack@google.com 21313292Sgabeblack@google.comsc_module & 21413292Sgabeblack@google.comsc_module::operator << (sc_interface &iface) 21513292Sgabeblack@google.com{ 21613292Sgabeblack@google.com (*this)(iface); 21713292Sgabeblack@google.com return *this; 21813292Sgabeblack@google.com} 21913292Sgabeblack@google.com 22013292Sgabeblack@google.comsc_module & 22113292Sgabeblack@google.comsc_module::operator << (sc_port_base &pb) 22213292Sgabeblack@google.com{ 22313292Sgabeblack@google.com (*this)(pb); 22413292Sgabeblack@google.com return *this; 22513292Sgabeblack@google.com} 22613292Sgabeblack@google.com 22713292Sgabeblack@google.comsc_module & 22813292Sgabeblack@google.comsc_module::operator , (sc_interface &iface) 22913292Sgabeblack@google.com{ 23013292Sgabeblack@google.com (*this)(iface); 23113292Sgabeblack@google.com return *this; 23213292Sgabeblack@google.com} 23313292Sgabeblack@google.com 23413292Sgabeblack@google.comsc_module & 23513292Sgabeblack@google.comsc_module::operator , (sc_port_base &pb) 23613292Sgabeblack@google.com{ 23713292Sgabeblack@google.com (*this)(pb); 23813292Sgabeblack@google.com return *this; 23913292Sgabeblack@google.com} 24013292Sgabeblack@google.com 24112837Sgabeblack@google.comconst std::vector<sc_object *> & 24212837Sgabeblack@google.comsc_module::get_child_objects() const 24312837Sgabeblack@google.com{ 24412951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 24512837Sgabeblack@google.com} 24612837Sgabeblack@google.com 24712837Sgabeblack@google.comconst std::vector<sc_event *> & 24812837Sgabeblack@google.comsc_module::get_child_events() const 24912837Sgabeblack@google.com{ 25012951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 25112837Sgabeblack@google.com} 25212837Sgabeblack@google.com 25312951Sgabeblack@google.comsc_module::sc_module() : 25413079Sgabeblack@google.com sc_object(sc_gem5::newModuleChecked()->name()), 25512951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 25613284Sgabeblack@google.com{ 25713284Sgabeblack@google.com if (sc_is_running()) { 25813284Sgabeblack@google.com SC_REPORT_ERROR("(E529) insert module failed", "simulation running"); 25913284Sgabeblack@google.com std::cout << "Running!\n"; 26013284Sgabeblack@google.com } 26113284Sgabeblack@google.com if (::sc_gem5::scheduler.elaborationDone()) { 26213284Sgabeblack@google.com SC_REPORT_ERROR("(E529) insert module failed", "elaboration done"); 26313284Sgabeblack@google.com std::cout << "Elaboration done!\n"; 26413284Sgabeblack@google.com } 26513284Sgabeblack@google.com} 26612837Sgabeblack@google.com 26712951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 26813191Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 26913191Sgabeblack@google.com{ 27013191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 27113191Sgabeblack@google.com SC_REPORT_WARNING("(W569) sc_module(const char*), " 27213191Sgabeblack@google.com "sc_module(const std::string&) have been deprecated, use " 27313191Sgabeblack@google.com "sc_module(const sc_module_name&)", _name); 27413191Sgabeblack@google.com} 27512951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 27612951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 27713191Sgabeblack@google.com{ 27813191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 27913191Sgabeblack@google.com SC_REPORT_WARNING("(W569) sc_module(const char*), " 28013191Sgabeblack@google.com "sc_module(const std::string&) have been deprecated, use " 28113191Sgabeblack@google.com "sc_module(const sc_module_name&)", _name.c_str()); 28213191Sgabeblack@google.com} 28313191Sgabeblack@google.com 28413191Sgabeblack@google.comvoid 28513191Sgabeblack@google.comsc_module::end_module() 28613191Sgabeblack@google.com{ 28713191Sgabeblack@google.com _gem5_module->endModule(); 28813191Sgabeblack@google.com} 28912928Sgabeblack@google.com 29012837Sgabeblack@google.comvoid 29113260Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &port, bool val) 29212837Sgabeblack@google.com{ 29313288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 29412837Sgabeblack@google.com} 29512837Sgabeblack@google.com 29612837Sgabeblack@google.comvoid 29713260Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 29812837Sgabeblack@google.com{ 29913288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 30012837Sgabeblack@google.com} 30112837Sgabeblack@google.com 30212837Sgabeblack@google.comvoid 30313260Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &port, bool val) 30412837Sgabeblack@google.com{ 30513288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 30612837Sgabeblack@google.com} 30712837Sgabeblack@google.com 30812837Sgabeblack@google.comvoid 30913260Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 31012837Sgabeblack@google.com{ 31113288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), true, val); 31212837Sgabeblack@google.com} 31312837Sgabeblack@google.com 31412837Sgabeblack@google.com 31512837Sgabeblack@google.comvoid 31613260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 31712837Sgabeblack@google.com{ 31813288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 31912837Sgabeblack@google.com} 32012837Sgabeblack@google.com 32112837Sgabeblack@google.comvoid 32213260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 32312837Sgabeblack@google.com{ 32413288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 32512837Sgabeblack@google.com} 32612837Sgabeblack@google.com 32712837Sgabeblack@google.comvoid 32813260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 32912837Sgabeblack@google.com{ 33013288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 33112837Sgabeblack@google.com} 33212837Sgabeblack@google.com 33312837Sgabeblack@google.comvoid 33413260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 33512837Sgabeblack@google.com{ 33613288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), false, val); 33712837Sgabeblack@google.com} 33812837Sgabeblack@google.com 33912837Sgabeblack@google.com 34012837Sgabeblack@google.comvoid 34112837Sgabeblack@google.comsc_module::dont_initialize() 34212837Sgabeblack@google.com{ 34313194Sgabeblack@google.com ::sc_gem5::Process::newest()->dontInitialize(true); 34412837Sgabeblack@google.com} 34512837Sgabeblack@google.com 34612837Sgabeblack@google.comvoid 34712953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 34812837Sgabeblack@google.com{ 34912953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 35012837Sgabeblack@google.com} 35112837Sgabeblack@google.com 35212837Sgabeblack@google.com 35312951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 35412951Sgabeblack@google.com 35512837Sgabeblack@google.comvoid 35612951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 35712837Sgabeblack@google.com{ 35812951Sgabeblack@google.com ::sc_core::next_trigger(e); 35912837Sgabeblack@google.com} 36012837Sgabeblack@google.com 36112837Sgabeblack@google.comvoid 36212951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 36312837Sgabeblack@google.com{ 36412951Sgabeblack@google.com ::sc_core::next_trigger(eol); 36512837Sgabeblack@google.com} 36612837Sgabeblack@google.com 36712837Sgabeblack@google.comvoid 36812951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 36912837Sgabeblack@google.com{ 37012951Sgabeblack@google.com ::sc_core::next_trigger(eal); 37112837Sgabeblack@google.com} 37212837Sgabeblack@google.com 37312837Sgabeblack@google.comvoid 37412951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 37512837Sgabeblack@google.com{ 37612951Sgabeblack@google.com ::sc_core::next_trigger(t); 37712837Sgabeblack@google.com} 37812837Sgabeblack@google.com 37912837Sgabeblack@google.comvoid 38012951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 38112837Sgabeblack@google.com{ 38212951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 38312837Sgabeblack@google.com} 38412837Sgabeblack@google.com 38512837Sgabeblack@google.comvoid 38612951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 38712837Sgabeblack@google.com{ 38812951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 38912837Sgabeblack@google.com} 39012837Sgabeblack@google.com 39112837Sgabeblack@google.comvoid 39212951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 39312837Sgabeblack@google.com{ 39412951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 39512837Sgabeblack@google.com} 39612837Sgabeblack@google.com 39712837Sgabeblack@google.comvoid 39812951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 39912837Sgabeblack@google.com{ 40012951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 40112837Sgabeblack@google.com} 40212837Sgabeblack@google.com 40312837Sgabeblack@google.comvoid 40412951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 40512837Sgabeblack@google.com{ 40612951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 40712837Sgabeblack@google.com} 40812837Sgabeblack@google.com 40912837Sgabeblack@google.comvoid 41012951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 41112837Sgabeblack@google.com{ 41212951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 41312837Sgabeblack@google.com} 41412837Sgabeblack@google.com 41512837Sgabeblack@google.comvoid 41612951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 41712837Sgabeblack@google.com{ 41812951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 41912837Sgabeblack@google.com} 42012837Sgabeblack@google.com 42112837Sgabeblack@google.com 42212929Sgabeblack@google.combool 42312929Sgabeblack@google.comsc_module::timed_out() 42412929Sgabeblack@google.com{ 42513189Sgabeblack@google.com return ::sc_core::timed_out(); 42612929Sgabeblack@google.com} 42712929Sgabeblack@google.com 42812929Sgabeblack@google.com 42912837Sgabeblack@google.comvoid 43012837Sgabeblack@google.comsc_module::wait() 43112837Sgabeblack@google.com{ 43212951Sgabeblack@google.com ::sc_core::wait(); 43312837Sgabeblack@google.com} 43412837Sgabeblack@google.com 43512837Sgabeblack@google.comvoid 43612951Sgabeblack@google.comsc_module::wait(int i) 43712837Sgabeblack@google.com{ 43812951Sgabeblack@google.com ::sc_core::wait(i); 43912837Sgabeblack@google.com} 44012837Sgabeblack@google.com 44112837Sgabeblack@google.comvoid 44212951Sgabeblack@google.comsc_module::wait(const sc_event &e) 44312837Sgabeblack@google.com{ 44412951Sgabeblack@google.com ::sc_core::wait(e); 44512837Sgabeblack@google.com} 44612837Sgabeblack@google.com 44712837Sgabeblack@google.comvoid 44812951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 44912837Sgabeblack@google.com{ 45012951Sgabeblack@google.com ::sc_core::wait(eol); 45112837Sgabeblack@google.com} 45212837Sgabeblack@google.com 45312837Sgabeblack@google.comvoid 45412951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 45512837Sgabeblack@google.com{ 45612951Sgabeblack@google.com ::sc_core::wait(eal); 45712837Sgabeblack@google.com} 45812837Sgabeblack@google.com 45912837Sgabeblack@google.comvoid 46012951Sgabeblack@google.comsc_module::wait(const sc_time &t) 46112837Sgabeblack@google.com{ 46212951Sgabeblack@google.com ::sc_core::wait(t); 46312837Sgabeblack@google.com} 46412837Sgabeblack@google.com 46512837Sgabeblack@google.comvoid 46612951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 46712837Sgabeblack@google.com{ 46812951Sgabeblack@google.com ::sc_core::wait(d, u); 46912837Sgabeblack@google.com} 47012837Sgabeblack@google.com 47112837Sgabeblack@google.comvoid 47212951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 47312837Sgabeblack@google.com{ 47412951Sgabeblack@google.com ::sc_core::wait(t, e); 47512837Sgabeblack@google.com} 47612837Sgabeblack@google.com 47712837Sgabeblack@google.comvoid 47812951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 47912837Sgabeblack@google.com{ 48012951Sgabeblack@google.com ::sc_core::wait(d, u, e); 48112837Sgabeblack@google.com} 48212837Sgabeblack@google.com 48312837Sgabeblack@google.comvoid 48412951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 48512837Sgabeblack@google.com{ 48612951Sgabeblack@google.com ::sc_core::wait(t, eol); 48712837Sgabeblack@google.com} 48812837Sgabeblack@google.com 48912837Sgabeblack@google.comvoid 49012951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 49112837Sgabeblack@google.com{ 49212951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 49312837Sgabeblack@google.com} 49412837Sgabeblack@google.com 49512837Sgabeblack@google.comvoid 49612951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 49712837Sgabeblack@google.com{ 49812951Sgabeblack@google.com ::sc_core::wait(t, eal); 49912837Sgabeblack@google.com} 50012837Sgabeblack@google.com 50112837Sgabeblack@google.comvoid 50212951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 50312837Sgabeblack@google.com{ 50412951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 50512837Sgabeblack@google.com} 50612837Sgabeblack@google.com 50712837Sgabeblack@google.com 50812837Sgabeblack@google.comvoid 50912909Sgabeblack@google.comsc_module::halt() 51012909Sgabeblack@google.com{ 51112951Sgabeblack@google.com ::sc_core::halt(); 51212909Sgabeblack@google.com} 51312909Sgabeblack@google.com 51412914Sgabeblack@google.comvoid 51512951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 51612914Sgabeblack@google.com{ 51712951Sgabeblack@google.com ::sc_core::at_posedge(s); 51812914Sgabeblack@google.com} 51912914Sgabeblack@google.com 52012914Sgabeblack@google.comvoid 52112951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 52212914Sgabeblack@google.com{ 52312951Sgabeblack@google.com ::sc_core::at_posedge(s); 52412914Sgabeblack@google.com} 52512914Sgabeblack@google.com 52612914Sgabeblack@google.comvoid 52712951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 52812914Sgabeblack@google.com{ 52912951Sgabeblack@google.com ::sc_core::at_negedge(s); 53012914Sgabeblack@google.com} 53112914Sgabeblack@google.com 53212914Sgabeblack@google.comvoid 53312951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 53412914Sgabeblack@google.com{ 53512951Sgabeblack@google.com ::sc_core::at_negedge(s); 53612914Sgabeblack@google.com} 53712914Sgabeblack@google.com 53812909Sgabeblack@google.com 53912909Sgabeblack@google.comvoid 54012837Sgabeblack@google.comnext_trigger() 54112837Sgabeblack@google.com{ 54212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54313206Sgabeblack@google.com p->cancelTimeout(); 54413206Sgabeblack@google.com p->clearDynamic(); 54512837Sgabeblack@google.com} 54612837Sgabeblack@google.com 54712837Sgabeblack@google.comvoid 54812958Sgabeblack@google.comnext_trigger(const sc_event &e) 54912837Sgabeblack@google.com{ 55012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55113206Sgabeblack@google.com p->cancelTimeout(); 55213207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 55312837Sgabeblack@google.com} 55412837Sgabeblack@google.com 55512837Sgabeblack@google.comvoid 55612958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 55712837Sgabeblack@google.com{ 55812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55913206Sgabeblack@google.com p->cancelTimeout(); 56013207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 56112837Sgabeblack@google.com} 56212837Sgabeblack@google.com 56312837Sgabeblack@google.comvoid 56412958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 56512837Sgabeblack@google.com{ 56612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56713206Sgabeblack@google.com p->cancelTimeout(); 56813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 56912837Sgabeblack@google.com} 57012837Sgabeblack@google.com 57112837Sgabeblack@google.comvoid 57212958Sgabeblack@google.comnext_trigger(const sc_time &t) 57312837Sgabeblack@google.com{ 57412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 57513206Sgabeblack@google.com p->setTimeout(t); 57613206Sgabeblack@google.com p->clearDynamic(); 57712837Sgabeblack@google.com} 57812837Sgabeblack@google.com 57912837Sgabeblack@google.comvoid 58012951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 58112837Sgabeblack@google.com{ 58212951Sgabeblack@google.com next_trigger(sc_time(d, u)); 58312837Sgabeblack@google.com} 58412837Sgabeblack@google.com 58512837Sgabeblack@google.comvoid 58612958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 58712837Sgabeblack@google.com{ 58812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58913206Sgabeblack@google.com p->setTimeout(t); 59013207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 59112837Sgabeblack@google.com} 59212837Sgabeblack@google.com 59312837Sgabeblack@google.comvoid 59412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 59512837Sgabeblack@google.com{ 59612951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 59712837Sgabeblack@google.com} 59812837Sgabeblack@google.com 59912837Sgabeblack@google.comvoid 60012958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 60112837Sgabeblack@google.com{ 60212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 60313206Sgabeblack@google.com p->setTimeout(t); 60413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 60512837Sgabeblack@google.com} 60612837Sgabeblack@google.com 60712837Sgabeblack@google.comvoid 60812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 60912837Sgabeblack@google.com{ 61012951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 61112837Sgabeblack@google.com} 61212837Sgabeblack@google.com 61312837Sgabeblack@google.comvoid 61412958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 61512837Sgabeblack@google.com{ 61612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 61713206Sgabeblack@google.com p->setTimeout(t); 61813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 61912837Sgabeblack@google.com} 62012837Sgabeblack@google.com 62112837Sgabeblack@google.comvoid 62212951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 62312837Sgabeblack@google.com{ 62412951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 62512837Sgabeblack@google.com} 62612837Sgabeblack@google.com 62712929Sgabeblack@google.combool 62812929Sgabeblack@google.comtimed_out() 62912929Sgabeblack@google.com{ 63013189Sgabeblack@google.com ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 63113189Sgabeblack@google.com if (!p) 63213189Sgabeblack@google.com return false; 63313189Sgabeblack@google.com else 63413189Sgabeblack@google.com return p->timedOut(); 63512929Sgabeblack@google.com} 63612929Sgabeblack@google.com 63712837Sgabeblack@google.com 63813248Sgabeblack@google.comnamespace 63913248Sgabeblack@google.com{ 64013248Sgabeblack@google.com 64113248Sgabeblack@google.combool 64213248Sgabeblack@google.comwaitErrorCheck(sc_gem5::Process *p) 64313248Sgabeblack@google.com{ 64413248Sgabeblack@google.com if (p->procKind() == SC_METHOD_PROC_) { 64513248Sgabeblack@google.com SC_REPORT_ERROR( 64613248Sgabeblack@google.com "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs", 64713248Sgabeblack@google.com "\n in SC_METHODs use next_trigger() instead"); 64813248Sgabeblack@google.com return true; 64913248Sgabeblack@google.com } 65013248Sgabeblack@google.com return false; 65113248Sgabeblack@google.com} 65213248Sgabeblack@google.com 65313248Sgabeblack@google.com} // anonymous namespace 65413248Sgabeblack@google.com 65512837Sgabeblack@google.comvoid 65612837Sgabeblack@google.comwait() 65712837Sgabeblack@google.com{ 65812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 65913248Sgabeblack@google.com if (waitErrorCheck(p)) 66013248Sgabeblack@google.com return; 66113206Sgabeblack@google.com p->cancelTimeout(); 66213206Sgabeblack@google.com p->clearDynamic(); 66312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 66412837Sgabeblack@google.com} 66512837Sgabeblack@google.com 66612837Sgabeblack@google.comvoid 66712958Sgabeblack@google.comwait(int n) 66812837Sgabeblack@google.com{ 66913146Sgabeblack@google.com if (n <= 0) { 67013146Sgabeblack@google.com std::string msg = csprintf("n = %d", n); 67113146Sgabeblack@google.com SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str()); 67213146Sgabeblack@google.com } 67313260Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 67413260Sgabeblack@google.com p->waitCount(n - 1); 67513260Sgabeblack@google.com wait(); 67612837Sgabeblack@google.com} 67712837Sgabeblack@google.com 67812837Sgabeblack@google.comvoid 67912958Sgabeblack@google.comwait(const sc_event &e) 68012837Sgabeblack@google.com{ 68112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 68213248Sgabeblack@google.com if (waitErrorCheck(p)) 68313248Sgabeblack@google.com return; 68413206Sgabeblack@google.com p->cancelTimeout(); 68513207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 68612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 68712837Sgabeblack@google.com} 68812837Sgabeblack@google.com 68912837Sgabeblack@google.comvoid 69012958Sgabeblack@google.comwait(const sc_event_or_list &eol) 69112837Sgabeblack@google.com{ 69212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 69313248Sgabeblack@google.com if (waitErrorCheck(p)) 69413248Sgabeblack@google.com return; 69513206Sgabeblack@google.com p->cancelTimeout(); 69613207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 69712958Sgabeblack@google.com sc_gem5::scheduler.yield(); 69812837Sgabeblack@google.com} 69912837Sgabeblack@google.com 70012837Sgabeblack@google.comvoid 70112958Sgabeblack@google.comwait(const sc_event_and_list &eal) 70212837Sgabeblack@google.com{ 70312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 70413248Sgabeblack@google.com if (waitErrorCheck(p)) 70513248Sgabeblack@google.com return; 70613206Sgabeblack@google.com p->cancelTimeout(); 70713207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 70812958Sgabeblack@google.com sc_gem5::scheduler.yield(); 70912837Sgabeblack@google.com} 71012837Sgabeblack@google.com 71112837Sgabeblack@google.comvoid 71212958Sgabeblack@google.comwait(const sc_time &t) 71312837Sgabeblack@google.com{ 71412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 71513248Sgabeblack@google.com if (waitErrorCheck(p)) 71613248Sgabeblack@google.com return; 71713206Sgabeblack@google.com p->setTimeout(t); 71813206Sgabeblack@google.com p->clearDynamic(); 71912958Sgabeblack@google.com sc_gem5::scheduler.yield(); 72012837Sgabeblack@google.com} 72112837Sgabeblack@google.com 72212837Sgabeblack@google.comvoid 72312951Sgabeblack@google.comwait(double d, sc_time_unit u) 72412837Sgabeblack@google.com{ 72512951Sgabeblack@google.com wait(sc_time(d, u)); 72612837Sgabeblack@google.com} 72712837Sgabeblack@google.com 72812837Sgabeblack@google.comvoid 72912958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 73012837Sgabeblack@google.com{ 73112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 73213248Sgabeblack@google.com if (waitErrorCheck(p)) 73313248Sgabeblack@google.com return; 73413206Sgabeblack@google.com p->setTimeout(t); 73513207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 73612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 73712837Sgabeblack@google.com} 73812837Sgabeblack@google.com 73912837Sgabeblack@google.comvoid 74012951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 74112837Sgabeblack@google.com{ 74212951Sgabeblack@google.com wait(sc_time(d, u), e); 74312837Sgabeblack@google.com} 74412837Sgabeblack@google.com 74512837Sgabeblack@google.comvoid 74612958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 74712837Sgabeblack@google.com{ 74812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 74913248Sgabeblack@google.com if (waitErrorCheck(p)) 75013248Sgabeblack@google.com return; 75113206Sgabeblack@google.com p->setTimeout(t); 75213207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 75312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 75412837Sgabeblack@google.com} 75512837Sgabeblack@google.com 75612837Sgabeblack@google.comvoid 75712951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 75812837Sgabeblack@google.com{ 75912951Sgabeblack@google.com wait(sc_time(d, u), eol); 76012837Sgabeblack@google.com} 76112837Sgabeblack@google.com 76212837Sgabeblack@google.comvoid 76312958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 76412837Sgabeblack@google.com{ 76512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 76613248Sgabeblack@google.com if (waitErrorCheck(p)) 76713248Sgabeblack@google.com return; 76813206Sgabeblack@google.com p->setTimeout(t); 76913207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 77012958Sgabeblack@google.com sc_gem5::scheduler.yield(); 77112837Sgabeblack@google.com} 77212837Sgabeblack@google.com 77312837Sgabeblack@google.comvoid 77412951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 77512837Sgabeblack@google.com{ 77612951Sgabeblack@google.com wait(sc_time(d, u), eal); 77712837Sgabeblack@google.com} 77812837Sgabeblack@google.com 77912909Sgabeblack@google.comvoid 78012909Sgabeblack@google.comhalt() 78112909Sgabeblack@google.com{ 78213175Sgabeblack@google.com ::sc_core::wait(); 78313175Sgabeblack@google.com throw ::sc_gem5::ScHalt(); 78412909Sgabeblack@google.com} 78512909Sgabeblack@google.com 78612914Sgabeblack@google.comvoid 78713155Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &s) 78812914Sgabeblack@google.com{ 78913155Sgabeblack@google.com while (s.read()) 79013155Sgabeblack@google.com wait(); 79113155Sgabeblack@google.com while (!s.read()) 79213155Sgabeblack@google.com wait(); 79312914Sgabeblack@google.com} 79412914Sgabeblack@google.com 79512914Sgabeblack@google.comvoid 79613155Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 79712914Sgabeblack@google.com{ 79813155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 79913155Sgabeblack@google.com wait(); 80013155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 80113155Sgabeblack@google.com wait(); 80212914Sgabeblack@google.com} 80312914Sgabeblack@google.com 80412914Sgabeblack@google.comvoid 80513155Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &s) 80612914Sgabeblack@google.com{ 80713155Sgabeblack@google.com while (!s.read()) 80813155Sgabeblack@google.com wait(); 80913155Sgabeblack@google.com while (s.read()) 81013155Sgabeblack@google.com wait(); 81112914Sgabeblack@google.com} 81212914Sgabeblack@google.com 81312914Sgabeblack@google.comvoid 81413155Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 81512914Sgabeblack@google.com{ 81613155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 81713155Sgabeblack@google.com wait(); 81813155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 81913155Sgabeblack@google.com wait(); 82012914Sgabeblack@google.com} 82112914Sgabeblack@google.com 82212837Sgabeblack@google.comconst char * 82313035Sgabeblack@google.comsc_gen_unique_name(const char *seed) 82412837Sgabeblack@google.com{ 82513268Sgabeblack@google.com auto mod = sc_gem5::pickParentModule(); 82613285Sgabeblack@google.com if (mod) 82713285Sgabeblack@google.com return mod->uniqueName(seed); 82813285Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 82913285Sgabeblack@google.com if (p) 83013285Sgabeblack@google.com return p->uniqueName(seed); 83113285Sgabeblack@google.com return ::sc_gem5::nameGen.gen(seed); 83212837Sgabeblack@google.com} 83312837Sgabeblack@google.com 83412837Sgabeblack@google.combool 83512930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 83612930Sgabeblack@google.com{ 83713280Sgabeblack@google.com return sc_gem5::findEvent(name) != sc_gem5::allEvents.end() || 83813280Sgabeblack@google.com ::sc_gem5::findObject(name, sc_gem5::allObjects); 83912930Sgabeblack@google.com} 84012930Sgabeblack@google.com 84112930Sgabeblack@google.combool 84212837Sgabeblack@google.comsc_start_of_simulation_invoked() 84312837Sgabeblack@google.com{ 84412982Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 84512837Sgabeblack@google.com} 84612837Sgabeblack@google.com 84712837Sgabeblack@google.combool 84812837Sgabeblack@google.comsc_end_of_simulation_invoked() 84912837Sgabeblack@google.com{ 85012982Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 85112837Sgabeblack@google.com} 85212837Sgabeblack@google.com 85312901Sgabeblack@google.comsc_module * 85412901Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 85512901Sgabeblack@google.com{ 85612901Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 85712901Sgabeblack@google.com modules.emplace_back(mod); 85812901Sgabeblack@google.com return mod; 85912901Sgabeblack@google.com} 86012901Sgabeblack@google.com 86112837Sgabeblack@google.com} // namespace sc_core 862