sc_module.cc revision 12982
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 return new Method(name, func); 4712993Sgabeblack@google.com} 4812993Sgabeblack@google.com 4912952Sgabeblack@google.comProcess * 5012952Sgabeblack@google.comnewThreadProcess(const char *name, ProcessFuncWrapper *func) 5112952Sgabeblack@google.com{ 5212952Sgabeblack@google.com return new Thread(name, func); 5312952Sgabeblack@google.com} 5412993Sgabeblack@google.com 5512993Sgabeblack@google.comProcess * 5612993Sgabeblack@google.comnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 5712952Sgabeblack@google.com{ 5812952Sgabeblack@google.com return new CThread(name, func); 5912952Sgabeblack@google.com} 6012952Sgabeblack@google.com 6112952Sgabeblack@google.com} // namespace sc_gem5 6212993Sgabeblack@google.com 6312993Sgabeblack@google.comnamespace sc_core 6413060Sgabeblack@google.com{ 6512993Sgabeblack@google.com 6612952Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_interface &_interface) : 6712952Sgabeblack@google.com _interface(&_interface), _port(nullptr) 6813035Sgabeblack@google.com{} 6913035Sgabeblack@google.com 7012952Sgabeblack@google.comsc_bind_proxy::sc_bind_proxy(const sc_port_base &_port) : 7112952Sgabeblack@google.com _interface(nullptr), _port(&_port) 7212837Sgabeblack@google.com{} 7312837Sgabeblack@google.com 7412837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr); 7512951Sgabeblack@google.com 7612951Sgabeblack@google.comsc_module::~sc_module() { delete _gem5_module; } 7712951Sgabeblack@google.com 7812837Sgabeblack@google.comconst sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr); 7912951Sgabeblack@google.com 8012951Sgabeblack@google.comvoid 8112951Sgabeblack@google.comsc_module::operator () (const sc_bind_proxy &p001, 8212837Sgabeblack@google.com const sc_bind_proxy &p002, 8312837Sgabeblack@google.com const sc_bind_proxy &p003, 8412837Sgabeblack@google.com const sc_bind_proxy &p004, 8512982Sgabeblack@google.com const sc_bind_proxy &p005, 8612837Sgabeblack@google.com const sc_bind_proxy &p006, 8712837Sgabeblack@google.com const sc_bind_proxy &p007, 8812837Sgabeblack@google.com const sc_bind_proxy &p008, 8912837Sgabeblack@google.com const sc_bind_proxy &p009, 9012837Sgabeblack@google.com const sc_bind_proxy &p010, 9112837Sgabeblack@google.com const sc_bind_proxy &p011, 9212837Sgabeblack@google.com const sc_bind_proxy &p012, 9312837Sgabeblack@google.com const sc_bind_proxy &p013, 9412837Sgabeblack@google.com const sc_bind_proxy &p014, 9512837Sgabeblack@google.com const sc_bind_proxy &p015, 9612837Sgabeblack@google.com const sc_bind_proxy &p016, 9712837Sgabeblack@google.com const sc_bind_proxy &p017, 9812837Sgabeblack@google.com const sc_bind_proxy &p018, 9912837Sgabeblack@google.com const sc_bind_proxy &p019, 10012837Sgabeblack@google.com const sc_bind_proxy &p020, 10112837Sgabeblack@google.com const sc_bind_proxy &p021, 10212837Sgabeblack@google.com const sc_bind_proxy &p022, 10312837Sgabeblack@google.com const sc_bind_proxy &p023, 10412837Sgabeblack@google.com const sc_bind_proxy &p024, 10512837Sgabeblack@google.com const sc_bind_proxy &p025, 10612837Sgabeblack@google.com const sc_bind_proxy &p026, 10712837Sgabeblack@google.com const sc_bind_proxy &p027, 10812837Sgabeblack@google.com const sc_bind_proxy &p028, 10912837Sgabeblack@google.com const sc_bind_proxy &p029, 11012837Sgabeblack@google.com const sc_bind_proxy &p030, 11112837Sgabeblack@google.com const sc_bind_proxy &p031, 11212837Sgabeblack@google.com const sc_bind_proxy &p032, 11312837Sgabeblack@google.com const sc_bind_proxy &p033, 11412837Sgabeblack@google.com const sc_bind_proxy &p034, 11512837Sgabeblack@google.com const sc_bind_proxy &p035, 11612837Sgabeblack@google.com const sc_bind_proxy &p036, 11712837Sgabeblack@google.com const sc_bind_proxy &p037, 11812837Sgabeblack@google.com const sc_bind_proxy &p038, 11912837Sgabeblack@google.com const sc_bind_proxy &p039, 12012837Sgabeblack@google.com const sc_bind_proxy &p040, 12112837Sgabeblack@google.com const sc_bind_proxy &p041, 12212837Sgabeblack@google.com const sc_bind_proxy &p042, 12312837Sgabeblack@google.com const sc_bind_proxy &p043, 12412837Sgabeblack@google.com const sc_bind_proxy &p044, 12512837Sgabeblack@google.com const sc_bind_proxy &p045, 12612837Sgabeblack@google.com const sc_bind_proxy &p046, 12712837Sgabeblack@google.com const sc_bind_proxy &p047, 12812837Sgabeblack@google.com const sc_bind_proxy &p048, 12912837Sgabeblack@google.com const sc_bind_proxy &p049, 13012837Sgabeblack@google.com const sc_bind_proxy &p050, 13112837Sgabeblack@google.com const sc_bind_proxy &p051, 13212837Sgabeblack@google.com const sc_bind_proxy &p052, 13312837Sgabeblack@google.com const sc_bind_proxy &p053, 13412837Sgabeblack@google.com const sc_bind_proxy &p054, 13512837Sgabeblack@google.com const sc_bind_proxy &p055, 13612837Sgabeblack@google.com const sc_bind_proxy &p056, 13712837Sgabeblack@google.com const sc_bind_proxy &p057, 13812837Sgabeblack@google.com const sc_bind_proxy &p058, 13912837Sgabeblack@google.com const sc_bind_proxy &p059, 14012837Sgabeblack@google.com const sc_bind_proxy &p060, 14112837Sgabeblack@google.com const sc_bind_proxy &p061, 14212837Sgabeblack@google.com const sc_bind_proxy &p062, 14312837Sgabeblack@google.com const sc_bind_proxy &p063, 14412837Sgabeblack@google.com const sc_bind_proxy &p064) 14512837Sgabeblack@google.com{ 14612837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 14712837Sgabeblack@google.com} 14812837Sgabeblack@google.com 14912837Sgabeblack@google.comconst std::vector<sc_object *> & 15012837Sgabeblack@google.comsc_module::get_child_objects() const 15112837Sgabeblack@google.com{ 15212837Sgabeblack@google.com return _gem5_module->obj()->get_child_objects(); 15312837Sgabeblack@google.com} 15412837Sgabeblack@google.com 15512837Sgabeblack@google.comconst std::vector<sc_event *> & 15612837Sgabeblack@google.comsc_module::get_child_events() const 15712837Sgabeblack@google.com{ 15812837Sgabeblack@google.com return _gem5_module->obj()->get_child_events(); 15912837Sgabeblack@google.com} 16012837Sgabeblack@google.com 16112951Sgabeblack@google.comsc_module::sc_module() : 16212837Sgabeblack@google.com sc_object(sc_gem5::newModule()->name()), 16312837Sgabeblack@google.com _gem5_module(sc_gem5::currentModule()) 16412837Sgabeblack@google.com{} 16512837Sgabeblack@google.com 16612837Sgabeblack@google.comsc_module::sc_module(const sc_module_name &) : sc_module() {} 16712951Sgabeblack@google.comsc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {} 16812837Sgabeblack@google.comsc_module::sc_module(const std::string &_name) : 16912837Sgabeblack@google.com sc_module(sc_module_name(_name.c_str())) 17012951Sgabeblack@google.com{} 17112952Sgabeblack@google.com 17212951Sgabeblack@google.comvoid 17312951Sgabeblack@google.comsc_module::reset_signal_is(const sc_in<bool> &, bool) 17412837Sgabeblack@google.com{ 17512951Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 17612951Sgabeblack@google.com} 17712951Sgabeblack@google.com 17812951Sgabeblack@google.comvoid 17912951Sgabeblack@google.comsc_module::reset_signal_is(const sc_inout<bool> &, bool) 18012928Sgabeblack@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_out<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_signal_in_if<bool> &, bool) 19212837Sgabeblack@google.com{ 19312837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 19412837Sgabeblack@google.com} 19512837Sgabeblack@google.com 19612837Sgabeblack@google.com 19712837Sgabeblack@google.comvoid 19812837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_in<bool> &, bool) 19912837Sgabeblack@google.com{ 20012837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 20112837Sgabeblack@google.com} 20212837Sgabeblack@google.com 20312837Sgabeblack@google.comvoid 20412837Sgabeblack@google.comsc_module::async_reset_signal_is(const sc_inout<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_out<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_signal_in_if<bool> &, bool) 21712837Sgabeblack@google.com{ 21812837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 21912837Sgabeblack@google.com} 22012837Sgabeblack@google.com 22112837Sgabeblack@google.com 22212837Sgabeblack@google.comvoid 22312837Sgabeblack@google.comsc_module::dont_initialize() 22412837Sgabeblack@google.com{ 22512837Sgabeblack@google.com ::sc_gem5::Process::newest()->dontInitialize(); 22612837Sgabeblack@google.com} 22712837Sgabeblack@google.com 22812837Sgabeblack@google.comvoid 22912837Sgabeblack@google.comsc_module::set_stack_size(size_t size) 23012837Sgabeblack@google.com{ 23112837Sgabeblack@google.com ::sc_gem5::Process::newest()->setStackSize(size); 23212837Sgabeblack@google.com} 23312837Sgabeblack@google.com 23412953Sgabeblack@google.com 23512837Sgabeblack@google.comvoid sc_module::next_trigger() { ::sc_core::next_trigger(); } 23612837Sgabeblack@google.com 23712837Sgabeblack@google.comvoid 23812953Sgabeblack@google.comsc_module::next_trigger(const sc_event &e) 23912837Sgabeblack@google.com{ 24012953Sgabeblack@google.com ::sc_core::next_trigger(e); 24112837Sgabeblack@google.com} 24212837Sgabeblack@google.com 24312837Sgabeblack@google.comvoid 24412951Sgabeblack@google.comsc_module::next_trigger(const sc_event_or_list &eol) 24512951Sgabeblack@google.com{ 24612837Sgabeblack@google.com ::sc_core::next_trigger(eol); 24712951Sgabeblack@google.com} 24812837Sgabeblack@google.com 24912951Sgabeblack@google.comvoid 25012837Sgabeblack@google.comsc_module::next_trigger(const sc_event_and_list &eal) 25112837Sgabeblack@google.com{ 25212837Sgabeblack@google.com ::sc_core::next_trigger(eal); 25312951Sgabeblack@google.com} 25412837Sgabeblack@google.com 25512951Sgabeblack@google.comvoid 25612837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t) 25712837Sgabeblack@google.com{ 25812837Sgabeblack@google.com ::sc_core::next_trigger(t); 25912951Sgabeblack@google.com} 26012837Sgabeblack@google.com 26112951Sgabeblack@google.comvoid 26212837Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u) 26312837Sgabeblack@google.com{ 26412837Sgabeblack@google.com ::sc_core::next_trigger(d, u); 26512951Sgabeblack@google.com} 26612837Sgabeblack@google.com 26712951Sgabeblack@google.comvoid 26812837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event &e) 26912837Sgabeblack@google.com{ 27012837Sgabeblack@google.com ::sc_core::next_trigger(t, e); 27112951Sgabeblack@google.com} 27212837Sgabeblack@google.com 27312951Sgabeblack@google.comvoid 27412837Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 27512837Sgabeblack@google.com{ 27612837Sgabeblack@google.com ::sc_core::next_trigger(d, u, e); 27712951Sgabeblack@google.com} 27812837Sgabeblack@google.com 27912951Sgabeblack@google.comvoid 28012837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 28112837Sgabeblack@google.com{ 28212837Sgabeblack@google.com ::sc_core::next_trigger(t, eol); 28312951Sgabeblack@google.com} 28412837Sgabeblack@google.com 28512951Sgabeblack@google.comvoid 28612837Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 28712837Sgabeblack@google.com{ 28812837Sgabeblack@google.com ::sc_core::next_trigger(d, u, eol); 28912951Sgabeblack@google.com} 29012837Sgabeblack@google.com 29112951Sgabeblack@google.comvoid 29212837Sgabeblack@google.comsc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 29312837Sgabeblack@google.com{ 29412837Sgabeblack@google.com ::sc_core::next_trigger(t, eal); 29512951Sgabeblack@google.com} 29612837Sgabeblack@google.com 29712951Sgabeblack@google.comvoid 29812837Sgabeblack@google.comsc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 29912837Sgabeblack@google.com{ 30012837Sgabeblack@google.com ::sc_core::next_trigger(d, u, eal); 30112951Sgabeblack@google.com} 30212837Sgabeblack@google.com 30312951Sgabeblack@google.com 30412837Sgabeblack@google.combool 30512837Sgabeblack@google.comsc_module::timed_out() 30612837Sgabeblack@google.com{ 30712951Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 30812837Sgabeblack@google.com return false; 30912951Sgabeblack@google.com} 31012837Sgabeblack@google.com 31112837Sgabeblack@google.com 31212837Sgabeblack@google.comvoid 31312929Sgabeblack@google.comsc_module::wait() 31412929Sgabeblack@google.com{ 31512929Sgabeblack@google.com ::sc_core::wait(); 31612929Sgabeblack@google.com} 31712929Sgabeblack@google.com 31812929Sgabeblack@google.comvoid 31912929Sgabeblack@google.comsc_module::wait(int i) 32012929Sgabeblack@google.com{ 32112837Sgabeblack@google.com ::sc_core::wait(i); 32212837Sgabeblack@google.com} 32312837Sgabeblack@google.com 32412951Sgabeblack@google.comvoid 32512837Sgabeblack@google.comsc_module::wait(const sc_event &e) 32612837Sgabeblack@google.com{ 32712837Sgabeblack@google.com ::sc_core::wait(e); 32812951Sgabeblack@google.com} 32912837Sgabeblack@google.com 33012951Sgabeblack@google.comvoid 33112837Sgabeblack@google.comsc_module::wait(const sc_event_or_list &eol) 33212837Sgabeblack@google.com{ 33312837Sgabeblack@google.com ::sc_core::wait(eol); 33412951Sgabeblack@google.com} 33512837Sgabeblack@google.com 33612951Sgabeblack@google.comvoid 33712837Sgabeblack@google.comsc_module::wait(const sc_event_and_list &eal) 33812837Sgabeblack@google.com{ 33912837Sgabeblack@google.com ::sc_core::wait(eal); 34012951Sgabeblack@google.com} 34112837Sgabeblack@google.com 34212951Sgabeblack@google.comvoid 34312837Sgabeblack@google.comsc_module::wait(const sc_time &t) 34412837Sgabeblack@google.com{ 34512837Sgabeblack@google.com ::sc_core::wait(t); 34612951Sgabeblack@google.com} 34712837Sgabeblack@google.com 34812951Sgabeblack@google.comvoid 34912837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u) 35012837Sgabeblack@google.com{ 35112837Sgabeblack@google.com ::sc_core::wait(d, u); 35212951Sgabeblack@google.com} 35312837Sgabeblack@google.com 35412951Sgabeblack@google.comvoid 35512837Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event &e) 35612837Sgabeblack@google.com{ 35712837Sgabeblack@google.com ::sc_core::wait(t, e); 35812951Sgabeblack@google.com} 35912837Sgabeblack@google.com 36012951Sgabeblack@google.comvoid 36112837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event &e) 36212837Sgabeblack@google.com{ 36312837Sgabeblack@google.com ::sc_core::wait(d, u, e); 36412951Sgabeblack@google.com} 36512837Sgabeblack@google.com 36612951Sgabeblack@google.comvoid 36712837Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_or_list &eol) 36812837Sgabeblack@google.com{ 36912837Sgabeblack@google.com ::sc_core::wait(t, eol); 37012951Sgabeblack@google.com} 37112837Sgabeblack@google.com 37212951Sgabeblack@google.comvoid 37312837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 37412837Sgabeblack@google.com{ 37512837Sgabeblack@google.com ::sc_core::wait(d, u, eol); 37612951Sgabeblack@google.com} 37712837Sgabeblack@google.com 37812951Sgabeblack@google.comvoid 37912837Sgabeblack@google.comsc_module::wait(const sc_time &t, const sc_event_and_list &eal) 38012837Sgabeblack@google.com{ 38112837Sgabeblack@google.com ::sc_core::wait(t, eal); 38212951Sgabeblack@google.com} 38312837Sgabeblack@google.com 38412951Sgabeblack@google.comvoid 38512837Sgabeblack@google.comsc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 38612837Sgabeblack@google.com{ 38712837Sgabeblack@google.com ::sc_core::wait(d, u, eal); 38812951Sgabeblack@google.com} 38912837Sgabeblack@google.com 39012951Sgabeblack@google.com 39112837Sgabeblack@google.comvoid 39212837Sgabeblack@google.comsc_module::halt() 39312837Sgabeblack@google.com{ 39412951Sgabeblack@google.com ::sc_core::halt(); 39512837Sgabeblack@google.com} 39612951Sgabeblack@google.com 39712837Sgabeblack@google.comvoid 39812837Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<bool> &s) 39912837Sgabeblack@google.com{ 40012837Sgabeblack@google.com ::sc_core::at_posedge(s); 40112909Sgabeblack@google.com} 40212909Sgabeblack@google.com 40312951Sgabeblack@google.comvoid 40412909Sgabeblack@google.comsc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 40512909Sgabeblack@google.com{ 40612914Sgabeblack@google.com ::sc_core::at_posedge(s); 40712951Sgabeblack@google.com} 40812914Sgabeblack@google.com 40912951Sgabeblack@google.comvoid 41012914Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<bool> &s) 41112914Sgabeblack@google.com{ 41212914Sgabeblack@google.com ::sc_core::at_negedge(s); 41312951Sgabeblack@google.com} 41412914Sgabeblack@google.com 41512951Sgabeblack@google.comvoid 41612914Sgabeblack@google.comsc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 41712914Sgabeblack@google.com{ 41812914Sgabeblack@google.com ::sc_core::at_negedge(s); 41912951Sgabeblack@google.com} 42012914Sgabeblack@google.com 42112951Sgabeblack@google.com 42212914Sgabeblack@google.comvoid 42312914Sgabeblack@google.comnext_trigger() 42412914Sgabeblack@google.com{ 42512951Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 42612914Sgabeblack@google.com p->setDynamic(nullptr); 42712951Sgabeblack@google.com} 42812914Sgabeblack@google.com 42912914Sgabeblack@google.comvoid 43012909Sgabeblack@google.comnext_trigger(const sc_event &e) 43112909Sgabeblack@google.com{ 43212837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 43312837Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 43412958Sgabeblack@google.com} 43512958Sgabeblack@google.com 43612837Sgabeblack@google.comvoid 43712837Sgabeblack@google.comnext_trigger(const sc_event_or_list &eol) 43812837Sgabeblack@google.com{ 43912958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 44012837Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 44112958Sgabeblack@google.com} 44212958Sgabeblack@google.com 44312837Sgabeblack@google.comvoid 44412837Sgabeblack@google.comnext_trigger(const sc_event_and_list &eal) 44512837Sgabeblack@google.com{ 44612958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 44712837Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 44812958Sgabeblack@google.com} 44912958Sgabeblack@google.com 45012837Sgabeblack@google.comvoid 45112837Sgabeblack@google.comnext_trigger(const sc_time &t) 45212837Sgabeblack@google.com{ 45312958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 45412837Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 45512958Sgabeblack@google.com} 45612958Sgabeblack@google.com 45712837Sgabeblack@google.comvoid 45812837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u) 45912837Sgabeblack@google.com{ 46012958Sgabeblack@google.com next_trigger(sc_time(d, u)); 46112837Sgabeblack@google.com} 46212958Sgabeblack@google.com 46312958Sgabeblack@google.comvoid 46412837Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event &e) 46512837Sgabeblack@google.com{ 46612837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 46712951Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 46812837Sgabeblack@google.com} 46912951Sgabeblack@google.com 47012837Sgabeblack@google.comvoid 47112837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event &e) 47212837Sgabeblack@google.com{ 47312958Sgabeblack@google.com next_trigger(sc_time(d, u), e); 47412837Sgabeblack@google.com} 47512958Sgabeblack@google.com 47612958Sgabeblack@google.comvoid 47712837Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_or_list &eol) 47812837Sgabeblack@google.com{ 47912837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 48012951Sgabeblack@google.com p->setDynamic( 48112837Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 48212951Sgabeblack@google.com} 48312837Sgabeblack@google.com 48412837Sgabeblack@google.comvoid 48512837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 48612958Sgabeblack@google.com{ 48712837Sgabeblack@google.com next_trigger(sc_time(d, u), eol); 48812958Sgabeblack@google.com} 48912958Sgabeblack@google.com 49012958Sgabeblack@google.comvoid 49112837Sgabeblack@google.comnext_trigger(const sc_time &t, const sc_event_and_list &eal) 49212837Sgabeblack@google.com{ 49312837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 49412951Sgabeblack@google.com p->setDynamic( 49512837Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 49612951Sgabeblack@google.com} 49712837Sgabeblack@google.com 49812837Sgabeblack@google.comvoid 49912837Sgabeblack@google.comnext_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 50012958Sgabeblack@google.com{ 50112837Sgabeblack@google.com next_trigger(sc_time(d, u), eal); 50212958Sgabeblack@google.com} 50312958Sgabeblack@google.com 50412958Sgabeblack@google.combool 50512837Sgabeblack@google.comtimed_out() 50612837Sgabeblack@google.com{ 50712837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 50812951Sgabeblack@google.com return false; 50912837Sgabeblack@google.com} 51012951Sgabeblack@google.com 51112837Sgabeblack@google.com 51212837Sgabeblack@google.comvoid 51312929Sgabeblack@google.comwait() 51412929Sgabeblack@google.com{ 51512929Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 51612929Sgabeblack@google.com p->setDynamic(nullptr); 51712929Sgabeblack@google.com sc_gem5::scheduler.yield(); 51812929Sgabeblack@google.com} 51912929Sgabeblack@google.com 52012837Sgabeblack@google.comvoid 52112837Sgabeblack@google.comwait(int n) 52212837Sgabeblack@google.com{ 52312837Sgabeblack@google.com for (int i = 0; i < n; i++) 52412958Sgabeblack@google.com wait(); 52512958Sgabeblack@google.com} 52612958Sgabeblack@google.com 52712837Sgabeblack@google.comvoid 52812837Sgabeblack@google.comwait(const sc_event &e) 52912837Sgabeblack@google.com{ 53012958Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53112837Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 53212958Sgabeblack@google.com sc_gem5::scheduler.yield(); 53312958Sgabeblack@google.com} 53412837Sgabeblack@google.com 53512837Sgabeblack@google.comvoid 53612837Sgabeblack@google.comwait(const sc_event_or_list &eol) 53712958Sgabeblack@google.com{ 53812837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 53912958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 54012958Sgabeblack@google.com sc_gem5::scheduler.yield(); 54112958Sgabeblack@google.com} 54212837Sgabeblack@google.com 54312837Sgabeblack@google.comvoid 54412837Sgabeblack@google.comwait(const sc_event_and_list &eal) 54512958Sgabeblack@google.com{ 54612837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 54712958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 54812958Sgabeblack@google.com sc_gem5::scheduler.yield(); 54912958Sgabeblack@google.com} 55012837Sgabeblack@google.com 55112837Sgabeblack@google.comvoid 55212837Sgabeblack@google.comwait(const sc_time &t) 55312958Sgabeblack@google.com{ 55412837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 55512958Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 55612958Sgabeblack@google.com sc_gem5::scheduler.yield(); 55712958Sgabeblack@google.com} 55812837Sgabeblack@google.com 55912837Sgabeblack@google.comvoid 56012837Sgabeblack@google.comwait(double d, sc_time_unit u) 56112958Sgabeblack@google.com{ 56212837Sgabeblack@google.com wait(sc_time(d, u)); 56312958Sgabeblack@google.com} 56412958Sgabeblack@google.com 56512958Sgabeblack@google.comvoid 56612837Sgabeblack@google.comwait(const sc_time &t, const sc_event &e) 56712837Sgabeblack@google.com{ 56812837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 56912951Sgabeblack@google.com p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 57012837Sgabeblack@google.com sc_gem5::scheduler.yield(); 57112951Sgabeblack@google.com} 57212837Sgabeblack@google.com 57312837Sgabeblack@google.comvoid 57412837Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event &e) 57512958Sgabeblack@google.com{ 57612837Sgabeblack@google.com wait(sc_time(d, u), e); 57712958Sgabeblack@google.com} 57812958Sgabeblack@google.com 57912958Sgabeblack@google.comvoid 58012837Sgabeblack@google.comwait(const sc_time &t, const sc_event_or_list &eol) 58112837Sgabeblack@google.com{ 58212837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 58312951Sgabeblack@google.com p->setDynamic( 58412837Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 58512951Sgabeblack@google.com sc_gem5::scheduler.yield(); 58612837Sgabeblack@google.com} 58712837Sgabeblack@google.com 58812837Sgabeblack@google.comvoid 58912958Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_or_list &eol) 59012837Sgabeblack@google.com{ 59112958Sgabeblack@google.com wait(sc_time(d, u), eol); 59212958Sgabeblack@google.com} 59312958Sgabeblack@google.com 59412958Sgabeblack@google.comvoid 59512837Sgabeblack@google.comwait(const sc_time &t, const sc_event_and_list &eal) 59612837Sgabeblack@google.com{ 59712837Sgabeblack@google.com sc_gem5::Process *p = sc_gem5::scheduler.current(); 59812951Sgabeblack@google.com p->setDynamic( 59912837Sgabeblack@google.com new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 60012951Sgabeblack@google.com sc_gem5::scheduler.yield(); 60112837Sgabeblack@google.com} 60212837Sgabeblack@google.com 60312837Sgabeblack@google.comvoid 60412958Sgabeblack@google.comwait(double d, sc_time_unit u, const sc_event_and_list &eal) 60512837Sgabeblack@google.com{ 60612958Sgabeblack@google.com wait(sc_time(d, u), eal); 60712958Sgabeblack@google.com} 60812958Sgabeblack@google.com 60912958Sgabeblack@google.comvoid 61012837Sgabeblack@google.comhalt() 61112837Sgabeblack@google.com{ 61212837Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 61312951Sgabeblack@google.com} 61412837Sgabeblack@google.com 61512951Sgabeblack@google.comvoid 61612837Sgabeblack@google.comat_posedge(const sc_signal_in_if<bool> &) 61712837Sgabeblack@google.com{ 61812909Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 61912909Sgabeblack@google.com} 62012909Sgabeblack@google.com 62112909Sgabeblack@google.comvoid 62212909Sgabeblack@google.comat_posedge(const sc_signal_in_if<sc_dt::sc_logic> &) 62312909Sgabeblack@google.com{ 62412914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 62512914Sgabeblack@google.com} 62612914Sgabeblack@google.com 62712914Sgabeblack@google.comvoid 62812914Sgabeblack@google.comat_negedge(const sc_signal_in_if<bool> &) 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<sc_dt::sc_logic> &) 63512914Sgabeblack@google.com{ 63612914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 63712914Sgabeblack@google.com} 63812914Sgabeblack@google.com 63912914Sgabeblack@google.comconst char * 64012914Sgabeblack@google.comsc_gen_unique_name(const char *) 64112914Sgabeblack@google.com{ 64212914Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 64312914Sgabeblack@google.com return ""; 64412914Sgabeblack@google.com} 64512914Sgabeblack@google.com 64612914Sgabeblack@google.combool 64712914Sgabeblack@google.comsc_hierarchical_name_exists(const char *name) 64812837Sgabeblack@google.com{ 64913035Sgabeblack@google.com warn("%s not implemented.\n", __PRETTY_FUNCTION__); 65012837Sgabeblack@google.com return false; 65113035Sgabeblack@google.com} 65213035Sgabeblack@google.com 65313035Sgabeblack@google.combool 65412837Sgabeblack@google.comsc_start_of_simulation_invoked() 65512837Sgabeblack@google.com{ 65612837Sgabeblack@google.com return ::sc_gem5::kernel->startOfSimulationComplete(); 65712930Sgabeblack@google.com} 65812930Sgabeblack@google.com 65912930Sgabeblack@google.combool 66012930Sgabeblack@google.comsc_end_of_simulation_invoked() 66112930Sgabeblack@google.com{ 66212930Sgabeblack@google.com return ::sc_gem5::kernel->endOfSimulationComplete(); 66312930Sgabeblack@google.com} 66412837Sgabeblack@google.com 66512837Sgabeblack@google.comsc_module * 66612982Sgabeblack@google.comsc_module_sc_new(sc_module *mod) 66712837Sgabeblack@google.com{ 66812837Sgabeblack@google.com static std::vector<std::unique_ptr<sc_module> > modules; 66912837Sgabeblack@google.com modules.emplace_back(mod); 67012837Sgabeblack@google.com return mod; 67112837Sgabeblack@google.com} 67212982Sgabeblack@google.com 67312837Sgabeblack@google.com} // namespace sc_core 67412837Sgabeblack@google.com