63#include "params/Gem5ToTlmBridge32.hh"
64#include "params/Gem5ToTlmBridge64.hh"
65#include "params/Gem5ToTlmBridge128.hh"
66#include "params/Gem5ToTlmBridge256.hh"
67#include "params/Gem5ToTlmBridge512.hh"
121 extraPacketToPayloadSteps.push_back(std::move(step));
134 auto *tlmSenderState =
139 if (tlmSenderState !=
nullptr) {
141 trans = &tlmSenderState->trans;
145 for (
auto &step : extraPacketToPayloadSteps) {
146 step(packet, *trans);
151 trans =
mm.allocate();
160 unsigned int size = packet->
getSize();
161 unsigned char *
data = packet->
getPtr<
unsigned char>();
170 }
else if (packet->
isRead()) {
172 }
else if (packet->
isWrite()) {
184 std::shared_ptr<AtomicOpFunctor>(
185 packet->
req->getAtomicOpFunctor()->clone()),
186 packet->
req->isAtomicReturn());
191 for (
auto &step : extraPacketToPayloadSteps) {
192 step(packet, *trans);
216template <
unsigned int BITWIDTH>
240 bool need_retry =
false;
259 socket->nb_transport_fw(trans, fw_phase, delay);
267template <
unsigned int BITWIDTH>
282 if (!
socket->get_direct_mem_ptr(trans, dmi_data))
299template <
unsigned int BITWIDTH>
304 "Should not see packets where cache is responding");
313 socket->b_transport(*trans, delay);
321 return delay.
value();
324template <
unsigned int BITWIDTH>
330 "Should not see packets where cache is responding");
339 socket->b_transport(*trans, delay);
341 if (trans->is_dmi_allowed())
355 return delay.
value();
358template <
unsigned int BITWIDTH>
364 "unimplemented func.: recvFunctionalSnoop");
368template <
unsigned int BITWIDTH>
373 "Should not see packets where cache is responding");
443 auto cb = [
this, trans, phase]() {
pec(*trans, phase); };
456template <
unsigned int BITWIDTH>
462 "unimplemented func.: recvTimingSnoopResp");
466template <
unsigned int BITWIDTH>
470 panic(
"tryTiming(PacketPtr) isn't implemented.");
473template <
unsigned int BITWIDTH>
492 socket->nb_transport_fw(*trans, phase, delay);
499template <
unsigned int BITWIDTH>
507 unsigned int bytes =
socket->transport_dbg(*trans);
508 if (bytes != trans->get_data_length()) {
510 "debug transport was not completed");
516template <
unsigned int BITWIDTH>
541template <
unsigned int BITWIDTH>
546 auto cb = [
this, &trans, phase]() {
pec(trans, phase); };
553template <
unsigned int BITWIDTH>
565 it->second->invalidate();
571template <
unsigned int BITWIDTH>
580 addrRanges(params.addr_ranges.begin(), params.addr_ranges.end())
584template <
unsigned int BITWIDTH>
588 if (if_name ==
"gem5")
590 else if (if_name ==
"tlm")
596template <
unsigned int BITWIDTH>
603 socket.register_invalidate_direct_mem_ptr(
611gem5::Gem5ToTlmBridge32Params::create()
const
618gem5::Gem5ToTlmBridge64Params::create()
const
625gem5::Gem5ToTlmBridge128Params::create()
const
632gem5::Gem5ToTlmBridge256Params::create()
const
639gem5::Gem5ToTlmBridge512Params::create()
const
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
const AddrRange & range() const
bool needsResponse() const
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
T * getPtr()
get a pointer to the data ptr.
RequestPtr req
A pointer to the original request.
bool cacheResponding() const
Ports are used to interface objects to each other.
@ NO_ACCESS
The request should not cause a memory access.
virtual void before_end_of_elaboration()
virtual gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1)
const char * name() const
static sc_time from_value(sc_dt::uint64)
sc_dt::uint64 value() const
bool needToSendRequestRetry
Did another gem5 request arrive while currently blocked?
std::unordered_map< tlm::tlm_generic_payload *, gem5::PacketPtr > packetMap
A map to record the association between payload and packet.
void before_end_of_elaboration() override
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
void pec(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
tlm::tlm_generic_payload * blockingRequest
A transaction after BEGIN_REQ has been sent but before END_REQ, which is blocking the request channel...
void recvMemBackdoorReq(const gem5::MemBackdoorReq &req, gem5::MemBackdoorPtr &backdoor)
gem5::AddrRangeList addrRanges
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
gem5::MemBackdoorPtr getBackdoor(tlm::tlm_generic_payload &trans)
gem5::Gem5ToTlmBridgeBaseParams Params
tlm_utils::simple_initiator_socket< Gem5ToTlmBridge< BITWIDTH >, BITWIDTH > socket
Gem5ToTlmBridge(const Params &p, const sc_core::sc_module_name &mn)
gem5::AddrRangeMap< gem5::MemBackdoorPtr > backdoorMap
void recvFunctionalSnoop(gem5::PacketPtr packet)
gem5::Tick recvAtomic(gem5::PacketPtr packet)
gem5::Tick recvAtomicBackdoor(gem5::PacketPtr pkt, gem5::MemBackdoorPtr &backdoor)
bool tryTiming(gem5::PacketPtr packet)
bool recvTimingSnoopResp(gem5::PacketPtr packet)
gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
bool recvTimingReq(gem5::PacketPtr packet)
sc_gem5::TlmInitiatorWrapper< BITWIDTH > wrapper
void recvFunctional(gem5::PacketPtr packet)
tlm::tlm_generic_payload * blockingResponse
A response which has been asked to retry by gem5 and so is blocking the response channel.
BridgeResponsePort bridgeResponsePort
unsigned char * get_dmi_ptr() const
sc_dt::uint64 get_start_address() const
sc_dt::uint64 get_end_address() const
bool is_read_allowed() const
bool is_write_allowed() const
void set_data_ptr(unsigned char *data)
T * set_auto_extension(T *ext)
void set_response_status(const tlm_response_status response_status)
void set_address(const sc_dt::uint64 address)
void set_command(const tlm_command command)
sc_dt::uint64 get_address() const
tlm_response_status get_response_status() const
void set_data_length(const unsigned int length)
unsigned int get_data_length() const
void set_streaming_width(const unsigned int streaming_width)
Addr start() const
Get the start address of the range.
Addr size() const
Get the size of the address range.
static const Priority Default_Pri
Default is zero for historical reasons.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 Arm Limited All rights reserved.
const PortID InvalidPortID
Tick curTick()
The universal simulation clock.
MemBackdoor * MemBackdoorPtr
uint64_t Tick
Tick count type.
const sc_time SC_ZERO_TIME
std::function< void(gem5::PacketPtr pkt, tlm::tlm_generic_payload &trans)> PacketToPayloadConversionStep
Gem5SystemC::MemoryManager mm
Instantiate a tlm memory manager that takes care about all the tlm transactions in the system.
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 TLM payload by copying all the relevant information to new payload.
static EventBase::Priority getPriorityOfTlmPhase(const tlm::tlm_phase &phase)
Helper function to help set priority of phase change events of tlm transactions.
void setPacketResponse(PacketPtr pkt, tlm::tlm_generic_payload &trans)
Overload hash function for BasicBlockRange type.
@ TLM_COMMAND_ERROR_RESPONSE
@ TLM_INCOMPLETE_RESPONSE
#define SC_REPORT_FATAL(msg_type, msg)
const std::string & name()