sc_module.cc revision 13135
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" 3512982Sgabeblack@google.com#include "systemc/core/kernel.hh" 3612951Sgabeblack@google.com#include "systemc/core/module.hh" 3712953Sgabeblack@google.com#include "systemc/core/process_types.hh" 3812837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh" 3912951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh" 4013135Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 4112837Sgabeblack@google.com 4212952Sgabeblack@google.comnamespace sc_gem5 4312952Sgabeblack@google.com{ 4412952Sgabeblack@google.com 4512952Sgabeblack@google.comProcess * 4612952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func) 4712952Sgabeblack@google.com{ 4813135Sgabeblack@google.com Method *p = new Method(name, func); 4913135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 5013135Sgabeblack@google.com std::string name = p->name(); 5113135Sgabeblack@google.com delete p; 5213135Sgabeblack@google.com SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 5313135Sgabeblack@google.com "simulation running", name.c_str()); 5413135Sgabeblack@google.com return nullptr; 5513135Sgabeblack@google.com } 5612993Sgabeblack@google.com scheduler.reg(p); 5712993Sgabeblack@google.com return p; 5812952Sgabeblack@google.com} 5912952Sgabeblack@google.com 6012952Sgabeblack@google.comProcess * 6112952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 6212952Sgabeblack@google.com{ 6313135Sgabeblack@google.com Thread *p = new Thread(name, func); 6413135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 6513135Sgabeblack@google.com std::string name = p->name(); 6613135Sgabeblack@google.com delete p; 6713135Sgabeblack@google.com SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 6813135Sgabeblack@google.com "simulation running", name.c_str()); 6913135Sgabeblack@google.com return nullptr; 7013135Sgabeblack@google.com } 7112993Sgabeblack@google.com scheduler.reg(p); 7212993Sgabeblack@google.com return p; 7312952Sgabeblack@google.com} 7412952Sgabeblack@google.com 7512952Sgabeblack@google.comProcess * 7612952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 7712952Sgabeblack@google.com{ 7813135Sgabeblack@google.com CThread *p = new CThread(name, func); 7913135Sgabeblack@google.com if (::sc_core::sc_is_running()) { 8013135Sgabeblack@google.com std::string name = p->name(); 8113135Sgabeblack@google.com delete p; 8213135Sgabeblack@google.com SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 8313135Sgabeblack@google.com "simulation running", name.c_str()); 8413135Sgabeblack@google.com return nullptr; 8513135Sgabeblack@google.com } 8612993Sgabeblack@google.com scheduler.reg(p); 8713060Sgabeblack@google.com p->dontInitialize(); 8812993Sgabeblack@google.com return p; 8912952Sgabeblack@google.com} 9012952Sgabeblack@google.com 9113035Sgabeblack@google.comUniqueNameGen nameGen; 9213035Sgabeblack@google.com 9312952Sgabeblack@google.com} // namespace sc_gem5 9412952Sgabeblack@google.com 9512837Sgabeblack@google.comnamespace sc_core 9612837Sgabeblack@google.com{ 9712837Sgabeblack@google.com 9813091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 9912951Sgabeblack@google.com _interface(&_interface), _port(nullptr) 10012951Sgabeblack@google.com{} 10112837Sgabeblack@google.com 10213091Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 10312951Sgabeblack@google.com _interface(nullptr), _port(&_port) 10412951Sgabeblack@google.com{} 10512837Sgabeblack@google.com 10613091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 10712837Sgabeblack@google.com 10812982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 10912837Sgabeblack@google.com 11013091Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 11112837Sgabeblack@google.com 11212837Sgabeblack@google.comvoid 11312837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 11412837Sgabeblack@google.com const sc_bind_proxy &p002, 11512837Sgabeblack@google.com const sc_bind_proxy &p003, 11612837Sgabeblack@google.com const sc_bind_proxy &p004, 11712837Sgabeblack@google.com const sc_bind_proxy &p005, 11812837Sgabeblack@google.com const sc_bind_proxy &p006, 11912837Sgabeblack@google.com const sc_bind_proxy &p007, 12012837Sgabeblack@google.com const sc_bind_proxy &p008, 12112837Sgabeblack@google.com const sc_bind_proxy &p009, 12212837Sgabeblack@google.com const sc_bind_proxy &p010, 12312837Sgabeblack@google.com const sc_bind_proxy &p011, 12412837Sgabeblack@google.com const sc_bind_proxy &p012, 12512837Sgabeblack@google.com const sc_bind_proxy &p013, 12612837Sgabeblack@google.com const sc_bind_proxy &p014, 12712837Sgabeblack@google.com const sc_bind_proxy &p015, 12812837Sgabeblack@google.com const sc_bind_proxy &p016, 12912837Sgabeblack@google.com const sc_bind_proxy &p017, 13012837Sgabeblack@google.com const sc_bind_proxy &p018, 13112837Sgabeblack@google.com const sc_bind_proxy &p019, 13212837Sgabeblack@google.com const sc_bind_proxy &p020, 13312837Sgabeblack@google.com const sc_bind_proxy &p021, 13412837Sgabeblack@google.com const sc_bind_proxy &p022, 13512837Sgabeblack@google.com const sc_bind_proxy &p023, 13612837Sgabeblack@google.com const sc_bind_proxy &p024, 13712837Sgabeblack@google.com const sc_bind_proxy &p025, 13812837Sgabeblack@google.com const sc_bind_proxy &p026, 13912837Sgabeblack@google.com const sc_bind_proxy &p027, 14012837Sgabeblack@google.com const sc_bind_proxy &p028, 14112837Sgabeblack@google.com const sc_bind_proxy &p029, 14212837Sgabeblack@google.com const sc_bind_proxy &p030, 14312837Sgabeblack@google.com const sc_bind_proxy &p031, 14412837Sgabeblack@google.com const sc_bind_proxy &p032, 14512837Sgabeblack@google.com const sc_bind_proxy &p033, 14612837Sgabeblack@google.com const sc_bind_proxy &p034, 14712837Sgabeblack@google.com const sc_bind_proxy &p035, 14812837Sgabeblack@google.com const sc_bind_proxy &p036, 14912837Sgabeblack@google.com const sc_bind_proxy &p037, 15012837Sgabeblack@google.com const sc_bind_proxy &p038, 15112837Sgabeblack@google.com const sc_bind_proxy &p039, 15212837Sgabeblack@google.com const sc_bind_proxy &p040, 15312837Sgabeblack@google.com const sc_bind_proxy &p041, 15412837Sgabeblack@google.com const sc_bind_proxy &p042, 15512837Sgabeblack@google.com const sc_bind_proxy &p043, 15612837Sgabeblack@google.com const sc_bind_proxy &p044, 15712837Sgabeblack@google.com const sc_bind_proxy &p045, 15812837Sgabeblack@google.com const sc_bind_proxy &p046, 15912837Sgabeblack@google.com const sc_bind_proxy &p047, 16012837Sgabeblack@google.com const sc_bind_proxy &p048, 16112837Sgabeblack@google.com const sc_bind_proxy &p049, 16212837Sgabeblack@google.com const sc_bind_proxy &p050, 16312837Sgabeblack@google.com const sc_bind_proxy &p051, 16412837Sgabeblack@google.com const sc_bind_proxy &p052, 16512837Sgabeblack@google.com const sc_bind_proxy &p053, 16612837Sgabeblack@google.com const sc_bind_proxy &p054, 16712837Sgabeblack@google.com const sc_bind_proxy &p055, 16812837Sgabeblack@google.com const sc_bind_proxy &p056, 16912837Sgabeblack@google.com const sc_bind_proxy &p057, 17012837Sgabeblack@google.com const sc_bind_proxy &p058, 17112837Sgabeblack@google.com const sc_bind_proxy &p059, 17212837Sgabeblack@google.com const sc_bind_proxy &p060, 17312837Sgabeblack@google.com const sc_bind_proxy &p061, 17412837Sgabeblack@google.com const sc_bind_proxy &p062, 17512837Sgabeblack@google.com const sc_bind_proxy &p063, 17612837Sgabeblack@google.com const sc_bind_proxy &p064) 17712837Sgabeblack@google.com{ 17813091Sgabeblack@google.com std::vector<const ::sc_core::sc_bind_proxy *> proxies; 17913091Sgabeblack@google.com auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 18013091Sgabeblack@google.com if (!p.port() && !p.interface()) 18113091Sgabeblack@google.com return false; 18213091Sgabeblack@google.com proxies.push_back(&p); 18313091Sgabeblack@google.com return true; 18413091Sgabeblack@google.com }; 18513091Sgabeblack@google.com insert(p001) && insert(p002) && insert(p003) && insert(p004) && 18613091Sgabeblack@google.com insert(p005) && insert(p006) && insert(p007) && insert(p008) && 18713091Sgabeblack@google.com insert(p009) && insert(p010) && insert(p011) && insert(p012) && 18813091Sgabeblack@google.com insert(p013) && insert(p014) && insert(p015) && insert(p016) && 18913091Sgabeblack@google.com insert(p017) && insert(p018) && insert(p019) && insert(p020) && 19013091Sgabeblack@google.com insert(p021) && insert(p022) && insert(p023) && insert(p024) && 19113091Sgabeblack@google.com insert(p025) && insert(p026) && insert(p027) && insert(p028) && 19213091Sgabeblack@google.com insert(p029) && insert(p030) && insert(p031) && insert(p032) && 19313091Sgabeblack@google.com insert(p033) && insert(p034) && insert(p035) && insert(p036) && 19413091Sgabeblack@google.com insert(p037) && insert(p038) && insert(p039) && insert(p040) && 19513091Sgabeblack@google.com insert(p041) && insert(p042) && insert(p043) && insert(p044) && 19613091Sgabeblack@google.com insert(p045) && insert(p046) && insert(p047) && insert(p048) && 19713091Sgabeblack@google.com insert(p049) && insert(p050) && insert(p051) && insert(p052) && 19813091Sgabeblack@google.com insert(p053) && insert(p054) && insert(p055) && insert(p056) && 19913091Sgabeblack@google.com insert(p057) && insert(p058) && insert(p059) && insert(p060) && 20013091Sgabeblack@google.com insert(p061) && insert(p062) && insert(p063) && insert(p064); 20113091Sgabeblack@google.com _gem5_module->bindPorts(proxies); 20212837Sgabeblack@google.com} 20312837Sgabeblack@google.com 20412837Sgabeblack@google.comconst std::vector<sc_object *> & 20512837Sgabeblack@google.comsc_module::get_child_objects() const 20612837Sgabeblack@google.com{ 20712951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 20812837Sgabeblack@google.com} 20912837Sgabeblack@google.com 21012837Sgabeblack@google.comconst std::vector<sc_event *> & 21112837Sgabeblack@google.comsc_module::get_child_events() const 21212837Sgabeblack@google.com{ 21312951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 21412837Sgabeblack@google.com} 21512837Sgabeblack@google.com 21612951Sgabeblack@google.comsc_module::sc_module() : 21713079Sgabeblack@google.com sc_object(sc_gem5::newModuleChecked()->name()), 21812951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 21912951Sgabeblack@google.com{} 22012837Sgabeblack@google.com 22112951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 22212951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {} 22312951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 22412951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 22512951Sgabeblack@google.com{} 22612928Sgabeblack@google.com 22712837Sgabeblack@google.comvoid 22812837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool) 22912837Sgabeblack@google.com{ 23012837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 23112837Sgabeblack@google.com} 23212837Sgabeblack@google.com 23312837Sgabeblack@google.comvoid 23412837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool) 23512837Sgabeblack@google.com{ 23612837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 23712837Sgabeblack@google.com} 23812837Sgabeblack@google.com 23912837Sgabeblack@google.comvoid 24012837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool) 24112837Sgabeblack@google.com{ 24212837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 24312837Sgabeblack@google.com} 24412837Sgabeblack@google.com 24512837Sgabeblack@google.comvoid 24612837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool) 24712837Sgabeblack@google.com{ 24812837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 24912837Sgabeblack@google.com} 25012837Sgabeblack@google.com 25112837Sgabeblack@google.com 25212837Sgabeblack@google.comvoid 25312837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool) 25412837Sgabeblack@google.com{ 25512837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 25612837Sgabeblack@google.com} 25712837Sgabeblack@google.com 25812837Sgabeblack@google.comvoid 25912837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool) 26012837Sgabeblack@google.com{ 26112837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 26212837Sgabeblack@google.com} 26312837Sgabeblack@google.com 26412837Sgabeblack@google.comvoid 26512837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool) 26612837Sgabeblack@google.com{ 26712837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 26812837Sgabeblack@google.com} 26912837Sgabeblack@google.com 27012837Sgabeblack@google.comvoid 27112837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool) 27212837Sgabeblack@google.com{ 27312837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 27412837Sgabeblack@google.com} 27512837Sgabeblack@google.com 27612837Sgabeblack@google.com 27712837Sgabeblack@google.comvoid 27812837Sgabeblack@google.comsc_module::dont_initialize() 27912837Sgabeblack@google.com{ 28012953Sgabeblack@google.com ::sc_gem5::Process::newest()->dontInitialize(); 28112837Sgabeblack@google.com} 28212837Sgabeblack@google.com 28312837Sgabeblack@google.comvoid 28412953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 28512837Sgabeblack@google.com{ 28612953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 28712837Sgabeblack@google.com} 28812837Sgabeblack@google.com 28912837Sgabeblack@google.com 29012951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 29112951Sgabeblack@google.com 29212837Sgabeblack@google.comvoid 29312951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 29412837Sgabeblack@google.com{ 29512951Sgabeblack@google.com ::sc_core::next_trigger(e); 29612837Sgabeblack@google.com} 29712837Sgabeblack@google.com 29812837Sgabeblack@google.comvoid 29912951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 30012837Sgabeblack@google.com{ 30112951Sgabeblack@google.com ::sc_core::next_trigger(eol); 30212837Sgabeblack@google.com} 30312837Sgabeblack@google.com 30412837Sgabeblack@google.comvoid 30512951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 30612837Sgabeblack@google.com{ 30712951Sgabeblack@google.com ::sc_core::next_trigger(eal); 30812837Sgabeblack@google.com} 30912837Sgabeblack@google.com 31012837Sgabeblack@google.comvoid 31112951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 31212837Sgabeblack@google.com{ 31312951Sgabeblack@google.com ::sc_core::next_trigger(t); 31412837Sgabeblack@google.com} 31512837Sgabeblack@google.com 31612837Sgabeblack@google.comvoid 31712951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 31812837Sgabeblack@google.com{ 31912951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 32012837Sgabeblack@google.com} 32112837Sgabeblack@google.com 32212837Sgabeblack@google.comvoid 32312951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 32412837Sgabeblack@google.com{ 32512951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 32612837Sgabeblack@google.com} 32712837Sgabeblack@google.com 32812837Sgabeblack@google.comvoid 32912951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 33012837Sgabeblack@google.com{ 33112951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 33212837Sgabeblack@google.com} 33312837Sgabeblack@google.com 33412837Sgabeblack@google.comvoid 33512951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 33612837Sgabeblack@google.com{ 33712951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 33812837Sgabeblack@google.com} 33912837Sgabeblack@google.com 34012837Sgabeblack@google.comvoid 34112951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 34212837Sgabeblack@google.com{ 34312951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 34412837Sgabeblack@google.com} 34512837Sgabeblack@google.com 34612837Sgabeblack@google.comvoid 34712951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 34812837Sgabeblack@google.com{ 34912951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 35012837Sgabeblack@google.com} 35112837Sgabeblack@google.com 35212837Sgabeblack@google.comvoid 35312951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 35412837Sgabeblack@google.com{ 35512951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 35612837Sgabeblack@google.com} 35712837Sgabeblack@google.com 35812837Sgabeblack@google.com 35912929Sgabeblack@google.combool 36012929Sgabeblack@google.comsc_module::timed_out() 36112929Sgabeblack@google.com{ 36212929Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 36312929Sgabeblack@google.com return false; 36412929Sgabeblack@google.com} 36512929Sgabeblack@google.com 36612929Sgabeblack@google.com 36712837Sgabeblack@google.comvoid 36812837Sgabeblack@google.comsc_module::wait() 36912837Sgabeblack@google.com{ 37012951Sgabeblack@google.com ::sc_core::wait(); 37112837Sgabeblack@google.com} 37212837Sgabeblack@google.com 37312837Sgabeblack@google.comvoid 37412951Sgabeblack@google.comsc_module::wait(int i) 37512837Sgabeblack@google.com{ 37612951Sgabeblack@google.com ::sc_core::wait(i); 37712837Sgabeblack@google.com} 37812837Sgabeblack@google.com 37912837Sgabeblack@google.comvoid 38012951Sgabeblack@google.comsc_module::wait(const sc_event &e) 38112837Sgabeblack@google.com{ 38212951Sgabeblack@google.com ::sc_core::wait(e); 38312837Sgabeblack@google.com} 38412837Sgabeblack@google.com 38512837Sgabeblack@google.comvoid 38612951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 38712837Sgabeblack@google.com{ 38812951Sgabeblack@google.com ::sc_core::wait(eol); 38912837Sgabeblack@google.com} 39012837Sgabeblack@google.com 39112837Sgabeblack@google.comvoid 39212951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 39312837Sgabeblack@google.com{ 39412951Sgabeblack@google.com ::sc_core::wait(eal); 39512837Sgabeblack@google.com} 39612837Sgabeblack@google.com 39712837Sgabeblack@google.comvoid 39812951Sgabeblack@google.comsc_module::wait(const sc_time &t) 39912837Sgabeblack@google.com{ 40012951Sgabeblack@google.com ::sc_core::wait(t); 40112837Sgabeblack@google.com} 40212837Sgabeblack@google.com 40312837Sgabeblack@google.comvoid 40412951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 40512837Sgabeblack@google.com{ 40612951Sgabeblack@google.com ::sc_core::wait(d, u); 40712837Sgabeblack@google.com} 40812837Sgabeblack@google.com 40912837Sgabeblack@google.comvoid 41012951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 41112837Sgabeblack@google.com{ 41212951Sgabeblack@google.com ::sc_core::wait(t, e); 41312837Sgabeblack@google.com} 41412837Sgabeblack@google.com 41512837Sgabeblack@google.comvoid 41612951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 41712837Sgabeblack@google.com{ 41812951Sgabeblack@google.com ::sc_core::wait(d, u, e); 41912837Sgabeblack@google.com} 42012837Sgabeblack@google.com 42112837Sgabeblack@google.comvoid 42212951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 42312837Sgabeblack@google.com{ 42412951Sgabeblack@google.com ::sc_core::wait(t, eol); 42512837Sgabeblack@google.com} 42612837Sgabeblack@google.com 42712837Sgabeblack@google.comvoid 42812951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 42912837Sgabeblack@google.com{ 43012951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 43112837Sgabeblack@google.com} 43212837Sgabeblack@google.com 43312837Sgabeblack@google.comvoid 43412951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 43512837Sgabeblack@google.com{ 43612951Sgabeblack@google.com ::sc_core::wait(t, eal); 43712837Sgabeblack@google.com} 43812837Sgabeblack@google.com 43912837Sgabeblack@google.comvoid 44012951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 44112837Sgabeblack@google.com{ 44212951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 44312837Sgabeblack@google.com} 44412837Sgabeblack@google.com 44512837Sgabeblack@google.com 44612837Sgabeblack@google.comvoid 44712909Sgabeblack@google.comsc_module::halt() 44812909Sgabeblack@google.com{ 44912951Sgabeblack@google.com ::sc_core::halt(); 45012909Sgabeblack@google.com} 45112909Sgabeblack@google.com 45212914Sgabeblack@google.comvoid 45312951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 45412914Sgabeblack@google.com{ 45512951Sgabeblack@google.com ::sc_core::at_posedge(s); 45612914Sgabeblack@google.com} 45712914Sgabeblack@google.com 45812914Sgabeblack@google.comvoid 45912951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 46012914Sgabeblack@google.com{ 46112951Sgabeblack@google.com ::sc_core::at_posedge(s); 46212914Sgabeblack@google.com} 46312914Sgabeblack@google.com 46412914Sgabeblack@google.comvoid 46512951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 46612914Sgabeblack@google.com{ 46712951Sgabeblack@google.com ::sc_core::at_negedge(s); 46812914Sgabeblack@google.com} 46912914Sgabeblack@google.com 47012914Sgabeblack@google.comvoid 47112951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 47212914Sgabeblack@google.com{ 47312951Sgabeblack@google.com ::sc_core::at_negedge(s); 47412914Sgabeblack@google.com} 47512914Sgabeblack@google.com 47612909Sgabeblack@google.com 47712909Sgabeblack@google.comvoid 47812837Sgabeblack@google.comnext_trigger() 47912837Sgabeblack@google.com{ 48012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 48112958Sgabeblack@google.com p->setDynamic(nullptr); 48212837Sgabeblack@google.com} 48312837Sgabeblack@google.com 48412837Sgabeblack@google.comvoid 48512958Sgabeblack@google.comnext_trigger(const sc_event &e) 48612837Sgabeblack@google.com{ 48712958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 48812958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 48912837Sgabeblack@google.com} 49012837Sgabeblack@google.com 49112837Sgabeblack@google.comvoid 49212958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 49312837Sgabeblack@google.com{ 49412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 49512958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 49612837Sgabeblack@google.com} 49712837Sgabeblack@google.com 49812837Sgabeblack@google.comvoid 49912958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 50012837Sgabeblack@google.com{ 50112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 50212958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 50312837Sgabeblack@google.com} 50412837Sgabeblack@google.com 50512837Sgabeblack@google.comvoid 50612958Sgabeblack@google.comnext_trigger(const sc_time &t) 50712837Sgabeblack@google.com{ 50812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 50912958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 51012837Sgabeblack@google.com} 51112837Sgabeblack@google.com 51212837Sgabeblack@google.comvoid 51312951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 51412837Sgabeblack@google.com{ 51512951Sgabeblack@google.com next_trigger(sc_time(d, u)); 51612837Sgabeblack@google.com} 51712837Sgabeblack@google.com 51812837Sgabeblack@google.comvoid 51912958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 52012837Sgabeblack@google.com{ 52112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 52212958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 52312837Sgabeblack@google.com} 52412837Sgabeblack@google.com 52512837Sgabeblack@google.comvoid 52612951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 52712837Sgabeblack@google.com{ 52812951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 52912837Sgabeblack@google.com} 53012837Sgabeblack@google.com 53112837Sgabeblack@google.comvoid 53212958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 53312837Sgabeblack@google.com{ 53412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53512958Sgabeblack@google.com p->setDynamic( 53612958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 53712837Sgabeblack@google.com} 53812837Sgabeblack@google.com 53912837Sgabeblack@google.comvoid 54012951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 54112837Sgabeblack@google.com{ 54212951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 54312837Sgabeblack@google.com} 54412837Sgabeblack@google.com 54512837Sgabeblack@google.comvoid 54612958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 54712837Sgabeblack@google.com{ 54812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54912958Sgabeblack@google.com p->setDynamic( 55012958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 55112837Sgabeblack@google.com} 55212837Sgabeblack@google.com 55312837Sgabeblack@google.comvoid 55412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 55512837Sgabeblack@google.com{ 55612951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 55712837Sgabeblack@google.com} 55812837Sgabeblack@google.com 55912929Sgabeblack@google.combool 56012929Sgabeblack@google.comtimed_out() 56112929Sgabeblack@google.com{ 56212929Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 56312929Sgabeblack@google.com return false; 56412929Sgabeblack@google.com} 56512929Sgabeblack@google.com 56612837Sgabeblack@google.com 56712837Sgabeblack@google.comvoid 56812837Sgabeblack@google.comwait() 56912837Sgabeblack@google.com{ 57012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 57112958Sgabeblack@google.com p->setDynamic(nullptr); 57212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 57312837Sgabeblack@google.com} 57412837Sgabeblack@google.com 57512837Sgabeblack@google.comvoid 57612958Sgabeblack@google.comwait(int n) 57712837Sgabeblack@google.com{ 57812958Sgabeblack@google.com for (int i = 0; i < n; i++) 57912958Sgabeblack@google.com wait(); 58012837Sgabeblack@google.com} 58112837Sgabeblack@google.com 58212837Sgabeblack@google.comvoid 58312958Sgabeblack@google.comwait(const sc_event &e) 58412837Sgabeblack@google.com{ 58512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58612958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 58712958Sgabeblack@google.com sc_gem5::scheduler.yield(); 58812837Sgabeblack@google.com} 58912837Sgabeblack@google.com 59012837Sgabeblack@google.comvoid 59112958Sgabeblack@google.comwait(const sc_event_or_list &eol) 59212837Sgabeblack@google.com{ 59312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 59412958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 59512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 59612837Sgabeblack@google.com} 59712837Sgabeblack@google.com 59812837Sgabeblack@google.comvoid 59912958Sgabeblack@google.comwait(const sc_event_and_list &eal) 60012837Sgabeblack@google.com{ 60112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 60212958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 60312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 60412837Sgabeblack@google.com} 60512837Sgabeblack@google.com 60612837Sgabeblack@google.comvoid 60712958Sgabeblack@google.comwait(const sc_time &t) 60812837Sgabeblack@google.com{ 60912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 61012958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 61112958Sgabeblack@google.com sc_gem5::scheduler.yield(); 61212837Sgabeblack@google.com} 61312837Sgabeblack@google.com 61412837Sgabeblack@google.comvoid 61512951Sgabeblack@google.comwait(double d, sc_time_unit u) 61612837Sgabeblack@google.com{ 61712951Sgabeblack@google.com wait(sc_time(d, u)); 61812837Sgabeblack@google.com} 61912837Sgabeblack@google.com 62012837Sgabeblack@google.comvoid 62112958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 62212837Sgabeblack@google.com{ 62312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 62412958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 62512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 62612837Sgabeblack@google.com} 62712837Sgabeblack@google.com 62812837Sgabeblack@google.comvoid 62912951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 63012837Sgabeblack@google.com{ 63112951Sgabeblack@google.com wait(sc_time(d, u), e); 63212837Sgabeblack@google.com} 63312837Sgabeblack@google.com 63412837Sgabeblack@google.comvoid 63512958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 63612837Sgabeblack@google.com{ 63712958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 63812958Sgabeblack@google.com p->setDynamic( 63912958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 64012958Sgabeblack@google.com sc_gem5::scheduler.yield(); 64112837Sgabeblack@google.com} 64212837Sgabeblack@google.com 64312837Sgabeblack@google.comvoid 64412951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 64512837Sgabeblack@google.com{ 64612951Sgabeblack@google.com wait(sc_time(d, u), eol); 64712837Sgabeblack@google.com} 64812837Sgabeblack@google.com 64912837Sgabeblack@google.comvoid 65012958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 65112837Sgabeblack@google.com{ 65212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 65312958Sgabeblack@google.com p->setDynamic( 65412958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 65512958Sgabeblack@google.com sc_gem5::scheduler.yield(); 65612837Sgabeblack@google.com} 65712837Sgabeblack@google.com 65812837Sgabeblack@google.comvoid 65912951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 66012837Sgabeblack@google.com{ 66112951Sgabeblack@google.com wait(sc_time(d, u), eal); 66212837Sgabeblack@google.com} 66312837Sgabeblack@google.com 66412909Sgabeblack@google.comvoid 66512909Sgabeblack@google.comhalt() 66612909Sgabeblack@google.com{ 66712909Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 66812909Sgabeblack@google.com} 66912909Sgabeblack@google.com 67012914Sgabeblack@google.comvoid 67112914Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &) 67212914Sgabeblack@google.com{ 67312914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 67412914Sgabeblack@google.com} 67512914Sgabeblack@google.com 67612914Sgabeblack@google.comvoid 67712914Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &) 67812914Sgabeblack@google.com{ 67912914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 68012914Sgabeblack@google.com} 68112914Sgabeblack@google.com 68212914Sgabeblack@google.comvoid 68312914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &) 68412914Sgabeblack@google.com{ 68512914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 68612914Sgabeblack@google.com} 68712914Sgabeblack@google.com 68812914Sgabeblack@google.comvoid 68912914Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &) 69012914Sgabeblack@google.com{ 69112914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 69212914Sgabeblack@google.com} 69312914Sgabeblack@google.com 69412837Sgabeblack@google.comconst char * 69513035Sgabeblack@google.comsc_gen_unique_name(const char *seed) 69612837Sgabeblack@google.com{ 69713035Sgabeblack@google.com ::sc_gem5::Module *mod = ::sc_gem5::currentModule(); 69813035Sgabeblack@google.com return mod ? mod->uniqueName(seed) : 69913035Sgabeblack@google.com ::sc_gem5::nameGen.gen(seed); 70012837Sgabeblack@google.com} 70112837Sgabeblack@google.com 70212837Sgabeblack@google.combool 70312930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 70412930Sgabeblack@google.com{ 70512930Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 70612930Sgabeblack@google.com return false; 70712930Sgabeblack@google.com} 70812930Sgabeblack@google.com 70912930Sgabeblack@google.combool 71012837Sgabeblack@google.comsc_start_of_simulation_invoked() 71112837Sgabeblack@google.com{ 71212982Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 71312837Sgabeblack@google.com} 71412837Sgabeblack@google.com 71512837Sgabeblack@google.combool 71612837Sgabeblack@google.comsc_end_of_simulation_invoked() 71712837Sgabeblack@google.com{ 71812982Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 71912837Sgabeblack@google.com} 72012837Sgabeblack@google.com 72112901Sgabeblack@google.comsc_module * 72212901Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 72312901Sgabeblack@google.com{ 72412901Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 72512901Sgabeblack@google.com modules.emplace_back(mod); 72612901Sgabeblack@google.com return mod; 72712901Sgabeblack@google.com} 72812901Sgabeblack@google.com 72912837Sgabeblack@google.com} // namespace sc_core 730