Go to the documentation of this file.
63 #include "params/Gem5ToTlmBridge32.hh"
64 #include "params/Gem5ToTlmBridge64.hh"
96 extraPacketToPayloadSteps.push_back(std::move(step));
114 unsigned int size = packet->
getSize();
115 unsigned char *
data = packet->
getPtr<
unsigned char>();
124 }
else if (packet->
isRead()) {
126 }
else if (packet->
isWrite()) {
137 for (
auto &step : extraPacketToPayloadSteps) {
138 step(packet, *trans);
144 template <
unsigned int BITWIDTH>
154 blockingRequest =
nullptr;
157 if (needToSendRequestRetry) {
158 needToSendRequestRetry =
false;
159 bridgeResponsePort.sendRetryReq();
164 auto packet = extension.getPacket();
168 bool need_retry =
false;
174 if (packet->needsResponse()) {
175 packet->makeResponse();
177 if (packet->isResponse()) {
178 need_retry = !bridgeResponsePort.sendTimingResp(packet);
182 blockingResponse = &trans;
188 socket->nb_transport_fw(trans, fw_phase, delay);
196 template <
unsigned int BITWIDTH>
205 auto it = backdoorMap.contains(
r);
206 if (it != backdoorMap.end())
211 if (!socket->get_direct_mem_ptr(trans, dmi_data))
222 backdoorMap.insert(dmi_r, backdoor);
228 template <
unsigned int BITWIDTH>
233 "Should not see packets where cache is responding");
242 socket->b_transport(*trans, delay);
250 return delay.
value();
253 template <
unsigned int BITWIDTH>
259 "Should not see packets where cache is responding");
268 socket->b_transport(*trans, delay);
270 if (trans->is_dmi_allowed())
271 backdoor = getBackdoor(*trans);
275 backdoor = getBackdoor(*trans);
283 return delay.
value();
286 template <
unsigned int BITWIDTH>
292 "unimplemented func.: recvFunctionalSnoop");
296 template <
unsigned int BITWIDTH>
301 "Should not see packets where cache is responding");
309 if (blockingRequest) {
310 needToSendRequestRetry =
true;
358 status = socket->nb_transport_fw(*trans, phase, delay);
363 blockingRequest = trans;
368 blockingRequest = trans;
369 auto cb = [
this, trans, phase]() { pec(*trans, phase); };
381 template <
unsigned int BITWIDTH>
387 "unimplemented func.: recvTimingSnoopResp");
391 template <
unsigned int BITWIDTH>
395 panic(
"tryTiming(PacketPtr) isn't implemented.");
398 template <
unsigned int BITWIDTH>
406 blockingResponse =
nullptr;
410 bool need_retry = !bridgeResponsePort.sendTimingResp(packet);
416 socket->nb_transport_fw(*trans, phase, delay);
422 template <
unsigned int BITWIDTH>
430 unsigned int bytes = socket->transport_dbg(*trans);
431 if (bytes != trans->get_data_length()) {
433 "debug transport was not completed");
439 template <
unsigned int BITWIDTH>
444 auto cb = [
this, &trans, phase]() { pec(trans, phase); };
450 template <
unsigned int BITWIDTH>
458 auto it = backdoorMap.intersects(
r);
459 if (it == backdoorMap.end())
462 it->second->invalidate();
464 backdoorMap.erase(it);
468 template <
unsigned int BITWIDTH>
472 bridgeResponsePort(
std::string(
name()) +
".gem5", *this),
473 socket(
"tlm_socket"),
476 needToSendRequestRetry(false), blockingResponse(nullptr),
477 addrRanges(params.addr_ranges.begin(), params.addr_ranges.end())
481 template <
unsigned int BITWIDTH>
485 if (if_name ==
"gem5")
486 return bridgeResponsePort;
487 else if (if_name ==
"tlm")
493 template <
unsigned int BITWIDTH>
497 bridgeResponsePort.sendRangeChange();
500 socket.register_invalidate_direct_mem_ptr(
508 Gem5ToTlmBridge32Params::create()
const
515 Gem5ToTlmBridge64Params::create()
const
static sc_time from_value(sc_dt::uint64)
void set_data_length(const unsigned int length)
bool cacheResponding() const
void before_end_of_elaboration() override
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
const PortID InvalidPortID
Tick recvAtomic(PacketPtr packet)
void addPacketToPayloadConversionStep(PacketToPayloadConversionStep step)
Notify the Gem5ToTlm bridge that we need an extra step to properly convert a gem5 packet to tlm paylo...
tlm::tlm_generic_payload * packet2payload(PacketPtr packet)
Convert a gem5 packet to a TLM payload by copying all the relevant information to new tlm payload.
uint64_t Tick
Tick count type.
const sc_time SC_ZERO_TIME
#define SC_REPORT_FATAL(msg_type, msg)
bool recvTimingSnoopResp(PacketPtr packet)
RequestPtr req
A pointer to the original request.
Gem5ToTlmBridge(const Params &p, const sc_core::sc_module_name &mn)
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
std::function< void(PacketPtr pkt, tlm::tlm_generic_payload &trans)> PacketToPayloadConversionStep
::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
virtual ::Port & gem5_getPort(const std::string &if_name, int idx=-1)
void set_command(const tlm_command command)
bool is_read_allowed() const
unsigned int get_data_length() const
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
bool needsResponse() const
sc_dt::uint64 value() const
sc_dt::uint64 get_end_address() const
bool is_write_allowed() const
sc_dt::uint64 get_start_address() const
Gem5ToTlmBridgeBaseParams Params
void set_streaming_width(const unsigned int streaming_width)
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
const std::string & name()
unsigned char * get_dmi_ptr() const
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor)
@ 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...
static Gem5Extension & getExtension(const tlm::tlm_generic_payload *payload)
Overload hash function for BasicBlockRange type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
virtual void before_end_of_elaboration()
void recvFunctional(PacketPtr packet)
void set_address(const sc_dt::uint64 address)
void recvFunctionalSnoop(PacketPtr packet)
bool recvTimingReq(PacketPtr packet)
T * getPtr()
get a pointer to the data ptr.
T * set_auto_extension(T *ext)
MemBackdoorPtr getBackdoor(tlm::tlm_generic_payload &trans)
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
Tick curTick()
The universal simulation clock.
Gem5SystemC::MemoryManager mm
Instantiate a tlm memory manager that takes care about all the tlm transactions in the system.
bool tryTiming(PacketPtr packet)
sc_dt::uint64 get_address() const
void pec(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
#define panic(...)
This implements a cprintf based panic() function.
void set_data_ptr(unsigned char *data)
Generated on Tue Mar 23 2021 19:41:31 for gem5 by doxygen 1.8.17