process.cc (13093:bea17ab221ef) process.cc (13102:f9a4fa519bb3)
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

--- 18 unchanged lines hidden (view full) ---

27 * Authors: Gabe Black
28 */
29
30#include "systemc/core/process.hh"
31
32#include "base/logging.hh"
33#include "systemc/core/event.hh"
34#include "systemc/core/scheduler.hh"
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

--- 18 unchanged lines hidden (view full) ---

27 * Authors: Gabe Black
28 */
29
30#include "systemc/core/process.hh"
31
32#include "base/logging.hh"
33#include "systemc/core/event.hh"
34#include "systemc/core/scheduler.hh"
35#include "systemc/ext/core/sc_main.hh"
35#include "systemc/ext/core/sc_process_handle.hh"
36#include "systemc/ext/utils/sc_report_handler.hh"
37
38namespace sc_gem5
39{
40
41SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) :
42 Sensitivity(p), timeoutEvent([this]() { this->timeout(); })

--- 164 unchanged lines hidden (view full) ---

207 forEachKid([](Process *p) { p->enable(true); });
208
209 _disabled = false;
210}
211
212void
213Process::kill(bool inc_kids)
214{
36#include "systemc/ext/core/sc_process_handle.hh"
37#include "systemc/ext/utils/sc_report_handler.hh"
38
39namespace sc_gem5
40{
41
42SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) :
43 Sensitivity(p), timeoutEvent([this]() { this->timeout(); })

--- 164 unchanged lines hidden (view full) ---

208 forEachKid([](Process *p) { p->enable(true); });
209
210 _disabled = false;
211}
212
213void
214Process::kill(bool inc_kids)
215{
216 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
217 SC_REPORT_ERROR(
218 "(E572) a process may not be killed before it is initialized",
219 name());
220 }
221
215 // Propogate the kill to our children no matter what happens to us.
216 if (inc_kids)
217 forEachKid([](Process *p) { p->kill(true); });
218
219 // If we're in the middle of unwinding, ignore the kill request.
220 if (_isUnwinding)
221 return;
222

--- 7 unchanged lines hidden (view full) ---

230 // Inject the kill exception into this process if it's started.
231 if (!_needsStart)
232 injectException(killException);
233}
234
235void
236Process::reset(bool inc_kids)
237{
222 // Propogate the kill to our children no matter what happens to us.
223 if (inc_kids)
224 forEachKid([](Process *p) { p->kill(true); });
225
226 // If we're in the middle of unwinding, ignore the kill request.
227 if (_isUnwinding)
228 return;
229

--- 7 unchanged lines hidden (view full) ---

237 // Inject the kill exception into this process if it's started.
238 if (!_needsStart)
239 injectException(killException);
240}
241
242void
243Process::reset(bool inc_kids)
244{
245 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
246 SC_REPORT_ERROR(
247 "(E573) a process may not be asynchronously reset while"
248 "the simulation is not running", name());
249 }
250
238 // Propogate the reset to our children no matter what happens to us.
239 if (inc_kids)
240 forEachKid([](Process *p) { p->reset(true); });
241
242 // If we're in the middle of unwinding, ignore the reset request.
243 if (_isUnwinding)
244 return;
245

--- 6 unchanged lines hidden (view full) ---

252 }
253
254 _resetEvent.notify();
255}
256
257void
258Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
259{
251 // Propogate the reset to our children no matter what happens to us.
252 if (inc_kids)
253 forEachKid([](Process *p) { p->reset(true); });
254
255 // If we're in the middle of unwinding, ignore the reset request.
256 if (_isUnwinding)
257 return;
258

--- 6 unchanged lines hidden (view full) ---

265 }
266
267 _resetEvent.notify();
268}
269
270void
271Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
272{
273 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
274 SC_REPORT_ERROR(
275 "(E574) throw_it not allowed unless simulation is running ",
276 name());
277 }
278
260 if (inc_kids)
261 forEachKid([&exc](Process *p) { p->throw_it(exc, true); });
262
263 // Only inject an exception into threads that have started.
264 if (!_needsStart)
265 injectException(exc);
266}
267

--- 141 unchanged lines hidden ---
279 if (inc_kids)
280 forEachKid([&exc](Process *p) { p->throw_it(exc, true); });
281
282 // Only inject an exception into threads that have started.
283 if (!_needsStart)
284 injectException(exc);
285}
286

--- 141 unchanged lines hidden ---