Earl Ou has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/37375 )

Change subject: systemc: remove pipe through flag in TLM extension
......................................................................

systemc: remove pipe through flag in TLM extension

Pipe through flag should be equal to weather we have the extension
in TLM payload or not. However, in the current implementation the
two are different and cause issues when we have gem5 - SystemC
connection.

Change-Id: I2c318777d91dca446c1a700d9f7cff356d29ae6d
---
M src/systemc/tlm_bridge/gem5_to_tlm.cc
M src/systemc/tlm_bridge/sc_ext.cc
M src/systemc/tlm_bridge/sc_ext.hh
M src/systemc/tlm_bridge/tlm_to_gem5.cc
M util/tlm/src/sc_ext.cc
M util/tlm/src/sc_ext.hh
M util/tlm/src/sc_master_port.cc
M util/tlm/src/sc_slave_port.cc
8 files changed, 7 insertions(+), 44 deletions(-)



diff --git a/src/systemc/tlm_bridge/gem5_to_tlm.cc b/src/systemc/tlm_bridge/gem5_to_tlm.cc
index ba8f121..d2eb5e6 100644
--- a/src/systemc/tlm_bridge/gem5_to_tlm.cc
+++ b/src/systemc/tlm_bridge/gem5_to_tlm.cc
@@ -139,18 +139,10 @@

         bool need_retry = false;

-        /*
- * If the packet was piped through and needs a response, we don't need
-         * to touch the packet and can forward it directly as a response.
-         * Otherwise, we need to make a response and send the transformed
-         * packet.
-         */
-        if (extension.isPipeThrough()) {
-            if (packet->isResponse()) {
-                need_retry = !bridgeResponsePort.sendTimingResp(packet);
-            }
-        } else if (packet->needsResponse()) {
+        if (packet->needsResponse()) {
             packet->makeResponse();
+        }
+        if (packet->isResponse()) {
             need_retry = !bridgeResponsePort.sendTimingResp(packet);
         }

diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc
index ea188c4..194ecbc 100644
--- a/src/systemc/tlm_bridge/sc_ext.cc
+++ b/src/systemc/tlm_bridge/sc_ext.cc
@@ -41,7 +41,6 @@
 Gem5Extension::Gem5Extension(PacketPtr _packet)
 {
     packet = _packet;
-    pipeThrough = false;
 }

 Gem5Extension &
diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh
index 0d9fc91..56a19a77 100644
--- a/src/systemc/tlm_bridge/sc_ext.hh
+++ b/src/systemc/tlm_bridge/sc_ext.hh
@@ -54,12 +54,8 @@
             const tlm::tlm_generic_payload &payload);
     PacketPtr getPacket();

-    bool isPipeThrough() const { return pipeThrough; }
-    void setPipeThrough() { pipeThrough = true; }
-
   private:
     PacketPtr packet;
-    bool pipeThrough;
 };

 } // namespace Gem5SystemC
diff --git a/src/systemc/tlm_bridge/tlm_to_gem5.cc b/src/systemc/tlm_bridge/tlm_to_gem5.cc
index 0cc0d7f..d901899 100644
--- a/src/systemc/tlm_bridge/tlm_to_gem5.cc
+++ b/src/systemc/tlm_bridge/tlm_to_gem5.cc
@@ -153,7 +153,6 @@
     // world and we can pipe through the original packet. Otherwise, we
     // generate a new packet based on the transaction.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         pkt = extension->getPacket();
     } else {
         pkt = payload2packet(_id, trans);
@@ -278,7 +277,6 @@
     // If there is an extension, this transaction was initiated by the gem5
     // world and we can pipe through the original packet.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         pkt = extension->getPacket();
     } else {
         pkt = payload2packet(_id, trans);
@@ -315,7 +313,6 @@
     // If there is an extension, this transaction was initiated by the gem5
     // world and we can pipe through the original packet.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         bmp.sendFunctional(extension->getPacket());
     } else {
         auto pkt = payload2packet(_id, trans);
@@ -341,7 +338,6 @@
     // If there is an extension, this transaction was initiated by the gem5
     // world and we can pipe through the original packet.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         pkt = extension->getPacket();
     } else {
         pkt = payload2packet(_id, trans);
@@ -419,8 +415,6 @@
     // delete it. The packet travels back with the transaction.
     if (extension == nullptr)
         destroyPacket(pkt);
-    else
-        sc_assert(extension->isPipeThrough());

     sendBeginResp(trans, delay);
     trans.release();
diff --git a/util/tlm/src/sc_ext.cc b/util/tlm/src/sc_ext.cc
index 5e45ed9..fb9613f 100644
--- a/util/tlm/src/sc_ext.cc
+++ b/util/tlm/src/sc_ext.cc
@@ -41,7 +41,6 @@
 Gem5Extension::Gem5Extension(PacketPtr packet)
 {
     Packet = packet;
-    pipeThrough = false;
 }

Gem5Extension& Gem5Extension::getExtension(const tlm_generic_payload *payload)
diff --git a/util/tlm/src/sc_ext.hh b/util/tlm/src/sc_ext.hh
index 18221de..b370208 100644
--- a/util/tlm/src/sc_ext.hh
+++ b/util/tlm/src/sc_ext.hh
@@ -58,12 +58,8 @@
         getExtension(const tlm::tlm_generic_payload &payload);
     PacketPtr getPacket();

-    bool isPipeThrough() const { return pipeThrough; }
-    void setPipeThrough() { pipeThrough = true; }
-
   private:
     PacketPtr Packet;
-    bool pipeThrough;
 };

 }
diff --git a/util/tlm/src/sc_master_port.cc b/util/tlm/src/sc_master_port.cc
index 2d569e8..88da496 100644
--- a/util/tlm/src/sc_master_port.cc
+++ b/util/tlm/src/sc_master_port.cc
@@ -206,7 +206,6 @@
     // world and we can pipe through the original packet. Otherwise, we
     // generate a new packet based on the transaction.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         pkt = extension->getPacket();
     } else {
         pkt = generatePacket(trans);
@@ -263,7 +262,6 @@
     // If there is an extension, this transaction was initiated by the gem5
     // world and we can pipe through the original packet.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         pkt = extension->getPacket();
     } else {
         pkt = generatePacket(trans);
@@ -297,7 +295,6 @@
     // If there is an extension, this transaction was initiated by the gem5
     // world and we can pipe through the original packet.
     if (extension != nullptr) {
-        extension->setPipeThrough();
         sendFunctional(extension->getPacket());
     } else {
         auto pkt = generatePacket(trans);
@@ -353,8 +350,6 @@
     // delete it. The packet travels back with the transaction.
     if (extension == nullptr)
         destroyPacket(pkt);
-    else
-        sc_assert(extension->isPipeThrough());

     sendBeginResp(trans, delay);
     trans.release();
diff --git a/util/tlm/src/sc_slave_port.cc b/util/tlm/src/sc_slave_port.cc
index a3b8783..5ec94b4 100644
--- a/util/tlm/src/sc_slave_port.cc
+++ b/util/tlm/src/sc_slave_port.cc
@@ -293,19 +293,11 @@

         bool need_retry = false;

-        /*
- * If the packet was piped through and needs a response, we don't need
-         * to touch the packet and can forward it directly as a response.
-         * Otherwise, we need to make a response and send the transformed
-         * packet.
-         */
-        if (extension.isPipeThrough()) {
-            if (packet->isResponse()) {
-                need_retry = !sendTimingResp(packet);
-            }
-        } else if (packet->needsResponse()) {
+        if (packet->needsResponse()) {
             packet->makeResponse();
-            need_retry = !sendTimingResp(packet);
+        }
+        if (packet->isResponse()) {
+            need_retry = !bridgeResponsePort.sendTimingResp(packet);
         }

         if (need_retry) {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37375
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2c318777d91dca446c1a700d9f7cff356d29ae6d
Gerrit-Change-Number: 37375
Gerrit-PatchSet: 1
Gerrit-Owner: Earl Ou <shunhsin...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to