Deleted Added
sdiff udiff text old ( 11305:78c1e4f5dfc5 ) new ( 11307:bd7d06ea90f5 )
full compact
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"
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;
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),
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),
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__