RubyRequest.hh (11305:78c1e4f5dfc5) RubyRequest.hh (11307:bd7d06ea90f5)
1/*
2 * Copyright (c) 2009 Mark D. Hill and David A. Wood
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
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
30#define __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
31
32#include <ostream>
33#include <vector>
34
35#include "mem/protocol/HSAScope.hh"
36#include "mem/protocol/HSASegment.hh"
37#include "mem/protocol/Message.hh"
38#include "mem/protocol/PrefetchBit.hh"
39#include "mem/protocol/RubyAccessMode.hh"
40#include "mem/protocol/RubyRequestType.hh"
41#include "mem/ruby/common/Address.hh"
42#include "mem/ruby/common/DataBlock.hh"
1/*
2 * Copyright (c) 2009 Mark D. Hill and David A. Wood
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
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
30#define __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
31
32#include <ostream>
33#include <vector>
34
35#include "mem/protocol/HSAScope.hh"
36#include "mem/protocol/HSASegment.hh"
37#include "mem/protocol/Message.hh"
38#include "mem/protocol/PrefetchBit.hh"
39#include "mem/protocol/RubyAccessMode.hh"
40#include "mem/protocol/RubyRequestType.hh"
41#include "mem/ruby/common/Address.hh"
42#include "mem/ruby/common/DataBlock.hh"
43#include "mem/ruby/common/WriteMask.hh"
43
44class RubyRequest : public Message
45{
46 public:
47 Addr m_PhysicalAddress;
48 Addr m_LineAddress;
49 RubyRequestType m_Type;
50 Addr m_ProgramCounter;
51 RubyAccessMode m_AccessMode;
52 int m_Size;
53 PrefetchBit m_Prefetch;
54 uint8_t* data;
55 PacketPtr pkt;
56 ContextID m_contextId;
44
45class RubyRequest : public Message
46{
47 public:
48 Addr m_PhysicalAddress;
49 Addr m_LineAddress;
50 RubyRequestType m_Type;
51 Addr m_ProgramCounter;
52 RubyAccessMode m_AccessMode;
53 int m_Size;
54 PrefetchBit m_Prefetch;
55 uint8_t* data;
56 PacketPtr pkt;
57 ContextID m_contextId;
58 WriteMask m_writeMask;
59 DataBlock m_WTData;
57 int m_wfid;
58 HSAScope m_scope;
59 HSASegment m_segment;
60
61
62 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
63 uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
64 PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
65 ContextID _proc_id = 100, ContextID _core_id = 99,
66 HSAScope _scope = HSAScope_UNSPECIFIED,
67 HSASegment _segment = HSASegment_GLOBAL)
68 : Message(curTime),
69 m_PhysicalAddress(_paddr),
70 m_Type(_type),
71 m_ProgramCounter(_pc),
72 m_AccessMode(_access_mode),
73 m_Size(_len),
74 m_Prefetch(_pb),
75 data(_data),
76 pkt(_pkt),
77 m_contextId(_core_id),
78 m_scope(_scope),
79 m_segment(_segment)
80 {
81 m_LineAddress = makeLineAddress(m_PhysicalAddress);
82 }
83
84 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
85 uint64_t _pc, RubyRequestType _type,
86 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
87 unsigned _proc_id, unsigned _core_id,
88 int _wm_size, std::vector<bool> & _wm_mask,
89 DataBlock & _Data,
90 HSAScope _scope = HSAScope_UNSPECIFIED,
91 HSASegment _segment = HSASegment_GLOBAL)
92 : Message(curTime),
93 m_PhysicalAddress(_paddr),
94 m_Type(_type),
95 m_ProgramCounter(_pc),
96 m_AccessMode(_access_mode),
97 m_Size(_len),
98 m_Prefetch(_pb),
99 data(_data),
100 pkt(_pkt),
101 m_contextId(_core_id),
60 int m_wfid;
61 HSAScope m_scope;
62 HSASegment m_segment;
63
64
65 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
66 uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
67 PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
68 ContextID _proc_id = 100, ContextID _core_id = 99,
69 HSAScope _scope = HSAScope_UNSPECIFIED,
70 HSASegment _segment = HSASegment_GLOBAL)
71 : Message(curTime),
72 m_PhysicalAddress(_paddr),
73 m_Type(_type),
74 m_ProgramCounter(_pc),
75 m_AccessMode(_access_mode),
76 m_Size(_len),
77 m_Prefetch(_pb),
78 data(_data),
79 pkt(_pkt),
80 m_contextId(_core_id),
81 m_scope(_scope),
82 m_segment(_segment)
83 {
84 m_LineAddress = makeLineAddress(m_PhysicalAddress);
85 }
86
87 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
88 uint64_t _pc, RubyRequestType _type,
89 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
90 unsigned _proc_id, unsigned _core_id,
91 int _wm_size, std::vector<bool> & _wm_mask,
92 DataBlock & _Data,
93 HSAScope _scope = HSAScope_UNSPECIFIED,
94 HSASegment _segment = HSASegment_GLOBAL)
95 : Message(curTime),
96 m_PhysicalAddress(_paddr),
97 m_Type(_type),
98 m_ProgramCounter(_pc),
99 m_AccessMode(_access_mode),
100 m_Size(_len),
101 m_Prefetch(_pb),
102 data(_data),
103 pkt(_pkt),
104 m_contextId(_core_id),
105 m_writeMask(_wm_size,_wm_mask),
106 m_WTData(_Data),
102 m_wfid(_proc_id),
103 m_scope(_scope),
104 m_segment(_segment)
105 {
106 m_LineAddress = makeLineAddress(m_PhysicalAddress);
107 }
108
109 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
110 uint64_t _pc, RubyRequestType _type,
111 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
112 unsigned _proc_id, unsigned _core_id,
113 int _wm_size, std::vector<bool> & _wm_mask,
114 DataBlock & _Data,
115 std::vector< std::pair<int,AtomicOpFunctor*> > _atomicOps,
116 HSAScope _scope = HSAScope_UNSPECIFIED,
117 HSASegment _segment = HSASegment_GLOBAL)
118 : Message(curTime),
119 m_PhysicalAddress(_paddr),
120 m_Type(_type),
121 m_ProgramCounter(_pc),
122 m_AccessMode(_access_mode),
123 m_Size(_len),
124 m_Prefetch(_pb),
125 data(_data),
126 pkt(_pkt),
127 m_contextId(_core_id),
107 m_wfid(_proc_id),
108 m_scope(_scope),
109 m_segment(_segment)
110 {
111 m_LineAddress = makeLineAddress(m_PhysicalAddress);
112 }
113
114 RubyRequest(Tick curTime, uint64_t _paddr, uint8_t* _data, int _len,
115 uint64_t _pc, RubyRequestType _type,
116 RubyAccessMode _access_mode, PacketPtr _pkt, PrefetchBit _pb,
117 unsigned _proc_id, unsigned _core_id,
118 int _wm_size, std::vector<bool> & _wm_mask,
119 DataBlock & _Data,
120 std::vector< std::pair<int,AtomicOpFunctor*> > _atomicOps,
121 HSAScope _scope = HSAScope_UNSPECIFIED,
122 HSASegment _segment = HSASegment_GLOBAL)
123 : Message(curTime),
124 m_PhysicalAddress(_paddr),
125 m_Type(_type),
126 m_ProgramCounter(_pc),
127 m_AccessMode(_access_mode),
128 m_Size(_len),
129 m_Prefetch(_pb),
130 data(_data),
131 pkt(_pkt),
132 m_contextId(_core_id),
133 m_writeMask(_wm_size,_wm_mask,_atomicOps),
134 m_WTData(_Data),
128 m_wfid(_proc_id),
129 m_scope(_scope),
130 m_segment(_segment)
131 {
132 m_LineAddress = makeLineAddress(m_PhysicalAddress);
133 }
134
135
136 RubyRequest(Tick curTime) : Message(curTime) {}
137 MsgPtr clone() const
138 { return std::shared_ptr<Message>(new RubyRequest(*this)); }
139
140 Addr getLineAddress() const { return m_LineAddress; }
141 Addr getPhysicalAddress() const { return m_PhysicalAddress; }
142 const RubyRequestType& getType() const { return m_Type; }
143 Addr getProgramCounter() const { return m_ProgramCounter; }
144 const RubyAccessMode& getAccessMode() const { return m_AccessMode; }
145 const int& getSize() const { return m_Size; }
146 const PrefetchBit& getPrefetch() const { return m_Prefetch; }
147
148 void print(std::ostream& out) const;
149 bool functionalRead(Packet *pkt);
150 bool functionalWrite(Packet *pkt);
151};
152
153inline std::ostream&
154operator<<(std::ostream& out, const RubyRequest& obj)
155{
156 obj.print(out);
157 out << std::flush;
158 return out;
159}
160
161#endif // __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
135 m_wfid(_proc_id),
136 m_scope(_scope),
137 m_segment(_segment)
138 {
139 m_LineAddress = makeLineAddress(m_PhysicalAddress);
140 }
141
142
143 RubyRequest(Tick curTime) : Message(curTime) {}
144 MsgPtr clone() const
145 { return std::shared_ptr<Message>(new RubyRequest(*this)); }
146
147 Addr getLineAddress() const { return m_LineAddress; }
148 Addr getPhysicalAddress() const { return m_PhysicalAddress; }
149 const RubyRequestType& getType() const { return m_Type; }
150 Addr getProgramCounter() const { return m_ProgramCounter; }
151 const RubyAccessMode& getAccessMode() const { return m_AccessMode; }
152 const int& getSize() const { return m_Size; }
153 const PrefetchBit& getPrefetch() const { return m_Prefetch; }
154
155 void print(std::ostream& out) const;
156 bool functionalRead(Packet *pkt);
157 bool functionalWrite(Packet *pkt);
158};
159
160inline std::ostream&
161operator<<(std::ostream& out, const RubyRequest& obj)
162{
163 obj.print(out);
164 out << std::flush;
165 return out;
166}
167
168#endif // __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__