From 2a566b4fa7fbd805746d598d0ffc096c2710cef9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 16 Aug 2019 15:27:35 -0700 Subject: mem, sim, systemc: Reorganize Port and co.s bind, unbind slightly. The base Port class can keep track of its peer, and also whether it's connected. This is partially delegated away from the port subclasses which still keep track of a cast version of their peer pointer for their own conveneince, so that it can be used by generic code. Even with the Port mechanism's new flexibility, each port still has exactly one peer and is either connected or not based on whether there is a peer currently. Change-Id: Id3228617dd1604d196814254a1aadeac5ade7cde Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20232 Tested-by: kokoro Reviewed-by: Nikos Nikoleris Reviewed-by: Andreas Sandberg Maintainer: Gabe Black --- src/systemc/sc_port_wrapper.hh | 3 +++ src/systemc/tlm_port_wrapper.hh | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src/systemc') diff --git a/src/systemc/sc_port_wrapper.hh b/src/systemc/sc_port_wrapper.hh index b6f6f8504..9f7d80de8 100644 --- a/src/systemc/sc_port_wrapper.hh +++ b/src/systemc/sc_port_wrapper.hh @@ -85,6 +85,7 @@ class ScPortWrapper : public ::Port fatal("Attempt to bind sc_port %s to incompatible port %s.", name(), peer.name()); } + Port::bind(peer); } private: @@ -123,6 +124,7 @@ class ScInterfaceWrapper : public ::Port // Don't bind to peer otherwise we may have error messages saying that // this interface has already be bound since the peer may already did // that. Just let sc_port or sc_export do the binding + Port::bind(peer); } private: @@ -160,6 +162,7 @@ class ScExportWrapper : public ::Port name(), peer.name()); port_.bind(iface->interface()); + Port::bind(peer); } private: diff --git a/src/systemc/tlm_port_wrapper.hh b/src/systemc/tlm_port_wrapper.hh index 0553a18ef..59f8d9fe0 100644 --- a/src/systemc/tlm_port_wrapper.hh +++ b/src/systemc/tlm_port_wrapper.hh @@ -74,6 +74,7 @@ class TlmInitiatorWrapper : public ::Port "incompatible port %s.", name(), peer.name()); initiator().bind(target->target()); + Port::bind(peer); } void @@ -107,6 +108,7 @@ class TlmTargetWrapper : public ::Port { // Ignore attempts to bind a target socket. The initiator will // handle it. + Port::bind(peer); } void -- cgit v1.2.3