sc_module.hh revision 12864
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 3012837Sgabeblack@google.com#ifndef __SYSTEMC_CORE_EXT_SC_MODULE_HH__ 3112837Sgabeblack@google.com#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__ 3212837Sgabeblack@google.com 3312837Sgabeblack@google.com#include <vector> 3412837Sgabeblack@google.com 3512837Sgabeblack@google.com#include "sc_object.hh" 3612837Sgabeblack@google.com#include "sc_sensitive.hh" 3712837Sgabeblack@google.com#include "sc_time.hh" 3812837Sgabeblack@google.com 3912837Sgabeblack@google.comnamespace sc_core 4012837Sgabeblack@google.com{ 4112837Sgabeblack@google.com 4212837Sgabeblack@google.comtemplate <class T> 4312837Sgabeblack@google.comclass sc_in; 4412837Sgabeblack@google.comtemplate <class T> 4512837Sgabeblack@google.comclass sc_out; 4612837Sgabeblack@google.comtemplate <class T> 4712837Sgabeblack@google.comclass sc_inout; 4812837Sgabeblack@google.comtemplate <class T> 4912837Sgabeblack@google.comclass sc_signal_in_if; 5012837Sgabeblack@google.com 5112837Sgabeblack@google.comclass sc_event; 5212837Sgabeblack@google.comclass sc_event_and_list; 5312837Sgabeblack@google.comclass sc_event_or_list; 5412837Sgabeblack@google.comclass sc_module_name; 5512837Sgabeblack@google.com 5612837Sgabeblack@google.comclass sc_bind_proxy 5712837Sgabeblack@google.com{ 5812837Sgabeblack@google.com public: 5912837Sgabeblack@google.com sc_bind_proxy(const sc_interface &interface); 6012837Sgabeblack@google.com sc_bind_proxy(const sc_port_base &port); 6112837Sgabeblack@google.com}; 6212837Sgabeblack@google.com 6312837Sgabeblack@google.comextern const sc_bind_proxy SC_BIND_PROXY_NIL; 6412837Sgabeblack@google.com 6512837Sgabeblack@google.comclass sc_module : public sc_object 6612837Sgabeblack@google.com{ 6712837Sgabeblack@google.com public: 6812837Sgabeblack@google.com virtual ~sc_module(); 6912837Sgabeblack@google.com 7012837Sgabeblack@google.com virtual const char *kind() const; 7112837Sgabeblack@google.com 7212837Sgabeblack@google.com void operator () (const sc_bind_proxy &p001, 7312837Sgabeblack@google.com const sc_bind_proxy &p002 = SC_BIND_PROXY_NIL, 7412837Sgabeblack@google.com const sc_bind_proxy &p003 = SC_BIND_PROXY_NIL, 7512837Sgabeblack@google.com const sc_bind_proxy &p004 = SC_BIND_PROXY_NIL, 7612837Sgabeblack@google.com const sc_bind_proxy &p005 = SC_BIND_PROXY_NIL, 7712837Sgabeblack@google.com const sc_bind_proxy &p006 = SC_BIND_PROXY_NIL, 7812837Sgabeblack@google.com const sc_bind_proxy &p007 = SC_BIND_PROXY_NIL, 7912837Sgabeblack@google.com const sc_bind_proxy &p008 = SC_BIND_PROXY_NIL, 8012837Sgabeblack@google.com const sc_bind_proxy &p009 = SC_BIND_PROXY_NIL, 8112837Sgabeblack@google.com const sc_bind_proxy &p010 = SC_BIND_PROXY_NIL, 8212837Sgabeblack@google.com const sc_bind_proxy &p011 = SC_BIND_PROXY_NIL, 8312837Sgabeblack@google.com const sc_bind_proxy &p012 = SC_BIND_PROXY_NIL, 8412837Sgabeblack@google.com const sc_bind_proxy &p013 = SC_BIND_PROXY_NIL, 8512837Sgabeblack@google.com const sc_bind_proxy &p014 = SC_BIND_PROXY_NIL, 8612837Sgabeblack@google.com const sc_bind_proxy &p015 = SC_BIND_PROXY_NIL, 8712837Sgabeblack@google.com const sc_bind_proxy &p016 = SC_BIND_PROXY_NIL, 8812837Sgabeblack@google.com const sc_bind_proxy &p017 = SC_BIND_PROXY_NIL, 8912837Sgabeblack@google.com const sc_bind_proxy &p018 = SC_BIND_PROXY_NIL, 9012837Sgabeblack@google.com const sc_bind_proxy &p019 = SC_BIND_PROXY_NIL, 9112837Sgabeblack@google.com const sc_bind_proxy &p020 = SC_BIND_PROXY_NIL, 9212837Sgabeblack@google.com const sc_bind_proxy &p021 = SC_BIND_PROXY_NIL, 9312837Sgabeblack@google.com const sc_bind_proxy &p022 = SC_BIND_PROXY_NIL, 9412837Sgabeblack@google.com const sc_bind_proxy &p023 = SC_BIND_PROXY_NIL, 9512837Sgabeblack@google.com const sc_bind_proxy &p024 = SC_BIND_PROXY_NIL, 9612837Sgabeblack@google.com const sc_bind_proxy &p025 = SC_BIND_PROXY_NIL, 9712837Sgabeblack@google.com const sc_bind_proxy &p026 = SC_BIND_PROXY_NIL, 9812837Sgabeblack@google.com const sc_bind_proxy &p027 = SC_BIND_PROXY_NIL, 9912837Sgabeblack@google.com const sc_bind_proxy &p028 = SC_BIND_PROXY_NIL, 10012837Sgabeblack@google.com const sc_bind_proxy &p029 = SC_BIND_PROXY_NIL, 10112837Sgabeblack@google.com const sc_bind_proxy &p030 = SC_BIND_PROXY_NIL, 10212837Sgabeblack@google.com const sc_bind_proxy &p031 = SC_BIND_PROXY_NIL, 10312837Sgabeblack@google.com const sc_bind_proxy &p032 = SC_BIND_PROXY_NIL, 10412837Sgabeblack@google.com const sc_bind_proxy &p033 = SC_BIND_PROXY_NIL, 10512837Sgabeblack@google.com const sc_bind_proxy &p034 = SC_BIND_PROXY_NIL, 10612837Sgabeblack@google.com const sc_bind_proxy &p035 = SC_BIND_PROXY_NIL, 10712837Sgabeblack@google.com const sc_bind_proxy &p036 = SC_BIND_PROXY_NIL, 10812837Sgabeblack@google.com const sc_bind_proxy &p037 = SC_BIND_PROXY_NIL, 10912837Sgabeblack@google.com const sc_bind_proxy &p038 = SC_BIND_PROXY_NIL, 11012837Sgabeblack@google.com const sc_bind_proxy &p039 = SC_BIND_PROXY_NIL, 11112837Sgabeblack@google.com const sc_bind_proxy &p040 = SC_BIND_PROXY_NIL, 11212837Sgabeblack@google.com const sc_bind_proxy &p041 = SC_BIND_PROXY_NIL, 11312837Sgabeblack@google.com const sc_bind_proxy &p042 = SC_BIND_PROXY_NIL, 11412837Sgabeblack@google.com const sc_bind_proxy &p043 = SC_BIND_PROXY_NIL, 11512837Sgabeblack@google.com const sc_bind_proxy &p044 = SC_BIND_PROXY_NIL, 11612837Sgabeblack@google.com const sc_bind_proxy &p045 = SC_BIND_PROXY_NIL, 11712837Sgabeblack@google.com const sc_bind_proxy &p046 = SC_BIND_PROXY_NIL, 11812837Sgabeblack@google.com const sc_bind_proxy &p047 = SC_BIND_PROXY_NIL, 11912837Sgabeblack@google.com const sc_bind_proxy &p048 = SC_BIND_PROXY_NIL, 12012837Sgabeblack@google.com const sc_bind_proxy &p049 = SC_BIND_PROXY_NIL, 12112837Sgabeblack@google.com const sc_bind_proxy &p050 = SC_BIND_PROXY_NIL, 12212837Sgabeblack@google.com const sc_bind_proxy &p051 = SC_BIND_PROXY_NIL, 12312837Sgabeblack@google.com const sc_bind_proxy &p052 = SC_BIND_PROXY_NIL, 12412837Sgabeblack@google.com const sc_bind_proxy &p053 = SC_BIND_PROXY_NIL, 12512837Sgabeblack@google.com const sc_bind_proxy &p054 = SC_BIND_PROXY_NIL, 12612837Sgabeblack@google.com const sc_bind_proxy &p055 = SC_BIND_PROXY_NIL, 12712837Sgabeblack@google.com const sc_bind_proxy &p056 = SC_BIND_PROXY_NIL, 12812837Sgabeblack@google.com const sc_bind_proxy &p057 = SC_BIND_PROXY_NIL, 12912837Sgabeblack@google.com const sc_bind_proxy &p058 = SC_BIND_PROXY_NIL, 13012837Sgabeblack@google.com const sc_bind_proxy &p059 = SC_BIND_PROXY_NIL, 13112837Sgabeblack@google.com const sc_bind_proxy &p060 = SC_BIND_PROXY_NIL, 13212837Sgabeblack@google.com const sc_bind_proxy &p061 = SC_BIND_PROXY_NIL, 13312837Sgabeblack@google.com const sc_bind_proxy &p062 = SC_BIND_PROXY_NIL, 13412837Sgabeblack@google.com const sc_bind_proxy &p063 = SC_BIND_PROXY_NIL, 13512837Sgabeblack@google.com const sc_bind_proxy &p064 = SC_BIND_PROXY_NIL); 13612837Sgabeblack@google.com 13712837Sgabeblack@google.com virtual const std::vector<sc_object *> &get_child_objects() const; 13812837Sgabeblack@google.com virtual const std::vector<sc_event *> &get_child_events() const; 13912837Sgabeblack@google.com 14012837Sgabeblack@google.com protected: 14112837Sgabeblack@google.com sc_module(const sc_module_name &); 14212837Sgabeblack@google.com sc_module(); 14312837Sgabeblack@google.com 14412864Sgabeblack@google.com /* Deprecated, but used in the regression tests. */ 14512864Sgabeblack@google.com void end_module() {} 14612864Sgabeblack@google.com 14712837Sgabeblack@google.com void reset_signal_is(const sc_in<bool> &, bool); 14812837Sgabeblack@google.com void reset_signal_is(const sc_inout<bool> &, bool); 14912837Sgabeblack@google.com void reset_signal_is(const sc_out<bool> &, bool); 15012837Sgabeblack@google.com void reset_signal_is(const sc_signal_in_if<bool> &, bool); 15112837Sgabeblack@google.com 15212837Sgabeblack@google.com void async_reset_signal_is(const sc_in<bool> &, bool); 15312837Sgabeblack@google.com void async_reset_signal_is(const sc_inout<bool> &, bool); 15412837Sgabeblack@google.com void async_reset_signal_is(const sc_out<bool> &, bool); 15512837Sgabeblack@google.com void async_reset_signal_is(const sc_signal_in_if<bool> &, bool); 15612837Sgabeblack@google.com 15712837Sgabeblack@google.com sc_sensitive sensitive; 15812837Sgabeblack@google.com 15912837Sgabeblack@google.com void dont_initialize(); 16012837Sgabeblack@google.com void set_stack_size(size_t); 16112837Sgabeblack@google.com 16212837Sgabeblack@google.com void next_trigger(); 16312837Sgabeblack@google.com void next_trigger(const sc_event &); 16412837Sgabeblack@google.com void next_trigger(const sc_event_or_list &); 16512837Sgabeblack@google.com void next_trigger(const sc_event_and_list &); 16612837Sgabeblack@google.com void next_trigger(const sc_time &); 16712837Sgabeblack@google.com void next_trigger(double, sc_time_unit); 16812837Sgabeblack@google.com void next_trigger(const sc_time &, const sc_event &); 16912837Sgabeblack@google.com void next_trigger(double, sc_time_unit, const sc_event &); 17012837Sgabeblack@google.com void next_trigger(const sc_time &, const sc_event_or_list &); 17112837Sgabeblack@google.com void next_trigger(double, sc_time_unit, const sc_event_or_list &); 17212837Sgabeblack@google.com void next_trigger(const sc_time &, const sc_event_and_list &); 17312837Sgabeblack@google.com void next_trigger(double, sc_time_unit, const sc_event_and_list &); 17412837Sgabeblack@google.com 17512837Sgabeblack@google.com void wait(); 17612837Sgabeblack@google.com void wait(int); 17712837Sgabeblack@google.com void wait(const sc_event &); 17812837Sgabeblack@google.com void wait(const sc_event_or_list &); 17912837Sgabeblack@google.com void wait(const sc_event_and_list &); 18012837Sgabeblack@google.com void wait(const sc_time &); 18112837Sgabeblack@google.com void wait(double, sc_time_unit); 18212837Sgabeblack@google.com void wait(const sc_time &, const sc_event &); 18312837Sgabeblack@google.com void wait(double, sc_time_unit, const sc_event &); 18412837Sgabeblack@google.com void wait(const sc_time &, const sc_event_or_list &); 18512837Sgabeblack@google.com void wait(double, sc_time_unit, const sc_event_or_list &); 18612837Sgabeblack@google.com void wait(const sc_time &, const sc_event_and_list &); 18712837Sgabeblack@google.com void wait(double, sc_time_unit, const sc_event_and_list &); 18812837Sgabeblack@google.com 18912837Sgabeblack@google.com virtual void before_end_of_elaboration() {} 19012837Sgabeblack@google.com virtual void end_of_elaboration() {} 19112837Sgabeblack@google.com virtual void start_of_simulation() {} 19212837Sgabeblack@google.com virtual void end_of_simulation() {} 19312837Sgabeblack@google.com 19412837Sgabeblack@google.com private: 19512837Sgabeblack@google.com // Disabled 19612837Sgabeblack@google.com sc_module(const sc_module &) : sc_object() {}; 19712837Sgabeblack@google.com sc_module &operator = (const sc_module &) { return *this; } 19812837Sgabeblack@google.com}; 19912837Sgabeblack@google.com 20012837Sgabeblack@google.comvoid next_trigger(); 20112837Sgabeblack@google.comvoid next_trigger(const sc_event &); 20212837Sgabeblack@google.comvoid next_trigger(const sc_event_or_list &); 20312837Sgabeblack@google.comvoid next_trigger(const sc_event_and_list &); 20412837Sgabeblack@google.comvoid next_trigger(const sc_time &); 20512837Sgabeblack@google.comvoid next_trigger(double, sc_time_unit); 20612837Sgabeblack@google.comvoid next_trigger(const sc_time &, const sc_event &); 20712837Sgabeblack@google.comvoid next_trigger(double, sc_time_unit, const sc_event &); 20812837Sgabeblack@google.comvoid next_trigger(const sc_time &, const sc_event_or_list &); 20912837Sgabeblack@google.comvoid next_trigger(double, sc_time_unit, const sc_event_or_list &); 21012837Sgabeblack@google.comvoid next_trigger(const sc_time &, const sc_event_and_list &); 21112837Sgabeblack@google.comvoid next_trigger(double, sc_time_unit, const sc_event_and_list &); 21212837Sgabeblack@google.com 21312837Sgabeblack@google.comvoid wait(); 21412837Sgabeblack@google.comvoid wait(int); 21512837Sgabeblack@google.comvoid wait(const sc_event &); 21612837Sgabeblack@google.comvoid wait(const sc_event_or_list &); 21712837Sgabeblack@google.comvoid wait(const sc_event_and_list &); 21812837Sgabeblack@google.comvoid wait(const sc_time &); 21912837Sgabeblack@google.comvoid wait(double, sc_time_unit); 22012837Sgabeblack@google.comvoid wait(const sc_time &, const sc_event &); 22112837Sgabeblack@google.comvoid wait(double, sc_time_unit, const sc_event &); 22212837Sgabeblack@google.comvoid wait(const sc_time &, const sc_event_or_list &); 22312837Sgabeblack@google.comvoid wait(double, sc_time_unit, const sc_event_or_list &); 22412837Sgabeblack@google.comvoid wait(const sc_time &, const sc_event_and_list &); 22512837Sgabeblack@google.comvoid wait(double, sc_time_unit, const sc_event_and_list &); 22612837Sgabeblack@google.com 22712837Sgabeblack@google.com#define SC_MODULE(name) struct name : ::sc_core::sc_module 22812837Sgabeblack@google.com 22912837Sgabeblack@google.com#define SC_CTOR(name) \ 23012837Sgabeblack@google.com typedef name SC_CURRENT_USER_MODULE; \ 23112837Sgabeblack@google.com name(::sc_core::sc_module_name) 23212837Sgabeblack@google.com 23312837Sgabeblack@google.com#define SC_HAS_PROCESS(name) typedef name SC_CURRENT_USER_MODULE 23412837Sgabeblack@google.com 23512837Sgabeblack@google.com#define SC_METHOD(name) /* Implementation defined */ 23612837Sgabeblack@google.com#define SC_THREAD(name) /* Implementation defined */ 23712837Sgabeblack@google.com#define SC_CTHREAD(name, clk) /* Implementation defined */ 23812837Sgabeblack@google.com 23912837Sgabeblack@google.comconst char *sc_gen_unique_name(const char *); 24012837Sgabeblack@google.com 24112837Sgabeblack@google.comtypedef sc_module sc_behavior; 24212837Sgabeblack@google.comtypedef sc_module sc_channel; 24312837Sgabeblack@google.com 24412837Sgabeblack@google.combool sc_start_of_simulation_invoked(); 24512837Sgabeblack@google.combool sc_end_of_simulation_invoked(); 24612837Sgabeblack@google.com 24712837Sgabeblack@google.com} // namespace sc_core 24812837Sgabeblack@google.com 24912837Sgabeblack@google.com#endif //__SYSTEMC_EXT_CORE_SC_MODULE_HH__ 250