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
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;
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),
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),
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__