Go to the documentation of this file.
60 #include "params/TlmToGem5Bridge32.hh"
61 #include "params/TlmToGem5Bridge64.hh"
85 "received transaction with unsupported command");
89 auto req = std::make_shared<Request>(
96 auto pkt =
new Packet(req, cmd);
102 template <
unsigned int BITWIDTH>
109 auto status = socket->nb_transport_bw(trans, phase, delay);
111 "Unexpected status after sending END_REQ");
114 template <
unsigned int BITWIDTH>
123 auto status = socket->nb_transport_bw(trans, phase, delay);
128 responseInProgress =
false;
131 responseInProgress =
true;
133 panic(
"Unexpected status after sending BEGIN_RESP");
137 template <
unsigned int BITWIDTH>
155 if (extension !=
nullptr) {
168 if (bmp.sendTimingReq(pkt)) {
170 if (!needsResponse) {
172 sendBeginResp(trans, delay);
177 pendingRequest = &trans;
182 template <
unsigned int BITWIDTH>
188 responseInProgress =
false;
190 checkTransaction(trans);
192 if (needToSendRetry) {
194 needToSendRetry =
false;
198 template <
unsigned int BITWIDTH>
205 template <
unsigned int BITWIDTH>
210 std::stringstream
ss;
211 ss <<
"Transaction returned with error, response status = "
217 template <
unsigned int BITWIDTH>
221 socket->invalidate_direct_mem_ptr(
222 backdoor.range().start(), backdoor.range().end());
225 template <
unsigned int BITWIDTH>
232 handleBeginReq(trans);
235 handleEndResp(trans);
238 panic(
"unimplemented phase in callback");
242 template <
unsigned int BITWIDTH>
253 if (byteEnable != 0) {
264 peq.notify(trans, phase, delay);
268 template <
unsigned int BITWIDTH>
280 if (extension !=
nullptr) {
288 Tick ticks = bmp.sendAtomicBackdoor(pkt, backdoor);
294 "Packet sending failed!\n");
302 if (extension ==
nullptr)
308 template <
unsigned int BITWIDTH>
317 if (extension !=
nullptr) {
319 bmp.sendFunctional(extension->
getPacket());
323 bmp.sendFunctional(pkt);
331 template <
unsigned int BITWIDTH>
343 if (extension !=
nullptr) {
352 bmp.sendAtomicBackdoor(pkt, backdoor);
370 invalidateDmi(backdoor);
375 if (extension ==
nullptr)
380 return backdoor !=
nullptr;
383 template <
unsigned int BITWIDTH>
389 if (responseInProgress) {
391 needToSendRetry =
true;
410 auto &trans = tlmSenderState->trans;
413 trans.get_extension(extension);
416 delete tlmSenderState;
420 if (extension ==
nullptr)
425 sendBeginResp(trans, delay);
431 template <
unsigned int BITWIDTH>
441 bool needsResponse = pendingPacket->needsResponse();
442 if (bmp.sendTimingReq(pendingPacket)) {
443 waitForRetry =
false;
444 pendingPacket =
nullptr;
446 auto &trans = *pendingRequest;
448 if (!needsResponse) {
450 sendBeginResp(trans, delay);
454 pendingRequest =
nullptr;
458 template <
unsigned int BITWIDTH>
463 "received address range change but ignored it");
466 template <
unsigned int BITWIDTH>
470 if (if_name ==
"gem5")
472 else if (if_name ==
"tlm")
478 template <
unsigned int BITWIDTH>
482 waitForRetry(false), pendingRequest(nullptr), pendingPacket(nullptr),
483 needToSendRetry(false), responseInProgress(false),
484 bmp(
std::string(
name()) +
"master", *this), socket(
"tlm_socket"),
487 _id(params->
system->getGlobalRequestorId(
488 std::string(
"[systemc].") +
name()))
492 template <
unsigned int BITWIDTH>
504 if (
system->isTimingMode()) {
505 SC_REPORT_INFO(
"TlmToGem5Bridge",
"register non-blocking interface");
506 socket.register_nb_transport_fw(
508 }
else if (
system->isAtomicMode()) {
510 socket.register_b_transport(
512 socket.register_get_direct_mem_ptr(
515 panic(
"gem5 operates neither in Timing nor in Atomic mode");
518 socket.register_transport_dbg(
527 TlmToGem5Bridge32Params::create()
534 TlmToGem5Bridge64Params::create()
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
@ NO_ACCESS
The request should not cause a memory access.
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(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
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 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)
#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)
bool isPipeThrough() const
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 Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17