fastmodel: add amba_to_tlm_bridge hooks before going to gem5
To handle atomic transaction, we need to convert amba far atomic extension into gem5 atomic extension before going to gem5 world. This cl prepares hooks that enables us to do the conversion. Change-Id: I1b5a99c38f619689bd318253356928091a4fdb02 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44645 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -32,11 +32,21 @@
|
||||
namespace FastModel
|
||||
{
|
||||
|
||||
AmbaToTlmBridge64::AmbaToTlmBridge64(const char *name) :
|
||||
AmbaToTlmBridge64::AmbaToTlmBridge64(const sc_core::sc_module_name& name) :
|
||||
amba_pv::amba_pv_to_tlm_bridge<64>(name),
|
||||
tlmWrapper(tlm_m, std::string(name) + ".tlm", -1),
|
||||
targetProxy("target_proxy"),
|
||||
initiatorProxy("initiator_proxy"),
|
||||
tlmWrapper(initiatorProxy, std::string(name) + ".tlm", -1),
|
||||
ambaWrapper(amba_pv_s, std::string(name) + ".amba", -1)
|
||||
{}
|
||||
{
|
||||
targetProxy.register_b_transport(this, &AmbaToTlmBridge64::bTransport);
|
||||
targetProxy.register_get_direct_mem_ptr(
|
||||
this, &AmbaToTlmBridge64::getDirectMemPtr);
|
||||
targetProxy.register_transport_dbg(this, &AmbaToTlmBridge64::transportDbg);
|
||||
initiatorProxy.register_invalidate_direct_mem_ptr(
|
||||
this, &AmbaToTlmBridge64::invalidateDirectMemPtr);
|
||||
tlm_m(targetProxy);
|
||||
}
|
||||
|
||||
Port &
|
||||
AmbaToTlmBridge64::gem5_getPort(const std::string &if_name, int idx)
|
||||
@@ -49,6 +59,33 @@ AmbaToTlmBridge64::gem5_getPort(const std::string &if_name, int idx)
|
||||
return amba_pv::amba_pv_to_tlm_bridge<64>::gem5_getPort(if_name, idx);
|
||||
}
|
||||
|
||||
void
|
||||
AmbaToTlmBridge64::bTransport(amba_pv::amba_pv_transaction &trans,
|
||||
sc_core::sc_time &t)
|
||||
{
|
||||
return initiatorProxy->b_transport(trans, t);
|
||||
}
|
||||
|
||||
bool
|
||||
AmbaToTlmBridge64::getDirectMemPtr(amba_pv::amba_pv_transaction &trans,
|
||||
tlm::tlm_dmi &dmi_data)
|
||||
{
|
||||
return initiatorProxy->get_direct_mem_ptr(trans, dmi_data);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
AmbaToTlmBridge64::transportDbg(amba_pv::amba_pv_transaction &trans)
|
||||
{
|
||||
return initiatorProxy->transport_dbg(trans);
|
||||
}
|
||||
|
||||
void
|
||||
AmbaToTlmBridge64::invalidateDirectMemPtr(sc_dt::uint64 start_range,
|
||||
sc_dt::uint64 end_range)
|
||||
{
|
||||
targetProxy->invalidate_direct_mem_ptr(start_range, end_range);
|
||||
}
|
||||
|
||||
} // namespace FastModel
|
||||
|
||||
FastModel::AmbaToTlmBridge64 *
|
||||
|
||||
@@ -43,11 +43,22 @@ namespace FastModel
|
||||
class AmbaToTlmBridge64 : public amba_pv::amba_pv_to_tlm_bridge<64>
|
||||
{
|
||||
public:
|
||||
AmbaToTlmBridge64(const char *name);
|
||||
AmbaToTlmBridge64(const sc_core::sc_module_name &name);
|
||||
|
||||
::Port &gem5_getPort(const std::string &if_name, int idx=-1) override;
|
||||
|
||||
private:
|
||||
void bTransport(amba_pv::amba_pv_transaction &trans, sc_core::sc_time &t);
|
||||
bool getDirectMemPtr(amba_pv::amba_pv_transaction &trans,
|
||||
tlm::tlm_dmi &dmi_data);
|
||||
unsigned int transportDbg(amba_pv::amba_pv_transaction &trans);
|
||||
void invalidateDirectMemPtr(sc_dt::uint64 start_range,
|
||||
sc_dt::uint64 end_range);
|
||||
|
||||
tlm_utils::simple_target_socket<
|
||||
AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types> targetProxy;
|
||||
tlm_utils::simple_initiator_socket<
|
||||
AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types> initiatorProxy;
|
||||
sc_gem5::TlmInitiatorWrapper<64> tlmWrapper;
|
||||
AmbaTarget ambaWrapper;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user