gem5  v22.0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
memory_manager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __DEV_AMDGPU_MEMORY_MANAGER_HH__
33 #define __DEV_AMDGPU_MEMORY_MANAGER_HH__
34 
35 #include <deque>
36 
37 #include "base/callback.hh"
38 #include "mem/port.hh"
39 #include "params/AMDGPUMemoryManager.hh"
40 #include "sim/clocked_object.hh"
41 
42 namespace gem5
43 {
44 
46 {
47  class GPUMemPort : public MasterPort
48  {
49  public:
50  GPUMemPort(const std::string &_name, AMDGPUMemoryManager *_gpuMemMgr)
51  : MasterPort(_name, _gpuMemMgr)
52  {
53  }
54 
55  bool recvTimingResp(PacketPtr pkt) override;
56  void recvReqRetry() override;
57 
59  {
60  SenderState(Event *callback, Addr addr)
61  : _callback(callback), _addr(addr)
62  {}
63 
66  };
67 
69  };
70 
72  const int cacheLineSize;
74 
75  public:
76  AMDGPUMemoryManager(const AMDGPUMemoryManagerParams &p);
78 
89  void writeRequest(Addr addr, uint8_t *data, int size,
90  Request::Flags flag = 0, Event *callback = nullptr);
91 
99 
100  Port &
101  getPort(const std::string &if_name, PortID idx) override
102  {
103  if (if_name == "port") {
104  return _gpuMemPort;
105  } else {
106  return ClockedObject::getPort(if_name, idx);
107  }
108  }
109 };
110 
111 } // namespace gem5
112 
113 #endif // __DEV_AMDGPU_MEMORY_MANAGER_HH__
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::AMDGPUMemoryManager::GPUMemPort::SenderState::_addr
Addr _addr
Definition: memory_manager.hh:65
gem5::SimObject::getPort
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Definition: sim_object.cc:126
gem5::AMDGPUMemoryManager::GPUMemPort::SenderState::_callback
Event * _callback
Definition: memory_manager.hh:64
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::AMDGPUMemoryManager::AMDGPUMemoryManager
AMDGPUMemoryManager(const AMDGPUMemoryManagerParams &p)
Definition: memory_manager.cc:45
gem5::AMDGPUMemoryManager::GPUMemPort::recvReqRetry
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: memory_manager.cc:106
gem5::AMDGPUMemoryManager::getPort
Port & getPort(const std::string &if_name, PortID idx) override
Get a port with a given name and index.
Definition: memory_manager.hh:101
gem5::AMDGPUMemoryManager::GPUMemPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
Definition: memory_manager.cc:86
gem5::Flags< FlagsType >
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::AMDGPUMemoryManager::GPUMemPort::SenderState::SenderState
SenderState(Event *callback, Addr addr)
Definition: memory_manager.hh:60
gem5::AMDGPUMemoryManager::_requestorId
const RequestorID _requestorId
Definition: memory_manager.hh:73
gem5::Event
Definition: eventq.hh:251
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:291
gem5::AMDGPUMemoryManager::GPUMemPort::retries
std::deque< PacketPtr > retries
Definition: memory_manager.hh:68
gem5::MasterPort
Definition: port.hh:251
port.hh
gem5::AMDGPUMemoryManager
Definition: memory_manager.hh:45
gem5::AMDGPUMemoryManager::GPUMemPort
Definition: memory_manager.hh:47
gem5::Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:465
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::AMDGPUMemoryManager::_gpuMemPort
GPUMemPort _gpuMemPort
Definition: memory_manager.hh:71
gem5::AMDGPUMemoryManager::getRequestorID
RequestorID getRequestorID() const
Get the requestorID for the memory manager.
Definition: memory_manager.hh:98
gem5::AMDGPUMemoryManager::writeRequest
void writeRequest(Addr addr, uint8_t *data, int size, Request::Flags flag=0, Event *callback=nullptr)
Write size amount of data to device memory at addr using flags and callback.
Definition: memory_manager.cc:53
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
clocked_object.hh
std::deque
STL deque class.
Definition: stl.hh:44
gem5::AMDGPUMemoryManager::~AMDGPUMemoryManager
~AMDGPUMemoryManager()
Definition: memory_manager.hh:77
gem5::RequestorID
uint16_t RequestorID
Definition: request.hh:95
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::AMDGPUMemoryManager::cacheLineSize
const int cacheLineSize
Definition: memory_manager.hh:72
gem5::AMDGPUMemoryManager::GPUMemPort::SenderState
Definition: memory_manager.hh:58
gem5::AMDGPUMemoryManager::GPUMemPort::GPUMemPort
GPUMemPort(const std::string &_name, AMDGPUMemoryManager *_gpuMemMgr)
Definition: memory_manager.hh:50
callback.hh
gem5::Named::_name
const std::string _name
Definition: named.hh:41
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Wed Jul 13 2022 10:39:18 for gem5 by doxygen 1.8.17