Go to the documentation of this file.
62 #include "params/TlmToGem5Bridge32.hh"
63 #include "params/TlmToGem5Bridge64.hh"
89 extraPayloadToPacketSteps.push_back(std::move(step));
108 "received transaction with unsupported command");
112 auto req = std::make_shared<Request>(
119 auto pkt =
new Packet(req, cmd);
123 for (
auto &step : extraPayloadToPacketSteps) {
130 template <
unsigned int BITWIDTH>
137 auto status = socket->nb_transport_bw(trans, phase, delay);
139 "Unexpected status after sending END_REQ");
142 template <
unsigned int BITWIDTH>
151 auto status = socket->nb_transport_bw(trans, phase, delay);
156 responseInProgress =
false;
159 responseInProgress =
true;
161 panic(
"Unexpected status after sending BEGIN_RESP");
165 template <
unsigned int BITWIDTH>
183 if (extension !=
nullptr) {
195 if (bmp.sendTimingReq(pkt)) {
197 if (!needsResponse) {
199 sendBeginResp(trans, delay);
204 pendingRequest = &trans;
209 template <
unsigned int BITWIDTH>
215 responseInProgress =
false;
217 checkTransaction(trans);
219 if (needToSendRetry) {
221 needToSendRetry =
false;
225 template <
unsigned int BITWIDTH>
232 template <
unsigned int BITWIDTH>
237 std::stringstream
ss;
238 ss <<
"Transaction returned with error, response status = "
244 template <
unsigned int BITWIDTH>
248 socket->invalidate_direct_mem_ptr(
249 backdoor.range().start(), backdoor.range().end());
252 template <
unsigned int BITWIDTH>
259 handleBeginReq(trans);
262 handleEndResp(trans);
265 panic(
"unimplemented phase in callback");
269 template <
unsigned int BITWIDTH>
280 if (byteEnable != 0) {
291 peq.notify(trans, phase, delay);
295 template <
unsigned int BITWIDTH>
307 if (extension !=
nullptr) {
314 Tick ticks = bmp.sendAtomicBackdoor(pkt, backdoor);
320 "Packet sending failed!\n");
328 if (extension ==
nullptr)
334 template <
unsigned int BITWIDTH>
343 if (extension !=
nullptr) {
344 bmp.sendFunctional(extension->
getPacket());
348 bmp.sendFunctional(pkt);
356 template <
unsigned int BITWIDTH>
368 if (extension !=
nullptr) {
376 bmp.sendAtomicBackdoor(pkt, backdoor);
394 invalidateDmi(backdoor);
399 if (extension ==
nullptr)
404 return backdoor !=
nullptr;
407 template <
unsigned int BITWIDTH>
413 if (responseInProgress) {
415 needToSendRetry =
true;
434 auto &trans = tlmSenderState->trans;
437 trans.get_extension(extension);
440 delete tlmSenderState;
444 if (extension ==
nullptr)
447 sendBeginResp(trans, delay);
453 template <
unsigned int BITWIDTH>
463 bool needsResponse = pendingPacket->needsResponse();
464 if (bmp.sendTimingReq(pendingPacket)) {
465 waitForRetry =
false;
466 pendingPacket =
nullptr;
468 auto &trans = *pendingRequest;
470 if (!needsResponse) {
472 sendBeginResp(trans, delay);
476 pendingRequest =
nullptr;
480 template <
unsigned int BITWIDTH>
485 "received address range change but ignored it");
488 template <
unsigned int BITWIDTH>
492 if (if_name ==
"gem5")
494 else if (if_name ==
"tlm")
500 template <
unsigned int BITWIDTH>
504 waitForRetry(false), pendingRequest(nullptr), pendingPacket(nullptr),
505 needToSendRetry(false), responseInProgress(false),
506 bmp(
std::string(
name()) +
"master", *this), socket(
"tlm_socket"),
509 _id(params.
system->getGlobalRequestorId(
510 std::string(
"[systemc].") +
name()))
514 template <
unsigned int BITWIDTH>
526 if (
system->isTimingMode()) {
527 SC_REPORT_INFO(
"TlmToGem5Bridge",
"register non-blocking interface");
528 socket.register_nb_transport_fw(
530 }
else if (
system->isAtomicMode()) {
532 socket.register_b_transport(
534 socket.register_get_direct_mem_ptr(
537 panic(
"gem5 operates neither in Timing nor in Atomic mode");
540 socket.register_transport_dbg(
549 TlmToGem5Bridge32Params::create()
const
556 TlmToGem5Bridge64Params::create()
const
PacketPtr payload2packet(RequestorID _id, tlm::tlm_generic_payload &trans)
static sc_time from_value(sc_dt::uint64)
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
const PortID InvalidPortID
unsigned int get_streaming_width() const
void invalidateDmi(const ::MemBackdoor &backdoor)
uint64_t Tick
Tick count type.
@ TLM_BYTE_ENABLE_ERROR_RESPONSE
const sc_time SC_ZERO_TIME
#define SC_REPORT_FATAL(msg_type, msg)
Addr end() const
Get the end address of the range.
RequestPtr req
A pointer to the original request.
TlmToGem5Bridge(const Params &p, const sc_core::sc_module_name &mn)
TlmToGem5BridgeBaseParams Params
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
void set_dmi_allowed(bool dmi_allowed)
std::string get_response_string() const
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
void destroyPacket(PacketPtr pkt)
@ TLM_BURST_ERROR_RESPONSE
void set_end_address(sc_dt::uint64 addr)
tlm_command get_command() const
unsigned char * get_byte_enable_ptr() const
virtual ::Port & gem5_getPort(const std::string &if_name, int idx=-1)
#define SC_REPORT_ERROR(msg_type, msg)
unsigned int get_data_length() const
void before_end_of_elaboration() override
std::function< void(PacketPtr pkt, tlm::tlm_generic_payload &trans)> PayloadToPacketConversionStep
bool needsResponse() const
void sendEndReq(tlm::tlm_generic_payload &trans)
const AddrRange & range() const
void sendBeginResp(tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
void get_extension(T *&ext) const
void checkTransaction(tlm::tlm_generic_payload &trans)
ProbePointArg< PacketInfo > Packet
Packet probe point.
::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
bool recvTimingResp(PacketPtr pkt)
const std::string & name()
#define SC_REPORT_INFO(msg_type, msg)
void addPayloadToPacketConversionStep(PayloadToPacketConversionStep step)
Notify the Tlm2Gem5 bridge that we need an extra step to properly convert a tlm payload to gem5 packe...
void handleBeginReq(tlm::tlm_generic_payload &trans)
#define SC_REPORT_WARNING(msg_type, msg)
void b_transport(tlm::tlm_generic_payload &trans, sc_core::sc_time &t)
void addInvalidationCallback(CbFunction func)
@ NO_ACCESS
The request should not cause a memory access.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
Addr start() const
Get the start address of the range.
Overload hash function for BasicBlockRange type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
virtual void before_end_of_elaboration()
bool is_response_error() const
void set_dmi_ptr(unsigned char *p)
void handleEndResp(tlm::tlm_generic_payload &trans)
unsigned int transport_dbg(tlm::tlm_generic_payload &trans)
void set_start_address(sc_dt::uint64 addr)
bool get_direct_mem_ptr(tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
void peq_cb(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
sc_dt::uint64 get_address() const
unsigned char * get_data_ptr() const
void set_granted_access(dmi_access_e a)
#define panic(...)
This implements a cprintf based panic() function.
void set_response_status(const tlm_response_status response_status)
Generated on Tue Jun 22 2021 15:28:33 for gem5 by doxygen 1.8.17