1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright --- 14 unchanged lines hidden (view full) --- 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29 30#include <memory> |
31#include <string> |
32#include <vector> 33 34#include "base/logging.hh" 35#include "systemc/core/kernel.hh" 36#include "systemc/core/module.hh" 37#include "systemc/core/process_types.hh" 38#include "systemc/ext/core/sc_module.hh" 39#include "systemc/ext/core/sc_module_name.hh" |
40#include "systemc/ext/utils/sc_report_handler.hh" |
41 42namespace sc_gem5 43{ 44 45Process * 46newMethodProcess(const char *name, ProcessFuncWrapper *func) 47{ |
48 Method *p = new Method(name, func); 49 if (::sc_core::sc_is_running()) { 50 std::string name = p->name(); 51 delete p; 52 SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 53 "simulation running", name.c_str()); 54 return nullptr; 55 } |
56 scheduler.reg(p); 57 return p; 58} 59 60Process * 61newThreadProcess(const char *name, ProcessFuncWrapper *func) 62{ |
63 Thread *p = new Thread(name, func); 64 if (::sc_core::sc_is_running()) { 65 std::string name = p->name(); 66 delete p; 67 SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 68 "simulation running", name.c_str()); 69 return nullptr; 70 } |
71 scheduler.reg(p); 72 return p; 73} 74 75Process * 76newCThreadProcess(const char *name, ProcessFuncWrapper *func) 77{ |
78 CThread *p = new CThread(name, func); 79 if (::sc_core::sc_is_running()) { 80 std::string name = p->name(); 81 delete p; 82 SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 83 "simulation running", name.c_str()); 84 return nullptr; 85 } |
86 scheduler.reg(p); 87 p->dontInitialize(); 88 return p; 89} 90 91UniqueNameGen nameGen; 92 93} // namespace sc_gem5 --- 636 unchanged lines hidden --- |