Go to the documentation of this file.
61 #include "params/Gem5ToTlmBridge32.hh"
62 #include "params/Gem5ToTlmBridge64.hh"
91 unsigned int size = packet->
getSize();
92 unsigned char *
data = packet->
getPtr<
unsigned char>();
101 }
else if (packet->
isRead()) {
103 }
else if (packet->
isWrite()) {
116 template <
unsigned int BITWIDTH>
126 blockingRequest =
nullptr;
129 if (needToSendRequestRetry) {
130 needToSendRequestRetry =
false;
131 bridgeResponsePort.sendRetryReq();
136 auto packet = extension.getPacket();
140 bool need_retry =
false;
148 if (extension.isPipeThrough()) {
149 if (packet->isResponse()) {
150 need_retry = !bridgeResponsePort.sendTimingResp(packet);
152 }
else if (packet->needsResponse()) {
153 packet->makeResponse();
154 need_retry = !bridgeResponsePort.sendTimingResp(packet);
158 blockingResponse = &trans;
164 socket->nb_transport_fw(trans, fw_phase, delay);
172 template <
unsigned int BITWIDTH>
181 auto it = backdoorMap.contains(
r);
182 if (it != backdoorMap.end())
187 if (!socket->get_direct_mem_ptr(trans, dmi_data))
198 backdoorMap.insert(dmi_r, backdoor);
204 template <
unsigned int BITWIDTH>
209 "Should not see packets where cache is responding");
218 socket->b_transport(*trans, delay);
226 return delay.
value();
229 template <
unsigned int BITWIDTH>
235 "Should not see packets where cache is responding");
244 socket->b_transport(*trans, delay);
246 if (trans->is_dmi_allowed())
247 backdoor = getBackdoor(*trans);
251 backdoor = getBackdoor(*trans);
259 return delay.
value();
262 template <
unsigned int BITWIDTH>
268 "unimplemented func.: recvFunctionalSnoop");
272 template <
unsigned int BITWIDTH>
277 "Should not see packets where cache is responding");
285 if (blockingRequest) {
286 needToSendRequestRetry =
true;
334 status = socket->nb_transport_fw(*trans, phase, delay);
339 blockingRequest = trans;
343 auto cb = [
this, trans, phase]() { pec(*trans, phase); };
355 template <
unsigned int BITWIDTH>
361 "unimplemented func.: recvTimingSnoopResp");
365 template <
unsigned int BITWIDTH>
369 panic(
"tryTiming(PacketPtr) isn't implemented.");
372 template <
unsigned int BITWIDTH>
380 blockingResponse =
nullptr;
384 bool need_retry = !bridgeResponsePort.sendTimingResp(packet);
390 socket->nb_transport_fw(*trans, phase, delay);
396 template <
unsigned int BITWIDTH>
404 unsigned int bytes = socket->transport_dbg(*trans);
405 if (bytes != trans->get_data_length()) {
407 "debug transport was not completed");
413 template <
unsigned int BITWIDTH>
418 auto cb = [
this, &trans, phase]() { pec(trans, phase); };
424 template <
unsigned int BITWIDTH>
432 auto it = backdoorMap.intersects(
r);
433 if (it == backdoorMap.end())
436 it->second->invalidate();
438 backdoorMap.erase(it);
442 template <
unsigned int BITWIDTH>
446 bridgeResponsePort(
std::string(
name()) +
".gem5", *this),
447 socket(
"tlm_socket"),
450 needToSendRequestRetry(false), blockingResponse(nullptr),
451 addrRanges(params->addr_ranges.begin(), params->addr_ranges.end())
455 template <
unsigned int BITWIDTH>
459 if (if_name ==
"gem5")
460 return bridgeResponsePort;
461 else if (if_name ==
"tlm")
467 template <
unsigned int BITWIDTH>
471 bridgeResponsePort.sendRangeChange();
474 socket.register_invalidate_direct_mem_ptr(
482 Gem5ToTlmBridge32Params::create()
489 Gem5ToTlmBridge64Params::create()
Gem5ToTlmBridge(Params *p, const sc_core::sc_module_name &mn)
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)
@ NO_ACCESS
The request should not cause a memory access.
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.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
::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)
#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)
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.
Tick curTick()
The current simulated tick.
void set_data_ptr(unsigned char *data)
Generated on Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17