gem5  v20.1.0.0
addr_mapper.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __MEM_ADDR_MAPPER_HH__
39 #define __MEM_ADDR_MAPPER_HH__
40 
41 #include "mem/port.hh"
42 #include "params/AddrMapper.hh"
43 #include "params/RangeAddrMapper.hh"
44 #include "sim/sim_object.hh"
45 
55 class AddrMapper : public SimObject
56 {
57 
58  public:
59 
60  AddrMapper(const AddrMapperParams* params);
61 
62  virtual ~AddrMapper() { }
63 
64  Port &getPort(const std::string &if_name,
65  PortID idx=InvalidPortID) override;
66 
67  void init() override;
68 
69  protected:
70 
78  virtual Addr remapAddr(Addr addr) const = 0;
79 
81  {
82 
83  public:
84 
90  AddrMapperSenderState(Addr _origAddr) : origAddr(_origAddr)
91  { }
92 
95 
98 
99  };
100 
102  {
103 
104  public:
105 
106  MapperRequestPort(const std::string& _name, AddrMapper& _mapper)
107  : RequestPort(_name, &_mapper), mapper(_mapper)
108  { }
109 
110  protected:
111 
113  {
115  }
116 
118  {
119  return mapper.recvAtomicSnoop(pkt);
120  }
121 
123  {
124  return mapper.recvTimingResp(pkt);
125  }
126 
128  {
130  }
131 
133  {
135  }
136 
137  bool isSnooping() const
138  {
139  return mapper.isSnooping();
140  }
141 
143  {
145  }
146 
147  private:
148 
150 
151  };
152 
155 
157  {
158 
159  public:
160 
161  MapperResponsePort(const std::string& _name, AddrMapper& _mapper)
162  : ResponsePort(_name, &_mapper), mapper(_mapper)
163  { }
164 
165  protected:
166 
168  {
169  mapper.recvFunctional(pkt);
170  }
171 
173  {
174  return mapper.recvAtomic(pkt);
175  }
176 
178  {
179  return mapper.recvTimingReq(pkt);
180  }
181 
183  {
184  return mapper.recvTimingSnoopResp(pkt);
185  }
186 
188  {
189  return mapper.getAddrRanges();
190  }
191 
193  {
195  }
196 
197  private:
198 
200 
201  };
202 
205 
206  void recvFunctional(PacketPtr pkt);
207 
208  void recvFunctionalSnoop(PacketPtr pkt);
209 
211 
213 
214  bool recvTimingReq(PacketPtr pkt);
215 
216  bool recvTimingResp(PacketPtr pkt);
217 
218  void recvTimingSnoopReq(PacketPtr pkt);
219 
220  bool recvTimingSnoopResp(PacketPtr pkt);
221 
222  virtual AddrRangeList getAddrRanges() const = 0;
223 
224  bool isSnooping() const;
225 
226  void recvReqRetry();
227 
228  void recvRespRetry();
229 
230  void recvRangeChange();
231 };
232 
240 {
241 
242  public:
243 
244  RangeAddrMapper(const RangeAddrMapperParams* p);
245 
247 
249 
250  protected:
251 
258 
264 
265  Addr remapAddr(Addr addr) const;
266 
267 };
268 
269 #endif //__MEM_ADDR_MAPPER_HH__
AddrMapper::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Definition: addr_mapper.cc:172
RangeAddrMapper::remappedRanges
std::vector< AddrRange > remappedRanges
This contains a list of ranges that addresses should be remapped to.
Definition: addr_mapper.hh:263
ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:265
AddrMapper::MapperResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: addr_mapper.hh:167
RangeAddrMapper::remapAddr
Addr remapAddr(Addr addr) const
This function does the actual remapping of one address to another.
Definition: addr_mapper.cc:226
AddrMapper::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Definition: addr_mapper.cc:105
AddrMapper::MapperRequestPort::mapper
AddrMapper & mapper
Definition: addr_mapper.hh:149
AddrMapper::MapperResponsePort::recvTimingSnoopResp
bool recvTimingSnoopResp(PacketPtr pkt)
Receive a timing snoop response from the peer.
Definition: addr_mapper.hh:182
AddrMapper::remapAddr
virtual Addr remapAddr(Addr addr) const =0
This function does the actual remapping of one address to another.
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
AddrMapper::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: addr_mapper.cc:133
AddrMapper::MapperRequestPort::isSnooping
bool isSnooping() const
Determine if this request port is snooping or not.
Definition: addr_mapper.hh:137
AddrMapper::MapperResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: addr_mapper.hh:172
AddrMapper::MapperResponsePort
Definition: addr_mapper.hh:156
AddrMapper::AddrMapperSenderState::~AddrMapperSenderState
~AddrMapperSenderState()
Destructor.
Definition: addr_mapper.hh:94
AddrMapper::MapperRequestPort::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition: addr_mapper.hh:127
AddrMapper::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Definition: addr_mapper.cc:76
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
AddrMapper
An address mapper changes the packet addresses in going from the response port side of the mapper to ...
Definition: addr_mapper.hh:55
AddrMapper::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: addr_mapper.cc:48
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
AddrMapper::MapperRequestPort::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition: addr_mapper.hh:117
AddrMapper::MapperRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: addr_mapper.hh:122
RangeAddrMapper::originalRanges
std::vector< AddrRange > originalRanges
This contains a list of ranges the should be remapped.
Definition: addr_mapper.hh:257
std::vector< AddrRange >
AddrMapper::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Definition: addr_mapper.cc:85
AddrMapper::MapperResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: addr_mapper.hh:187
AddrMapper::MapperRequestPort::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition: addr_mapper.hh:112
AddrMapper::recvReqRetry
void recvReqRetry()
Definition: addr_mapper.cc:186
AddrMapper::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Definition: addr_mapper.cc:95
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
AddrMapper::MapperRequestPort
Definition: addr_mapper.hh:101
AddrMapper::isSnooping
bool isSnooping() const
Definition: addr_mapper.cc:178
AddrMapper::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Definition: addr_mapper.cc:166
sim_object.hh
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
AddrMapper::MapperResponsePort::MapperResponsePort
MapperResponsePort(const std::string &_name, AddrMapper &_mapper)
Definition: addr_mapper.hh:161
port.hh
RangeAddrMapper::getAddrRanges
AddrRangeList getAddrRanges() const
Definition: addr_mapper.cc:239
AddrMapper::MapperRequestPort::recvReqRetry
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: addr_mapper.hh:142
AddrMapper::recvRespRetry
void recvRespRetry()
Definition: addr_mapper.cc:192
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
AddrMapper::MapperResponsePort::mapper
AddrMapper & mapper
Definition: addr_mapper.hh:199
AddrMapper::recvRangeChange
void recvRangeChange()
Definition: addr_mapper.cc:198
SimObject::params
const Params * params() const
Definition: sim_object.hh:119
AddrMapper::AddrMapper
AddrMapper(const AddrMapperParams *params)
Definition: addr_mapper.cc:40
RangeAddrMapper::~RangeAddrMapper
~RangeAddrMapper()
Definition: addr_mapper.hh:246
AddrMapper::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: addr_mapper.cc:55
AddrMapper::cpuSidePort
MapperResponsePort cpuSidePort
Instance of response port, i.e.
Definition: addr_mapper.hh:204
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
addr
ip6_addr_t addr
Definition: inet.hh:423
AddrMapper::~AddrMapper
virtual ~AddrMapper()
Definition: addr_mapper.hh:62
AddrMapper::memSidePort
MapperRequestPort memSidePort
Instance of request port, facing the memory side.
Definition: addr_mapper.hh:154
AddrMapper::getAddrRanges
virtual AddrRangeList getAddrRanges() const =0
AddrMapper::MapperRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: addr_mapper.hh:132
RangeAddrMapper
Range address mapper that maps a set of original ranges to a set of remapped ranges,...
Definition: addr_mapper.hh:239
AddrMapper::MapperRequestPort::MapperRequestPort
MapperRequestPort(const std::string &_name, AddrMapper &_mapper)
Definition: addr_mapper.hh:106
RangeAddrMapper::RangeAddrMapper
RangeAddrMapper(const RangeAddrMapperParams *p)
Definition: addr_mapper.cc:203
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< AddrRange >
AddrMapper::recvFunctional
void recvFunctional(PacketPtr pkt)
Definition: addr_mapper.cc:67
AddrMapper::AddrMapperSenderState::origAddr
Addr origAddr
The original address the packet was destined for.
Definition: addr_mapper.hh:97
AddrMapper::MapperResponsePort::recvRespRetry
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Definition: addr_mapper.hh:192
AddrMapper::AddrMapperSenderState
Definition: addr_mapper.hh:80
AddrMapper::MapperResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: addr_mapper.hh:177
AddrMapper::AddrMapperSenderState::AddrMapperSenderState
AddrMapperSenderState(Addr _origAddr)
Construct a new sender state to remember the original address.
Definition: addr_mapper.hh:90
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

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