sc_module.cc revision 13317
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" 4613317Sgabeblack@google.com#include "systemc/ext/core/messages.hh" 4712837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh" 4812951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh" 4913155Sgabeblack@google.com#include "systemc/ext/dt/bit/sc_logic.hh" 5013135Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 5112837Sgabeblack@google.com 5212952Sgabeblack@google.comnamespace sc_gem5 5312952Sgabeblack@google.com{ 5412952Sgabeblack@google.com 5512952Sgabeblack@google.comProcess * 5612952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func) 5712952Sgabeblack@google.com{ 5813135Sgabeblack@google.com Method *p = new Method(name, func); 5913135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 6013135Sgabeblack@google.com std::string name = p->name(); 6113135Sgabeblack@google.com delete p; 6213317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_METHOD_AFTER_START_, 6313317Sgabeblack@google.com name.c_str()); 6413135Sgabeblack@google.com return nullptr; 6513135Sgabeblack@google.com } 6612993Sgabeblack@google.com scheduler.reg(p); 6712993Sgabeblack@google.com return p; 6812952Sgabeblack@google.com} 6912952Sgabeblack@google.com 7012952Sgabeblack@google.comProcess * 7112952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 7212952Sgabeblack@google.com{ 7313135Sgabeblack@google.com Thread *p = new Thread(name, func); 7413135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 7513135Sgabeblack@google.com std::string name = p->name(); 7613135Sgabeblack@google.com delete p; 7713317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_THREAD_AFTER_START_, 7813317Sgabeblack@google.com name.c_str()); 7913135Sgabeblack@google.com return nullptr; 8013135Sgabeblack@google.com } 8112993Sgabeblack@google.com scheduler.reg(p); 8212993Sgabeblack@google.com return p; 8312952Sgabeblack@google.com} 8412952Sgabeblack@google.com 8512952Sgabeblack@google.comProcess * 8612952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 8712952Sgabeblack@google.com{ 8813135Sgabeblack@google.com CThread *p = new CThread(name, func); 8913135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 9013135Sgabeblack@google.com std::string name = p->name(); 9113135Sgabeblack@google.com delete p; 9213317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_CTHREAD_AFTER_START_, 9313317Sgabeblack@google.com name.c_str()); 9413135Sgabeblack@google.com return nullptr; 9513135Sgabeblack@google.com } 9612993Sgabeblack@google.com scheduler.reg(p); 9713194Sgabeblack@google.com p->dontInitialize(true); 9812993Sgabeblack@google.com return p; 9912952Sgabeblack@google.com} 10012952Sgabeblack@google.com 10112952Sgabeblack@google.com} // namespace sc_gem5 10212952Sgabeblack@google.com 10312837Sgabeblack@google.comnamespace sc_core 10412837Sgabeblack@google.com{ 10512837Sgabeblack@google.com 10613091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 10712951Sgabeblack@google.com _interface(&_interface), _port(nullptr) 10812951Sgabeblack@google.com{} 10912837Sgabeblack@google.com 11013091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 11112951Sgabeblack@google.com _interface(nullptr), _port(&_port) 11212951Sgabeblack@google.com{} 11312837Sgabeblack@google.com 11413091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 11512837Sgabeblack@google.com 11612982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 11712837Sgabeblack@google.com 11813091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 11912837Sgabeblack@google.com 12012837Sgabeblack@google.comvoid 12112837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 12212837Sgabeblack@google.com const sc_bind_proxy &p002, 12312837Sgabeblack@google.com const sc_bind_proxy &p003, 12412837Sgabeblack@google.com const sc_bind_proxy &p004, 12512837Sgabeblack@google.com const sc_bind_proxy &p005, 12612837Sgabeblack@google.com const sc_bind_proxy &p006, 12712837Sgabeblack@google.com const sc_bind_proxy &p007, 12812837Sgabeblack@google.com const sc_bind_proxy &p008, 12912837Sgabeblack@google.com const sc_bind_proxy &p009, 13012837Sgabeblack@google.com const sc_bind_proxy &p010, 13112837Sgabeblack@google.com const sc_bind_proxy &p011, 13212837Sgabeblack@google.com const sc_bind_proxy &p012, 13312837Sgabeblack@google.com const sc_bind_proxy &p013, 13412837Sgabeblack@google.com const sc_bind_proxy &p014, 13512837Sgabeblack@google.com const sc_bind_proxy &p015, 13612837Sgabeblack@google.com const sc_bind_proxy &p016, 13712837Sgabeblack@google.com const sc_bind_proxy &p017, 13812837Sgabeblack@google.com const sc_bind_proxy &p018, 13912837Sgabeblack@google.com const sc_bind_proxy &p019, 14012837Sgabeblack@google.com const sc_bind_proxy &p020, 14112837Sgabeblack@google.com const sc_bind_proxy &p021, 14212837Sgabeblack@google.com const sc_bind_proxy &p022, 14312837Sgabeblack@google.com const sc_bind_proxy &p023, 14412837Sgabeblack@google.com const sc_bind_proxy &p024, 14512837Sgabeblack@google.com const sc_bind_proxy &p025, 14612837Sgabeblack@google.com const sc_bind_proxy &p026, 14712837Sgabeblack@google.com const sc_bind_proxy &p027, 14812837Sgabeblack@google.com const sc_bind_proxy &p028, 14912837Sgabeblack@google.com const sc_bind_proxy &p029, 15012837Sgabeblack@google.com const sc_bind_proxy &p030, 15112837Sgabeblack@google.com const sc_bind_proxy &p031, 15212837Sgabeblack@google.com const sc_bind_proxy &p032, 15312837Sgabeblack@google.com const sc_bind_proxy &p033, 15412837Sgabeblack@google.com const sc_bind_proxy &p034, 15512837Sgabeblack@google.com const sc_bind_proxy &p035, 15612837Sgabeblack@google.com const sc_bind_proxy &p036, 15712837Sgabeblack@google.com const sc_bind_proxy &p037, 15812837Sgabeblack@google.com const sc_bind_proxy &p038, 15912837Sgabeblack@google.com const sc_bind_proxy &p039, 16012837Sgabeblack@google.com const sc_bind_proxy &p040, 16112837Sgabeblack@google.com const sc_bind_proxy &p041, 16212837Sgabeblack@google.com const sc_bind_proxy &p042, 16312837Sgabeblack@google.com const sc_bind_proxy &p043, 16412837Sgabeblack@google.com const sc_bind_proxy &p044, 16512837Sgabeblack@google.com const sc_bind_proxy &p045, 16612837Sgabeblack@google.com const sc_bind_proxy &p046, 16712837Sgabeblack@google.com const sc_bind_proxy &p047, 16812837Sgabeblack@google.com const sc_bind_proxy &p048, 16912837Sgabeblack@google.com const sc_bind_proxy &p049, 17012837Sgabeblack@google.com const sc_bind_proxy &p050, 17112837Sgabeblack@google.com const sc_bind_proxy &p051, 17212837Sgabeblack@google.com const sc_bind_proxy &p052, 17312837Sgabeblack@google.com const sc_bind_proxy &p053, 17412837Sgabeblack@google.com const sc_bind_proxy &p054, 17512837Sgabeblack@google.com const sc_bind_proxy &p055, 17612837Sgabeblack@google.com const sc_bind_proxy &p056, 17712837Sgabeblack@google.com const sc_bind_proxy &p057, 17812837Sgabeblack@google.com const sc_bind_proxy &p058, 17912837Sgabeblack@google.com const sc_bind_proxy &p059, 18012837Sgabeblack@google.com const sc_bind_proxy &p060, 18112837Sgabeblack@google.com const sc_bind_proxy &p061, 18212837Sgabeblack@google.com const sc_bind_proxy &p062, 18312837Sgabeblack@google.com const sc_bind_proxy &p063, 18412837Sgabeblack@google.com const sc_bind_proxy &p064) 18512837Sgabeblack@google.com{ 18613091Sgabeblack@google.com std::vector<const ::sc_core::sc_bind_proxy *> proxies; 18713091Sgabeblack@google.com auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 18813091Sgabeblack@google.com if (!p.port() && !p.interface()) 18913091Sgabeblack@google.com return false; 19013091Sgabeblack@google.com proxies.push_back(&p); 19113091Sgabeblack@google.com return true; 19213091Sgabeblack@google.com }; 19313091Sgabeblack@google.com insert(p001) && insert(p002) && insert(p003) && insert(p004) && 19413091Sgabeblack@google.com insert(p005) && insert(p006) && insert(p007) && insert(p008) && 19513091Sgabeblack@google.com insert(p009) && insert(p010) && insert(p011) && insert(p012) && 19613091Sgabeblack@google.com insert(p013) && insert(p014) && insert(p015) && insert(p016) && 19713091Sgabeblack@google.com insert(p017) && insert(p018) && insert(p019) && insert(p020) && 19813091Sgabeblack@google.com insert(p021) && insert(p022) && insert(p023) && insert(p024) && 19913091Sgabeblack@google.com insert(p025) && insert(p026) && insert(p027) && insert(p028) && 20013091Sgabeblack@google.com insert(p029) && insert(p030) && insert(p031) && insert(p032) && 20113091Sgabeblack@google.com insert(p033) && insert(p034) && insert(p035) && insert(p036) && 20213091Sgabeblack@google.com insert(p037) && insert(p038) && insert(p039) && insert(p040) && 20313091Sgabeblack@google.com insert(p041) && insert(p042) && insert(p043) && insert(p044) && 20413091Sgabeblack@google.com insert(p045) && insert(p046) && insert(p047) && insert(p048) && 20513091Sgabeblack@google.com insert(p049) && insert(p050) && insert(p051) && insert(p052) && 20613091Sgabeblack@google.com insert(p053) && insert(p054) && insert(p055) && insert(p056) && 20713091Sgabeblack@google.com insert(p057) && insert(p058) && insert(p059) && insert(p060) && 20813091Sgabeblack@google.com insert(p061) && insert(p062) && insert(p063) && insert(p064); 20913091Sgabeblack@google.com _gem5_module->bindPorts(proxies); 21012837Sgabeblack@google.com} 21112837Sgabeblack@google.com 21213292Sgabeblack@google.comsc_module & 21313292Sgabeblack@google.comsc_module::operator << (sc_interface &iface) 21413292Sgabeblack@google.com{ 21513292Sgabeblack@google.com (*this)(iface); 21613292Sgabeblack@google.com return *this; 21713292Sgabeblack@google.com} 21813292Sgabeblack@google.com 21913292Sgabeblack@google.comsc_module & 22013292Sgabeblack@google.comsc_module::operator << (sc_port_base &pb) 22113292Sgabeblack@google.com{ 22213292Sgabeblack@google.com (*this)(pb); 22313292Sgabeblack@google.com return *this; 22413292Sgabeblack@google.com} 22513292Sgabeblack@google.com 22613292Sgabeblack@google.comsc_module & 22713292Sgabeblack@google.comsc_module::operator , (sc_interface &iface) 22813292Sgabeblack@google.com{ 22913292Sgabeblack@google.com (*this)(iface); 23013292Sgabeblack@google.com return *this; 23113292Sgabeblack@google.com} 23213292Sgabeblack@google.com 23313292Sgabeblack@google.comsc_module & 23413292Sgabeblack@google.comsc_module::operator , (sc_port_base &pb) 23513292Sgabeblack@google.com{ 23613292Sgabeblack@google.com (*this)(pb); 23713292Sgabeblack@google.com return *this; 23813292Sgabeblack@google.com} 23913292Sgabeblack@google.com 24012837Sgabeblack@google.comconst std::vector<sc_object *> & 24112837Sgabeblack@google.comsc_module::get_child_objects() const 24212837Sgabeblack@google.com{ 24312951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 24412837Sgabeblack@google.com} 24512837Sgabeblack@google.com 24612837Sgabeblack@google.comconst std::vector<sc_event *> & 24712837Sgabeblack@google.comsc_module::get_child_events() const 24812837Sgabeblack@google.com{ 24912951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 25012837Sgabeblack@google.com} 25112837Sgabeblack@google.com 25212951Sgabeblack@google.comsc_module::sc_module() : 25313079Sgabeblack@google.com sc_object(sc_gem5::newModuleChecked()->name()), 25412951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 25513284Sgabeblack@google.com{ 25613317Sgabeblack@google.com if (sc_is_running()) 25713317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "simulation running"); 25813317Sgabeblack@google.com if (::sc_gem5::scheduler.elaborationDone()) 25913317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "elaboration done"); 26013284Sgabeblack@google.com} 26112837Sgabeblack@google.com 26212951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 26313191Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 26413191Sgabeblack@google.com{ 26513191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 26613317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name); 26713191Sgabeblack@google.com} 26812951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 26912951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 27013191Sgabeblack@google.com{ 27113191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 27213317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name.c_str()); 27313191Sgabeblack@google.com} 27413191Sgabeblack@google.com 27513191Sgabeblack@google.comvoid 27613191Sgabeblack@google.comsc_module::end_module() 27713191Sgabeblack@google.com{ 27813191Sgabeblack@google.com _gem5_module->endModule(); 27913191Sgabeblack@google.com} 28012928Sgabeblack@google.com 28112837Sgabeblack@google.comvoid 28213260Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &port, bool val) 28312837Sgabeblack@google.com{ 28413288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 28512837Sgabeblack@google.com} 28612837Sgabeblack@google.com 28712837Sgabeblack@google.comvoid 28813260Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 28912837Sgabeblack@google.com{ 29013288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 29112837Sgabeblack@google.com} 29212837Sgabeblack@google.com 29312837Sgabeblack@google.comvoid 29413260Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &port, bool val) 29512837Sgabeblack@google.com{ 29613288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 29712837Sgabeblack@google.com} 29812837Sgabeblack@google.com 29912837Sgabeblack@google.comvoid 30013260Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 30112837Sgabeblack@google.com{ 30213288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), true, val); 30312837Sgabeblack@google.com} 30412837Sgabeblack@google.com 30512837Sgabeblack@google.com 30612837Sgabeblack@google.comvoid 30713260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 30812837Sgabeblack@google.com{ 30913288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 31012837Sgabeblack@google.com} 31112837Sgabeblack@google.com 31212837Sgabeblack@google.comvoid 31313260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 31412837Sgabeblack@google.com{ 31513288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 31612837Sgabeblack@google.com} 31712837Sgabeblack@google.com 31812837Sgabeblack@google.comvoid 31913260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 32012837Sgabeblack@google.com{ 32113288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 32212837Sgabeblack@google.com} 32312837Sgabeblack@google.com 32412837Sgabeblack@google.comvoid 32513260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 32612837Sgabeblack@google.com{ 32713288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), false, val); 32812837Sgabeblack@google.com} 32912837Sgabeblack@google.com 33012837Sgabeblack@google.com 33112837Sgabeblack@google.comvoid 33212837Sgabeblack@google.comsc_module::dont_initialize() 33312837Sgabeblack@google.com{ 33413315Sgabeblack@google.com ::sc_gem5::Process *p = ::sc_gem5::Process::newest(); 33513317Sgabeblack@google.com if (p->procKind() == SC_CTHREAD_PROC_) 33613317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_DONT_INITIALIZE_, ""); 33713315Sgabeblack@google.com p->dontInitialize(true); 33812837Sgabeblack@google.com} 33912837Sgabeblack@google.com 34012837Sgabeblack@google.comvoid 34112953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 34212837Sgabeblack@google.com{ 34312953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 34412837Sgabeblack@google.com} 34512837Sgabeblack@google.com 34612837Sgabeblack@google.com 34712951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 34812951Sgabeblack@google.com 34912837Sgabeblack@google.comvoid 35012951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 35112837Sgabeblack@google.com{ 35212951Sgabeblack@google.com ::sc_core::next_trigger(e); 35312837Sgabeblack@google.com} 35412837Sgabeblack@google.com 35512837Sgabeblack@google.comvoid 35612951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 35712837Sgabeblack@google.com{ 35812951Sgabeblack@google.com ::sc_core::next_trigger(eol); 35912837Sgabeblack@google.com} 36012837Sgabeblack@google.com 36112837Sgabeblack@google.comvoid 36212951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 36312837Sgabeblack@google.com{ 36412951Sgabeblack@google.com ::sc_core::next_trigger(eal); 36512837Sgabeblack@google.com} 36612837Sgabeblack@google.com 36712837Sgabeblack@google.comvoid 36812951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 36912837Sgabeblack@google.com{ 37012951Sgabeblack@google.com ::sc_core::next_trigger(t); 37112837Sgabeblack@google.com} 37212837Sgabeblack@google.com 37312837Sgabeblack@google.comvoid 37412951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 37512837Sgabeblack@google.com{ 37612951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 37712837Sgabeblack@google.com} 37812837Sgabeblack@google.com 37912837Sgabeblack@google.comvoid 38012951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 38112837Sgabeblack@google.com{ 38212951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 38312837Sgabeblack@google.com} 38412837Sgabeblack@google.com 38512837Sgabeblack@google.comvoid 38612951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 38712837Sgabeblack@google.com{ 38812951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 38912837Sgabeblack@google.com} 39012837Sgabeblack@google.com 39112837Sgabeblack@google.comvoid 39212951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 39312837Sgabeblack@google.com{ 39412951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 39512837Sgabeblack@google.com} 39612837Sgabeblack@google.com 39712837Sgabeblack@google.comvoid 39812951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 39912837Sgabeblack@google.com{ 40012951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 40112837Sgabeblack@google.com} 40212837Sgabeblack@google.com 40312837Sgabeblack@google.comvoid 40412951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 40512837Sgabeblack@google.com{ 40612951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 40712837Sgabeblack@google.com} 40812837Sgabeblack@google.com 40912837Sgabeblack@google.comvoid 41012951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 41112837Sgabeblack@google.com{ 41212951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 41312837Sgabeblack@google.com} 41412837Sgabeblack@google.com 41512837Sgabeblack@google.com 41612929Sgabeblack@google.combool 41712929Sgabeblack@google.comsc_module::timed_out() 41812929Sgabeblack@google.com{ 41913189Sgabeblack@google.com return ::sc_core::timed_out(); 42012929Sgabeblack@google.com} 42112929Sgabeblack@google.com 42212929Sgabeblack@google.com 42312837Sgabeblack@google.comvoid 42412837Sgabeblack@google.comsc_module::wait() 42512837Sgabeblack@google.com{ 42612951Sgabeblack@google.com ::sc_core::wait(); 42712837Sgabeblack@google.com} 42812837Sgabeblack@google.com 42912837Sgabeblack@google.comvoid 43012951Sgabeblack@google.comsc_module::wait(int i) 43112837Sgabeblack@google.com{ 43212951Sgabeblack@google.com ::sc_core::wait(i); 43312837Sgabeblack@google.com} 43412837Sgabeblack@google.com 43512837Sgabeblack@google.comvoid 43612951Sgabeblack@google.comsc_module::wait(const sc_event &e) 43712837Sgabeblack@google.com{ 43812951Sgabeblack@google.com ::sc_core::wait(e); 43912837Sgabeblack@google.com} 44012837Sgabeblack@google.com 44112837Sgabeblack@google.comvoid 44212951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 44312837Sgabeblack@google.com{ 44412951Sgabeblack@google.com ::sc_core::wait(eol); 44512837Sgabeblack@google.com} 44612837Sgabeblack@google.com 44712837Sgabeblack@google.comvoid 44812951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 44912837Sgabeblack@google.com{ 45012951Sgabeblack@google.com ::sc_core::wait(eal); 45112837Sgabeblack@google.com} 45212837Sgabeblack@google.com 45312837Sgabeblack@google.comvoid 45412951Sgabeblack@google.comsc_module::wait(const sc_time &t) 45512837Sgabeblack@google.com{ 45612951Sgabeblack@google.com ::sc_core::wait(t); 45712837Sgabeblack@google.com} 45812837Sgabeblack@google.com 45912837Sgabeblack@google.comvoid 46012951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 46112837Sgabeblack@google.com{ 46212951Sgabeblack@google.com ::sc_core::wait(d, u); 46312837Sgabeblack@google.com} 46412837Sgabeblack@google.com 46512837Sgabeblack@google.comvoid 46612951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 46712837Sgabeblack@google.com{ 46812951Sgabeblack@google.com ::sc_core::wait(t, e); 46912837Sgabeblack@google.com} 47012837Sgabeblack@google.com 47112837Sgabeblack@google.comvoid 47212951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 47312837Sgabeblack@google.com{ 47412951Sgabeblack@google.com ::sc_core::wait(d, u, e); 47512837Sgabeblack@google.com} 47612837Sgabeblack@google.com 47712837Sgabeblack@google.comvoid 47812951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 47912837Sgabeblack@google.com{ 48012951Sgabeblack@google.com ::sc_core::wait(t, eol); 48112837Sgabeblack@google.com} 48212837Sgabeblack@google.com 48312837Sgabeblack@google.comvoid 48412951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 48512837Sgabeblack@google.com{ 48612951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 48712837Sgabeblack@google.com} 48812837Sgabeblack@google.com 48912837Sgabeblack@google.comvoid 49012951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 49112837Sgabeblack@google.com{ 49212951Sgabeblack@google.com ::sc_core::wait(t, eal); 49312837Sgabeblack@google.com} 49412837Sgabeblack@google.com 49512837Sgabeblack@google.comvoid 49612951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 49712837Sgabeblack@google.com{ 49812951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 49912837Sgabeblack@google.com} 50012837Sgabeblack@google.com 50112837Sgabeblack@google.com 50212837Sgabeblack@google.comvoid 50312909Sgabeblack@google.comsc_module::halt() 50412909Sgabeblack@google.com{ 50512951Sgabeblack@google.com ::sc_core::halt(); 50612909Sgabeblack@google.com} 50712909Sgabeblack@google.com 50812914Sgabeblack@google.comvoid 50912951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 51012914Sgabeblack@google.com{ 51112951Sgabeblack@google.com ::sc_core::at_posedge(s); 51212914Sgabeblack@google.com} 51312914Sgabeblack@google.com 51412914Sgabeblack@google.comvoid 51512951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &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_negedge(const sc_signal_in_if<bool> &s) 52212914Sgabeblack@google.com{ 52312951Sgabeblack@google.com ::sc_core::at_negedge(s); 52412914Sgabeblack@google.com} 52512914Sgabeblack@google.com 52612914Sgabeblack@google.comvoid 52712951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 52812914Sgabeblack@google.com{ 52912951Sgabeblack@google.com ::sc_core::at_negedge(s); 53012914Sgabeblack@google.com} 53112914Sgabeblack@google.com 53212909Sgabeblack@google.com 53312909Sgabeblack@google.comvoid 53412837Sgabeblack@google.comnext_trigger() 53512837Sgabeblack@google.com{ 53612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53713206Sgabeblack@google.com p->cancelTimeout(); 53813206Sgabeblack@google.com p->clearDynamic(); 53912837Sgabeblack@google.com} 54012837Sgabeblack@google.com 54112837Sgabeblack@google.comvoid 54212958Sgabeblack@google.comnext_trigger(const sc_event &e) 54312837Sgabeblack@google.com{ 54412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54513206Sgabeblack@google.com p->cancelTimeout(); 54613207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 54712837Sgabeblack@google.com} 54812837Sgabeblack@google.com 54912837Sgabeblack@google.comvoid 55012958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 55112837Sgabeblack@google.com{ 55212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55313206Sgabeblack@google.com p->cancelTimeout(); 55413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 55512837Sgabeblack@google.com} 55612837Sgabeblack@google.com 55712837Sgabeblack@google.comvoid 55812958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 55912837Sgabeblack@google.com{ 56012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56113206Sgabeblack@google.com p->cancelTimeout(); 56213207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 56312837Sgabeblack@google.com} 56412837Sgabeblack@google.com 56512837Sgabeblack@google.comvoid 56612958Sgabeblack@google.comnext_trigger(const sc_time &t) 56712837Sgabeblack@google.com{ 56812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56913206Sgabeblack@google.com p->setTimeout(t); 57013206Sgabeblack@google.com p->clearDynamic(); 57112837Sgabeblack@google.com} 57212837Sgabeblack@google.com 57312837Sgabeblack@google.comvoid 57412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 57512837Sgabeblack@google.com{ 57612951Sgabeblack@google.com next_trigger(sc_time(d, u)); 57712837Sgabeblack@google.com} 57812837Sgabeblack@google.com 57912837Sgabeblack@google.comvoid 58012958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 58112837Sgabeblack@google.com{ 58212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58313206Sgabeblack@google.com p->setTimeout(t); 58413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 58512837Sgabeblack@google.com} 58612837Sgabeblack@google.com 58712837Sgabeblack@google.comvoid 58812951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 58912837Sgabeblack@google.com{ 59012951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 59112837Sgabeblack@google.com} 59212837Sgabeblack@google.com 59312837Sgabeblack@google.comvoid 59412958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 59512837Sgabeblack@google.com{ 59612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 59713206Sgabeblack@google.com p->setTimeout(t); 59813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 59912837Sgabeblack@google.com} 60012837Sgabeblack@google.com 60112837Sgabeblack@google.comvoid 60212951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 60312837Sgabeblack@google.com{ 60412951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 60512837Sgabeblack@google.com} 60612837Sgabeblack@google.com 60712837Sgabeblack@google.comvoid 60812958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 60912837Sgabeblack@google.com{ 61012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 61113206Sgabeblack@google.com p->setTimeout(t); 61213207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 61312837Sgabeblack@google.com} 61412837Sgabeblack@google.com 61512837Sgabeblack@google.comvoid 61612951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 61712837Sgabeblack@google.com{ 61812951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 61912837Sgabeblack@google.com} 62012837Sgabeblack@google.com 62112929Sgabeblack@google.combool 62212929Sgabeblack@google.comtimed_out() 62312929Sgabeblack@google.com{ 62413189Sgabeblack@google.com ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 62513189Sgabeblack@google.com if (!p) 62613189Sgabeblack@google.com return false; 62713189Sgabeblack@google.com else 62813189Sgabeblack@google.com return p->timedOut(); 62912929Sgabeblack@google.com} 63012929Sgabeblack@google.com 63112837Sgabeblack@google.com 63213248Sgabeblack@google.comnamespace 63313248Sgabeblack@google.com{ 63413248Sgabeblack@google.com 63513248Sgabeblack@google.combool 63613248Sgabeblack@google.comwaitErrorCheck(sc_gem5::Process *p) 63713248Sgabeblack@google.com{ 63813248Sgabeblack@google.com if (p->procKind() == SC_METHOD_PROC_) { 63913317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_WAIT_NOT_ALLOWED_, 64013248Sgabeblack@google.com "\n in SC_METHODs use next_trigger() instead"); 64113248Sgabeblack@google.com return true; 64213248Sgabeblack@google.com } 64313248Sgabeblack@google.com return false; 64413248Sgabeblack@google.com} 64513248Sgabeblack@google.com 64613248Sgabeblack@google.com} // anonymous namespace 64713248Sgabeblack@google.com 64812837Sgabeblack@google.comvoid 64912837Sgabeblack@google.comwait() 65012837Sgabeblack@google.com{ 65112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 65213248Sgabeblack@google.com if (waitErrorCheck(p)) 65313248Sgabeblack@google.com return; 65413206Sgabeblack@google.com p->cancelTimeout(); 65513206Sgabeblack@google.com p->clearDynamic(); 65612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 65712837Sgabeblack@google.com} 65812837Sgabeblack@google.com 65912837Sgabeblack@google.comvoid 66012958Sgabeblack@google.comwait(int n) 66112837Sgabeblack@google.com{ 66213146Sgabeblack@google.com if (n <= 0) { 66313146Sgabeblack@google.com std::string msg = csprintf("n = %d", n); 66413317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_WAIT_N_INVALID_, msg.c_str()); 66513146Sgabeblack@google.com } 66613260Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 66713260Sgabeblack@google.com p->waitCount(n - 1); 66813260Sgabeblack@google.com wait(); 66912837Sgabeblack@google.com} 67012837Sgabeblack@google.com 67112837Sgabeblack@google.comvoid 67212958Sgabeblack@google.comwait(const sc_event &e) 67312837Sgabeblack@google.com{ 67412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 67513248Sgabeblack@google.com if (waitErrorCheck(p)) 67613248Sgabeblack@google.com return; 67713206Sgabeblack@google.com p->cancelTimeout(); 67813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 67912958Sgabeblack@google.com sc_gem5::scheduler.yield(); 68012837Sgabeblack@google.com} 68112837Sgabeblack@google.com 68212837Sgabeblack@google.comvoid 68312958Sgabeblack@google.comwait(const sc_event_or_list &eol) 68412837Sgabeblack@google.com{ 68512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 68613248Sgabeblack@google.com if (waitErrorCheck(p)) 68713248Sgabeblack@google.com return; 68813206Sgabeblack@google.com p->cancelTimeout(); 68913207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 69012958Sgabeblack@google.com sc_gem5::scheduler.yield(); 69112837Sgabeblack@google.com} 69212837Sgabeblack@google.com 69312837Sgabeblack@google.comvoid 69412958Sgabeblack@google.comwait(const sc_event_and_list &eal) 69512837Sgabeblack@google.com{ 69612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 69713248Sgabeblack@google.com if (waitErrorCheck(p)) 69813248Sgabeblack@google.com return; 69913206Sgabeblack@google.com p->cancelTimeout(); 70013207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 70112958Sgabeblack@google.com sc_gem5::scheduler.yield(); 70212837Sgabeblack@google.com} 70312837Sgabeblack@google.com 70412837Sgabeblack@google.comvoid 70512958Sgabeblack@google.comwait(const sc_time &t) 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); 71113206Sgabeblack@google.com p->clearDynamic(); 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) 71712837Sgabeblack@google.com{ 71812951Sgabeblack@google.com wait(sc_time(d, u)); 71912837Sgabeblack@google.com} 72012837Sgabeblack@google.com 72112837Sgabeblack@google.comvoid 72212958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 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::newDynamicSensitivityEvent(p, &e); 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 &e) 73412837Sgabeblack@google.com{ 73512951Sgabeblack@google.com wait(sc_time(d, u), e); 73612837Sgabeblack@google.com} 73712837Sgabeblack@google.com 73812837Sgabeblack@google.comvoid 73912958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 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::newDynamicSensitivityEventOrList(p, &eol); 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_or_list &eol) 75112837Sgabeblack@google.com{ 75212951Sgabeblack@google.com wait(sc_time(d, u), eol); 75312837Sgabeblack@google.com} 75412837Sgabeblack@google.com 75512837Sgabeblack@google.comvoid 75612958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 75712837Sgabeblack@google.com{ 75812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 75913248Sgabeblack@google.com if (waitErrorCheck(p)) 76013248Sgabeblack@google.com return; 76113206Sgabeblack@google.com p->setTimeout(t); 76213207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 76312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 76412837Sgabeblack@google.com} 76512837Sgabeblack@google.com 76612837Sgabeblack@google.comvoid 76712951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 76812837Sgabeblack@google.com{ 76912951Sgabeblack@google.com wait(sc_time(d, u), eal); 77012837Sgabeblack@google.com} 77112837Sgabeblack@google.com 77212909Sgabeblack@google.comvoid 77312909Sgabeblack@google.comhalt() 77412909Sgabeblack@google.com{ 77513175Sgabeblack@google.com ::sc_core::wait(); 77613175Sgabeblack@google.com throw ::sc_gem5::ScHalt(); 77712909Sgabeblack@google.com} 77812909Sgabeblack@google.com 77912914Sgabeblack@google.comvoid 78013155Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &s) 78112914Sgabeblack@google.com{ 78213155Sgabeblack@google.com while (s.read()) 78313155Sgabeblack@google.com wait(); 78413155Sgabeblack@google.com while (!s.read()) 78513155Sgabeblack@google.com wait(); 78612914Sgabeblack@google.com} 78712914Sgabeblack@google.com 78812914Sgabeblack@google.comvoid 78913155Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 79012914Sgabeblack@google.com{ 79113155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 79213155Sgabeblack@google.com wait(); 79313155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 79413155Sgabeblack@google.com wait(); 79512914Sgabeblack@google.com} 79612914Sgabeblack@google.com 79712914Sgabeblack@google.comvoid 79813155Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &s) 79912914Sgabeblack@google.com{ 80013155Sgabeblack@google.com while (!s.read()) 80113155Sgabeblack@google.com wait(); 80213155Sgabeblack@google.com while (s.read()) 80313155Sgabeblack@google.com wait(); 80412914Sgabeblack@google.com} 80512914Sgabeblack@google.com 80612914Sgabeblack@google.comvoid 80713155Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 80812914Sgabeblack@google.com{ 80913155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 81013155Sgabeblack@google.com wait(); 81113155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 81213155Sgabeblack@google.com wait(); 81312914Sgabeblack@google.com} 81412914Sgabeblack@google.com 81512837Sgabeblack@google.comconst char * 81613035Sgabeblack@google.comsc_gen_unique_name(const char *seed) 81712837Sgabeblack@google.com{ 81813296Sgabeblack@google.com if (!seed || seed[0] == '\0') { 81913317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_GEN_UNIQUE_NAME_, ""); 82013296Sgabeblack@google.com seed = "unnamed"; 82113296Sgabeblack@google.com } 82213296Sgabeblack@google.com 82313268Sgabeblack@google.com auto mod = sc_gem5::pickParentModule(); 82413285Sgabeblack@google.com if (mod) 82513285Sgabeblack@google.com return mod->uniqueName(seed); 82613296Sgabeblack@google.com 82713285Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 82813285Sgabeblack@google.com if (p) 82913285Sgabeblack@google.com return p->uniqueName(seed); 83013296Sgabeblack@google.com 83113303Sgabeblack@google.com return ::sc_gem5::globalNameGen.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