summaryrefslogtreecommitdiff
path: root/util/tlm/sc_slave_port.cc
diff options
context:
space:
mode:
authorChristian Menard <Christian.Menard@tu-dresden.de>2017-02-09 19:15:48 -0500
committerChristian Menard <Christian.Menard@tu-dresden.de>2017-02-09 19:15:48 -0500
commit78e4967b6a98e0819e83f000d3a4de8766802bae (patch)
tree5f067c7145695d783b5637fa26359e432c07aa64 /util/tlm/sc_slave_port.cc
parent0c4a69bcbf851e3ece8fae5b1159540206036ee8 (diff)
downloadgem5-78e4967b6a98e0819e83f000d3a4de8766802bae.tar.xz
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 <jason@lowepower.com>
Diffstat (limited to 'util/tlm/sc_slave_port.cc')
-rw-r--r--util/tlm/sc_slave_port.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/util/tlm/sc_slave_port.cc b/util/tlm/sc_slave_port.cc
index 8c6b051e9..dcf7c5d95 100644
--- a/util/tlm/sc_slave_port.cc
+++ b/util/tlm/sc_slave_port.cc
@@ -214,9 +214,34 @@ SCSlavePort::recvTimingReq(PacketPtr packet)
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);