sc_module.cc revision 13382
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 3413280Sgabeblack@google.com#include "systemc/core/event.hh" 3512982Sgabeblack@google.com#include "systemc/core/kernel.hh" 3612951Sgabeblack@google.com#include "systemc/core/module.hh" 3713280Sgabeblack@google.com#include "systemc/core/object.hh" 3813288Sgabeblack@google.com#include "systemc/core/port.hh" 3912953Sgabeblack@google.com#include "systemc/core/process_types.hh" 4013260Sgabeblack@google.com#include "systemc/core/sensitivity.hh" 4113288Sgabeblack@google.com#include "systemc/ext/channel/sc_in.hh" 4213288Sgabeblack@google.com#include "systemc/ext/channel/sc_inout.hh" 4313288Sgabeblack@google.com#include "systemc/ext/channel/sc_out.hh" 4413155Sgabeblack@google.com#include "systemc/ext/channel/sc_signal_in_if.hh" 4513317Sgabeblack@google.com#include "systemc/ext/core/messages.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; 6113317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_METHOD_AFTER_START_, 6213317Sgabeblack@google.com 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; 7613317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_THREAD_AFTER_START_, 7713317Sgabeblack@google.com 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; 9113317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_MODULE_CTHREAD_AFTER_START_, 9213317Sgabeblack@google.com 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 10012952Sgabeblack@google.com} // namespace sc_gem5 10112952Sgabeblack@google.com 10212837Sgabeblack@google.comnamespace sc_core 10312837Sgabeblack@google.com{ 10412837Sgabeblack@google.com 10513382Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy() : _interface(nullptr), _port(nullptr) {} 10613382Sgabeblack@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 11513382Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL; 11612837Sgabeblack@google.com 11712982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 11812837Sgabeblack@google.com 11912837Sgabeblack@google.comvoid 12012837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 12112837Sgabeblack@google.com const sc_bind_proxy &p002, 12212837Sgabeblack@google.com const sc_bind_proxy &p003, 12312837Sgabeblack@google.com const sc_bind_proxy &p004, 12412837Sgabeblack@google.com const sc_bind_proxy &p005, 12512837Sgabeblack@google.com const sc_bind_proxy &p006, 12612837Sgabeblack@google.com const sc_bind_proxy &p007, 12712837Sgabeblack@google.com const sc_bind_proxy &p008, 12812837Sgabeblack@google.com const sc_bind_proxy &p009, 12912837Sgabeblack@google.com const sc_bind_proxy &p010, 13012837Sgabeblack@google.com const sc_bind_proxy &p011, 13112837Sgabeblack@google.com const sc_bind_proxy &p012, 13212837Sgabeblack@google.com const sc_bind_proxy &p013, 13312837Sgabeblack@google.com const sc_bind_proxy &p014, 13412837Sgabeblack@google.com const sc_bind_proxy &p015, 13512837Sgabeblack@google.com const sc_bind_proxy &p016, 13612837Sgabeblack@google.com const sc_bind_proxy &p017, 13712837Sgabeblack@google.com const sc_bind_proxy &p018, 13812837Sgabeblack@google.com const sc_bind_proxy &p019, 13912837Sgabeblack@google.com const sc_bind_proxy &p020, 14012837Sgabeblack@google.com const sc_bind_proxy &p021, 14112837Sgabeblack@google.com const sc_bind_proxy &p022, 14212837Sgabeblack@google.com const sc_bind_proxy &p023, 14312837Sgabeblack@google.com const sc_bind_proxy &p024, 14412837Sgabeblack@google.com const sc_bind_proxy &p025, 14512837Sgabeblack@google.com const sc_bind_proxy &p026, 14612837Sgabeblack@google.com const sc_bind_proxy &p027, 14712837Sgabeblack@google.com const sc_bind_proxy &p028, 14812837Sgabeblack@google.com const sc_bind_proxy &p029, 14912837Sgabeblack@google.com const sc_bind_proxy &p030, 15012837Sgabeblack@google.com const sc_bind_proxy &p031, 15112837Sgabeblack@google.com const sc_bind_proxy &p032, 15212837Sgabeblack@google.com const sc_bind_proxy &p033, 15312837Sgabeblack@google.com const sc_bind_proxy &p034, 15412837Sgabeblack@google.com const sc_bind_proxy &p035, 15512837Sgabeblack@google.com const sc_bind_proxy &p036, 15612837Sgabeblack@google.com const sc_bind_proxy &p037, 15712837Sgabeblack@google.com const sc_bind_proxy &p038, 15812837Sgabeblack@google.com const sc_bind_proxy &p039, 15912837Sgabeblack@google.com const sc_bind_proxy &p040, 16012837Sgabeblack@google.com const sc_bind_proxy &p041, 16112837Sgabeblack@google.com const sc_bind_proxy &p042, 16212837Sgabeblack@google.com const sc_bind_proxy &p043, 16312837Sgabeblack@google.com const sc_bind_proxy &p044, 16412837Sgabeblack@google.com const sc_bind_proxy &p045, 16512837Sgabeblack@google.com const sc_bind_proxy &p046, 16612837Sgabeblack@google.com const sc_bind_proxy &p047, 16712837Sgabeblack@google.com const sc_bind_proxy &p048, 16812837Sgabeblack@google.com const sc_bind_proxy &p049, 16912837Sgabeblack@google.com const sc_bind_proxy &p050, 17012837Sgabeblack@google.com const sc_bind_proxy &p051, 17112837Sgabeblack@google.com const sc_bind_proxy &p052, 17212837Sgabeblack@google.com const sc_bind_proxy &p053, 17312837Sgabeblack@google.com const sc_bind_proxy &p054, 17412837Sgabeblack@google.com const sc_bind_proxy &p055, 17512837Sgabeblack@google.com const sc_bind_proxy &p056, 17612837Sgabeblack@google.com const sc_bind_proxy &p057, 17712837Sgabeblack@google.com const sc_bind_proxy &p058, 17812837Sgabeblack@google.com const sc_bind_proxy &p059, 17912837Sgabeblack@google.com const sc_bind_proxy &p060, 18012837Sgabeblack@google.com const sc_bind_proxy &p061, 18112837Sgabeblack@google.com const sc_bind_proxy &p062, 18212837Sgabeblack@google.com const sc_bind_proxy &p063, 18312837Sgabeblack@google.com const sc_bind_proxy &p064) 18412837Sgabeblack@google.com{ 18513091Sgabeblack@google.com std::vector<const ::sc_core::sc_bind_proxy *> proxies; 18613091Sgabeblack@google.com auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 18713091Sgabeblack@google.com if (!p.port() && !p.interface()) 18813091Sgabeblack@google.com return false; 18913091Sgabeblack@google.com proxies.push_back(&p); 19013091Sgabeblack@google.com return true; 19113091Sgabeblack@google.com }; 19213091Sgabeblack@google.com insert(p001) && insert(p002) && insert(p003) && insert(p004) && 19313091Sgabeblack@google.com insert(p005) && insert(p006) && insert(p007) && insert(p008) && 19413091Sgabeblack@google.com insert(p009) && insert(p010) && insert(p011) && insert(p012) && 19513091Sgabeblack@google.com insert(p013) && insert(p014) && insert(p015) && insert(p016) && 19613091Sgabeblack@google.com insert(p017) && insert(p018) && insert(p019) && insert(p020) && 19713091Sgabeblack@google.com insert(p021) && insert(p022) && insert(p023) && insert(p024) && 19813091Sgabeblack@google.com insert(p025) && insert(p026) && insert(p027) && insert(p028) && 19913091Sgabeblack@google.com insert(p029) && insert(p030) && insert(p031) && insert(p032) && 20013091Sgabeblack@google.com insert(p033) && insert(p034) && insert(p035) && insert(p036) && 20113091Sgabeblack@google.com insert(p037) && insert(p038) && insert(p039) && insert(p040) && 20213091Sgabeblack@google.com insert(p041) && insert(p042) && insert(p043) && insert(p044) && 20313091Sgabeblack@google.com insert(p045) && insert(p046) && insert(p047) && insert(p048) && 20413091Sgabeblack@google.com insert(p049) && insert(p050) && insert(p051) && insert(p052) && 20513091Sgabeblack@google.com insert(p053) && insert(p054) && insert(p055) && insert(p056) && 20613091Sgabeblack@google.com insert(p057) && insert(p058) && insert(p059) && insert(p060) && 20713091Sgabeblack@google.com insert(p061) && insert(p062) && insert(p063) && insert(p064); 20813091Sgabeblack@google.com _gem5_module->bindPorts(proxies); 20912837Sgabeblack@google.com} 21012837Sgabeblack@google.com 21113292Sgabeblack@google.comsc_module & 21213292Sgabeblack@google.comsc_module::operator << (sc_interface &iface) 21313292Sgabeblack@google.com{ 21413292Sgabeblack@google.com (*this)(iface); 21513292Sgabeblack@google.com return *this; 21613292Sgabeblack@google.com} 21713292Sgabeblack@google.com 21813292Sgabeblack@google.comsc_module & 21913292Sgabeblack@google.comsc_module::operator << (sc_port_base &pb) 22013292Sgabeblack@google.com{ 22113292Sgabeblack@google.com (*this)(pb); 22213292Sgabeblack@google.com return *this; 22313292Sgabeblack@google.com} 22413292Sgabeblack@google.com 22513292Sgabeblack@google.comsc_module & 22613292Sgabeblack@google.comsc_module::operator , (sc_interface &iface) 22713292Sgabeblack@google.com{ 22813292Sgabeblack@google.com (*this)(iface); 22913292Sgabeblack@google.com return *this; 23013292Sgabeblack@google.com} 23113292Sgabeblack@google.com 23213292Sgabeblack@google.comsc_module & 23313292Sgabeblack@google.comsc_module::operator , (sc_port_base &pb) 23413292Sgabeblack@google.com{ 23513292Sgabeblack@google.com (*this)(pb); 23613292Sgabeblack@google.com return *this; 23713292Sgabeblack@google.com} 23813292Sgabeblack@google.com 23912837Sgabeblack@google.comconst std::vector<sc_object *> & 24012837Sgabeblack@google.comsc_module::get_child_objects() const 24112837Sgabeblack@google.com{ 24212951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 24312837Sgabeblack@google.com} 24412837Sgabeblack@google.com 24512837Sgabeblack@google.comconst std::vector<sc_event *> & 24612837Sgabeblack@google.comsc_module::get_child_events() const 24712837Sgabeblack@google.com{ 24812951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 24912837Sgabeblack@google.com} 25012837Sgabeblack@google.com 25112951Sgabeblack@google.comsc_module::sc_module() : 25213079Sgabeblack@google.com sc_object(sc_gem5::newModuleChecked()->name()), 25312951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 25413284Sgabeblack@google.com{ 25513317Sgabeblack@google.com if (sc_is_running()) 25613317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "simulation running"); 25713317Sgabeblack@google.com if (::sc_gem5::scheduler.elaborationDone()) 25813317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "elaboration done"); 25913284Sgabeblack@google.com} 26012837Sgabeblack@google.com 26112951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 26213191Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 26313191Sgabeblack@google.com{ 26413191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 26513317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name); 26613191Sgabeblack@google.com} 26712951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 26812951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 26913191Sgabeblack@google.com{ 27013191Sgabeblack@google.com _gem5_module->deprecatedConstructor(); 27113317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name.c_str()); 27213191Sgabeblack@google.com} 27313191Sgabeblack@google.com 27413191Sgabeblack@google.comvoid 27513191Sgabeblack@google.comsc_module::end_module() 27613191Sgabeblack@google.com{ 27713191Sgabeblack@google.com _gem5_module->endModule(); 27813191Sgabeblack@google.com} 27912928Sgabeblack@google.com 28012837Sgabeblack@google.comvoid 28113260Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &port, bool val) 28212837Sgabeblack@google.com{ 28313288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 28412837Sgabeblack@google.com} 28512837Sgabeblack@google.com 28612837Sgabeblack@google.comvoid 28713260Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 28812837Sgabeblack@google.com{ 28913288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 29012837Sgabeblack@google.com} 29112837Sgabeblack@google.com 29212837Sgabeblack@google.comvoid 29313260Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &port, bool val) 29412837Sgabeblack@google.com{ 29513288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 29612837Sgabeblack@google.com} 29712837Sgabeblack@google.com 29812837Sgabeblack@google.comvoid 29913260Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 30012837Sgabeblack@google.com{ 30113288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), true, val); 30212837Sgabeblack@google.com} 30312837Sgabeblack@google.com 30412837Sgabeblack@google.com 30512837Sgabeblack@google.comvoid 30613260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 30712837Sgabeblack@google.com{ 30813288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 30912837Sgabeblack@google.com} 31012837Sgabeblack@google.com 31112837Sgabeblack@google.comvoid 31213260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 31312837Sgabeblack@google.com{ 31413288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 31512837Sgabeblack@google.com} 31612837Sgabeblack@google.com 31712837Sgabeblack@google.comvoid 31813260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 31912837Sgabeblack@google.com{ 32013288Sgabeblack@google.com ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 32112837Sgabeblack@google.com} 32212837Sgabeblack@google.com 32312837Sgabeblack@google.comvoid 32413260Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 32512837Sgabeblack@google.com{ 32613288Sgabeblack@google.com ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), false, val); 32712837Sgabeblack@google.com} 32812837Sgabeblack@google.com 32912837Sgabeblack@google.com 33012837Sgabeblack@google.comvoid 33112837Sgabeblack@google.comsc_module::dont_initialize() 33212837Sgabeblack@google.com{ 33313315Sgabeblack@google.com ::sc_gem5::Process *p = ::sc_gem5::Process::newest(); 33413317Sgabeblack@google.com if (p->procKind() == SC_CTHREAD_PROC_) 33513317Sgabeblack@google.com SC_REPORT_WARNING(SC_ID_DONT_INITIALIZE_, ""); 33613315Sgabeblack@google.com p->dontInitialize(true); 33712837Sgabeblack@google.com} 33812837Sgabeblack@google.com 33912837Sgabeblack@google.comvoid 34012953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 34112837Sgabeblack@google.com{ 34212953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 34312837Sgabeblack@google.com} 34412837Sgabeblack@google.com 34512837Sgabeblack@google.com 34612951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 34712951Sgabeblack@google.com 34812837Sgabeblack@google.comvoid 34912951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 35012837Sgabeblack@google.com{ 35112951Sgabeblack@google.com ::sc_core::next_trigger(e); 35212837Sgabeblack@google.com} 35312837Sgabeblack@google.com 35412837Sgabeblack@google.comvoid 35512951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 35612837Sgabeblack@google.com{ 35712951Sgabeblack@google.com ::sc_core::next_trigger(eol); 35812837Sgabeblack@google.com} 35912837Sgabeblack@google.com 36012837Sgabeblack@google.comvoid 36112951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 36212837Sgabeblack@google.com{ 36312951Sgabeblack@google.com ::sc_core::next_trigger(eal); 36412837Sgabeblack@google.com} 36512837Sgabeblack@google.com 36612837Sgabeblack@google.comvoid 36712951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 36812837Sgabeblack@google.com{ 36912951Sgabeblack@google.com ::sc_core::next_trigger(t); 37012837Sgabeblack@google.com} 37112837Sgabeblack@google.com 37212837Sgabeblack@google.comvoid 37312951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 37412837Sgabeblack@google.com{ 37512951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 37612837Sgabeblack@google.com} 37712837Sgabeblack@google.com 37812837Sgabeblack@google.comvoid 37912951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 38012837Sgabeblack@google.com{ 38112951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 38212837Sgabeblack@google.com} 38312837Sgabeblack@google.com 38412837Sgabeblack@google.comvoid 38512951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 38612837Sgabeblack@google.com{ 38712951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 38812837Sgabeblack@google.com} 38912837Sgabeblack@google.com 39012837Sgabeblack@google.comvoid 39112951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 39212837Sgabeblack@google.com{ 39312951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 39412837Sgabeblack@google.com} 39512837Sgabeblack@google.com 39612837Sgabeblack@google.comvoid 39712951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 39812837Sgabeblack@google.com{ 39912951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 40012837Sgabeblack@google.com} 40112837Sgabeblack@google.com 40212837Sgabeblack@google.comvoid 40312951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 40412837Sgabeblack@google.com{ 40512951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 40612837Sgabeblack@google.com} 40712837Sgabeblack@google.com 40812837Sgabeblack@google.comvoid 40912951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 41012837Sgabeblack@google.com{ 41112951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 41212837Sgabeblack@google.com} 41312837Sgabeblack@google.com 41412837Sgabeblack@google.com 41512929Sgabeblack@google.combool 41612929Sgabeblack@google.comsc_module::timed_out() 41712929Sgabeblack@google.com{ 41813189Sgabeblack@google.com return ::sc_core::timed_out(); 41912929Sgabeblack@google.com} 42012929Sgabeblack@google.com 42112929Sgabeblack@google.com 42212837Sgabeblack@google.comvoid 42312837Sgabeblack@google.comsc_module::wait() 42412837Sgabeblack@google.com{ 42512951Sgabeblack@google.com ::sc_core::wait(); 42612837Sgabeblack@google.com} 42712837Sgabeblack@google.com 42812837Sgabeblack@google.comvoid 42912951Sgabeblack@google.comsc_module::wait(int i) 43012837Sgabeblack@google.com{ 43112951Sgabeblack@google.com ::sc_core::wait(i); 43212837Sgabeblack@google.com} 43312837Sgabeblack@google.com 43412837Sgabeblack@google.comvoid 43512951Sgabeblack@google.comsc_module::wait(const sc_event &e) 43612837Sgabeblack@google.com{ 43712951Sgabeblack@google.com ::sc_core::wait(e); 43812837Sgabeblack@google.com} 43912837Sgabeblack@google.com 44012837Sgabeblack@google.comvoid 44112951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 44212837Sgabeblack@google.com{ 44312951Sgabeblack@google.com ::sc_core::wait(eol); 44412837Sgabeblack@google.com} 44512837Sgabeblack@google.com 44612837Sgabeblack@google.comvoid 44712951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 44812837Sgabeblack@google.com{ 44912951Sgabeblack@google.com ::sc_core::wait(eal); 45012837Sgabeblack@google.com} 45112837Sgabeblack@google.com 45212837Sgabeblack@google.comvoid 45312951Sgabeblack@google.comsc_module::wait(const sc_time &t) 45412837Sgabeblack@google.com{ 45512951Sgabeblack@google.com ::sc_core::wait(t); 45612837Sgabeblack@google.com} 45712837Sgabeblack@google.com 45812837Sgabeblack@google.comvoid 45912951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 46012837Sgabeblack@google.com{ 46112951Sgabeblack@google.com ::sc_core::wait(d, u); 46212837Sgabeblack@google.com} 46312837Sgabeblack@google.com 46412837Sgabeblack@google.comvoid 46512951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 46612837Sgabeblack@google.com{ 46712951Sgabeblack@google.com ::sc_core::wait(t, e); 46812837Sgabeblack@google.com} 46912837Sgabeblack@google.com 47012837Sgabeblack@google.comvoid 47112951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 47212837Sgabeblack@google.com{ 47312951Sgabeblack@google.com ::sc_core::wait(d, u, e); 47412837Sgabeblack@google.com} 47512837Sgabeblack@google.com 47612837Sgabeblack@google.comvoid 47712951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 47812837Sgabeblack@google.com{ 47912951Sgabeblack@google.com ::sc_core::wait(t, eol); 48012837Sgabeblack@google.com} 48112837Sgabeblack@google.com 48212837Sgabeblack@google.comvoid 48312951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 48412837Sgabeblack@google.com{ 48512951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 48612837Sgabeblack@google.com} 48712837Sgabeblack@google.com 48812837Sgabeblack@google.comvoid 48912951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 49012837Sgabeblack@google.com{ 49112951Sgabeblack@google.com ::sc_core::wait(t, eal); 49212837Sgabeblack@google.com} 49312837Sgabeblack@google.com 49412837Sgabeblack@google.comvoid 49512951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 49612837Sgabeblack@google.com{ 49712951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 49812837Sgabeblack@google.com} 49912837Sgabeblack@google.com 50012837Sgabeblack@google.com 50112837Sgabeblack@google.comvoid 50212909Sgabeblack@google.comsc_module::halt() 50312909Sgabeblack@google.com{ 50412951Sgabeblack@google.com ::sc_core::halt(); 50512909Sgabeblack@google.com} 50612909Sgabeblack@google.com 50712914Sgabeblack@google.comvoid 50812951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 50912914Sgabeblack@google.com{ 51012951Sgabeblack@google.com ::sc_core::at_posedge(s); 51112914Sgabeblack@google.com} 51212914Sgabeblack@google.com 51312914Sgabeblack@google.comvoid 51412951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 51512914Sgabeblack@google.com{ 51612951Sgabeblack@google.com ::sc_core::at_posedge(s); 51712914Sgabeblack@google.com} 51812914Sgabeblack@google.com 51912914Sgabeblack@google.comvoid 52012951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 52112914Sgabeblack@google.com{ 52212951Sgabeblack@google.com ::sc_core::at_negedge(s); 52312914Sgabeblack@google.com} 52412914Sgabeblack@google.com 52512914Sgabeblack@google.comvoid 52612951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 52712914Sgabeblack@google.com{ 52812951Sgabeblack@google.com ::sc_core::at_negedge(s); 52912914Sgabeblack@google.com} 53012914Sgabeblack@google.com 53112909Sgabeblack@google.com 53212909Sgabeblack@google.comvoid 53312837Sgabeblack@google.comnext_trigger() 53412837Sgabeblack@google.com{ 53512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53613206Sgabeblack@google.com p->cancelTimeout(); 53713206Sgabeblack@google.com p->clearDynamic(); 53812837Sgabeblack@google.com} 53912837Sgabeblack@google.com 54012837Sgabeblack@google.comvoid 54112958Sgabeblack@google.comnext_trigger(const sc_event &e) 54212837Sgabeblack@google.com{ 54312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54413206Sgabeblack@google.com p->cancelTimeout(); 54513207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 54612837Sgabeblack@google.com} 54712837Sgabeblack@google.com 54812837Sgabeblack@google.comvoid 54912958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 55012837Sgabeblack@google.com{ 55112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55213206Sgabeblack@google.com p->cancelTimeout(); 55313207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 55412837Sgabeblack@google.com} 55512837Sgabeblack@google.com 55612837Sgabeblack@google.comvoid 55712958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 55812837Sgabeblack@google.com{ 55912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56013206Sgabeblack@google.com p->cancelTimeout(); 56113207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 56212837Sgabeblack@google.com} 56312837Sgabeblack@google.com 56412837Sgabeblack@google.comvoid 56512958Sgabeblack@google.comnext_trigger(const sc_time &t) 56612837Sgabeblack@google.com{ 56712958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56813206Sgabeblack@google.com p->setTimeout(t); 56913206Sgabeblack@google.com p->clearDynamic(); 57012837Sgabeblack@google.com} 57112837Sgabeblack@google.com 57212837Sgabeblack@google.comvoid 57312951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 57412837Sgabeblack@google.com{ 57512951Sgabeblack@google.com next_trigger(sc_time(d, u)); 57612837Sgabeblack@google.com} 57712837Sgabeblack@google.com 57812837Sgabeblack@google.comvoid 57912958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 58012837Sgabeblack@google.com{ 58112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58213206Sgabeblack@google.com p->setTimeout(t); 58313207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 58412837Sgabeblack@google.com} 58512837Sgabeblack@google.com 58612837Sgabeblack@google.comvoid 58712951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 58812837Sgabeblack@google.com{ 58912951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 59012837Sgabeblack@google.com} 59112837Sgabeblack@google.com 59212837Sgabeblack@google.comvoid 59312958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 59412837Sgabeblack@google.com{ 59512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 59613206Sgabeblack@google.com p->setTimeout(t); 59713207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 59812837Sgabeblack@google.com} 59912837Sgabeblack@google.com 60012837Sgabeblack@google.comvoid 60112951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 60212837Sgabeblack@google.com{ 60312951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 60412837Sgabeblack@google.com} 60512837Sgabeblack@google.com 60612837Sgabeblack@google.comvoid 60712958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 60812837Sgabeblack@google.com{ 60912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 61013206Sgabeblack@google.com p->setTimeout(t); 61113207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 61212837Sgabeblack@google.com} 61312837Sgabeblack@google.com 61412837Sgabeblack@google.comvoid 61512951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 61612837Sgabeblack@google.com{ 61712951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 61812837Sgabeblack@google.com} 61912837Sgabeblack@google.com 62012929Sgabeblack@google.combool 62112929Sgabeblack@google.comtimed_out() 62212929Sgabeblack@google.com{ 62313189Sgabeblack@google.com ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 62413189Sgabeblack@google.com if (!p) 62513189Sgabeblack@google.com return false; 62613189Sgabeblack@google.com else 62713189Sgabeblack@google.com return p->timedOut(); 62812929Sgabeblack@google.com} 62912929Sgabeblack@google.com 63012837Sgabeblack@google.com 63113248Sgabeblack@google.comnamespace 63213248Sgabeblack@google.com{ 63313248Sgabeblack@google.com 63413248Sgabeblack@google.combool 63513248Sgabeblack@google.comwaitErrorCheck(sc_gem5::Process *p) 63613248Sgabeblack@google.com{ 63713248Sgabeblack@google.com if (p->procKind() == SC_METHOD_PROC_) { 63813317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_WAIT_NOT_ALLOWED_, 63913248Sgabeblack@google.com "\n in SC_METHODs use next_trigger() instead"); 64013248Sgabeblack@google.com return true; 64113248Sgabeblack@google.com } 64213248Sgabeblack@google.com return false; 64313248Sgabeblack@google.com} 64413248Sgabeblack@google.com 64513248Sgabeblack@google.com} // anonymous namespace 64613248Sgabeblack@google.com 64712837Sgabeblack@google.comvoid 64812837Sgabeblack@google.comwait() 64912837Sgabeblack@google.com{ 65012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 65113248Sgabeblack@google.com if (waitErrorCheck(p)) 65213248Sgabeblack@google.com return; 65313206Sgabeblack@google.com p->cancelTimeout(); 65413206Sgabeblack@google.com p->clearDynamic(); 65512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 65612837Sgabeblack@google.com} 65712837Sgabeblack@google.com 65812837Sgabeblack@google.comvoid 65912958Sgabeblack@google.comwait(int n) 66012837Sgabeblack@google.com{ 66113146Sgabeblack@google.com if (n <= 0) { 66213146Sgabeblack@google.com std::string msg = csprintf("n = %d", n); 66313317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_WAIT_N_INVALID_, msg.c_str()); 66413146Sgabeblack@google.com } 66513260Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 66613260Sgabeblack@google.com p->waitCount(n - 1); 66713260Sgabeblack@google.com wait(); 66812837Sgabeblack@google.com} 66912837Sgabeblack@google.com 67012837Sgabeblack@google.comvoid 67112958Sgabeblack@google.comwait(const sc_event &e) 67212837Sgabeblack@google.com{ 67312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 67413248Sgabeblack@google.com if (waitErrorCheck(p)) 67513248Sgabeblack@google.com return; 67613206Sgabeblack@google.com p->cancelTimeout(); 67713207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 67812958Sgabeblack@google.com sc_gem5::scheduler.yield(); 67912837Sgabeblack@google.com} 68012837Sgabeblack@google.com 68112837Sgabeblack@google.comvoid 68212958Sgabeblack@google.comwait(const sc_event_or_list &eol) 68312837Sgabeblack@google.com{ 68412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 68513248Sgabeblack@google.com if (waitErrorCheck(p)) 68613248Sgabeblack@google.com return; 68713206Sgabeblack@google.com p->cancelTimeout(); 68813207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 68912958Sgabeblack@google.com sc_gem5::scheduler.yield(); 69012837Sgabeblack@google.com} 69112837Sgabeblack@google.com 69212837Sgabeblack@google.comvoid 69312958Sgabeblack@google.comwait(const sc_event_and_list &eal) 69412837Sgabeblack@google.com{ 69512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 69613248Sgabeblack@google.com if (waitErrorCheck(p)) 69713248Sgabeblack@google.com return; 69813206Sgabeblack@google.com p->cancelTimeout(); 69913207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 70012958Sgabeblack@google.com sc_gem5::scheduler.yield(); 70112837Sgabeblack@google.com} 70212837Sgabeblack@google.com 70312837Sgabeblack@google.comvoid 70412958Sgabeblack@google.comwait(const sc_time &t) 70512837Sgabeblack@google.com{ 70612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 70713248Sgabeblack@google.com if (waitErrorCheck(p)) 70813248Sgabeblack@google.com return; 70913206Sgabeblack@google.com p->setTimeout(t); 71013206Sgabeblack@google.com p->clearDynamic(); 71112958Sgabeblack@google.com sc_gem5::scheduler.yield(); 71212837Sgabeblack@google.com} 71312837Sgabeblack@google.com 71412837Sgabeblack@google.comvoid 71512951Sgabeblack@google.comwait(double d, sc_time_unit u) 71612837Sgabeblack@google.com{ 71712951Sgabeblack@google.com wait(sc_time(d, u)); 71812837Sgabeblack@google.com} 71912837Sgabeblack@google.com 72012837Sgabeblack@google.comvoid 72112958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 72212837Sgabeblack@google.com{ 72312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 72413248Sgabeblack@google.com if (waitErrorCheck(p)) 72513248Sgabeblack@google.com return; 72613206Sgabeblack@google.com p->setTimeout(t); 72713207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEvent(p, &e); 72812958Sgabeblack@google.com sc_gem5::scheduler.yield(); 72912837Sgabeblack@google.com} 73012837Sgabeblack@google.com 73112837Sgabeblack@google.comvoid 73212951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 73312837Sgabeblack@google.com{ 73412951Sgabeblack@google.com wait(sc_time(d, u), e); 73512837Sgabeblack@google.com} 73612837Sgabeblack@google.com 73712837Sgabeblack@google.comvoid 73812958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 73912837Sgabeblack@google.com{ 74012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 74113248Sgabeblack@google.com if (waitErrorCheck(p)) 74213248Sgabeblack@google.com return; 74313206Sgabeblack@google.com p->setTimeout(t); 74413207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 74512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 74612837Sgabeblack@google.com} 74712837Sgabeblack@google.com 74812837Sgabeblack@google.comvoid 74912951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 75012837Sgabeblack@google.com{ 75112951Sgabeblack@google.com wait(sc_time(d, u), eol); 75212837Sgabeblack@google.com} 75312837Sgabeblack@google.com 75412837Sgabeblack@google.comvoid 75512958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 75612837Sgabeblack@google.com{ 75712958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 75813248Sgabeblack@google.com if (waitErrorCheck(p)) 75913248Sgabeblack@google.com return; 76013206Sgabeblack@google.com p->setTimeout(t); 76113207Sgabeblack@google.com ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 76212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 76312837Sgabeblack@google.com} 76412837Sgabeblack@google.com 76512837Sgabeblack@google.comvoid 76612951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 76712837Sgabeblack@google.com{ 76812951Sgabeblack@google.com wait(sc_time(d, u), eal); 76912837Sgabeblack@google.com} 77012837Sgabeblack@google.com 77112909Sgabeblack@google.comvoid 77212909Sgabeblack@google.comhalt() 77312909Sgabeblack@google.com{ 77413175Sgabeblack@google.com ::sc_core::wait(); 77513175Sgabeblack@google.com throw ::sc_gem5::ScHalt(); 77612909Sgabeblack@google.com} 77712909Sgabeblack@google.com 77812914Sgabeblack@google.comvoid 77913155Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &s) 78012914Sgabeblack@google.com{ 78113155Sgabeblack@google.com while (s.read()) 78213155Sgabeblack@google.com wait(); 78313155Sgabeblack@google.com while (!s.read()) 78413155Sgabeblack@google.com wait(); 78512914Sgabeblack@google.com} 78612914Sgabeblack@google.com 78712914Sgabeblack@google.comvoid 78813155Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 78912914Sgabeblack@google.com{ 79013155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 79113155Sgabeblack@google.com wait(); 79213155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 79313155Sgabeblack@google.com wait(); 79412914Sgabeblack@google.com} 79512914Sgabeblack@google.com 79612914Sgabeblack@google.comvoid 79713155Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &s) 79812914Sgabeblack@google.com{ 79913155Sgabeblack@google.com while (!s.read()) 80013155Sgabeblack@google.com wait(); 80113155Sgabeblack@google.com while (s.read()) 80213155Sgabeblack@google.com wait(); 80312914Sgabeblack@google.com} 80412914Sgabeblack@google.com 80512914Sgabeblack@google.comvoid 80613155Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 80712914Sgabeblack@google.com{ 80813155Sgabeblack@google.com while (s.read() == sc_dt::Log_0) 80913155Sgabeblack@google.com wait(); 81013155Sgabeblack@google.com while (s.read() == sc_dt::Log_1) 81113155Sgabeblack@google.com wait(); 81212914Sgabeblack@google.com} 81312914Sgabeblack@google.com 81412837Sgabeblack@google.comconst char * 81513035Sgabeblack@google.comsc_gen_unique_name(const char *seed) 81612837Sgabeblack@google.com{ 81713296Sgabeblack@google.com if (!seed || seed[0] == '\0') { 81813317Sgabeblack@google.com SC_REPORT_ERROR(SC_ID_GEN_UNIQUE_NAME_, ""); 81913296Sgabeblack@google.com seed = "unnamed"; 82013296Sgabeblack@google.com } 82113296Sgabeblack@google.com 82213268Sgabeblack@google.com auto mod = sc_gem5::pickParentModule(); 82313285Sgabeblack@google.com if (mod) 82413285Sgabeblack@google.com return mod->uniqueName(seed); 82513296Sgabeblack@google.com 82613285Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 82713285Sgabeblack@google.com if (p) 82813285Sgabeblack@google.com return p->uniqueName(seed); 82913296Sgabeblack@google.com 83013303Sgabeblack@google.com return ::sc_gem5::globalNameGen.gen(seed); 83112837Sgabeblack@google.com} 83212837Sgabeblack@google.com 83312837Sgabeblack@google.combool 83412930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 83512930Sgabeblack@google.com{ 83613280Sgabeblack@google.com return sc_gem5::findEvent(name) != sc_gem5::allEvents.end() || 83713280Sgabeblack@google.com ::sc_gem5::findObject(name, sc_gem5::allObjects); 83812930Sgabeblack@google.com} 83912930Sgabeblack@google.com 84012930Sgabeblack@google.combool 84112837Sgabeblack@google.comsc_start_of_simulation_invoked() 84212837Sgabeblack@google.com{ 84312982Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 84412837Sgabeblack@google.com} 84512837Sgabeblack@google.com 84612837Sgabeblack@google.combool 84712837Sgabeblack@google.comsc_end_of_simulation_invoked() 84812837Sgabeblack@google.com{ 84912982Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 85012837Sgabeblack@google.com} 85112837Sgabeblack@google.com 85212901Sgabeblack@google.comsc_module * 85312901Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 85412901Sgabeblack@google.com{ 85512901Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 85612901Sgabeblack@google.com modules.emplace_back(mod); 85712901Sgabeblack@google.com return mod; 85812901Sgabeblack@google.com} 85912901Sgabeblack@google.com 86012837Sgabeblack@google.com} // namespace sc_core 861