Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/12030 )
Change subject: systemc: Implement sc_get_current_process_handle's other
personality.
......................................................................
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 <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/sc_process_handle.cc
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
diff --git a/src/systemc/core/sc_process_handle.cc
b/src/systemc/core/sc_process_handle.cc
index c4014b7..e0f6a81 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
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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12030
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I3fb247b9b7bf83891c782966cfef474753159158
Gerrit-Change-Number: 12030
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev