summaryrefslogtreecommitdiff
path: root/src/systemc/core/SystemC.py
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-07 03:51:18 -0700
committerGabe Black <gabeblack@google.com>2018-09-20 01:40:14 +0000
commit33e3365bf9876b09362897a3ad9941090e3aca9c (patch)
treef8e7848aef052da1366996b8a160f9ed13c32d15 /src/systemc/core/SystemC.py
parent049f7b8399a2721fea64274d89d44a8c3a54346b (diff)
downloadgem5-33e3365bf9876b09362897a3ad9941090e3aca9c.tar.xz
systemc: Generalize working with the systemc python module from C++.
This change pulls the systemc python module creation code out of sc_main and puts it into a more general purpose python.hh and python.cc which can be used by other code to add other entries into that module without having to track that in a central place. This change also adds a mechanism for notifying C++ code that the embedded python interpretter is up and ready to interact with in case it needs to call some python only functionality. An example of that is the code which tracks and then fixes the timescale for the simulator. Change-Id: I9afcd5a089b21d23ebc1b5fdb6f643ae2f7e5f11 Reviewed-on: https://gem5-review.googlesource.com/12069 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/SystemC.py')
-rw-r--r--src/systemc/core/SystemC.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/systemc/core/SystemC.py b/src/systemc/core/SystemC.py
index dff72e2ce..13ef4eb98 100644
--- a/src/systemc/core/SystemC.py
+++ b/src/systemc/core/SystemC.py
@@ -61,3 +61,11 @@ class SystemC_ScObject(SimObject):
locals().update({
method.name: (lambda *a, **k: None) for method in SimObject.cxx_exports
})
+
+try:
+ import _m5
+except:
+ pass
+else:
+ import _m5.systemc
+ _m5.systemc.python_ready()