63 #include "debug/TlmBridge.hh"
64 #include "params/TlmToGem5Bridge128.hh"
65 #include "params/TlmToGem5Bridge256.hh"
66 #include "params/TlmToGem5Bridge32.hh"
67 #include "params/TlmToGem5Bridge512.hh"
68 #include "params/TlmToGem5Bridge64.hh"
98 extraPayloadToPacketSteps.push_back(std::move(step));
117 if (extension !=
nullptr) {
122 for (
auto &step : extraPayloadToPacketSteps) {
125 return std::make_pair(pkt,
false);
141 req = std::make_shared<Request>(
143 0, 0, std::move(amo_op));
154 return std::make_pair(
nullptr,
false);
157 "received transaction with unsupported "
161 req = std::make_shared<Request>(
170 auto pkt =
new Packet(req, cmd);
174 for (
auto &step : extraPayloadToPacketSteps) {
178 return std::make_pair(pkt,
true);
193 template <
unsigned int BITWIDTH>
200 auto status = socket->nb_transport_bw(trans, phase, delay);
202 "Unexpected status after sending END_REQ");
205 template <
unsigned int BITWIDTH>
219 panic(
"TlmToGem5Bridge: "
220 "received transaction with unsupported command");
228 bmp.sendMemBackdoorReq(req, backdoor);
235 auto status = socket->nb_transport_bw(trans, phase, delay);
240 responseInProgress =
false;
243 responseInProgress =
true;
245 panic(
"Unexpected status after sending BEGIN_RESP");
249 template <
unsigned int BITWIDTH>
260 auto pkt = res.first;
265 bool needsResponse = pkt->needsResponse();
266 if (bmp.sendTimingReq(pkt)) {
268 if (!needsResponse) {
271 sendBeginResp(trans, delay);
276 pendingRequest = &trans;
281 template <
unsigned int BITWIDTH>
287 responseInProgress =
false;
289 if (needToSendRetry) {
291 needToSendRetry =
false;
295 template <
unsigned int BITWIDTH>
302 template <
unsigned int BITWIDTH>
306 socket->invalidate_direct_mem_ptr(
311 template <
unsigned int BITWIDTH>
318 handleBeginReq(trans);
321 handleEndResp(trans);
324 panic(
"unimplemented phase in callback");
328 template <
unsigned int BITWIDTH>
339 if (byteEnable != 0) {
350 peq.notify(trans, phase, delay);
354 template <
unsigned int BITWIDTH>
363 Tick ticks = bmp.sendAtomicBackdoor(pkt, backdoor);
368 panic_if(pkt->needsResponse() && !pkt->isResponse(),
369 "Packet sending failed!\n");
391 template <
unsigned int BITWIDTH>
396 if (pkt !=
nullptr) {
399 bmp.sendFunctional(pkt);
415 template <
unsigned int BITWIDTH>
429 panic(
"TlmToGem5Bridge: "
430 "received transaction with unsupported command");
438 bmp.sendMemBackdoorReq(req, backdoor);
448 if (backdoor->readable())
450 if (backdoor->writeable())
455 if (requestedBackdoors.find(backdoor) == requestedBackdoors.end()) {
456 backdoor->addInvalidationCallback(
459 invalidateDmi(backdoor);
462 requestedBackdoors.emplace(backdoor);
468 return backdoor !=
nullptr;
471 template <
unsigned int BITWIDTH>
477 if (responseInProgress) {
479 needToSendRetry =
true;
495 auto *tlmSenderState =
499 auto &trans = tlmSenderState->trans;
501 sendBeginResp(trans, delay);
504 trans.get_extension(extension);
507 delete tlmSenderState;
511 if (extension ==
nullptr)
519 template <
unsigned int BITWIDTH>
529 bool needsResponse = pendingPacket->needsResponse();
530 if (bmp.sendTimingReq(pendingPacket)) {
531 waitForRetry =
false;
533 auto &trans = *pendingRequest;
535 if (!needsResponse) {
538 sendBeginResp(trans, delay);
542 pendingRequest =
nullptr;
546 template <
unsigned int BITWIDTH>
551 "received address range change but ignored it");
554 template <
unsigned int BITWIDTH>
558 if (if_name ==
"gem5")
560 else if (if_name ==
"tlm")
566 template <
unsigned int BITWIDTH>
570 waitForRetry(false), pendingRequest(nullptr), pendingPacket(nullptr),
571 needToSendRetry(false), responseInProgress(false),
572 bmp(
std::string(
name()) +
"master", *this), socket(
"tlm_socket"),
575 _id(params.
system->getGlobalRequestorId(
576 std::string(
"[systemc].") +
name()))
580 template <
unsigned int BITWIDTH>
592 if (
system->isTimingMode()) {
593 DPRINTF(TlmBridge,
"register non-blocking interface");
594 socket.register_nb_transport_fw(
596 }
else if (
system->isAtomicMode()) {
597 DPRINTF(TlmBridge,
"register blocking interface");
598 socket.register_b_transport(
601 panic(
"gem5 operates neither in Timing nor in Atomic mode");
604 socket.register_get_direct_mem_ptr(
606 socket.register_transport_dbg(
615 gem5::TlmToGem5Bridge32Params::create()
const
622 gem5::TlmToGem5Bridge64Params::create()
const
629 gem5::TlmToGem5Bridge128Params::create()
const
636 gem5::TlmToGem5Bridge256Params::create()
const
643 gem5::TlmToGem5Bridge512Params::create()
const