2 * Copyright (c) 2009 Mark D. Hill and David A. Wood
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.
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.
29 #ifndef __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
30 #define __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__
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"
44 class RubyRequest : public Message
47 Addr m_PhysicalAddress;
49 RubyRequestType m_Type;
50 Addr m_ProgramCounter;
51 RubyAccessMode m_AccessMode;
53 PrefetchBit m_Prefetch;
56 ContextID m_contextId;
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)
69 m_PhysicalAddress(_paddr),
71 m_ProgramCounter(_pc),
72 m_AccessMode(_access_mode),
77 m_contextId(_core_id),
81 m_LineAddress = makeLineAddress(m_PhysicalAddress);
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,
90 HSAScope _scope = HSAScope_UNSPECIFIED,
91 HSASegment _segment = HSASegment_GLOBAL)
93 m_PhysicalAddress(_paddr),
95 m_ProgramCounter(_pc),
96 m_AccessMode(_access_mode),
101 m_contextId(_core_id),
106 m_LineAddress = makeLineAddress(m_PhysicalAddress);
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,
115 std::vector< std::pair<int,AtomicOpFunctor*> > _atomicOps,
116 HSAScope _scope = HSAScope_UNSPECIFIED,
117 HSASegment _segment = HSASegment_GLOBAL)
119 m_PhysicalAddress(_paddr),
121 m_ProgramCounter(_pc),
122 m_AccessMode(_access_mode),
127 m_contextId(_core_id),
132 m_LineAddress = makeLineAddress(m_PhysicalAddress);
136 RubyRequest(Tick curTime) : Message(curTime) {}
138 { return std::shared_ptr<Message>(new RubyRequest(*this)); }
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; }
148 void print(std::ostream& out) const;
149 bool functionalRead(Packet *pkt);
150 bool functionalWrite(Packet *pkt);
154 operator<<(std::ostream& out, const RubyRequest& obj)
161 #endif // __MEM_RUBY_SLICC_INTERFACE_RUBY_REQUEST_HH__