RubyRequest.hh revision 11005
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 ContextID m_contextId; 53 54 RubyRequest(Tick 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 ContextID _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(Tick curTime) : Message(curTime) {} 74 MsgPtr clone() const 75 { return std::shared_ptr<Message>(new RubyRequest(*this)); } 76 77 const Address& getLineAddress() const { return m_LineAddress; } 78 const Address& getPhysicalAddress() const { return m_PhysicalAddress; } 79 const RubyRequestType& getType() const { return m_Type; } 80 const Address& getProgramCounter() const { return m_ProgramCounter; } 81 const RubyAccessMode& getAccessMode() const { return m_AccessMode; } 82 const int& getSize() const { return m_Size; } 83 const PrefetchBit& getPrefetch() const { return m_Prefetch; } 84 85 void print(std::ostream& out) const; 86 bool functionalRead(Packet *pkt); 87 bool functionalWrite(Packet *pkt); 88}; 89 90inline std::ostream& 91operator<<(std::ostream& out, const RubyRequest& obj) 92{ 93 obj.print(out); 94 out << std::flush; 95 return out; 96} 97 98#endif 99