gem5 v24.0.0.0
Loading...
Searching...
No Matches
tlm_to_gem5.hh
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 * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
28 * All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions are
32 * met:
33 *
34 * 1. Redistributions of source code must retain the above copyright notice,
35 * this list of conditions and the following disclaimer.
36 *
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 *
41 * 3. Neither the name of the copyright holder nor the names of its
42 * contributors may be used to endorse or promote products derived from
43 * this software without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
47 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
49 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
50 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
52 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
53 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
54 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
55 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 */
57
58#ifndef __SYSTEMC_TLM_BRIDGE_TLM_TO_GEM5_HH__
59#define __SYSTEMC_TLM_BRIDGE_TLM_TO_GEM5_HH__
60
61#include <functional>
62#include <unordered_set>
63#include <utility>
64
65#include "mem/port.hh"
66#include "params/TlmToGem5BridgeBase.hh"
74
75namespace sc_gem5
76{
77
79 std::function<void(gem5::PacketPtr pkt, tlm::tlm_generic_payload &trans)>;
80
82
85
87{
88 protected:
90};
91
92template <unsigned int BITWIDTH>
94{
95 private:
97 {
98 protected:
100
101 bool
103 {
104 return bridge.recvTimingResp(pkt);
105 }
106 void recvReqRetry() override { bridge.recvReqRetry(); }
107 void recvRangeChange() override { bridge.recvRangeChange(); }
108
109 public:
110 BridgeRequestPort(const std::string &name_,
111 TlmToGem5Bridge<BITWIDTH> &bridge_) :
112 RequestPort(name_), bridge(bridge_)
113 {}
114 };
115
117
121
123
125
126 std::unordered_set<gem5::MemBackdoorPtr> requestedBackdoors;
127
132
134
137 sc_core::sc_time &delay);
138
141
143
144 void invalidateDmi(const gem5::MemBackdoor &backdoor);
145
146 void cacheBackdoor(gem5::MemBackdoorPtr backdoor);
147
148 protected:
149 // payload event call back
150 void peq_cb(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase);
151
152 // The TLM target interface
154 tlm::tlm_phase &phase,
157 unsigned int transport_dbg(tlm::tlm_generic_payload &trans);
159 tlm::tlm_dmi &dmi_data);
160
161 // Gem5 port interface.
163 void recvReqRetry();
164 void recvRangeChange();
165
166 public:
167 gem5::Port &gem5_getPort(const std::string &if_name, int idx=-1) override;
168
169 typedef gem5::TlmToGem5BridgeBaseParams Params;
171
174 {
175 return socket;
176 }
177
178 void before_end_of_elaboration() override;
179
181};
182
183} // namespace sc_gem5
184
185#endif // __SYSTEMC_TLM_BRIDGE_TLM_TO_GEM5_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
RequestPort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Request port.
Definition port.cc:125
BridgeRequestPort(const std::string &name_, TlmToGem5Bridge< BITWIDTH > &bridge_)
bool recvTimingResp(gem5::PacketPtr pkt) override
Receive a timing response from the peer.
TlmToGem5Bridge< BITWIDTH > & bridge
void recvRangeChange() override
Called to receive an address range change from the peer response port.
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
std::unordered_set< gem5::MemBackdoorPtr > requestedBackdoors
void destroyPacket(gem5::PacketPtr pkt)
void handleEndResp(tlm::tlm_generic_payload &trans)
bool get_direct_mem_ptr(tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
void sendBeginResp(tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
void invalidateDmi(const gem5::MemBackdoor &backdoor)
BridgeRequestPort bmp
void b_transport(tlm::tlm_generic_payload &trans, sc_core::sc_time &t)
tlm::tlm_generic_payload * pendingRequest
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
void cacheBackdoor(gem5::MemBackdoorPtr backdoor)
sc_gem5::TlmTargetWrapper< BITWIDTH > wrapper
unsigned int transport_dbg(tlm::tlm_generic_payload &trans)
void sendEndReq(tlm::tlm_generic_payload &trans)
void handleBeginReq(tlm::tlm_generic_payload &trans)
gem5::PacketPtr pendingPacket
gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
const gem5::RequestorID _id
tlm_utils::peq_with_cb_and_phase< TlmToGem5Bridge< BITWIDTH > > peq
void peq_cb(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
TlmToGem5Bridge(const Params &p, const sc_core::sc_module_name &mn)
void before_end_of_elaboration() override
bool recvTimingResp(gem5::PacketPtr pkt)
tlm_utils::simple_target_socket< TlmToGem5Bridge< BITWIDTH >, BITWIDTH > & getSocket()
gem5::TlmToGem5BridgeBaseParams Params
tlm_utils::simple_target_socket< TlmToGem5Bridge< BITWIDTH >, BITWIDTH > socket
STL pair class.
Definition stl.hh:58
An event queue that can contain any number of pending notifications.
Port Object Declaration.
uint16_t RequestorID
Definition request.hh:95
void addPayloadToPacketConversionStep(PayloadToPacketConversionStep step)
Notify the Tlm2Gem5 bridge that we need an extra step to properly convert a tlm payload to gem5 packe...
std::function< void(gem5::PacketPtr pkt, tlm::tlm_generic_payload &trans)> PayloadToPacketConversionStep
std::pair< PacketPtr, bool > payload2packet(RequestorID _id, tlm::tlm_generic_payload &trans)
Convert a TLM payload to gem5 packet by copying all the relevant information to new packet.
tlm_sync_enum
Definition fw_bw_ifs.hh:31

Generated on Tue Jun 18 2024 16:24:07 for gem5 by doxygen 1.11.0