sc_spawn.hh revision 12879
112855Sgabeblack@google.com/* 212855Sgabeblack@google.com * Copyright 2018 Google, Inc. 312855Sgabeblack@google.com * 412855Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512855Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612855Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812855Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912855Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012855Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112855Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212855Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312855Sgabeblack@google.com * this software without specific prior written permission. 1412855Sgabeblack@google.com * 1512855Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612855Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712855Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812855Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912855Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012855Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112855Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212855Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312855Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412855Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512855Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612855Sgabeblack@google.com * 2712855Sgabeblack@google.com * Authors: Gabe Black 2812855Sgabeblack@google.com */ 2912855Sgabeblack@google.com 3012855Sgabeblack@google.com#ifndef __SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 3112855Sgabeblack@google.com#define __SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 3212855Sgabeblack@google.com 3312855Sgabeblack@google.com#include "sc_process_handle.hh" 3412855Sgabeblack@google.com 3512855Sgabeblack@google.comnamespace sc_core 3612855Sgabeblack@google.com{ 3712855Sgabeblack@google.com 3812855Sgabeblack@google.comtemplate <class T> 3912855Sgabeblack@google.comclass sc_in; 4012855Sgabeblack@google.comtemplate <class T> 4112855Sgabeblack@google.comclass sc_inout; 4212855Sgabeblack@google.comtemplate <class T> 4312855Sgabeblack@google.comclass sc_out; 4412855Sgabeblack@google.comtemplate <class T> 4512855Sgabeblack@google.comclass sc_signal_in_if; 4612855Sgabeblack@google.com 4712855Sgabeblack@google.comclass sc_event; 4812855Sgabeblack@google.comclass sc_event_finder; 4912855Sgabeblack@google.comclass sc_export_base; 5012855Sgabeblack@google.comclass sc_interface; 5112855Sgabeblack@google.comclass sc_port_base; 5212855Sgabeblack@google.com 5312855Sgabeblack@google.comclass sc_spawn_options 5412855Sgabeblack@google.com{ 5512855Sgabeblack@google.com public: 5612855Sgabeblack@google.com sc_spawn_options(); 5712855Sgabeblack@google.com 5812855Sgabeblack@google.com void spawn_method(); 5912855Sgabeblack@google.com void dont_initialize(); 6012855Sgabeblack@google.com void set_stack_size(int); 6112855Sgabeblack@google.com 6212855Sgabeblack@google.com void set_sensitivity(const sc_event *); 6312855Sgabeblack@google.com void set_sensitivity(sc_port_base *); 6412855Sgabeblack@google.com void set_sensitivity(sc_export_base *); 6512855Sgabeblack@google.com void set_sensitivity(sc_interface *); 6612855Sgabeblack@google.com void set_sensitivity(sc_event_finder *); 6712855Sgabeblack@google.com 6812855Sgabeblack@google.com void reset_signal_is(const sc_in<bool> &, bool); 6912855Sgabeblack@google.com void reset_signal_is(const sc_inout<bool> &, bool); 7012855Sgabeblack@google.com void reset_signal_is(const sc_out<bool> &, bool); 7112855Sgabeblack@google.com void reset_signal_is(const sc_signal_in_if<bool> &, bool); 7212855Sgabeblack@google.com 7312855Sgabeblack@google.com void async_reset_signal_is(const sc_in<bool> &, bool); 7412855Sgabeblack@google.com void async_reset_signal_is(const sc_inout<bool> &, bool); 7512855Sgabeblack@google.com void async_reset_signal_is(const sc_out<bool> &, bool); 7612855Sgabeblack@google.com void async_reset_signal_is(const sc_signal_in_if<bool> &, bool); 7712855Sgabeblack@google.com 7812855Sgabeblack@google.com private: 79 // Disabled 80 sc_spawn_options(const sc_spawn_options &) {} 81 sc_spawn_options &operator = (const sc_spawn_options &) { return *this; } 82}; 83 84void sc_spawn_warn_unimpl(const char *func); 85 86template <typename T> 87sc_process_handle 88sc_spawn(T object, const char *name_p=nullptr, 89 const sc_spawn_options *opt_p=nullptr) 90{ 91 sc_spawn_warn_unimpl(__PRETTY_FUNCTION__); 92 return sc_process_handle(); 93} 94 95template <typename T> 96sc_process_handle 97sc_spawn(typename T::result_type *r_p, T object, const char *name_p=nullptr, 98 const sc_spawn_options *opt_p=nullptr) 99{ 100 sc_spawn_warn_unimpl(__PRETTY_FUNCTION__); 101 return sc_process_handle(); 102} 103 104#define sc_bind boost::bind 105#define sc_ref(r) boost::ref(r) 106#define sc_cref(r) boost::cref(r) 107 108#define SC_FORK \ 109{ \ 110 ::sc_core::sc_process_handle forkees[] = { 111 112#define SC_JOIN \ 113 }; /* TODO wait for the forkees. */ \ 114} 115 116// Non-standard 117#define SC_CJOIN SC_JOIN 118 119} // namespace sc_core 120 121namespace sc_unnamed 122{ 123 124typedef int ImplementationDefined; 125extern ImplementationDefined _1; 126extern ImplementationDefined _2; 127extern ImplementationDefined _3; 128extern ImplementationDefined _4; 129extern ImplementationDefined _5; 130extern ImplementationDefined _6; 131extern ImplementationDefined _7; 132extern ImplementationDefined _8; 133extern ImplementationDefined _9; 134 135} // namespace sc_unnamed 136 137#endif //__SYSTEMC_EXT_CORE_SC_SPAWN_HH__ 138