systemc: Make TLM port wrappers for tlm_base_(target|initiator)_socket.

These are useful if using TLM sockets without using the standard TLM
protocol. For instance, when used with ARM's fast models, this can wrap
sockets which carry the opaque GICv3Comms protocol.

Change-Id: I329a919068f958abbde2cb83683d3a3ae2e05a20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20860
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/systemc/tlm_port_wrapper.hh b/src/systemc/tlm_port_wrapper.hh
index 59f8d9f..1e46c5d 100644
--- a/src/systemc/tlm_port_wrapper.hh
+++ b/src/systemc/tlm_port_wrapper.hh
@@ -37,31 +37,27 @@
 namespace sc_gem5
 {
 
-template <unsigned int BUSWIDTH=32,
-          typename TYPES=tlm::tlm_base_protocol_types, int N=1,
-          sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND>
-class TlmInitiatorWrapper;
-
-template <unsigned int BUSWIDTH=32,
-          typename TYPES=tlm::tlm_base_protocol_types, int N=1,
-          sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND>
-class TlmTargetWrapper;
-
-template <unsigned int BUSWIDTH, typename TYPES, int N,
+template <unsigned int BUSWIDTH, typename FW_IF, typename BW_IF, int N,
           sc_core::sc_port_policy POL>
-class TlmInitiatorWrapper : public ::Port
+class TlmInitiatorBaseWrapper;
+
+template <unsigned int BUSWIDTH, typename FW_IF, typename BW_IF, int N,
+          sc_core::sc_port_policy POL>
+class TlmTargetBaseWrapper;
+
+template <unsigned int BUSWIDTH, typename FW_IF, typename BW_IF, int N,
+          sc_core::sc_port_policy POL>
+class TlmInitiatorBaseWrapper : public ::Port
 {
   public:
-    typedef tlm::tlm_base_initiator_socket<BUSWIDTH,
-            tlm::tlm_fw_transport_if<TYPES>,
-            tlm::tlm_bw_transport_if<TYPES>, N, POL>
+    typedef tlm::tlm_base_initiator_socket<BUSWIDTH, FW_IF, BW_IF, N, POL>
         InitiatorSocket;
     typedef typename InitiatorSocket::base_target_socket_type TargetSocket;
-    typedef TlmTargetWrapper<BUSWIDTH, TYPES, N, POL> TargetWrapper;
+    typedef TlmTargetBaseWrapper<BUSWIDTH, FW_IF, BW_IF, N, POL> TargetWrapper;
 
     InitiatorSocket &initiator() { return _initiator; }
 
-    TlmInitiatorWrapper(
+    TlmInitiatorBaseWrapper(
             InitiatorSocket &i, const std::string &_name, PortID _id) :
         Port(_name, _id), _initiator(i)
     {}
@@ -87,19 +83,18 @@
     InitiatorSocket &_initiator;
 };
 
-template <unsigned int BUSWIDTH, typename TYPES, int N,
+template <unsigned int BUSWIDTH, typename FW_IF, typename BW_IF, int N,
           sc_core::sc_port_policy POL>
-class TlmTargetWrapper : public ::Port
+class TlmTargetBaseWrapper : public ::Port
 {
   public:
-    typedef tlm::tlm_base_target_socket<BUSWIDTH,
-            tlm::tlm_fw_transport_if<TYPES>,
-            tlm::tlm_bw_transport_if<TYPES>, N, POL>
+    typedef tlm::tlm_base_target_socket<BUSWIDTH, FW_IF, BW_IF, N, POL>
         TargetSocket;
 
     TargetSocket &target() { return _target; }
 
-    TlmTargetWrapper(TargetSocket &t, const std::string &_name, PortID _id) :
+    TlmTargetBaseWrapper(TargetSocket &t, const std::string &_name,
+                         PortID _id) :
         Port(_name, _id), _target(t)
     {}
 
@@ -121,6 +116,20 @@
     TargetSocket &_target;
 };
 
+template <unsigned int BUSWIDTH=32,
+          typename TYPES=tlm::tlm_base_protocol_types, int N=1,
+          sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND>
+using TlmInitiatorWrapper =
+    TlmInitiatorBaseWrapper<BUSWIDTH, tlm::tlm_fw_transport_if<TYPES>,
+                            tlm::tlm_bw_transport_if<TYPES>, N, POL>;
+
+template <unsigned int BUSWIDTH=32,
+          typename TYPES=tlm::tlm_base_protocol_types, int N=1,
+          sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND>
+using TlmTargetWrapper =
+    TlmTargetBaseWrapper<BUSWIDTH, tlm::tlm_fw_transport_if<TYPES>,
+                         tlm::tlm_bw_transport_if<TYPES>, N, POL>;
+
 } // namespace sc_gem5
 
 #endif  //__SYSTEMC_TLM_PORT_WRAPPER_HH__