From: Gabe Black Date: Tue, 17 Jul 2018 03:23:21 +0000 (-0700) Subject: systemc: Implement sc_get_current_process_handle's other personality. X-Git-Tag: v19.0.0.0~1859 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=746c1eaa72dbce46899459f988336485190897c2;p=gem5.git systemc: Implement sc_get_current_process_handle's other personality. When run during simulation, sc_get_current_process_handle returns a handle for the currently running process or a invalid handle if no process is running (ie sc_main is running). When run during elaboration, it returns a handle to the most recently created process. This second context is what this change handles. Change-Id: I3fb247b9b7bf83891c782966cfef474753159158 Reviewed-on: https://gem5-review.googlesource.com/12030 Reviewed-by: Gabe Black Maintainer: Gabe Black --- diff --git a/src/systemc/core/sc_process_handle.cc b/src/systemc/core/sc_process_handle.cc index c4014b747..e0f6a8186 100644 --- a/src/systemc/core/sc_process_handle.cc +++ b/src/systemc/core/sc_process_handle.cc @@ -30,6 +30,7 @@ #include "base/logging.hh" #include "systemc/core/process.hh" #include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_main.hh" #include "systemc/ext/core/sc_process_handle.hh" namespace sc_core @@ -292,7 +293,10 @@ sc_process_handle::sync_reset_off( sc_process_handle sc_get_current_process_handle() { - return sc_process_handle(::sc_gem5::scheduler.current()); + if (sc_is_running()) + return sc_process_handle(::sc_gem5::scheduler.current()); + else + return sc_process_handle(::sc_gem5::Process::newest()); } bool