RubyRequest.hh revision 9466
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 34#include "mem/protocol/Message.hh" 35#include "mem/protocol/PrefetchBit.hh" 36#include "mem/protocol/RubyAccessMode.hh" 37#include "mem/protocol/RubyRequestType.hh" 38#include "mem/ruby/common/Address.hh" 39 40class RubyRequest : public Message 41{ 42 public: 43 Address m_PhysicalAddress; 44 Address m_LineAddress; 45 RubyRequestType m_Type; 46 Address m_ProgramCounter; 47 RubyAccessMode m_AccessMode; 48 int m_Size; 49 PrefetchBit m_Prefetch; 50 uint8_t* data; 51 PacketPtr pkt; 52 unsigned m_contextId; 53 54 RubyRequest(Time curTime, uint64_t _paddr, uint8_t* _data, int _len, 55 uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, 56 PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No, 57 unsigned _proc_id = 100) 58 : Message(curTime), 59 m_PhysicalAddress(_paddr), 60 m_Type(_type), 61 m_ProgramCounter(_pc), 62 m_AccessMode(_access_mode), 63 m_Size(_len), 64 m_Prefetch(_pb), 65 data(_data), 66 pkt(_pkt), 67 m_contextId(_proc_id) 68 { 69 m_LineAddress = m_PhysicalAddress; 70 m_LineAddress.makeLineAddress(); 71 } 72 73 RubyRequest(Time curTime) : Message(curTime) 74 { 75 } 76 77 RubyRequest* 78 clone() const 79 { 80 return new RubyRequest(*this); 81 } 82 83 const Address& 84 getLineAddress() const 85 { 86 return m_LineAddress; 87 } 88 89 const Address& 90 getPhysicalAddress() const 91 { 92 return m_PhysicalAddress; 93 } 94 95 const RubyRequestType& 96 getType() const 97 { 98 return m_Type; 99 } 100 101 const Address& 102 getProgramCounter() const 103 { 104 return m_ProgramCounter; 105 } 106 107 const RubyAccessMode& 108 getAccessMode() const 109 { 110 return m_AccessMode; 111 } 112 113 const int& 114 getSize() const 115 { 116 return m_Size; 117 } 118 119 const PrefetchBit& 120 getPrefetch() const 121 { 122 return m_Prefetch; 123 } 124 125 void print(std::ostream& out) const; 126 127 bool functionalRead(Packet *pkt); 128 bool functionalWrite(Packet *pkt); 129}; 130 131inline std::ostream& 132operator<<(std::ostream& out, const RubyRequest& obj) 133{ 134 obj.print(out); 135 out << std::flush; 136 return out; 137} 138 139#endif 140