gem5  v22.1.0.0
outgoing_request_bridge.cc
Go to the documentation of this file.
1 // Copyright (c) 2021 The Regents of the University of California
2 // All rights reserved.
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 
28 
29 #include <cassert>
30 #include <iomanip>
31 #include <sstream>
32 
33 #include "base/trace.hh"
34 
35 namespace gem5
36 {
37 
39  const OutgoingRequestBridgeParams &params) :
40  SimObject(params),
41  outgoingPort(std::string(name()), this),
42  sstResponder(nullptr),
43  physicalAddressRanges(params.physical_address_ranges.begin(),
44  params.physical_address_ranges.end())
45 {
46 }
47 
49 {
50 }
51 
53 OutgoingRequestPort::OutgoingRequestPort(const std::string &name_,
54  OutgoingRequestBridge* owner_) :
55  ResponsePort(name_, owner_)
56 {
57  owner = owner_;
58 }
59 
62 {
63 }
64 
65 void
67 {
70 }
71 
72 Port &
73 OutgoingRequestBridge::getPort(const std::string &if_name, PortID idx)
74 {
75  return outgoingPort;
76 }
77 
80 {
81  return outgoingPort.getAddrRanges();
82 }
83 
86 {
87  return initData;
88 }
89 
90 void
92 {
93  sstResponder = responder;
94 }
95 
96 bool
98 {
99  return outgoingPort.sendTimingResp(pkt);
100 }
101 
102 void
104 {
106 }
107 
108 void
110 {
111  uint8_t* ptr = pkt->getPtr<uint8_t>();
112  uint64_t size = pkt->getSize();
113  std::vector<uint8_t> data(ptr, ptr+size);
114  initData.push_back(std::make_pair(pkt->getAddr(), data));
115 }
116 
117 Tick
120 {
121  assert(false && "OutgoingRequestPort::recvAtomic not implemented");
122  return Tick();
123 }
124 
125 void
128 {
129  owner->handleRecvFunctional(pkt);
130 }
131 
132 bool
135 {
136  owner->sstResponder->handleRecvTimingReq(pkt);
137  return true;
138 }
139 
140 void
143 {
144  owner->sstResponder->handleRecvRespRetry();
145 }
146 
150 {
151  return owner->physicalAddressRanges;
152 }
153 
154 }; // namespace gem5
const char data[]
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
OutgoingRequestPort(const std::string &name_, OutgoingRequestBridge *owner_)
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Port & getPort(const std::string &if_name, PortID idx)
Get a port with a given name and index.
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
SSTResponderInterface * sstResponder
OutgoingRequestBridge(const OutgoingRequestBridgeParams &params)
std::vector< std::pair< Addr, std::vector< uint8_t > > > initData
std::vector< std::pair< Addr, std::vector< uint8_t > > > getInitData() const
void setResponder(SSTResponderInterface *responder)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
T * getPtr()
get a pointer to the data ptr.
Definition: packet.hh:1212
Addr getAddr() const
Definition: packet.hh:805
unsigned getSize() const
Definition: packet.hh:815
Ports are used to interface objects to each other.
Definition: port.hh:62
bool isConnected() const
Is this port currently connected to a peer?
Definition: port.hh:133
A ResponsePort is a specialization of a port.
Definition: port.hh:270
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
Definition: port.hh:370
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the request port by calling its corresponding receiv...
Definition: port.hh:387
void sendRangeChange() const
Called by the owner to send a range change.
Definition: port.hh:296
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
STL vector class.
Definition: stl.hh:37
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
uint64_t Tick
Tick count type.
Definition: types.hh:58
Overload hash function for BasicBlockRange type.
Definition: misc.hh:2826
const std::string & name()
Definition: trace.cc:49

Generated on Wed Dec 21 2022 10:22:40 for gem5 by doxygen 1.9.1