Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/17229 )
Change subject: systemc: Hook up gem5_getPort to the gem5 getPort mechanism.
..
systemc: Hook up gem5_getPort to the gem5 getPort mechanism.
Change-Id: I771607c4436f4c1ca9d355d1da52924308cfc3b3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17229
Reviewed-by: Andreas Sandberg
Maintainer: Gabe Black
---
M src/systemc/core/SystemC.py
M src/systemc/core/sc_module.cc
M src/systemc/ext/core/sc_module.hh
3 files changed, 20 insertions(+), 1 deletion(-)
Approvals:
Andreas Sandberg: Looks good to me, approved
Gabe Black: Looks good to me, approved
diff --git a/src/systemc/core/SystemC.py b/src/systemc/core/SystemC.py
index 649d6d3..74b7cec 100644
--- a/src/systemc/core/SystemC.py
+++ b/src/systemc/core/SystemC.py
@@ -25,7 +25,7 @@
#
# Authors: Gabe Black
-from m5.SimObject import SimObject
+from m5.SimObject import SimObject, cxxMethod
# This class represents the systemc kernel. There should be exactly one in
the
# simulation. It receives gem5 SimObject lifecycle callbacks (init,
regStats,
@@ -62,6 +62,10 @@
cxx_class = 'sc_core::sc_module'
cxx_header = 'systemc/ext/core/sc_module.hh'
+@cxxMethod(return_value_policy="reference", cxx_name="gem5_getPort")
+def getPort(self, if_name, iex):
+return None
+
try:
import _m5
except:
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index fc98aa3..ba9c76a 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -31,6 +31,7 @@
#include
#include
+#include "base/logging.hh"
#include "systemc/core/event.hh"
#include "systemc/core/kernel.hh"
#include "systemc/core/module.hh"
@@ -114,6 +115,12 @@
const sc_bind_proxy SC_BIND_PROXY_NIL;
+::Port &
+sc_module::gem5_getPort(const std::string _name, int idx)
+{
+fatal("%s does not have any port named %s\n", name(), if_name);
+}
+
sc_module::~sc_module() { delete _gem5_module; }
void
diff --git a/src/systemc/ext/core/sc_module.hh
b/src/systemc/ext/core/sc_module.hh
index 0c8bd9f..24a1aea 100644
--- a/src/systemc/ext/core/sc_module.hh
+++ b/src/systemc/ext/core/sc_module.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_CORE_EXT_SC_MODULE_HH__
#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__
+#include
#include
#include "sc_object.hh"
@@ -58,6 +59,9 @@
} // namespace sc_gem5
+// Gem5 prototype
+class Port;
+
namespace sc_core
{
@@ -95,6 +99,10 @@
class sc_module : public sc_object
{
public:
+// Gem5 specific extensions
+virtual ::Port _getPort(const std::string _name, int idx=-1);
+
+ public:
friend class ::sc_gem5::Kernel;
friend class ::sc_gem5::Module;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17229
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: I771607c4436f4c1ca9d355d1da52924308cfc3b3
Gerrit-Change-Number: 17229
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black
Gerrit-Reviewer: Andreas Sandberg
Gerrit-Reviewer: Gabe Black
Gerrit-Reviewer: Giacomo Travaglini
Gerrit-Reviewer: Jason Lowe-Power
Gerrit-Reviewer: Matthias Jung
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev