From: Gabe Black Date: Fri, 13 Sep 2019 22:02:53 +0000 (-0700) Subject: systemc: Make TLM port wrappers for tlm_base_(target|initiator)_socket. X-Git-Tag: v19.0.0.0~543 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd00a363f1dbb8eaf634154c6d5db9ad85278ee0;p=gem5.git 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 Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/systemc/tlm_port_wrapper.hh b/src/systemc/tlm_port_wrapper.hh index 59f8d9fe0..1e46c5d82 100644 --- a/src/systemc/tlm_port_wrapper.hh +++ b/src/systemc/tlm_port_wrapper.hh @@ -37,31 +37,27 @@ namespace sc_gem5 { -template -class TlmInitiatorWrapper; +template +class TlmInitiatorBaseWrapper; -template -class TlmTargetWrapper; +template +class TlmTargetBaseWrapper; -template -class TlmInitiatorWrapper : public ::Port +class TlmInitiatorBaseWrapper : public ::Port { public: - typedef tlm::tlm_base_initiator_socket, - tlm::tlm_bw_transport_if, N, POL> + typedef tlm::tlm_base_initiator_socket InitiatorSocket; typedef typename InitiatorSocket::base_target_socket_type TargetSocket; - typedef TlmTargetWrapper TargetWrapper; + typedef TlmTargetBaseWrapper TargetWrapper; InitiatorSocket &initiator() { return _initiator; } - TlmInitiatorWrapper( + TlmInitiatorBaseWrapper( InitiatorSocket &i, const std::string &_name, PortID _id) : Port(_name, _id), _initiator(i) {} @@ -87,19 +83,18 @@ class TlmInitiatorWrapper : public ::Port InitiatorSocket &_initiator; }; -template -class TlmTargetWrapper : public ::Port +class TlmTargetBaseWrapper : public ::Port { public: - typedef tlm::tlm_base_target_socket, - tlm::tlm_bw_transport_if, N, POL> + typedef tlm::tlm_base_target_socket 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 @@ class TlmTargetWrapper : public ::Port TargetSocket &_target; }; +template +using TlmInitiatorWrapper = + TlmInitiatorBaseWrapper, + tlm::tlm_bw_transport_if, N, POL>; + +template +using TlmTargetWrapper = + TlmTargetBaseWrapper, + tlm::tlm_bw_transport_if, N, POL>; + } // namespace sc_gem5 #endif //__SYSTEMC_TLM_PORT_WRAPPER_HH__