summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-05-14 21:54:26 -0700
committerGabe Black <gabeblack@google.com>2018-07-24 21:47:15 +0000
commitcd3e7230bee7f557a54bbd908879ce090bc46978 (patch)
tree08ffb4d8513a68fd3dd33f33060b16a08a24f611
parent5872389715a194dd91b17e46b770537415d50e30 (diff)
downloadgem5-cd3e7230bee7f557a54bbd908879ce090bc46978.tar.xz
systemc: Flesh out the sc_port implementation slightly.
This makes other files compile because it changes the relationship between constructors,etc., slightly. Change-Id: I8d9a6e12ec640a82da166fe05c4f5e91f3f608de Reviewed-on: https://gem5-review.googlesource.com/10840 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_port.cc2
-rw-r--r--src/systemc/ext/core/sc_port.hh51
2 files changed, 17 insertions, 36 deletions
diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc
index e1823bcc9..46a295b6e 100644
--- a/src/systemc/core/sc_port.cc
+++ b/src/systemc/core/sc_port.cc
@@ -34,7 +34,7 @@ namespace sc_core
{
void
-sc_port_base::warn_unimpl(const char *func)
+sc_port_base::warn_unimpl(const char *func) const
{
warn("%s not implemented.\n", func);
}
diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh
index 1d32422a5..b2f9bd8bb 100644
--- a/src/systemc/ext/core/sc_port.hh
+++ b/src/systemc/ext/core/sc_port.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_CORE_SC_PORT_HH__
#define __SYSTEMC_EXT_CORE_SC_PORT_HH__
+#include "sc_module.hh" // for sc_gen_unique_name
#include "sc_object.hh"
namespace sc_core
@@ -47,7 +48,10 @@ enum sc_port_policy
class sc_port_base : public sc_object
{
public:
- void warn_unimpl(const char *func);
+ sc_port_base(const char *name, int n, sc_port_policy p) : sc_object(name)
+ {}
+
+ void warn_unimpl(const char *func) const;
};
template <class IF>
@@ -133,20 +137,13 @@ class sc_port_b : public sc_port_base
virtual void start_of_elaboration() {}
virtual void end_of_simulation() {}
- explicit sc_port_b(int, sc_port_policy)
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
-
- sc_port_b(const char *, int, sc_port_policy)
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
-
- virtual ~sc_port_b()
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
+ explicit sc_port_b(int n, sc_port_policy p) :
+ sc_port_base(sc_gen_unique_name("sc_port"), n, p)
+ {}
+ sc_port_b(const char *name, int n, sc_port_policy p) :
+ sc_port_base(name, n, p)
+ {}
+ virtual ~sc_port_b() {}
private:
// Disabled
@@ -159,27 +156,11 @@ template <class IF, int N=1, sc_port_policy P=SC_ONE_OR_MORE_BOUND>
class sc_port : public sc_port_b<IF>
{
public:
- sc_port()
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
+ sc_port() : sc_port_b<IF>(sc_gen_unique_name("sc_port"), N, P) {}
+ explicit sc_port(const char *name) : sc_port_b<IF>(name, N, P) {}
+ virtual ~sc_port() {}
- explicit sc_port(const char *)
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
-
- virtual ~sc_port()
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- }
-
- virtual const char *
- kind() const
- {
- warn_unimpl(__PRETTY_FUNCTION__);
- return "";
- }
+ virtual const char *kind() const { return "sc_port"; }
private:
// Disabled