gem5 v24.1.0.1
Loading...
Searching...
No Matches
RubyRequest.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020-2021, 2024 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 * Copyright (c) 2009 Mark D. Hill and David A. Wood
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYREQUEST_HH__
42#define __MEM_RUBY_SLICC_INTERFACE_RUBYREQUEST_HH__
43
44#include <ostream>
45#include <vector>
46
50#include "mem/ruby/protocol/Message.hh"
51#include "mem/ruby/protocol/PrefetchBit.hh"
52#include "mem/ruby/protocol/RubyAccessMode.hh"
53#include "mem/ruby/protocol/RubyRequestType.hh"
54
55namespace gem5
56{
57
58namespace ruby
59{
60
61class RubyRequest : public Message
62{
63 public:
66 RubyRequestType m_Type;
68 RubyAccessMode m_AccessMode;
69 int m_Size;
70 PrefetchBit m_Prefetch;
75 int m_wfid;
76 uint64_t m_instSeqNum;
80 // Should be uint64, but SLICC complains about casts
82 // GPU cache bypass flags. GLC bypasses L1 while SLC bypasses both L1 and
83 // L2 if set to true. They are set to false by default and they must be
84 // explicitly set to true in the program in order to bypass caches
88
89 RubyRequest(Tick curTime, int block_size, RubySystem *rs,
90 uint64_t _paddr, int _len,
91 uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
92 PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
93 ContextID _proc_id = 100, ContextID _core_id = 99)
94 : Message(curTime, block_size, rs),
95 m_PhysicalAddress(_paddr),
96 m_Type(_type),
98 m_AccessMode(_access_mode),
99 m_Size(_len),
100 m_Prefetch(_pb),
101 m_pkt(_pkt),
102 m_contextId(_core_id),
103 m_writeMask(block_size),
104 m_WTData(block_size),
107 m_isTlbi(false),
109 m_isSecure(m_pkt ? m_pkt->req->isSecure() : false)
110 {
111 int block_size_bits = floorLog2(block_size);
113 if (_pkt) {
114 m_isGLCSet = m_pkt->req->isGLCSet();
115 m_isSLCSet = m_pkt->req->isSLCSet();
116 } else {
117 m_isGLCSet = 0;
118 m_isSLCSet = 0;
119 }
120 }
121
123 RubyRequest(Tick curTime, int block_size, RubySystem *rs,
124 uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
125 PacketPtr _pkt, ContextID _proc_id, ContextID _core_id)
126 : Message(curTime, block_size, rs),
128 m_Type(_type),
129 m_ProgramCounter(_pc),
130 m_AccessMode(_access_mode),
131 m_Size(0),
132 m_Prefetch(PrefetchBit_No),
133 m_pkt(_pkt),
134 m_contextId(_core_id),
135 m_writeMask(block_size),
136 m_WTData(block_size),
139 m_isTlbi(false),
141 m_isSecure(m_pkt->req->isSecure())
142 {
143 assert(m_pkt->req->isMemMgmt());
144 if (_pkt) {
145 m_isGLCSet = m_pkt->req->isGLCSet();
146 m_isSLCSet = m_pkt->req->isSLCSet();
147 } else {
148 m_isGLCSet = 0;
149 m_isSLCSet = 0;
150 }
151 }
152
153 RubyRequest(Tick curTime, int block_size, RubySystem *rs,
154 uint64_t _paddr, int _len, uint64_t _pc, RubyRequestType _type,
155 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
156 unsigned _proc_id, unsigned _core_id,
157 int _wm_size, std::vector<bool> & _wm_mask,
158 DataBlock & _Data,
159 uint64_t _instSeqNum = 0)
160 : Message(curTime, block_size, rs),
161 m_PhysicalAddress(_paddr),
162 m_Type(_type),
163 m_ProgramCounter(_pc),
164 m_AccessMode(_access_mode),
165 m_Size(_len),
166 m_Prefetch(_pb),
167 m_pkt(_pkt),
168 m_contextId(_core_id),
169 m_writeMask(_wm_size,_wm_mask),
170 m_WTData(_Data),
171 m_wfid(_proc_id),
172 m_instSeqNum(_instSeqNum),
175 m_isTlbi(false),
177 m_isSecure(m_pkt->req->isSecure())
178 {
179 int block_size_bits = floorLog2(block_size);
181 if (_pkt) {
182 m_isGLCSet = m_pkt->req->isGLCSet();
183 m_isSLCSet = m_pkt->req->isSLCSet();
184 } else {
185 m_isGLCSet = 0;
186 m_isSLCSet = 0;
187 }
188 }
189
190 RubyRequest(Tick curTime, int block_size, RubySystem *rs,
191 uint64_t _paddr, int _len, uint64_t _pc, RubyRequestType _type,
192 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
193 unsigned _proc_id, unsigned _core_id,
194 int _wm_size, std::vector<bool> & _wm_mask,
195 DataBlock & _Data,
197 uint64_t _instSeqNum = 0)
198 : Message(curTime, block_size, rs),
199 m_PhysicalAddress(_paddr),
200 m_Type(_type),
201 m_ProgramCounter(_pc),
202 m_AccessMode(_access_mode),
203 m_Size(_len),
204 m_Prefetch(_pb),
205 m_pkt(_pkt),
206 m_contextId(_core_id),
207 m_writeMask(_wm_size,_wm_mask,_atomicOps),
208 m_WTData(_Data),
209 m_wfid(_proc_id),
210 m_instSeqNum(_instSeqNum),
213 m_isTlbi(false),
215 m_isSecure(m_pkt->req->isSecure())
216 {
217 int block_size_bits = floorLog2(block_size);
219 if (_pkt) {
220 m_isGLCSet = m_pkt->req->isGLCSet();
221 m_isSLCSet = m_pkt->req->isSLCSet();
222
223 } else {
224 m_isGLCSet = 0;
225 m_isSLCSet = 0;
226 }
227 }
228
229 RubyRequest(Tick curTime, int block_size, RubySystem *rs)
230 : Message(curTime, block_size, rs),
231 m_writeMask(block_size),
232 m_WTData(block_size)
233 {
234 }
235 MsgPtr clone() const
236 { return std::shared_ptr<Message>(new RubyRequest(*this)); }
237
240 const RubyRequestType& getType() const { return m_Type; }
242 const RubyAccessMode& getAccessMode() const { return m_AccessMode; }
243 const int& getSize() const { return m_Size; }
244 const PrefetchBit& getPrefetch() const { return m_Prefetch; }
245 RequestPtr getRequestPtr() const { return m_pkt->req; }
246
247 void setWriteMask(uint32_t offset, uint32_t len,
249 void print(std::ostream& out) const;
250 bool functionalRead(Packet *pkt);
251 bool functionalRead(Packet *pkt, WriteMask &mask);
252 bool functionalWrite(Packet *pkt);
253};
254
255inline std::ostream&
256operator<<(std::ostream& out, const RubyRequest& obj)
257{
258 obj.print(out);
259 out << std::flush;
260 return out;
261}
262
263} // namespace ruby
264} // namespace gem5
265
266#endif //__MEM_RUBY_SLICC_INTERFACE_RUBYREQUEST_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
RequestPtr req
A pointer to the original request.
Definition packet.hh:377
RubyRequest(Tick curTime, int block_size, RubySystem *rs)
const int & getSize() const
Addr getPhysicalAddress() const
void setWriteMask(uint32_t offset, uint32_t len, std::vector< std::pair< int, AtomicOpFunctor * > > atomicOps)
Addr getLineAddress() const
RubyRequest(Tick curTime, int block_size, RubySystem *rs, uint64_t _paddr, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb, unsigned _proc_id, unsigned _core_id, int _wm_size, std::vector< bool > &_wm_mask, DataBlock &_Data, uint64_t _instSeqNum=0)
const RubyRequestType & getType() const
RubyRequest(Tick curTime, int block_size, RubySystem *rs, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, PacketPtr _pkt, ContextID _proc_id, ContextID _core_id)
RubyRequest for memory management commands.
RubyRequest(Tick curTime, int block_size, RubySystem *rs, uint64_t _paddr, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb=PrefetchBit_No, ContextID _proc_id=100, ContextID _core_id=99)
const PrefetchBit & getPrefetch() const
RubyRequestType m_Type
const RubyAccessMode & getAccessMode() const
RubyRequest(Tick curTime, int block_size, RubySystem *rs, uint64_t _paddr, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb, unsigned _proc_id, unsigned _core_id, int _wm_size, std::vector< bool > &_wm_mask, DataBlock &_Data, std::vector< std::pair< int, AtomicOpFunctor * > > _atomicOps, uint64_t _instSeqNum=0)
bool functionalWrite(Packet *pkt)
void print(std::ostream &out) const
RequestPtr getRequestPtr() const
bool functionalRead(Packet *pkt)
The two functions below are used for reading / writing the message functionally.
RubyAccessMode m_AccessMode
Addr getProgramCounter() const
STL pair class.
Definition stl.hh:58
STL vector class.
Definition stl.hh:37
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
Definition intmath.hh:59
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 18, 16 > len
bool isSecure(ThreadContext *tc)
Definition utility.cc:74
Bitfield< 23, 0 > offset
Definition types.hh:144
Bitfield< 9, 8 > rs
Addr makeLineAddress(Addr addr, int cacheLineBits)
Definition Address.cc:61
std::shared_ptr< Message > MsgPtr
Definition Message.hh:60
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint64_t Tick
Tick count type.
Definition types.hh:58
std::ostream & operator<<(std::ostream &os, const BaseSemihosting::InPlaceArg &ipa)
int ContextID
Globally unique thread context ID.
Definition types.hh:239

Generated on Mon Jan 13 2025 04:28:40 for gem5 by doxygen 1.9.8