Han-sheng Liu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/65371?usp=email )

Change subject: systemc: Add the stream id entry and its conversion in control extension
......................................................................

systemc: Add the stream id entry and its conversion in control extension

stream id and substream id are properties of gem5 Request. This CL adds
the information into gem5 ControlExtension to manipulate them in SystemC
level, and adds the conversion between ControlExtension and Packet.

Change-Id: Id13d181561ba496c2012f7237eb800f0a9786d05
---
M src/systemc/tlm_bridge/sc_ext.cc
M src/systemc/tlm_bridge/sc_ext.hh
2 files changed, 67 insertions(+), 1 deletion(-)



diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc
index 4d12fb3..95ce138 100644
--- a/src/systemc/tlm_bridge/sc_ext.cc
+++ b/src/systemc/tlm_bridge/sc_ext.cc
@@ -33,6 +33,8 @@

 #include "systemc/tlm_bridge/sc_ext.hh"

+#include <optional>
+
 #include "systemc/ext/utils/sc_report_handler.hh"
 #include "systemc/tlm_bridge/gem5_to_tlm.hh"
 #include "systemc/tlm_bridge/tlm_to_gem5.hh"
@@ -76,6 +78,14 @@
                 }

                 pkt->qosValue(control_ex->getQos());
+
+                if (control_ex->getStreamId().has_value()) {
+ pkt->req->setStreamId(control_ex->getStreamId().value());
+                }
+                if (control_ex->getSubstreamId().has_value()) {
+                    pkt->req->setSubstreamId(
+                        control_ex->getSubstreamId().value());
+                }
             });
         sc_gem5::addPacketToPayloadConversionStep(
             [] (PacketPtr pkt, tlm::tlm_generic_payload &trans)
@@ -90,6 +100,14 @@
                 control_ex->setSecure(pkt->req->isSecure());
                 control_ex->setInstruction(pkt->req->isInstFetch());
                 control_ex->setQos(pkt->qosValue());
+                if (pkt->req->hasStreamId()) {
+                    control_ex->setStreamId(
+                        std::make_optional(pkt->req->streamId()));
+                }
+                if (pkt->req->hasSubstreamId()) {
+                    control_ex->setSubstreamId(
+                        std::make_optional(pkt->req->substreamId()));
+                }
             });
     }
 };
@@ -263,4 +281,28 @@
     qos = q;
 }

-} // namespace Gem5SystemC
+std::optional<uint32_t>
+ControlExtension::getStreamId() const
+{
+    return stream_id;
+}
+
+void
+ControlExtension::setStreamId(std::optional<uint32_t> s)
+{
+    stream_id = s;
+}
+
+std::optional<uint32_t>
+ControlExtension::getSubstreamId() const
+{
+    return substream_id;
+}
+
+void
+ControlExtension::setSubstreamId(std::optional<uint32_t> s)
+{
+    substream_id = s;
+}
+
+}  // namespace Gem5SystemC
diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh
index bb67676..790b734 100644
--- a/src/systemc/tlm_bridge/sc_ext.hh
+++ b/src/systemc/tlm_bridge/sc_ext.hh
@@ -36,6 +36,7 @@

 #include <cstdint>
 #include <memory>
+#include <optional>

 #include "base/amo.hh"
 #include "mem/packet.hh"
@@ -115,6 +116,12 @@
     uint8_t getQos() const;
     void setQos(uint8_t q);

+    /* Stream ID and Substream ID */
+    std::optional<uint32_t> getStreamId() const;
+    void setStreamId(std::optional<uint32_t> s);
+    std::optional<uint32_t> getSubstreamId() const;
+    void setSubstreamId(std::optional<uint32_t> s);
+
   private:
     /* Secure and privileged access */
     bool privileged;
@@ -123,6 +130,10 @@

     /* Quality of Service (AXI4) */
     uint8_t qos;
+
+    /* Stream ID and Substream ID */
+    std::optional<uint32_t> stream_id;
+    std::optional<uint32_t> substream_id;
 };

 } // namespace Gem5SystemC

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/65371?usp=email 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: Id13d181561ba496c2012f7237eb800f0a9786d05
Gerrit-Change-Number: 65371
Gerrit-PatchSet: 1
Gerrit-Owner: Han-sheng Liu <handsome...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to