sc_module.cc revision 12993
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> 3112901Sgabeblack@google.com#include <vector> 3212901Sgabeblack@google.com 3312837Sgabeblack@google.com#include "base/logging.hh" 3412982Sgabeblack@google.com#include "systemc/core/kernel.hh" 3512951Sgabeblack@google.com#include "systemc/core/module.hh" 3612953Sgabeblack@google.com#include "systemc/core/process_types.hh" 3712837Sgabeblack@google.com#include "systemc/ext/core/sc_module.hh" 3812951Sgabeblack@google.com#include "systemc/ext/core/sc_module_name.hh" 3912837Sgabeblack@google.com 4012952Sgabeblack@google.comnamespace sc_gem5 4112952Sgabeblack@google.com{ 4212952Sgabeblack@google.com 4312952Sgabeblack@google.comProcess * 4412952Sgabeblack@google.comnewMethodProcess(const char *name, ProcessFuncWrapper *func) 4512952Sgabeblack@google.com{ 4612993Sgabeblack@google.com Process *p = new Method(name, func); 4712993Sgabeblack@google.com scheduler.reg(p); 4812993Sgabeblack@google.com return p; 4912952Sgabeblack@google.com} 5012952Sgabeblack@google.com 5112952Sgabeblack@google.comProcess * 5212952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 5312952Sgabeblack@google.com{ 5412993Sgabeblack@google.com Process *p = new Thread(name, func); 5512993Sgabeblack@google.com scheduler.reg(p); 5612993Sgabeblack@google.com return p; 5712952Sgabeblack@google.com} 5812952Sgabeblack@google.com 5912952Sgabeblack@google.comProcess * 6012952Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 6112952Sgabeblack@google.com{ 6212993Sgabeblack@google.com Process *p = new CThread(name, func); 6312993Sgabeblack@google.com scheduler.reg(p); 6412993Sgabeblack@google.com return p; 6512952Sgabeblack@google.com} 6612952Sgabeblack@google.com 6712952Sgabeblack@google.com} // namespace sc_gem5 6812952Sgabeblack@google.com 6912837Sgabeblack@google.comnamespace sc_core 7012837Sgabeblack@google.com{ 7112837Sgabeblack@google.com 7212951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) : 7312951Sgabeblack@google.com _interface(&_interface), _port(nullptr) 7412951Sgabeblack@google.com{} 7512837Sgabeblack@google.com 7612951Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) : 7712951Sgabeblack@google.com _interface(nullptr), _port(&_port) 7812951Sgabeblack@google.com{} 7912837Sgabeblack@google.com 8012837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr); 8112837Sgabeblack@google.com 8212982Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 8312837Sgabeblack@google.com 8412837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr); 8512837Sgabeblack@google.com 8612837Sgabeblack@google.comvoid 8712837Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 8812837Sgabeblack@google.com const sc_bind_proxy &p002, 8912837Sgabeblack@google.com const sc_bind_proxy &p003, 9012837Sgabeblack@google.com const sc_bind_proxy &p004, 9112837Sgabeblack@google.com const sc_bind_proxy &p005, 9212837Sgabeblack@google.com const sc_bind_proxy &p006, 9312837Sgabeblack@google.com const sc_bind_proxy &p007, 9412837Sgabeblack@google.com const sc_bind_proxy &p008, 9512837Sgabeblack@google.com const sc_bind_proxy &p009, 9612837Sgabeblack@google.com const sc_bind_proxy &p010, 9712837Sgabeblack@google.com const sc_bind_proxy &p011, 9812837Sgabeblack@google.com const sc_bind_proxy &p012, 9912837Sgabeblack@google.com const sc_bind_proxy &p013, 10012837Sgabeblack@google.com const sc_bind_proxy &p014, 10112837Sgabeblack@google.com const sc_bind_proxy &p015, 10212837Sgabeblack@google.com const sc_bind_proxy &p016, 10312837Sgabeblack@google.com const sc_bind_proxy &p017, 10412837Sgabeblack@google.com const sc_bind_proxy &p018, 10512837Sgabeblack@google.com const sc_bind_proxy &p019, 10612837Sgabeblack@google.com const sc_bind_proxy &p020, 10712837Sgabeblack@google.com const sc_bind_proxy &p021, 10812837Sgabeblack@google.com const sc_bind_proxy &p022, 10912837Sgabeblack@google.com const sc_bind_proxy &p023, 11012837Sgabeblack@google.com const sc_bind_proxy &p024, 11112837Sgabeblack@google.com const sc_bind_proxy &p025, 11212837Sgabeblack@google.com const sc_bind_proxy &p026, 11312837Sgabeblack@google.com const sc_bind_proxy &p027, 11412837Sgabeblack@google.com const sc_bind_proxy &p028, 11512837Sgabeblack@google.com const sc_bind_proxy &p029, 11612837Sgabeblack@google.com const sc_bind_proxy &p030, 11712837Sgabeblack@google.com const sc_bind_proxy &p031, 11812837Sgabeblack@google.com const sc_bind_proxy &p032, 11912837Sgabeblack@google.com const sc_bind_proxy &p033, 12012837Sgabeblack@google.com const sc_bind_proxy &p034, 12112837Sgabeblack@google.com const sc_bind_proxy &p035, 12212837Sgabeblack@google.com const sc_bind_proxy &p036, 12312837Sgabeblack@google.com const sc_bind_proxy &p037, 12412837Sgabeblack@google.com const sc_bind_proxy &p038, 12512837Sgabeblack@google.com const sc_bind_proxy &p039, 12612837Sgabeblack@google.com const sc_bind_proxy &p040, 12712837Sgabeblack@google.com const sc_bind_proxy &p041, 12812837Sgabeblack@google.com const sc_bind_proxy &p042, 12912837Sgabeblack@google.com const sc_bind_proxy &p043, 13012837Sgabeblack@google.com const sc_bind_proxy &p044, 13112837Sgabeblack@google.com const sc_bind_proxy &p045, 13212837Sgabeblack@google.com const sc_bind_proxy &p046, 13312837Sgabeblack@google.com const sc_bind_proxy &p047, 13412837Sgabeblack@google.com const sc_bind_proxy &p048, 13512837Sgabeblack@google.com const sc_bind_proxy &p049, 13612837Sgabeblack@google.com const sc_bind_proxy &p050, 13712837Sgabeblack@google.com const sc_bind_proxy &p051, 13812837Sgabeblack@google.com const sc_bind_proxy &p052, 13912837Sgabeblack@google.com const sc_bind_proxy &p053, 14012837Sgabeblack@google.com const sc_bind_proxy &p054, 14112837Sgabeblack@google.com const sc_bind_proxy &p055, 14212837Sgabeblack@google.com const sc_bind_proxy &p056, 14312837Sgabeblack@google.com const sc_bind_proxy &p057, 14412837Sgabeblack@google.com const sc_bind_proxy &p058, 14512837Sgabeblack@google.com const sc_bind_proxy &p059, 14612837Sgabeblack@google.com const sc_bind_proxy &p060, 14712837Sgabeblack@google.com const sc_bind_proxy &p061, 14812837Sgabeblack@google.com const sc_bind_proxy &p062, 14912837Sgabeblack@google.com const sc_bind_proxy &p063, 15012837Sgabeblack@google.com const sc_bind_proxy &p064) 15112837Sgabeblack@google.com{ 15212837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 15312837Sgabeblack@google.com} 15412837Sgabeblack@google.com 15512837Sgabeblack@google.comconst std::vector<sc_object *> & 15612837Sgabeblack@google.comsc_module::get_child_objects() const 15712837Sgabeblack@google.com{ 15812951Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 15912837Sgabeblack@google.com} 16012837Sgabeblack@google.com 16112837Sgabeblack@google.comconst std::vector<sc_event *> & 16212837Sgabeblack@google.comsc_module::get_child_events() const 16312837Sgabeblack@google.com{ 16412951Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 16512837Sgabeblack@google.com} 16612837Sgabeblack@google.com 16712951Sgabeblack@google.comsc_module::sc_module() : 16812952Sgabeblack@google.com sc_object(sc_gem5::newModule()->name()), 16912951Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 17012951Sgabeblack@google.com{} 17112837Sgabeblack@google.com 17212951Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 17312951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {} 17412951Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 17512951Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 17612951Sgabeblack@google.com{} 17712928Sgabeblack@google.com 17812837Sgabeblack@google.comvoid 17912837Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool) 18012837Sgabeblack@google.com{ 18112837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 18212837Sgabeblack@google.com} 18312837Sgabeblack@google.com 18412837Sgabeblack@google.comvoid 18512837Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool) 18612837Sgabeblack@google.com{ 18712837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 18812837Sgabeblack@google.com} 18912837Sgabeblack@google.com 19012837Sgabeblack@google.comvoid 19112837Sgabeblack@google.comsc_module::reset_signal_is(const sc_out<bool> &, bool) 19212837Sgabeblack@google.com{ 19312837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 19412837Sgabeblack@google.com} 19512837Sgabeblack@google.com 19612837Sgabeblack@google.comvoid 19712837Sgabeblack@google.comsc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool) 19812837Sgabeblack@google.com{ 19912837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 20012837Sgabeblack@google.com} 20112837Sgabeblack@google.com 20212837Sgabeblack@google.com 20312837Sgabeblack@google.comvoid 20412837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool) 20512837Sgabeblack@google.com{ 20612837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 20712837Sgabeblack@google.com} 20812837Sgabeblack@google.com 20912837Sgabeblack@google.comvoid 21012837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<bool> &, bool) 21112837Sgabeblack@google.com{ 21212837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 21312837Sgabeblack@google.com} 21412837Sgabeblack@google.com 21512837Sgabeblack@google.comvoid 21612837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_out<bool> &, bool) 21712837Sgabeblack@google.com{ 21812837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 21912837Sgabeblack@google.com} 22012837Sgabeblack@google.com 22112837Sgabeblack@google.comvoid 22212837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool) 22312837Sgabeblack@google.com{ 22412837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 22512837Sgabeblack@google.com} 22612837Sgabeblack@google.com 22712837Sgabeblack@google.com 22812837Sgabeblack@google.comvoid 22912837Sgabeblack@google.comsc_module::dont_initialize() 23012837Sgabeblack@google.com{ 23112953Sgabeblack@google.com ::sc_gem5::Process::newest()->dontInitialize(); 23212837Sgabeblack@google.com} 23312837Sgabeblack@google.com 23412837Sgabeblack@google.comvoid 23512953Sgabeblack@google.comsc_module::set_stack_size(size_t size) 23612837Sgabeblack@google.com{ 23712953Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 23812837Sgabeblack@google.com} 23912837Sgabeblack@google.com 24012837Sgabeblack@google.com 24112951Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 24212951Sgabeblack@google.com 24312837Sgabeblack@google.comvoid 24412951Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 24512837Sgabeblack@google.com{ 24612951Sgabeblack@google.com ::sc_core::next_trigger(e); 24712837Sgabeblack@google.com} 24812837Sgabeblack@google.com 24912837Sgabeblack@google.comvoid 25012951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 25112837Sgabeblack@google.com{ 25212951Sgabeblack@google.com ::sc_core::next_trigger(eol); 25312837Sgabeblack@google.com} 25412837Sgabeblack@google.com 25512837Sgabeblack@google.comvoid 25612951Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 25712837Sgabeblack@google.com{ 25812951Sgabeblack@google.com ::sc_core::next_trigger(eal); 25912837Sgabeblack@google.com} 26012837Sgabeblack@google.com 26112837Sgabeblack@google.comvoid 26212951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 26312837Sgabeblack@google.com{ 26412951Sgabeblack@google.com ::sc_core::next_trigger(t); 26512837Sgabeblack@google.com} 26612837Sgabeblack@google.com 26712837Sgabeblack@google.comvoid 26812951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 26912837Sgabeblack@google.com{ 27012951Sgabeblack@google.com ::sc_core::next_trigger(d, u); 27112837Sgabeblack@google.com} 27212837Sgabeblack@google.com 27312837Sgabeblack@google.comvoid 27412951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 27512837Sgabeblack@google.com{ 27612951Sgabeblack@google.com ::sc_core::next_trigger(t, e); 27712837Sgabeblack@google.com} 27812837Sgabeblack@google.com 27912837Sgabeblack@google.comvoid 28012951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 28112837Sgabeblack@google.com{ 28212951Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 28312837Sgabeblack@google.com} 28412837Sgabeblack@google.com 28512837Sgabeblack@google.comvoid 28612951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 28712837Sgabeblack@google.com{ 28812951Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 28912837Sgabeblack@google.com} 29012837Sgabeblack@google.com 29112837Sgabeblack@google.comvoid 29212951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 29312837Sgabeblack@google.com{ 29412951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 29512837Sgabeblack@google.com} 29612837Sgabeblack@google.com 29712837Sgabeblack@google.comvoid 29812951Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 29912837Sgabeblack@google.com{ 30012951Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 30112837Sgabeblack@google.com} 30212837Sgabeblack@google.com 30312837Sgabeblack@google.comvoid 30412951Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 30512837Sgabeblack@google.com{ 30612951Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 30712837Sgabeblack@google.com} 30812837Sgabeblack@google.com 30912837Sgabeblack@google.com 31012929Sgabeblack@google.combool 31112929Sgabeblack@google.comsc_module::timed_out() 31212929Sgabeblack@google.com{ 31312929Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 31412929Sgabeblack@google.com return false; 31512929Sgabeblack@google.com} 31612929Sgabeblack@google.com 31712929Sgabeblack@google.com 31812837Sgabeblack@google.comvoid 31912837Sgabeblack@google.comsc_module::wait() 32012837Sgabeblack@google.com{ 32112951Sgabeblack@google.com ::sc_core::wait(); 32212837Sgabeblack@google.com} 32312837Sgabeblack@google.com 32412837Sgabeblack@google.comvoid 32512951Sgabeblack@google.comsc_module::wait(int i) 32612837Sgabeblack@google.com{ 32712951Sgabeblack@google.com ::sc_core::wait(i); 32812837Sgabeblack@google.com} 32912837Sgabeblack@google.com 33012837Sgabeblack@google.comvoid 33112951Sgabeblack@google.comsc_module::wait(const sc_event &e) 33212837Sgabeblack@google.com{ 33312951Sgabeblack@google.com ::sc_core::wait(e); 33412837Sgabeblack@google.com} 33512837Sgabeblack@google.com 33612837Sgabeblack@google.comvoid 33712951Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 33812837Sgabeblack@google.com{ 33912951Sgabeblack@google.com ::sc_core::wait(eol); 34012837Sgabeblack@google.com} 34112837Sgabeblack@google.com 34212837Sgabeblack@google.comvoid 34312951Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 34412837Sgabeblack@google.com{ 34512951Sgabeblack@google.com ::sc_core::wait(eal); 34612837Sgabeblack@google.com} 34712837Sgabeblack@google.com 34812837Sgabeblack@google.comvoid 34912951Sgabeblack@google.comsc_module::wait(const sc_time &t) 35012837Sgabeblack@google.com{ 35112951Sgabeblack@google.com ::sc_core::wait(t); 35212837Sgabeblack@google.com} 35312837Sgabeblack@google.com 35412837Sgabeblack@google.comvoid 35512951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 35612837Sgabeblack@google.com{ 35712951Sgabeblack@google.com ::sc_core::wait(d, u); 35812837Sgabeblack@google.com} 35912837Sgabeblack@google.com 36012837Sgabeblack@google.comvoid 36112951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 36212837Sgabeblack@google.com{ 36312951Sgabeblack@google.com ::sc_core::wait(t, e); 36412837Sgabeblack@google.com} 36512837Sgabeblack@google.com 36612837Sgabeblack@google.comvoid 36712951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 36812837Sgabeblack@google.com{ 36912951Sgabeblack@google.com ::sc_core::wait(d, u, e); 37012837Sgabeblack@google.com} 37112837Sgabeblack@google.com 37212837Sgabeblack@google.comvoid 37312951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 37412837Sgabeblack@google.com{ 37512951Sgabeblack@google.com ::sc_core::wait(t, eol); 37612837Sgabeblack@google.com} 37712837Sgabeblack@google.com 37812837Sgabeblack@google.comvoid 37912951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 38012837Sgabeblack@google.com{ 38112951Sgabeblack@google.com ::sc_core::wait(d, u, eol); 38212837Sgabeblack@google.com} 38312837Sgabeblack@google.com 38412837Sgabeblack@google.comvoid 38512951Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 38612837Sgabeblack@google.com{ 38712951Sgabeblack@google.com ::sc_core::wait(t, eal); 38812837Sgabeblack@google.com} 38912837Sgabeblack@google.com 39012837Sgabeblack@google.comvoid 39112951Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 39212837Sgabeblack@google.com{ 39312951Sgabeblack@google.com ::sc_core::wait(d, u, eal); 39412837Sgabeblack@google.com} 39512837Sgabeblack@google.com 39612837Sgabeblack@google.com 39712837Sgabeblack@google.comvoid 39812909Sgabeblack@google.comsc_module::halt() 39912909Sgabeblack@google.com{ 40012951Sgabeblack@google.com ::sc_core::halt(); 40112909Sgabeblack@google.com} 40212909Sgabeblack@google.com 40312914Sgabeblack@google.comvoid 40412951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 40512914Sgabeblack@google.com{ 40612951Sgabeblack@google.com ::sc_core::at_posedge(s); 40712914Sgabeblack@google.com} 40812914Sgabeblack@google.com 40912914Sgabeblack@google.comvoid 41012951Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 41112914Sgabeblack@google.com{ 41212951Sgabeblack@google.com ::sc_core::at_posedge(s); 41312914Sgabeblack@google.com} 41412914Sgabeblack@google.com 41512914Sgabeblack@google.comvoid 41612951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 41712914Sgabeblack@google.com{ 41812951Sgabeblack@google.com ::sc_core::at_negedge(s); 41912914Sgabeblack@google.com} 42012914Sgabeblack@google.com 42112914Sgabeblack@google.comvoid 42212951Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 42312914Sgabeblack@google.com{ 42412951Sgabeblack@google.com ::sc_core::at_negedge(s); 42512914Sgabeblack@google.com} 42612914Sgabeblack@google.com 42712909Sgabeblack@google.com 42812909Sgabeblack@google.comvoid 42912837Sgabeblack@google.comnext_trigger() 43012837Sgabeblack@google.com{ 43112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 43212958Sgabeblack@google.com p->setDynamic(nullptr); 43312837Sgabeblack@google.com} 43412837Sgabeblack@google.com 43512837Sgabeblack@google.comvoid 43612958Sgabeblack@google.comnext_trigger(const sc_event &e) 43712837Sgabeblack@google.com{ 43812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 43912958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 44012837Sgabeblack@google.com} 44112837Sgabeblack@google.com 44212837Sgabeblack@google.comvoid 44312958Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 44412837Sgabeblack@google.com{ 44512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 44612958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 44712837Sgabeblack@google.com} 44812837Sgabeblack@google.com 44912837Sgabeblack@google.comvoid 45012958Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 45112837Sgabeblack@google.com{ 45212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 45312958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 45412837Sgabeblack@google.com} 45512837Sgabeblack@google.com 45612837Sgabeblack@google.comvoid 45712958Sgabeblack@google.comnext_trigger(const sc_time &t) 45812837Sgabeblack@google.com{ 45912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 46012958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 46112837Sgabeblack@google.com} 46212837Sgabeblack@google.com 46312837Sgabeblack@google.comvoid 46412951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 46512837Sgabeblack@google.com{ 46612951Sgabeblack@google.com next_trigger(sc_time(d, u)); 46712837Sgabeblack@google.com} 46812837Sgabeblack@google.com 46912837Sgabeblack@google.comvoid 47012958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 47112837Sgabeblack@google.com{ 47212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 47312958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 47412837Sgabeblack@google.com} 47512837Sgabeblack@google.com 47612837Sgabeblack@google.comvoid 47712951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 47812837Sgabeblack@google.com{ 47912951Sgabeblack@google.com next_trigger(sc_time(d, u), e); 48012837Sgabeblack@google.com} 48112837Sgabeblack@google.com 48212837Sgabeblack@google.comvoid 48312958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 48412837Sgabeblack@google.com{ 48512958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 48612958Sgabeblack@google.com p->setDynamic( 48712958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 48812837Sgabeblack@google.com} 48912837Sgabeblack@google.com 49012837Sgabeblack@google.comvoid 49112951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 49212837Sgabeblack@google.com{ 49312951Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 49412837Sgabeblack@google.com} 49512837Sgabeblack@google.com 49612837Sgabeblack@google.comvoid 49712958Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 49812837Sgabeblack@google.com{ 49912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 50012958Sgabeblack@google.com p->setDynamic( 50112958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 50212837Sgabeblack@google.com} 50312837Sgabeblack@google.com 50412837Sgabeblack@google.comvoid 50512951Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 50612837Sgabeblack@google.com{ 50712951Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 50812837Sgabeblack@google.com} 50912837Sgabeblack@google.com 51012929Sgabeblack@google.combool 51112929Sgabeblack@google.comtimed_out() 51212929Sgabeblack@google.com{ 51312929Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 51412929Sgabeblack@google.com return false; 51512929Sgabeblack@google.com} 51612929Sgabeblack@google.com 51712837Sgabeblack@google.com 51812837Sgabeblack@google.comvoid 51912837Sgabeblack@google.comwait() 52012837Sgabeblack@google.com{ 52112958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 52212958Sgabeblack@google.com p->setDynamic(nullptr); 52312958Sgabeblack@google.com sc_gem5::scheduler.yield(); 52412837Sgabeblack@google.com} 52512837Sgabeblack@google.com 52612837Sgabeblack@google.comvoid 52712958Sgabeblack@google.comwait(int n) 52812837Sgabeblack@google.com{ 52912958Sgabeblack@google.com for (int i = 0; i < n; i++) 53012958Sgabeblack@google.com wait(); 53112837Sgabeblack@google.com} 53212837Sgabeblack@google.com 53312837Sgabeblack@google.comvoid 53412958Sgabeblack@google.comwait(const sc_event &e) 53512837Sgabeblack@google.com{ 53612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53712958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 53812958Sgabeblack@google.com sc_gem5::scheduler.yield(); 53912837Sgabeblack@google.com} 54012837Sgabeblack@google.com 54112837Sgabeblack@google.comvoid 54212958Sgabeblack@google.comwait(const sc_event_or_list &eol) 54312837Sgabeblack@google.com{ 54412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54512958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 54612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 54712837Sgabeblack@google.com} 54812837Sgabeblack@google.com 54912837Sgabeblack@google.comvoid 55012958Sgabeblack@google.comwait(const sc_event_and_list &eal) 55112837Sgabeblack@google.com{ 55212958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55312958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 55412958Sgabeblack@google.com sc_gem5::scheduler.yield(); 55512837Sgabeblack@google.com} 55612837Sgabeblack@google.com 55712837Sgabeblack@google.comvoid 55812958Sgabeblack@google.comwait(const sc_time &t) 55912837Sgabeblack@google.com{ 56012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56112958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 56212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 56312837Sgabeblack@google.com} 56412837Sgabeblack@google.com 56512837Sgabeblack@google.comvoid 56612951Sgabeblack@google.comwait(double d, sc_time_unit u) 56712837Sgabeblack@google.com{ 56812951Sgabeblack@google.com wait(sc_time(d, u)); 56912837Sgabeblack@google.com} 57012837Sgabeblack@google.com 57112837Sgabeblack@google.comvoid 57212958Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 57312837Sgabeblack@google.com{ 57412958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 57512958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 57612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 57712837Sgabeblack@google.com} 57812837Sgabeblack@google.com 57912837Sgabeblack@google.comvoid 58012951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 58112837Sgabeblack@google.com{ 58212951Sgabeblack@google.com wait(sc_time(d, u), e); 58312837Sgabeblack@google.com} 58412837Sgabeblack@google.com 58512837Sgabeblack@google.comvoid 58612958Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 58712837Sgabeblack@google.com{ 58812958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58912958Sgabeblack@google.com p->setDynamic( 59012958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 59112958Sgabeblack@google.com sc_gem5::scheduler.yield(); 59212837Sgabeblack@google.com} 59312837Sgabeblack@google.com 59412837Sgabeblack@google.comvoid 59512951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 59612837Sgabeblack@google.com{ 59712951Sgabeblack@google.com wait(sc_time(d, u), eol); 59812837Sgabeblack@google.com} 59912837Sgabeblack@google.com 60012837Sgabeblack@google.comvoid 60112958Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 60212837Sgabeblack@google.com{ 60312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 60412958Sgabeblack@google.com p->setDynamic( 60512958Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 60612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 60712837Sgabeblack@google.com} 60812837Sgabeblack@google.com 60912837Sgabeblack@google.comvoid 61012951Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 61112837Sgabeblack@google.com{ 61212951Sgabeblack@google.com wait(sc_time(d, u), eal); 61312837Sgabeblack@google.com} 61412837Sgabeblack@google.com 61512909Sgabeblack@google.comvoid 61612909Sgabeblack@google.comhalt() 61712909Sgabeblack@google.com{ 61812909Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 61912909Sgabeblack@google.com} 62012909Sgabeblack@google.com 62112914Sgabeblack@google.comvoid 62212914Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &) 62312914Sgabeblack@google.com{ 62412914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 62512914Sgabeblack@google.com} 62612914Sgabeblack@google.com 62712914Sgabeblack@google.comvoid 62812914Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &) 62912914Sgabeblack@google.com{ 63012914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 63112914Sgabeblack@google.com} 63212914Sgabeblack@google.com 63312914Sgabeblack@google.comvoid 63412914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &) 63512914Sgabeblack@google.com{ 63612914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 63712914Sgabeblack@google.com} 63812914Sgabeblack@google.com 63912914Sgabeblack@google.comvoid 64012914Sgabeblack@google.comat_negedge(const sc_signal_in_if<sc_dt::sc_logic> &) 64112914Sgabeblack@google.com{ 64212914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 64312914Sgabeblack@google.com} 64412914Sgabeblack@google.com 64512837Sgabeblack@google.comconst char * 64612837Sgabeblack@google.comsc_gen_unique_name(const char *) 64712837Sgabeblack@google.com{ 64812837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 64912837Sgabeblack@google.com return ""; 65012837Sgabeblack@google.com} 65112837Sgabeblack@google.com 65212837Sgabeblack@google.combool 65312930Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 65412930Sgabeblack@google.com{ 65512930Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 65612930Sgabeblack@google.com return false; 65712930Sgabeblack@google.com} 65812930Sgabeblack@google.com 65912930Sgabeblack@google.combool 66012837Sgabeblack@google.comsc_start_of_simulation_invoked() 66112837Sgabeblack@google.com{ 66212982Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 66312837Sgabeblack@google.com} 66412837Sgabeblack@google.com 66512837Sgabeblack@google.combool 66612837Sgabeblack@google.comsc_end_of_simulation_invoked() 66712837Sgabeblack@google.com{ 66812982Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 66912837Sgabeblack@google.com} 67012837Sgabeblack@google.com 67112901Sgabeblack@google.comsc_module * 67212901Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 67312901Sgabeblack@google.com{ 67412901Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 67512901Sgabeblack@google.com modules.emplace_back(mod); 67612901Sgabeblack@google.com return mod; 67712901Sgabeblack@google.com} 67812901Sgabeblack@google.com 67912837Sgabeblack@google.com} // namespace sc_core 680