gem5  v22.1.0.0
RubyRequest.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2021 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 
55 namespace gem5
56 {
57 
58 namespace ruby
59 {
60 
61 class 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;
79  bool m_isTlbi;
80  // Should be uint64, but SLICC complains about casts
82 
83  RubyRequest(Tick curTime, uint64_t _paddr, int _len,
84  uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
85  PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
86  ContextID _proc_id = 100, ContextID _core_id = 99)
87  : Message(curTime),
88  m_PhysicalAddress(_paddr),
89  m_Type(_type),
90  m_ProgramCounter(_pc),
91  m_AccessMode(_access_mode),
92  m_Size(_len),
93  m_Prefetch(_pb),
94  m_pkt(_pkt),
95  m_contextId(_core_id),
96  m_htmFromTransaction(false),
98  m_isTlbi(false),
100  {
102  }
103 
105  RubyRequest(Tick curTime,
106  uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
107  PacketPtr _pkt, ContextID _proc_id, ContextID _core_id)
108  : Message(curTime),
110  m_Type(_type),
111  m_ProgramCounter(_pc),
112  m_AccessMode(_access_mode),
113  m_Size(0),
114  m_Prefetch(PrefetchBit_No),
115  m_pkt(_pkt),
116  m_contextId(_core_id),
117  m_htmFromTransaction(false),
119  m_isTlbi(false),
121  {
122  assert(m_pkt->req->isMemMgmt());
123  }
124 
125  RubyRequest(Tick curTime, uint64_t _paddr, int _len,
126  uint64_t _pc, RubyRequestType _type,
127  RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
128  unsigned _proc_id, unsigned _core_id,
129  int _wm_size, std::vector<bool> & _wm_mask,
130  DataBlock & _Data,
131  uint64_t _instSeqNum = 0)
132  : Message(curTime),
133  m_PhysicalAddress(_paddr),
134  m_Type(_type),
135  m_ProgramCounter(_pc),
136  m_AccessMode(_access_mode),
137  m_Size(_len),
138  m_Prefetch(_pb),
139  m_pkt(_pkt),
140  m_contextId(_core_id),
141  m_writeMask(_wm_size,_wm_mask),
142  m_WTData(_Data),
143  m_wfid(_proc_id),
144  m_instSeqNum(_instSeqNum),
145  m_htmFromTransaction(false),
147  m_isTlbi(false),
149  {
151  }
152 
153  RubyRequest(Tick curTime, uint64_t _paddr, int _len,
154  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,
160  uint64_t _instSeqNum = 0)
161  : Message(curTime),
162  m_PhysicalAddress(_paddr),
163  m_Type(_type),
164  m_ProgramCounter(_pc),
165  m_AccessMode(_access_mode),
166  m_Size(_len),
167  m_Prefetch(_pb),
168  m_pkt(_pkt),
169  m_contextId(_core_id),
170  m_writeMask(_wm_size,_wm_mask,_atomicOps),
171  m_WTData(_Data),
172  m_wfid(_proc_id),
173  m_instSeqNum(_instSeqNum),
174  m_htmFromTransaction(false),
176  m_isTlbi(false),
178  {
180  }
181 
182  RubyRequest(Tick curTime) : Message(curTime) {}
183  MsgPtr clone() const
184  { return std::shared_ptr<Message>(new RubyRequest(*this)); }
185 
186  Addr getLineAddress() const { return m_LineAddress; }
188  const RubyRequestType& getType() const { return m_Type; }
190  const RubyAccessMode& getAccessMode() const { return m_AccessMode; }
191  const int& getSize() const { return m_Size; }
192  const PrefetchBit& getPrefetch() const { return m_Prefetch; }
193  RequestPtr getRequestPtr() const { return m_pkt->req; }
194 
195  void print(std::ostream& out) const;
196  bool functionalRead(Packet *pkt);
197  bool functionalRead(Packet *pkt, WriteMask &mask);
198  bool functionalWrite(Packet *pkt);
199 };
200 
201 inline std::ostream&
202 operator<<(std::ostream& out, const RubyRequest& obj)
203 {
204  obj.print(out);
205  out << std::flush;
206  return out;
207 }
208 
209 } // namespace ruby
210 } // namespace gem5
211 
212 #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:294
RequestPtr req
A pointer to the original request.
Definition: packet.hh:376
const RubyAccessMode & getAccessMode() const
Definition: RubyRequest.hh:190
RubyRequest(Tick curTime, 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)
Definition: RubyRequest.hh:125
const PrefetchBit & getPrefetch() const
Definition: RubyRequest.hh:192
const int & getSize() const
Definition: RubyRequest.hh:191
MsgPtr clone() const
Definition: RubyRequest.hh:183
Addr getPhysicalAddress() const
Definition: RubyRequest.hh:187
Addr getLineAddress() const
Definition: RubyRequest.hh:186
RubyRequest(Tick curTime)
Definition: RubyRequest.hh:182
RubyRequestType m_Type
Definition: RubyRequest.hh:66
RubyRequest(Tick curTime, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, PacketPtr _pkt, ContextID _proc_id, ContextID _core_id)
RubyRequest for memory management commands.
Definition: RubyRequest.hh:105
RubyRequest(Tick curTime, 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)
Definition: RubyRequest.hh:83
RubyRequest(Tick curTime, 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)
Definition: RubyRequest.hh:153
bool functionalWrite(Packet *pkt)
Definition: RubyRequest.cc:85
const RubyRequestType & getType() const
Definition: RubyRequest.hh:188
void print(std::ostream &out) const
Definition: RubyRequest.cc:54
RequestPtr getRequestPtr() const
Definition: RubyRequest.hh:193
bool functionalRead(Packet *pkt)
The two functions below are used for reading / writing the message functionally.
Definition: RubyRequest.cc:69
RubyAccessMode m_AccessMode
Definition: RubyRequest.hh:68
Addr getProgramCounter() const
Definition: RubyRequest.hh:189
STL pair class.
Definition: stl.hh:58
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
std::shared_ptr< Message > MsgPtr
Definition: Message.hh:59
Addr makeLineAddress(Addr addr)
Definition: Address.cc:60
std::ostream & operator<<(std::ostream &os, const BoolVec &myvector)
Definition: BoolVec.cc:49
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
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
int ContextID
Globally unique thread context ID.
Definition: types.hh:239

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