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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65371 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
This commit is contained in:
committed by
Han-sheng Liu
parent
c8d687b05c
commit
90046bae6f
@@ -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 @@ 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<uint32_t>
|
||||
ControlExtension::getStreamId() const
|
||||
{
|
||||
return stream_id;
|
||||
}
|
||||
|
||||
void
|
||||
ControlExtension::setStreamId(std::optional<uint32_t> s)
|
||||
{
|
||||
stream_id = std::move(s);
|
||||
}
|
||||
|
||||
bool
|
||||
ControlExtension::hasSubstreamId() const
|
||||
{
|
||||
return substream_id.has_value();
|
||||
}
|
||||
|
||||
std::optional<uint32_t>
|
||||
ControlExtension::getSubstreamId() const
|
||||
{
|
||||
return substream_id;
|
||||
}
|
||||
|
||||
void
|
||||
ControlExtension::setSubstreamId(std::optional<uint32_t> s)
|
||||
{
|
||||
substream_id = std::move(s);
|
||||
}
|
||||
|
||||
} // namespace Gem5SystemC
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "base/amo.hh"
|
||||
#include "mem/packet.hh"
|
||||
@@ -115,6 +116,14 @@ class ControlExtension : public tlm::tlm_extension<ControlExtension>
|
||||
uint8_t getQos() const;
|
||||
void setQos(uint8_t q);
|
||||
|
||||
/* Stream ID and Substream ID */
|
||||
bool hasStreamId() const;
|
||||
std::optional<uint32_t> getStreamId() const;
|
||||
void setStreamId(std::optional<uint32_t> s);
|
||||
bool hasSubstreamId() const;
|
||||
std::optional<uint32_t> getSubstreamId() const;
|
||||
void setSubstreamId(std::optional<uint32_t> s);
|
||||
|
||||
private:
|
||||
/* Secure and privileged access */
|
||||
bool privileged;
|
||||
@@ -123,6 +132,10 @@ class ControlExtension : public tlm::tlm_extension<ControlExtension>
|
||||
|
||||
/* 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
|
||||
|
||||
Reference in New Issue
Block a user