misc: Clean up and complete the gem5<->SystemC-TLM bridge [3/10]
authorChristian Menard <Christian.Menard@tu-dresden.de>
Fri, 10 Feb 2017 00:15:35 +0000 (19:15 -0500)
committerChristian Menard <Christian.Menard@tu-dresden.de>
Fri, 10 Feb 2017 00:15:35 +0000 (19:15 -0500)
The current TLM bridge only provides a Slave Port that allows the gem5
world to send request to the SystemC world. This patch series refractors
and cleans up the existing code, and adds a Master Port that allows the
SystemC world to send requests to the gem5 world.

This patch:
 * Simplify the Slave Port by using a simple_initiator_socket.

Testing Done: Example applications are still running.

Reviewed at http://reviews.gem5.org/r/3686/

Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
util/tlm/sc_slave_port.cc
util/tlm/sc_slave_port.hh

index cea0f6db61b0f7f9baf46c7df3b6ea32acc8b247..3176de928cfaaeb17e1b6acde54f1ec567565954 100644 (file)
@@ -262,7 +262,7 @@ SCSlavePort::pec(
         /* Did another request arrive while blocked, schedule a retry */
         if (needToSendRequestRetry) {
             needToSendRequestRetry = false;
-           iSocket.sendRetryReq();
+            sendRetryReq();
         }
     }
     else if (phase == tlm::BEGIN_RESP)
@@ -276,7 +276,7 @@ SCSlavePort::pec(
         bool need_retry;
         if (packet->needsResponse()) {
             packet->makeResponse();
-            need_retry = !iSocket.sendTimingResp(packet);
+            need_retry = !sendTimingResp(packet);
         } else {
             need_retry = false;
         }
@@ -311,7 +311,7 @@ SCSlavePort::recvRespRetry()
     blockingResponse = NULL;
     PacketPtr packet = Gem5Extension::getExtension(trans).getPacket();
 
-    bool need_retry = !iSocket.sendTimingResp(packet);
+    bool need_retry = !sendTimingResp(packet);
 
     sc_assert(!need_retry);
 
@@ -333,24 +333,16 @@ SCSlavePort::nb_transport_bw(tlm::tlm_generic_payload& trans,
     return tlm::TLM_ACCEPTED;
 }
 
-void
-SCSlavePort::invalidate_direct_mem_ptr(sc_dt::uint64 start_range,
-     sc_dt::uint64 end_range)
-{
-    SC_REPORT_FATAL("SCSlavePort", "unimpl. func: invalidate_direct_mem_ptr");
-}
-
 SCSlavePort::SCSlavePort(const std::string &name_,
     const std::string &systemc_name,
     ExternalSlave &owner_) :
-    tlm::tlm_initiator_socket<>(systemc_name.c_str()),
     ExternalSlave::Port(name_, owner_),
-    iSocket(*this),
+    iSocket(systemc_name.c_str()),
     blockingRequest(NULL),
     needToSendRequestRetry(false),
     blockingResponse(NULL)
 {
-    m_export.bind(*this);
+    iSocket.register_nb_transport_bw(this, &SCSlavePort::nb_transport_bw);
 }
 
 class SlavePortHandler : public ExternalSlave::Handler
index a42532cad9c5bc30571b8467a163095bebf6937a..9e37ff4bb5797f6c6d45c10d90fe169e38a3a81d 100644 (file)
@@ -67,12 +67,10 @@ namespace Gem5SystemC
  * original packet as a payload extension, the packet can be restored and send
  * back to the gem5 world upon receiving a response from the SystemC world.
  */
-class SCSlavePort : public tlm::tlm_initiator_socket<>,
-        public tlm::tlm_bw_transport_if<>,
-        public ExternalSlave::Port
+class SCSlavePort : public ExternalSlave::Port
 {
   public:
-    SCSlavePort &iSocket;
+    tlm_utils::simple_initiator_socket<SCSlavePort> iSocket;
 
     /** One instance of pe and the related callback needed */
     //payloadEvent<SCSlavePort> pe;
@@ -111,9 +109,6 @@ class SCSlavePort : public tlm::tlm_initiator_socket<>,
                                        tlm::tlm_phase& phase,
                                        sc_core::sc_time& t);
 
-    void invalidate_direct_mem_ptr(sc_dt::uint64 start_range,
-                                   sc_dt::uint64 end_range);
-
   public:
     SCSlavePort(const std::string &name_,
                 const std::string &systemc_name,