sc_process_handle.cc (13087:1df34ed84a4b) sc_process_handle.cc (13128:60311a75e876)
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 "base/logging.hh"
31#include "systemc/core/process.hh"
32#include "systemc/core/scheduler.hh"
33#include "systemc/ext/core/sc_main.hh"
34#include "systemc/ext/core/sc_process_handle.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 "base/logging.hh"
31#include "systemc/core/process.hh"
32#include "systemc/core/scheduler.hh"
33#include "systemc/ext/core/sc_main.hh"
34#include "systemc/ext/core/sc_process_handle.hh"
35#include "systemc/ext/utils/sc_report_handler.hh"
35
36namespace sc_core
37{
38
39const char *
40sc_unwind_exception::what() const throw()
41{
42 return _isReset ? "RESET" : "KILL";

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

191sc_process_handle::terminated() const
192{
193 return _gem5_process ? _gem5_process->terminated() : false;
194}
195
196const sc_event &
197sc_process_handle::terminated_event() const
198{
36
37namespace sc_core
38{
39
40const char *
41sc_unwind_exception::what() const throw()
42{
43 return _isReset ? "RESET" : "KILL";

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

192sc_process_handle::terminated() const
193{
194 return _gem5_process ? _gem5_process->terminated() : false;
195}
196
197const sc_event &
198sc_process_handle::terminated_event() const
199{
199 static sc_event non_event;
200 return _gem5_process ? _gem5_process->terminatedEvent() : non_event;
200 if (!_gem5_process) {
201 SC_REPORT_WARNING("(W570) attempt to use an empty "
202 "process handle ignored", "terminated_event()");
203 static sc_event non_event;
204 return non_event;
205 }
206 return _gem5_process->terminatedEvent();
201}
202
203
204void
205sc_process_handle::suspend(sc_descendent_inclusion_info include_descendants)
206{
207}
208
209
210void
211sc_process_handle::suspend(sc_descendent_inclusion_info include_descendants)
212{
207 if (!_gem5_process)
213 if (!_gem5_process) {
214 SC_REPORT_WARNING("(W570) attempt to use an empty "
215 "process handle ignored", "suspend()");
208 return;
216 return;
217 }
209 _gem5_process->suspend(include_descendants == SC_INCLUDE_DESCENDANTS);
210}
211
212void
213sc_process_handle::resume(sc_descendent_inclusion_info include_descendants)
214{
218 _gem5_process->suspend(include_descendants == SC_INCLUDE_DESCENDANTS);
219}
220
221void
222sc_process_handle::resume(sc_descendent_inclusion_info include_descendants)
223{
215 if (!_gem5_process)
224 if (!_gem5_process) {
225 SC_REPORT_WARNING("(W570) attempt to use an empty "
226 "process handle ignored", "resume()");
216 return;
227 return;
228 }
217 _gem5_process->resume(include_descendants == SC_INCLUDE_DESCENDANTS);
218}
219
220void
221sc_process_handle::disable(sc_descendent_inclusion_info include_descendants)
222{
229 _gem5_process->resume(include_descendants == SC_INCLUDE_DESCENDANTS);
230}
231
232void
233sc_process_handle::disable(sc_descendent_inclusion_info include_descendants)
234{
223 if (!_gem5_process)
235 if (!_gem5_process) {
236 SC_REPORT_WARNING("(W570) attempt to use an empty "
237 "process handle ignored", "disable()");
224 return;
238 return;
239 }
225 _gem5_process->disable(include_descendants == SC_INCLUDE_DESCENDANTS);
226}
227
228void
229sc_process_handle::enable(sc_descendent_inclusion_info include_descendants)
230{
240 _gem5_process->disable(include_descendants == SC_INCLUDE_DESCENDANTS);
241}
242
243void
244sc_process_handle::enable(sc_descendent_inclusion_info include_descendants)
245{
231 if (!_gem5_process)
246 if (!_gem5_process) {
247 SC_REPORT_WARNING("(W570) attempt to use an empty "
248 "process handle ignored", "enable()");
232 return;
249 return;
250 }
233 _gem5_process->enable(include_descendants == SC_INCLUDE_DESCENDANTS);
234}
235
236void
237sc_process_handle::kill(sc_descendent_inclusion_info include_descendants)
238{
251 _gem5_process->enable(include_descendants == SC_INCLUDE_DESCENDANTS);
252}
253
254void
255sc_process_handle::kill(sc_descendent_inclusion_info include_descendants)
256{
239 if (!_gem5_process)
257 if (!_gem5_process) {
258 SC_REPORT_WARNING("(W570) attempt to use an empty "
259 "process handle ignored", "kill()");
240 return;
260 return;
261 }
241 _gem5_process->kill(include_descendants == SC_INCLUDE_DESCENDANTS);
242}
243
244void
245sc_process_handle::reset(sc_descendent_inclusion_info include_descendants)
246{
262 _gem5_process->kill(include_descendants == SC_INCLUDE_DESCENDANTS);
263}
264
265void
266sc_process_handle::reset(sc_descendent_inclusion_info include_descendants)
267{
247 if (!_gem5_process)
268 if (!_gem5_process) {
269 SC_REPORT_WARNING("(W570) attempt to use an empty "
270 "process handle ignored", "reset()");
248 return;
271 return;
272 }
249 _gem5_process->reset(include_descendants == SC_INCLUDE_DESCENDANTS);
250}
251
252bool
253sc_process_handle::is_unwinding()
254{
255 if (!_gem5_process) {
273 _gem5_process->reset(include_descendants == SC_INCLUDE_DESCENDANTS);
274}
275
276bool
277sc_process_handle::is_unwinding()
278{
279 if (!_gem5_process) {
256 //TODO This should generate a systemc style warning if the handle is
257 //invalid.
280 SC_REPORT_WARNING("(W570) attempt to use an empty "
281 "process handle ignored", "is_unwinding()");
258 return false;
282 return false;
259 } else {
260 return _gem5_process->isUnwinding();
261 }
283 }
284 return _gem5_process->isUnwinding();
262}
263
264const sc_event &
265sc_process_handle::reset_event() const
266{
285}
286
287const sc_event &
288sc_process_handle::reset_event() const
289{
267 static sc_event non_event;
268 return _gem5_process ? _gem5_process->resetEvent() : non_event;
290 if (!_gem5_process) {
291 SC_REPORT_WARNING("(W570) attempt to use an empty "
292 "process handle ignored", "reset()");
293 static sc_event non_event;
294 return non_event;
295 }
296 return _gem5_process->resetEvent();
269}
270
271
272void
273sc_process_handle::sync_reset_on(
274 sc_descendent_inclusion_info include_descendants)
275{
297}
298
299
300void
301sc_process_handle::sync_reset_on(
302 sc_descendent_inclusion_info include_descendants)
303{
276 if (!_gem5_process)
304 if (!_gem5_process) {
305 SC_REPORT_WARNING("(W570) attempt to use an empty "
306 "process handle ignored", "sync_reset_on()");
277 return;
307 return;
308 }
278 _gem5_process->syncResetOn(include_descendants == SC_INCLUDE_DESCENDANTS);
279}
280
281void
282sc_process_handle::sync_reset_off(
283 sc_descendent_inclusion_info include_descendants)
284{
309 _gem5_process->syncResetOn(include_descendants == SC_INCLUDE_DESCENDANTS);
310}
311
312void
313sc_process_handle::sync_reset_off(
314 sc_descendent_inclusion_info include_descendants)
315{
285 if (!_gem5_process)
316 if (!_gem5_process) {
317 SC_REPORT_WARNING("(W570) attempt to use an empty "
318 "process handle ignored", "sync_reset_off()");
286 return;
319 return;
320 }
287 _gem5_process->syncResetOff(include_descendants == SC_INCLUDE_DESCENDANTS);
288}
289
290
291sc_process_handle
292sc_get_current_process_handle()
293{
294 if (sc_is_running())

--- 14 unchanged lines hidden ---
321 _gem5_process->syncResetOff(include_descendants == SC_INCLUDE_DESCENDANTS);
322}
323
324
325sc_process_handle
326sc_get_current_process_handle()
327{
328 if (sc_is_running())

--- 14 unchanged lines hidden ---