sc_spawn.hh revision 12839
112839Sgabeblack@google.com/* 212839Sgabeblack@google.com * Copyright 2018 Google, Inc. 312839Sgabeblack@google.com * 412839Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512839Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612839Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712839Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812839Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912839Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012839Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112839Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212839Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312839Sgabeblack@google.com * this software without specific prior written permission. 1412839Sgabeblack@google.com * 1512839Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612839Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712839Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812839Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912839Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012839Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112839Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212839Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312839Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412839Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512839Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612839Sgabeblack@google.com * 2712839Sgabeblack@google.com * Authors: Gabe Black 2812839Sgabeblack@google.com */ 2912839Sgabeblack@google.com 3012839Sgabeblack@google.com#ifndef __SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 3112839Sgabeblack@google.com#define __SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 3212839Sgabeblack@google.com 3312839Sgabeblack@google.com#include "sc_process_handle.hh" 3412839Sgabeblack@google.com 3512839Sgabeblack@google.comnamespace sc_core 3612839Sgabeblack@google.com{ 3712839Sgabeblack@google.com 3812839Sgabeblack@google.comtemplate <class T> 3912839Sgabeblack@google.comclass sc_in; 4012839Sgabeblack@google.comtemplate <class T> 4112839Sgabeblack@google.comclass sc_inout; 4212839Sgabeblack@google.comtemplate <class T> 4312839Sgabeblack@google.comclass sc_out; 4412839Sgabeblack@google.comtemplate <class T> 4512839Sgabeblack@google.comclass sc_signal_in_if; 4612839Sgabeblack@google.com 4712839Sgabeblack@google.comclass sc_event; 4812839Sgabeblack@google.comclass sc_event_finder; 4912839Sgabeblack@google.comclass sc_export_base; 5012839Sgabeblack@google.comclass sc_interface; 5112839Sgabeblack@google.comclass sc_port_base; 5212839Sgabeblack@google.com 5312839Sgabeblack@google.comclass sc_spawn_options 5412839Sgabeblack@google.com{ 5512839Sgabeblack@google.com public: 5612839Sgabeblack@google.com sc_spawn_options(); 5712839Sgabeblack@google.com 5812839Sgabeblack@google.com void spawn_method(); 5912839Sgabeblack@google.com void dont_initialize(); 6012839Sgabeblack@google.com void set_stack_size(int); 6112839Sgabeblack@google.com 6212839Sgabeblack@google.com void set_sensitivity(const sc_event *); 6312839Sgabeblack@google.com void set_sensitivity(sc_port_base *); 6412839Sgabeblack@google.com void set_sensitivity(sc_export_base *); 6512839Sgabeblack@google.com void set_sensitivity(sc_interface *); 6612839Sgabeblack@google.com void set_sensitivity(sc_event_finder *); 6712839Sgabeblack@google.com 6812839Sgabeblack@google.com void reset_signal_is(const sc_in<bool> &, bool); 6912839Sgabeblack@google.com void reset_signal_is(const sc_inout<bool> &, bool); 7012839Sgabeblack@google.com void reset_signal_is(const sc_out<bool> &, bool); 7112839Sgabeblack@google.com void reset_signal_is(const sc_signal_in_if<bool> &, bool); 7212839Sgabeblack@google.com 7312839Sgabeblack@google.com void async_reset_signal_is(const sc_in<bool> &, bool); 7412839Sgabeblack@google.com void async_reset_signal_is(const sc_inout<bool> &, bool); 7512839Sgabeblack@google.com void async_reset_signal_is(const sc_out<bool> &, bool); 7612839Sgabeblack@google.com void async_reset_signal_is(const sc_signal_in_if<bool> &, bool); 7712839Sgabeblack@google.com 7812839Sgabeblack@google.com private: 7912839Sgabeblack@google.com // Disabled 8012839Sgabeblack@google.com sc_spawn_options(const sc_spawn_options &) {} 8112839Sgabeblack@google.com sc_spawn_options &operator = (const sc_spawn_options &) { return *this; } 8212839Sgabeblack@google.com}; 8312839Sgabeblack@google.com 8412839Sgabeblack@google.comvoid sc_spawn_warn_unimpl(const char *func); 8512839Sgabeblack@google.com 8612839Sgabeblack@google.comtemplate <typename T> 8712839Sgabeblack@google.comsc_process_handle 8812839Sgabeblack@google.comsc_spawn(T object, const char *name_p=nullptr, 8912839Sgabeblack@google.com const sc_spawn_options *opt_p=nullptr) 9012839Sgabeblack@google.com{ 9112839Sgabeblack@google.com sc_spawn_warn_unimpl(__PRETTY_FUNCTION__); 9212839Sgabeblack@google.com return sc_process_handle(); 9312839Sgabeblack@google.com} 9412839Sgabeblack@google.com 9512839Sgabeblack@google.comtemplate <typename T> 9612839Sgabeblack@google.comsc_process_handle 9712839Sgabeblack@google.comsc_spawn(typename T::result_type *r_p, T object, const char *name_p=nullptr, 9812839Sgabeblack@google.com const sc_spawn_options *opt_p=nullptr) 9912839Sgabeblack@google.com{ 10012839Sgabeblack@google.com sc_spawn_warn_unimpl(__PRETTY_FUNCTION__); 10112839Sgabeblack@google.com return sc_process_handle(); 10212839Sgabeblack@google.com} 10312839Sgabeblack@google.com 10412839Sgabeblack@google.com#define sc_bind boost::bind 10512839Sgabeblack@google.com#define sc_ref(r) boost::ref(r) 10612839Sgabeblack@google.com#define sc_cref(r) boost::cref(r) 10712839Sgabeblack@google.com 10812839Sgabeblack@google.com#define SC_FORK /* Implementation defined */ 10912839Sgabeblack@google.com#define SC_JOIN /* Implementation defined */ 11012839Sgabeblack@google.com 11112839Sgabeblack@google.com} // namespace sc_core 11212839Sgabeblack@google.com 11312839Sgabeblack@google.comnamespace sc_unnamed 11412839Sgabeblack@google.com{ 11512839Sgabeblack@google.com 11612839Sgabeblack@google.comtypedef int ImplementationDefined; 11712839Sgabeblack@google.comextern ImplementationDefined _1; 11812839Sgabeblack@google.comextern ImplementationDefined _2; 11912839Sgabeblack@google.comextern ImplementationDefined _3; 12012839Sgabeblack@google.comextern ImplementationDefined _4; 12112839Sgabeblack@google.comextern ImplementationDefined _5; 12212839Sgabeblack@google.comextern ImplementationDefined _6; 12312839Sgabeblack@google.comextern ImplementationDefined _7; 12412839Sgabeblack@google.comextern ImplementationDefined _8; 12512839Sgabeblack@google.comextern ImplementationDefined _9; 12612839Sgabeblack@google.com 12712839Sgabeblack@google.com} // namespace sc_unnamed 12812839Sgabeblack@google.com 12912839Sgabeblack@google.com#endif //__SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 130