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 |
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; |
170 void swap(sc_process_handle &); |
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 |
202 template <typename T> |
203 void 204 throw_it(const T &user_defined_exception, 205 sc_descendent_inclusion_info include_descendants= 206 SC_NO_DESCENDANTS) |
207 { |
208 ::sc_gem5::ExceptionWrapper<T> exc(user_defined_exception); 209 ::sc_gem5::throw_it_wrapper(_gem5_process, exc, 210 include_descendants == SC_INCLUDE_DESCENDANTS); |
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__ |