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 <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2019-03-12 00:33:52 -07:00
parent d3d24835bc
commit dee6fe7b6a
3 changed files with 20 additions and 1 deletions

View File

@@ -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 @@ class SystemC_ScModule(SystemC_ScObject):
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:

View File

@@ -31,6 +31,7 @@
#include <string>
#include <vector>
#include "base/logging.hh"
#include "systemc/core/event.hh"
#include "systemc/core/kernel.hh"
#include "systemc/core/module.hh"
@@ -114,6 +115,12 @@ sc_bind_proxy::sc_bind_proxy(sc_port_base &_port) :
const sc_bind_proxy SC_BIND_PROXY_NIL;
::Port &
sc_module::gem5_getPort(const std::string &if_name, int idx)
{
fatal("%s does not have any port named %s\n", name(), if_name);
}
sc_module::~sc_module() { delete _gem5_module; }
void

View File

@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_CORE_EXT_SC_MODULE_HH__
#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__
#include <string>
#include <vector>
#include "sc_object.hh"
@@ -58,6 +59,9 @@ Process *newCThreadProcess(const char *name, ProcessFuncWrapper *func);
} // namespace sc_gem5
// Gem5 prototype
class Port;
namespace sc_core
{
@@ -94,6 +98,10 @@ extern const sc_bind_proxy SC_BIND_PROXY_NIL;
class sc_module : public sc_object
{
public:
// Gem5 specific extensions
virtual ::Port &gem5_getPort(const std::string &if_name, int idx=-1);
public:
friend class ::sc_gem5::Kernel;
friend class ::sc_gem5::Module;