gem5  v20.1.0.0
gem5_to_tlm.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) 2015, University of Kaiserslautern
28  * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions are
33  * met:
34  *
35  * 1. Redistributions of source code must retain the above copyright notice,
36  * this list of conditions and the following disclaimer.
37  *
38  * 2. Redistributions in binary form must reproduce the above copyright
39  * notice, this list of conditions and the following disclaimer in the
40  * documentation and/or other materials provided with the distribution.
41  *
42  * 3. Neither the name of the copyright holder nor the names of its
43  * contributors may be used to endorse or promote products derived from
44  * this software without specific prior written permission.
45  *
46  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
48  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
50  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
51  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
52  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
53  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
54  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
55  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
56  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57  */
58 
59 #ifndef __SYSTEMC_TLM_BRIDGE_GEM5_TO_TLM_HH__
60 #define __SYSTEMC_TLM_BRIDGE_GEM5_TO_TLM_HH__
61 
62 #include <string>
63 
64 #include "mem/port.hh"
65 #include "params/Gem5ToTlmBridgeBase.hh"
66 #include "sim/system.hh"
72 
73 namespace sc_gem5
74 {
75 
77 
79 {
80  protected:
82 };
83 
84 template <unsigned int BITWIDTH>
86 {
87  private:
89  {
90  protected:
92 
94  getAddrRanges() const override
95  {
96  return bridge.getAddrRanges();
97  }
98  Tick
99  recvAtomic(PacketPtr pkt) override
100  {
101  return bridge.recvAtomic(pkt);
102  }
103  Tick
104  recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
105  {
106  return bridge.recvAtomicBackdoor(pkt, backdoor);
107  }
108  void
109  recvFunctional(PacketPtr pkt) override
110  {
111  return bridge.recvFunctional(pkt);
112  }
113  bool
114  recvTimingReq(PacketPtr pkt) override
115  {
116  return bridge.recvTimingReq(pkt);
117  }
118  bool
119  tryTiming(PacketPtr pkt) override
120  {
121  return bridge.tryTiming(pkt);
122  }
123  bool
125  {
126  return bridge.recvTimingSnoopResp(pkt);
127  }
128  void recvRespRetry() override { bridge.recvRespRetry(); }
129 
130  public:
131  BridgeResponsePort(const std::string &name_,
132  Gem5ToTlmBridge<BITWIDTH> &bridge_) :
133  ResponsePort(name_, nullptr), bridge(bridge_)
134  {}
135  };
136 
141 
143 
149 
155 
161 
163 
164  protected:
165  void pec(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase);
166 
169 
170  // The gem5 port interface.
171  Tick recvAtomic(PacketPtr packet);
173  void recvFunctional(PacketPtr packet);
174  bool recvTimingReq(PacketPtr packet);
175  bool tryTiming(PacketPtr packet);
176  bool recvTimingSnoopResp(PacketPtr packet);
177  void recvRespRetry();
178  void recvFunctionalSnoop(PacketPtr packet);
180 
181  // The TLM initiator interface.
183  tlm::tlm_phase &phase,
186  sc_dt::uint64 start_range, sc_dt::uint64 end_range);
187 
188  public:
189  ::Port &gem5_getPort(const std::string &if_name, int idx=-1) override;
190 
191  typedef Gem5ToTlmBridgeBaseParams Params;
193 
196  {
197  return socket;
198  }
199 
200  void before_end_of_elaboration() override;
201 };
202 
203 } // namespace sc_gem5
204 
205 #endif // __SYSTEMC_TLM_BRIDGE_GEM5_TO_TLM_HH__
sc_gem5::Gem5ToTlmBridge::Gem5ToTlmBridge
Gem5ToTlmBridge(Params *p, const sc_core::sc_module_name &mn)
Definition: gem5_to_tlm.cc:443
sc_gem5::Gem5ToTlmBridge::system
System * system
Definition: gem5_to_tlm.hh:142
ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:265
MemBackdoor
Definition: backdoor.hh:38
system.hh
sc_core::sc_module
Definition: sc_module.hh:97
tlm::tlm_phase
Definition: phase.hh:47
sc_gem5::Gem5ToTlmBridge::needToSendRequestRetry
bool needToSendRequestRetry
Did another gem5 request arrive while currently blocked? This variable is needed when a retry should ...
Definition: gem5_to_tlm.hh:154
sc_gem5::Gem5ToTlmBridge::before_end_of_elaboration
void before_end_of_elaboration() override
Definition: gem5_to_tlm.cc:469
sc_gem5::Gem5ToTlmBridge::recvAtomic
Tick recvAtomic(PacketPtr packet)
Definition: gem5_to_tlm.cc:206
sc_module_name.hh
sc_gem5::packet2payload
tlm::tlm_generic_payload * packet2payload(PacketPtr packet)
Convert a gem5 packet to a TLM payload by copying all the relevant information to new tlm payload.
Definition: gem5_to_tlm.cc:81
sc_core::sc_module::sc_module
sc_module()
Definition: sc_module.cc:256
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
sc_gem5::Gem5ToTlmBridge::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr packet)
Definition: gem5_to_tlm.cc:357
sc_gem5::Gem5ToTlmBridge::recvRespRetry
void recvRespRetry()
Definition: gem5_to_tlm.cc:374
sc_gem5::Gem5ToTlmBridge::blockingResponse
tlm::tlm_generic_payload * blockingResponse
A response which has been asked to retry by gem5 and so is blocking the response channel.
Definition: gem5_to_tlm.hh:160
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::bridge
Gem5ToTlmBridge< BITWIDTH > & bridge
Definition: gem5_to_tlm.hh:91
sc_gem5::Gem5ToTlmBridge::gem5_getPort
::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
Definition: gem5_to_tlm.cc:457
sc_gem5::Gem5ToTlmBridge::socket
tlm_utils::simple_initiator_socket< Gem5ToTlmBridge< BITWIDTH >, BITWIDTH > socket
Definition: gem5_to_tlm.hh:139
sc_dt::uint64
uint64_t uint64
Definition: sc_nbdefs.hh:206
System
Definition: system.hh:73
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort
Definition: gem5_to_tlm.hh:88
simple_initiator_socket.h
sc_core::sc_time
Definition: sc_time.hh:49
port.hh
AddrRangeMap
The AddrRangeMap uses an STL map to implement an interval tree for address decoding.
Definition: addr_range_map.hh:59
tlm_utils::simple_initiator_socket
Definition: simple_initiator_socket.h:173
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvRespRetry
void recvRespRetry() override
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Definition: gem5_to_tlm.hh:128
sc_core::sc_module_name
Definition: sc_module_name.hh:41
sc_gem5::Gem5ToTlmBridge::Params
Gem5ToTlmBridgeBaseParams Params
Definition: gem5_to_tlm.hh:191
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvAtomicBackdoor
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Default implementations.
Definition: gem5_to_tlm.hh:104
sc_gem5::Gem5ToTlmBridge
Definition: gem5_to_tlm.hh:85
sc_gem5::Gem5ToTlmBridge::nb_transport_bw
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
Definition: gem5_to_tlm.cc:415
sc_gem5::Gem5ToTlmBridge::backdoorMap
AddrRangeMap< MemBackdoorPtr > backdoorMap
Definition: gem5_to_tlm.hh:168
sc_module.hh
sc_gem5::Gem5ToTlmBridge::getSocket
tlm_utils::simple_initiator_socket< Gem5ToTlmBridge< BITWIDTH >, BITWIDTH > & getSocket()
Definition: gem5_to_tlm.hh:195
sc_gem5::Gem5ToTlmBridge::recvAtomicBackdoor
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor)
Definition: gem5_to_tlm.cc:231
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
Definition: gem5_to_tlm.hh:109
sc_gem5::Gem5ToTlmBridge::wrapper
sc_gem5::TlmInitiatorWrapper< BITWIDTH > wrapper
Definition: gem5_to_tlm.hh:140
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the peer.
Definition: gem5_to_tlm.hh:114
sc_gem5::Gem5ToTlmBridge::bridgeResponsePort
BridgeResponsePort bridgeResponsePort
Definition: gem5_to_tlm.hh:137
tlm::tlm_generic_payload
Definition: gp.hh:133
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: gem5_to_tlm.hh:94
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
sc_gem5::TlmInitiatorBaseWrapper
Definition: tlm_port_wrapper.hh:40
sc_gem5::Gem5ToTlmBridge::blockingRequest
tlm::tlm_generic_payload * blockingRequest
A transaction after BEGIN_REQ has been sent but before END_REQ, which is blocking the request channel...
Definition: gem5_to_tlm.hh:148
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
sc_gem5::Gem5ToTlmBridge::recvFunctional
void recvFunctional(PacketPtr packet)
Definition: gem5_to_tlm.cc:398
sc_gem5::Gem5ToTlmBridge::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr packet)
Definition: gem5_to_tlm.cc:264
sc_gem5::Gem5ToTlmBridge::recvTimingReq
bool recvTimingReq(PacketPtr packet)
Definition: gem5_to_tlm.cc:274
tlm::tlm_sync_enum
tlm_sync_enum
Definition: fw_bw_ifs.hh:48
sc_gem5::Port
Definition: port.hh:50
sc_gem5::Gem5ToTlmBridge::getBackdoor
MemBackdoorPtr getBackdoor(tlm::tlm_generic_payload &trans)
Definition: gem5_to_tlm.cc:174
tlm_port_wrapper.hh
sc_gem5::Gem5ToTlmBridge::invalidate_direct_mem_ptr
void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)
Definition: gem5_to_tlm.cc:426
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::tryTiming
bool tryTiming(PacketPtr pkt) override
Availability request from the peer.
Definition: gem5_to_tlm.hh:119
sc_gem5
Definition: sc_clock.cc:42
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< AddrRange >
sc_gem5::Gem5ToTlmBridge::getAddrRanges
AddrRangeList getAddrRanges() const
Definition: gem5_to_tlm.hh:179
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the peer.
Definition: gem5_to_tlm.hh:99
sc_gem5::Gem5ToTlmBridge::tryTiming
bool tryTiming(PacketPtr packet)
Definition: gem5_to_tlm.cc:367
sc_gem5::Gem5ToTlmBridge::addrRanges
AddrRangeList addrRanges
Definition: gem5_to_tlm.hh:162
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt) override
Receive a timing snoop response from the peer.
Definition: gem5_to_tlm.hh:124
sc_gem5::Gem5ToTlmBridge::pec
void pec(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
Definition: gem5_to_tlm.cc:118
sc_gem5::Gem5ToTlmBridgeBase
Definition: gem5_to_tlm.hh:78
sc_gem5::Gem5ToTlmBridge::BridgeResponsePort::BridgeResponsePort
BridgeResponsePort(const std::string &name_, Gem5ToTlmBridge< BITWIDTH > &bridge_)
Definition: gem5_to_tlm.hh:131
gp.hh

Generated on Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17