changeset 2a5b4e334f7d in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=2a5b4e334f7d
description:
        misc: Clean up and complete the gem5<->SystemC-TLM bridge [9/10]

        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:
          * Pay for the header delay that the gem5 XBar annotates to packets.

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

        Signed-off-by: Jason Lowe-Power <[email protected]>

diffstat:

 util/tlm/sc_master_port.cc |  12 +++++++++---
 util/tlm/sc_slave_port.cc  |  27 ++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r 9487cdff1bc3 -r 2a5b4e334f7d util/tlm/sc_master_port.cc
--- a/util/tlm/sc_master_port.cc        Thu Feb 09 19:15:46 2017 -0500
+++ b/util/tlm/sc_master_port.cc        Thu Feb 09 19:15:48 2017 -0500
@@ -329,9 +329,15 @@
 
     sc_assert(pkt->isResponse());
 
-    // pay for annotaded transport delays
-    auto delay =
-      sc_core::sc_time::from_value(pkt->payloadDelay + pkt->headerDelay);
+    /*
+     * Pay for annotated transport delays.
+     *
+     * See recvTimingReq in sc_slave_port.cc for a detailed description.
+     */
+    auto delay = sc_core::sc_time::from_value(pkt->payloadDelay);
+    // reset the delays
+    pkt->payloadDelay = 0;
+    pkt->headerDelay = 0;
 
     auto tlmSenderState = dynamic_cast<TlmSenderState*>(pkt->popSenderState());
     sc_assert(tlmSenderState != nullptr);
diff -r 9487cdff1bc3 -r 2a5b4e334f7d util/tlm/sc_slave_port.cc
--- a/util/tlm/sc_slave_port.cc Thu Feb 09 19:15:46 2017 -0500
+++ b/util/tlm/sc_slave_port.cc Thu Feb 09 19:15:48 2017 -0500
@@ -214,9 +214,34 @@
     Gem5Extension* extension = new Gem5Extension(packet);
     trans->set_auto_extension(extension);
 
+    /*
+     * Pay for annotated transport delays.
+     *
+     * The header delay marks the point in time, when the packet first is seen
+     * by the transactor. This is the point int time, when the transactor needs
+     * to send the BEGIN_REQ to the SystemC world.
+     *
+     * NOTE: We drop the payload delay here. Normally, the receiver would be
+     *       responsible for handling the payload delay. In this case, however,
+     *       the receiver is a SystemC module and has no notion of the gem5
+     *       transport protocol and we cannot simply forward the
+     *       payload delay to the receiving module. Instead, we expect the
+     *       receiving SystemC module to model the payload delay by deferring
+     *       the END_REQ. This could lead to incorrect delays, if the XBar
+     *       payload delay is longer than the time the receiver needs to accept
+     *       the request (time between BEGIN_REQ and END_REQ).
+     *
+     * TODO: We could detect the case described above by remembering the
+     *       payload delay and comparing it to the time between BEGIN_REQ and
+     *       END_REQ. Then, a warning should be printed.
+     */
+    auto delay = sc_core::sc_time::from_value(packet->payloadDelay);
+    // reset the delays
+    packet->payloadDelay = 0;
+    packet->headerDelay = 0;
+
     /* Starting TLM non-blocking sequence (AT) Refer to IEEE1666-2011 SystemC
      * Standard Page 507 for a visualisation of the procedure */
-    sc_core::sc_time delay = sc_core::SC_ZERO_TIME;
     tlm::tlm_phase phase = tlm::BEGIN_REQ;
     tlm::tlm_sync_enum status;
     status = transactor->socket->nb_transport_fw(*trans, phase, delay);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to