sc_process_handle.hh (12939:5256de693153) | sc_process_handle.hh (12952:94fca7e8120b) |
---|---|
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 --- 24 unchanged lines hidden (view full) --- 33#include <exception> 34#include <vector> 35 36namespace sc_gem5 37{ 38 39class Process; 40 | 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 --- 24 unchanged lines hidden (view full) --- 33#include <exception> 34#include <vector> 35 36namespace sc_gem5 37{ 38 39class Process; 40 |
41struct ProcessFuncWrapper 42{ 43 virtual void call() = 0; 44 virtual ~ProcessFuncWrapper() {} 45}; 46 47template <typename T> 48struct ProcessMemberFuncWrapper : public ProcessFuncWrapper 49{ 50 typedef void (T::*TFunc)(); 51 T *t; 52 TFunc func; 53 54 ProcessMemberFuncWrapper(T *t, TFunc func) : t(t), func(func) {} 55 56 void call() override { (t->*func)(); } 57}; 58 59struct ExceptionWrapperBase 60{ 61 virtual void throw_it() = 0; 62}; 63 64template <typename T> 65struct ExceptionWrapper : public ExceptionWrapperBase 66{ 67 const T &t; 68 ExceptionWrapper(const T &t) : t(t) {} 69 70 void throw_it() { throw t; } 71}; 72 73void throw_it_wrapper(Process *p, ExceptionWrapperBase &exc, bool inc_kids); 74 |
|
41} // namespace sc_gem5 42 43namespace sc_core 44{ 45 46class sc_event; 47class sc_object; 48 --- 79 unchanged lines hidden (view full) --- 128 } 129 130 bool valid() const; 131 132 sc_process_handle &operator = (const sc_process_handle &); 133 bool operator == (const sc_process_handle &) const; 134 bool operator != (const sc_process_handle &) const; 135 bool operator < (const sc_process_handle &) const; | 75} // namespace sc_gem5 76 77namespace sc_core 78{ 79 80class sc_event; 81class sc_object; 82 --- 79 unchanged lines hidden (view full) --- 162 } 163 164 bool valid() const; 165 166 sc_process_handle &operator = (const sc_process_handle &); 167 bool operator == (const sc_process_handle &) const; 168 bool operator != (const sc_process_handle &) const; 169 bool operator < (const sc_process_handle &) const; |
136 bool swap(sc_process_handle &); | 170 void swap(sc_process_handle &); |
137 138 const char *name() const; 139 sc_curr_proc_kind proc_kind() const; 140 const std::vector<sc_object *> &get_child_objects() const; 141 const std::vector<sc_event *> &get_child_events() const; 142 sc_object *get_parent_object() const; 143 sc_object *get_process_object() const; 144 bool dynamic() const; --- 15 unchanged lines hidden (view full) --- 160 bool is_unwinding(); 161 const sc_event &reset_event() const; 162 163 void sync_reset_on(sc_descendent_inclusion_info include_descendants= 164 SC_NO_DESCENDANTS); 165 void sync_reset_off(sc_descendent_inclusion_info include_descendants= 166 SC_NO_DESCENDANTS); 167 | 171 172 const char *name() const; 173 sc_curr_proc_kind proc_kind() const; 174 const std::vector<sc_object *> &get_child_objects() const; 175 const std::vector<sc_event *> &get_child_events() const; 176 sc_object *get_parent_object() const; 177 sc_object *get_process_object() const; 178 bool dynamic() const; --- 15 unchanged lines hidden (view full) --- 194 bool is_unwinding(); 195 const sc_event &reset_event() const; 196 197 void sync_reset_on(sc_descendent_inclusion_info include_descendants= 198 SC_NO_DESCENDANTS); 199 void sync_reset_off(sc_descendent_inclusion_info include_descendants= 200 SC_NO_DESCENDANTS); 201 |
168 void warn_unimpl(const char *func); | |
169 template <typename T> | 202 template <typename T> |
170 void throw_it(const T &user_defined_exception, 171 sc_descendent_inclusion_info include_descendants= 172 SC_NO_DESCENDANTS) | 203 void 204 throw_it(const T &user_defined_exception, 205 sc_descendent_inclusion_info include_descendants= 206 SC_NO_DESCENDANTS) |
173 { | 207 { |
174 warn_unimpl(__PRETTY_FUNCTION__); | 208 ::sc_gem5::ExceptionWrapper<T> exc(user_defined_exception); 209 ::sc_gem5::throw_it_wrapper(_gem5_process, exc, 210 include_descendants == SC_INCLUDE_DESCENDANTS); |
175 } 176}; 177 178sc_process_handle sc_get_current_process_handle(); 179bool sc_is_unwinding(); 180 181// Nonstandard 182// See Accellera's kernel/sim_context.cpp for an explanation of what this is 183// supposed to do. It essentially selects what happens during certain 184// undefined situations. 185extern bool sc_allow_process_control_corners; 186 187} // namespace sc_core 188 189#endif //__SYSTEMC_EXT_CORE_SC_PROCESS_HANDLE_HH__ | 211 } 212}; 213 214sc_process_handle sc_get_current_process_handle(); 215bool sc_is_unwinding(); 216 217// Nonstandard 218// See Accellera's kernel/sim_context.cpp for an explanation of what this is 219// supposed to do. It essentially selects what happens during certain 220// undefined situations. 221extern bool sc_allow_process_control_corners; 222 223} // namespace sc_core 224 225#endif //__SYSTEMC_EXT_CORE_SC_PROCESS_HANDLE_HH__ |