gem5 v24.0.0.0
Loading...
Searching...
No Matches
amba_from_tlm_bridge.cc
Go to the documentation of this file.
1/*
2 * Copyright 2019 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
29
30#include "params/AmbaFromTlmBridge64.hh"
31#include "pv_userpayload_extension.h"
33
34namespace gem5
35{
36
37namespace fastmodel
38{
39
41 const AmbaFromTlmBridge64Params &params,
43 amba_pv::amba_pv_from_tlm_bridge<64>(name),
44 targetProxy("target_proxy"),
45 initiatorProxy("initiator_proxy"),
46 tlmWrapper(targetProxy, std::string(name) + ".tlm", -1),
47 ambaWrapper(amba_pv_m, std::string(name) + ".amba", -1)
48{
49 targetProxy.register_b_transport(this, &AmbaFromTlmBridge64::bTransport);
50 targetProxy.register_get_direct_mem_ptr(
52 targetProxy.register_transport_dbg(this, &AmbaFromTlmBridge64::transportDbg);
53 initiatorProxy.register_invalidate_direct_mem_ptr(
55 initiatorProxy(tlm_s);
56}
57
58Port &
59AmbaFromTlmBridge64::gem5_getPort(const std::string &if_name, int idx)
60{
61 if (if_name == "tlm") {
62 return tlmWrapper;
63 } else if (if_name == "amba") {
64 return ambaWrapper;
65 } else {
66 return amba_pv::amba_pv_from_tlm_bridge<64>::gem5_getPort(
67 if_name, idx);
68 }
69}
70
71void
72AmbaFromTlmBridge64::bTransport(amba_pv::amba_pv_transaction &trans,
74{
76 return initiatorProxy->b_transport(trans, t);
77}
78
79bool
80AmbaFromTlmBridge64::getDirectMemPtr(amba_pv::amba_pv_transaction &trans,
81 tlm::tlm_dmi &dmi_data)
82{
83 return initiatorProxy->get_direct_mem_ptr(trans, dmi_data);
84}
85
86unsigned int
87AmbaFromTlmBridge64::transportDbg(amba_pv::amba_pv_transaction &trans)
88{
90 return initiatorProxy->transport_dbg(trans);
91}
92
93void
95 sc_dt::uint64 end_range)
96{
97 targetProxy->invalidate_direct_mem_ptr(start_range, end_range);
98}
99
100void
101AmbaFromTlmBridge64::syncControlExtension(amba_pv::amba_pv_transaction &trans)
102{
103 Gem5SystemC::ControlExtension *control_ex = nullptr;
104 trans.get_extension(control_ex);
105 if (!control_ex) {
106 return;
107 }
108
109 amba_pv::amba_pv_extension *amba_ex = nullptr;
110 trans.get_extension(amba_ex);
111 if (!amba_ex) {
112 return;
113 }
114
115 amba_ex->set_privileged(control_ex->isPrivileged());
116 amba_ex->set_non_secure(!control_ex->isSecure());
117 amba_ex->set_instruction(control_ex->isInstruction());
118}
119
120} // namespace fastmodel
121} // namespace gem5
Ports are used to interface objects to each other.
Definition port.hh:62
AmbaFromTlmBridge64(const AmbaFromTlmBridge64Params &params, const sc_core::sc_module_name &name)
void bTransport(amba_pv::amba_pv_transaction &trans, sc_core::sc_time &t)
tlm_utils::simple_initiator_socket< AmbaFromTlmBridge64, 64, tlm::tlm_base_protocol_types > initiatorProxy
void syncControlExtension(amba_pv::amba_pv_transaction &trans)
void invalidateDirectMemPtr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
tlm_utils::simple_target_socket< AmbaFromTlmBridge64, 64, tlm::tlm_base_protocol_types > targetProxy
gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
bool getDirectMemPtr(amba_pv::amba_pv_transaction &trans, tlm::tlm_dmi &dmi_data)
sc_gem5::TlmTargetWrapper< 64 > tlmWrapper
unsigned int transportDbg(amba_pv::amba_pv_transaction &trans)
Bitfield< 5 > t
Definition misc_types.hh:71
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t uint64
Definition sc_nbdefs.hh:172
Overload hash function for BasicBlockRange type.
Definition binary32.hh:81
const std::string & name()
Definition trace.cc:48

Generated on Tue Jun 18 2024 16:23:55 for gem5 by doxygen 1.11.0