31#include "params/AmbaToTlmBridge64.hh"
32#include "pv/FarAtomicService.h"
33#include "pv_userpayload_extension.h"
47uint8_t dummy_buffer[64] = {};
49struct FarAtomicOpFunctor :
public AtomicOpFunctor
51 FarAtomicOpFunctor(far_atomic::FarAtomic *_fa) :
fa(_fa) {}
54 operator() (uint8_t *
p)
override
56 fa->serviceWasFound();
57 fa->doAtomicOperation(
p);
63 return new FarAtomicOpFunctor(*
this);
66 far_atomic::FarAtomic *
fa;
76 amba_pv::amba_pv_to_tlm_bridge<64>(
name),
77 targetProxy(
"target_proxy"),
78 initiatorProxy(
"initiator_proxy"),
79 tlmWrapper(initiatorProxy,
std::string(
name) +
".tlm", -1),
80 ambaWrapper(amba_pv_s,
std::string(
name) +
".amba", -1),
81 setStreamId(params.set_stream_id)
97 else if (if_name ==
"amba")
100 return amba_pv::amba_pv_to_tlm_bridge<64>::gem5_getPort(if_name, idx);
129 targetProxy->invalidate_direct_mem_ptr(start_range, end_range);
134 amba_pv::amba_pv_transaction &trans)
137 trans.get_extension(atomic_ex);
141 pv_userpayload_extension *user_ex =
nullptr;
142 trans.get_extension(user_ex);
146 pv::UserPayloadBase *upb = user_ex->get_user_payload();
147 uint32_t appid = upb->get_appID();
148 if (appid != pv::UserPayloadBase::SERVICE_REQUEST)
152 far_atomic::FarAtomic *
fa =
static_cast<far_atomic::FarAtomic *
>(
158 fa->getDataValueSizeInBytes() >
sizeof(dummy_buffer),
159 "atomic operation(%d) is larger than dummy buffer(%d)",
160 fa->getDataValueSizeInBytes(),
sizeof(dummy_buffer));
161 trans.set_data_length(
fa->getDataValueSizeInBytes());
162 trans.set_data_ptr(dummy_buffer);
167 std::make_shared<FarAtomicOpFunctor>(
fa),
false);
169 trans.set_auto_extension(atomic_ex);
171 trans.set_extension(atomic_ex);
178 trans.get_extension(control_ex);
183 amba_pv::amba_pv_extension *amba_ex =
nullptr;
184 trans.get_extension(amba_ex);
192 control_ex->
setSecure(!amba_ex->is_non_secure());
199 if (trans.has_mm()) {
200 trans.set_auto_extension(control_ex);
202 trans.set_extension(control_ex);
far_atomic::FarAtomic * fa
void setPrivileged(bool p)
void setStreamId(std::optional< uint32_t > s)
void setInstruction(bool i)
Ports are used to interface objects to each other.
tlm_utils::simple_target_socket< AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types > targetProxy
void setupControlExtension(amba_pv::amba_pv_transaction &trans)
gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
tlm_utils::simple_initiator_socket< AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types > initiatorProxy
unsigned int transportDbg(amba_pv::amba_pv_transaction &trans)
sc_gem5::TlmInitiatorWrapper< 64 > tlmWrapper
AmbaToTlmBridge64(const AmbaToTlmBridge64Params ¶ms, const sc_core::sc_module_name &name)
void bTransport(amba_pv::amba_pv_transaction &trans, sc_core::sc_time &t)
void maybeSetupAtomicExtension(amba_pv::amba_pv_transaction &trans)
bool getDirectMemPtr(amba_pv::amba_pv_transaction &trans, tlm::tlm_dmi &dmi_data)
void invalidateDirectMemPtr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Overload hash function for BasicBlockRange type.
const std::string & name()