gem5  v20.1.0.0
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 "mem/port.hh"
62 #include "params/TlmToGem5BridgeBase.hh"
70 
71 namespace sc_gem5
72 {
73 
75 {
76  protected:
78 };
79 
81 
82 template <unsigned int BITWIDTH>
84 {
85  private:
87  {
90  };
91 
93  {
94  protected:
96 
97  bool
98  recvTimingResp(PacketPtr pkt) override
99  {
100  return bridge.recvTimingResp(pkt);
101  }
102  void recvReqRetry() override { bridge.recvReqRetry(); }
103  void recvRangeChange() override { bridge.recvRangeChange(); }
104 
105  public:
106  BridgeRequestPort(const std::string &name_,
107  TlmToGem5Bridge<BITWIDTH> &bridge_) :
108  RequestPort(name_, nullptr), bridge(bridge_)
109  {}
110  };
111 
113 
117 
119 
121 
126 
128 
131  sc_core::sc_time &delay);
132 
135 
136  void destroyPacket(PacketPtr pkt);
137 
139 
140  void invalidateDmi(const ::MemBackdoor &backdoor);
141 
142  protected:
143  // payload event call back
144  void peq_cb(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase);
145 
146  // The TLM target interface
148  tlm::tlm_phase &phase,
151  unsigned int transport_dbg(tlm::tlm_generic_payload &trans);
153  tlm::tlm_dmi &dmi_data);
154 
155  // Gem5 port interface.
156  bool recvTimingResp(PacketPtr pkt);
157  void recvReqRetry();
158  void recvRangeChange();
159 
160  public:
161  ::Port &gem5_getPort(const std::string &if_name, int idx=-1) override;
162 
163  typedef TlmToGem5BridgeBaseParams Params;
165 
168  {
169  return socket;
170  }
171 
172  void before_end_of_elaboration() override;
173 
175 };
176 
177 } // namespace sc_gem5
178 
179 #endif // __SYSTEMC_TLM_BRIDGE_TLM_TO_GEM5_HH__
sc_gem5::payload2packet
PacketPtr payload2packet(RequestorID _id, tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:70
sc_gem5::TlmToGem5Bridge::TlmSenderState::trans
tlm::tlm_generic_payload & trans
Definition: tlm_to_gem5.hh:88
sc_gem5::TlmToGem5Bridge::BridgeRequestPort::bridge
TlmToGem5Bridge< BITWIDTH > & bridge
Definition: tlm_to_gem5.hh:95
sc_gem5::TlmToGem5Bridge::recvRangeChange
void recvRangeChange()
Definition: tlm_to_gem5.cc:460
sc_core::sc_module
Definition: sc_module.hh:97
sc_gem5::TlmToGem5Bridge::BridgeRequestPort
Definition: tlm_to_gem5.hh:92
tlm::tlm_phase
Definition: phase.hh:47
sc_gem5::TlmToGem5Bridge::pendingRequest
tlm::tlm_generic_payload * pendingRequest
Definition: tlm_to_gem5.hh:115
peq_with_cb_and_phase.h
sc_gem5::TlmToGem5Bridge::peq
tlm_utils::peq_with_cb_and_phase< TlmToGem5Bridge< BITWIDTH > > peq
Definition: tlm_to_gem5.hh:112
sc_gem5::TlmToGem5Bridge::pendingPacket
PacketPtr pendingPacket
Definition: tlm_to_gem5.hh:116
sc_module_name.hh
sc_gem5::TlmToGem5Bridge::invalidateDmi
void invalidateDmi(const ::MemBackdoor &backdoor)
Definition: tlm_to_gem5.cc:219
tlm::tlm_dmi
Definition: dmi.hh:46
sc_ext.hh
sc_core::sc_module::sc_module
sc_module()
Definition: sc_module.cc:256
sc_gem5::TlmToGem5Bridge::_id
const RequestorID _id
Definition: tlm_to_gem5.hh:174
sc_gem5::TlmToGem5Bridge::BridgeRequestPort::BridgeRequestPort
BridgeRequestPort(const std::string &name_, TlmToGem5Bridge< BITWIDTH > &bridge_)
Definition: tlm_to_gem5.hh:106
sc_gem5::TlmToGem5Bridge::TlmToGem5Bridge
TlmToGem5Bridge(Params *p, const sc_core::sc_module_name &mn)
Definition: tlm_to_gem5.cc:479
sc_gem5::TlmToGem5Bridge::bmp
BridgeRequestPort bmp
Definition: tlm_to_gem5.hh:122
sc_gem5::TlmToGem5Bridge::Params
TlmToGem5BridgeBaseParams Params
Definition: tlm_to_gem5.hh:163
sc_gem5::TlmToGem5Bridge::recvReqRetry
void recvReqRetry()
Definition: tlm_to_gem5.cc:433
sc_gem5::TlmToGem5Bridge::responseInProgress
bool responseInProgress
Definition: tlm_to_gem5.hh:120
sc_gem5::TlmToGem5Bridge::BridgeRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
Definition: tlm_to_gem5.hh:98
sc_gem5::TlmToGem5Bridge::nb_transport_fw
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_core::sc_time &t)
Definition: tlm_to_gem5.cc:244
RequestorID
uint16_t RequestorID
Definition: request.hh:85
sc_gem5::TlmToGem5Bridge::destroyPacket
void destroyPacket(PacketPtr pkt)
Definition: tlm_to_gem5.cc:200
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
sc_gem5::TlmToGem5BridgeBase
Definition: tlm_to_gem5.hh:74
System
Definition: system.hh:73
sc_gem5::TlmToGem5Bridge::before_end_of_elaboration
void before_end_of_elaboration() override
Definition: tlm_to_gem5.cc:494
sc_gem5::TlmToGem5Bridge::wrapper
sc_gem5::TlmTargetWrapper< BITWIDTH > wrapper
Definition: tlm_to_gem5.hh:125
sc_core::sc_time
Definition: sc_time.hh:49
sc_gem5::TlmToGem5Bridge::sendEndReq
void sendEndReq(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:104
sc_gem5::TlmToGem5Bridge::TlmSenderState
Definition: tlm_to_gem5.hh:86
port.hh
sc_core::sc_module_name
Definition: sc_module_name.hh:41
sc_gem5::TlmToGem5Bridge::getSocket
tlm_utils::simple_target_socket< TlmToGem5Bridge< BITWIDTH >, BITWIDTH > & getSocket()
Definition: tlm_to_gem5.hh:167
sc_gem5::TlmToGem5Bridge::sendBeginResp
void sendBeginResp(tlm::tlm_generic_payload &trans, sc_core::sc_time &delay)
Definition: tlm_to_gem5.cc:116
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
sc_gem5::TlmToGem5Bridge::checkTransaction
void checkTransaction(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:207
tlm_utils::simple_target_socket
Definition: simple_target_socket.h:605
sc_gem5::TlmToGem5Bridge::gem5_getPort
::Port & gem5_getPort(const std::string &if_name, int idx=-1) override
Definition: tlm_to_gem5.cc:468
tlm_utils::peq_with_cb_and_phase
An event queue that can contain any number of pending notifications.
Definition: peq_with_cb_and_phase.h:152
sc_gem5::TlmToGem5Bridge::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: tlm_to_gem5.cc:385
sc_module.hh
sc_gem5::TlmToGem5Bridge::system
System * system
Definition: tlm_to_gem5.hh:127
sc_gem5::TlmToGem5Bridge::handleBeginReq
void handleBeginReq(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:139
sc_gem5::TlmToGem5Bridge::b_transport
void b_transport(tlm::tlm_generic_payload &trans, sc_core::sc_time &t)
Definition: tlm_to_gem5.cc:270
sc_gem5::TlmToGem5Bridge::TlmSenderState::TlmSenderState
TlmSenderState(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.hh:89
sc_gem5::TlmToGem5Bridge::BridgeRequestPort::recvReqRetry
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: tlm_to_gem5.hh:102
tlm::tlm_generic_payload
Definition: gp.hh:133
sc_gem5::TlmToGem5Bridge
Definition: tlm_to_gem5.hh:83
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
tlm::tlm_sync_enum
tlm_sync_enum
Definition: fw_bw_ifs.hh:48
sc_gem5::Port
Definition: port.hh:50
tlm_port_wrapper.hh
sc_gem5::TlmToGem5Bridge::handleEndResp
void handleEndResp(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:184
sc_gem5
Definition: sc_clock.cc:42
sc_gem5::TlmToGem5Bridge::transport_dbg
unsigned int transport_dbg(tlm::tlm_generic_payload &trans)
Definition: tlm_to_gem5.cc:310
sc_gem5::TlmToGem5Bridge::socket
tlm_utils::simple_target_socket< TlmToGem5Bridge< BITWIDTH >, BITWIDTH > socket
Definition: tlm_to_gem5.hh:124
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
sc_gem5::TlmToGem5Bridge::BridgeRequestPort::recvRangeChange
void recvRangeChange() override
Called to receive an address range change from the peer response port.
Definition: tlm_to_gem5.hh:103
sc_gem5::TlmToGem5Bridge::needToSendRetry
bool needToSendRetry
Definition: tlm_to_gem5.hh:118
sc_gem5::TlmTargetBaseWrapper
Definition: tlm_port_wrapper.hh:44
sc_gem5::TlmToGem5Bridge::get_direct_mem_ptr
bool get_direct_mem_ptr(tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
Definition: tlm_to_gem5.cc:333
sc_gem5::TlmToGem5Bridge::peq_cb
void peq_cb(tlm::tlm_generic_payload &trans, const tlm::tlm_phase &phase)
Definition: tlm_to_gem5.cc:227
simple_target_socket.h
gp.hh
sc_gem5::TlmToGem5Bridge::waitForRetry
bool waitForRetry
Definition: tlm_to_gem5.hh:114

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