diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc index 4d12fb3d9f..6e3cf113d3 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 + #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 @@ struct ControlConversionRegister } pkt->qosValue(control_ex->getQos()); + + if (control_ex->hasStreamId()) { + pkt->req->setStreamId(control_ex->getStreamId().value()); + } + if (control_ex->hasSubstreamId()) { + pkt->req->setSubstreamId( + control_ex->getSubstreamId().value()); + } }); sc_gem5::addPacketToPayloadConversionStep( [] (PacketPtr pkt, tlm::tlm_generic_payload &trans) @@ -90,6 +100,12 @@ struct ControlConversionRegister control_ex->setSecure(pkt->req->isSecure()); control_ex->setInstruction(pkt->req->isInstFetch()); control_ex->setQos(pkt->qosValue()); + if (pkt->req->hasStreamId()) { + control_ex->setStreamId(pkt->req->streamId()); + } + if (pkt->req->hasSubstreamId()) { + control_ex->setSubstreamId(pkt->req->substreamId()); + } }); } }; @@ -263,4 +279,40 @@ ControlExtension::setQos(uint8_t q) qos = q; } -} // namespace Gem5SystemC +bool +ControlExtension::hasStreamId() const +{ + return stream_id.has_value(); +} + +std::optional +ControlExtension::getStreamId() const +{ + return stream_id; +} + +void +ControlExtension::setStreamId(std::optional s) +{ + stream_id = std::move(s); +} + +bool +ControlExtension::hasSubstreamId() const +{ + return substream_id.has_value(); +} + +std::optional +ControlExtension::getSubstreamId() const +{ + return substream_id; +} + +void +ControlExtension::setSubstreamId(std::optional s) +{ + substream_id = std::move(s); +} + +} // namespace Gem5SystemC diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh index bb676761ce..f23f3fa54d 100644 --- a/src/systemc/tlm_bridge/sc_ext.hh +++ b/src/systemc/tlm_bridge/sc_ext.hh @@ -36,6 +36,7 @@ #include #include +#include #include "base/amo.hh" #include "mem/packet.hh" @@ -115,6 +116,14 @@ class ControlExtension : public tlm::tlm_extension uint8_t getQos() const; void setQos(uint8_t q); + /* Stream ID and Substream ID */ + bool hasStreamId() const; + std::optional getStreamId() const; + void setStreamId(std::optional s); + bool hasSubstreamId() const; + std::optional getSubstreamId() const; + void setSubstreamId(std::optional s); + private: /* Secure and privileged access */ bool privileged; @@ -123,6 +132,10 @@ class ControlExtension : public tlm::tlm_extension /* Quality of Service (AXI4) */ uint8_t qos; + + /* Stream ID and Substream ID */ + std::optional stream_id; + std::optional substream_id; }; } // namespace Gem5SystemC