systemc: fix flexible conversion when reusing transactions
To make the all extension states correct, we still need to proceed the plugins when reusing the transactions, since we don't know the detail of the plugins. Change-Id: I18acd64f54be4c82a0678b98e834ea9548de1f58 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63871 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -112,7 +112,8 @@ std::vector<PacketToPayloadConversionStep> extraPacketToPayloadSteps;
|
||||
* gem5 packet to tlm payload. This can be useful when there exists a SystemC
|
||||
* extension that requires information in gem5 packet. For example, if a user
|
||||
* defined a SystemC extension the carries stream_id, the user may add a step
|
||||
* here to read stream_id out and set the extension properly.
|
||||
* here to read stream_id out and set the extension properly. Steps should be
|
||||
* idempotent.
|
||||
*/
|
||||
void
|
||||
addPacketToPayloadConversionStep(PacketToPayloadConversionStep step)
|
||||
@@ -140,6 +141,10 @@ packet2payload(PacketPtr packet)
|
||||
trans = &tlmSenderState->trans;
|
||||
trans->set_address(packet->getAddr());
|
||||
trans->acquire();
|
||||
// Apply all conversion steps necessary in this specific setup.
|
||||
for (auto &step : extraPacketToPayloadSteps) {
|
||||
step(packet, *trans);
|
||||
}
|
||||
return trans;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ std::vector<PayloadToPacketConversionStep> extraPayloadToPacketSteps;
|
||||
* tlm payload to gem5 packet. This can be useful when there exists a SystemC
|
||||
* extension that carries extra information. For example, SystemC user might
|
||||
* define an extension to store stream_id, the user may then add an extra step
|
||||
* to set the generated request's stream_id accordingly.
|
||||
* to set the generated request's stream_id accordingly. Steps should be
|
||||
* idempotent.
|
||||
*/
|
||||
void
|
||||
addPayloadToPacketConversionStep(PayloadToPacketConversionStep step)
|
||||
@@ -117,6 +118,10 @@ payload2packet(RequestorID _id, tlm::tlm_generic_payload &trans)
|
||||
auto pkt = extension->getPacket();
|
||||
// Sync the address which could have changed.
|
||||
pkt->setAddr(trans.get_address());
|
||||
// Apply all conversion steps necessary in this specific setup.
|
||||
for (auto &step : extraPayloadToPacketSteps) {
|
||||
step(pkt, trans);
|
||||
}
|
||||
return std::make_pair(pkt, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user