Message.hh revision 9500:9c3e3d1c7a87
13021SN/A/* 23021SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 33021SN/A * All rights reserved. 410036SAli.Saidi@ARM.com * 58835SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without 610036SAli.Saidi@ARM.com * modification, are permitted provided that the following conditions are 77935SN/A * met: redistributions of source code must retain the above copyright 87935SN/A * notice, this list of conditions and the following disclaimer; 97935SN/A * redistributions in binary form must reproduce the above copyright 103021SN/A * notice, this list of conditions and the following disclaimer in the 113021SN/A * documentation and/or other materials provided with the distribution; 123021SN/A * neither the name of the copyright holders nor the names of its 1310315Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from 148835SAli.Saidi@ARM.com * this software without specific prior written permission. 159885Sstever@gmail.com * 169885Sstever@gmail.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1710036SAli.Saidi@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1811312Santhony.gutierrez@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 198835SAli.Saidi@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 208835SAli.Saidi@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2110315Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 228835SAli.Saidi@ARM.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2310315Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 243021SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259481Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 268540SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2710736Snilay@cs.wisc.edu */ 2811219Snilay@cs.wisc.edu 298721SN/A#ifndef __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ 308835SAli.Saidi@ARM.com#define __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ 318835SAli.Saidi@ARM.com 327935SN/A#include <iostream> 337935SN/A 347935SN/A#include "base/refcnt.hh" 357935SN/A#include "mem/packet.hh" 367935SN/A 377935SN/Aclass Message; 387935SN/Atypedef RefCountingPtr<Message> MsgPtr; 398983Snate@binkert.org 403021SN/Aclass Message : public RefCounted 419885Sstever@gmail.com{ 429885Sstever@gmail.com public: 439885Sstever@gmail.com Message(Cycles curTime) 4410315Snilay@cs.wisc.edu : m_time(curTime), 4510036SAli.Saidi@ARM.com m_LastEnqueueTime(curTime), 4610315Snilay@cs.wisc.edu m_DelayedCycles(0) 479885Sstever@gmail.com { } 489885Sstever@gmail.com 493021SN/A Message(const Message &other) 503021SN/A : m_time(other.m_time), 519481Snilay@cs.wisc.edu m_LastEnqueueTime(other.m_LastEnqueueTime), 5210315Snilay@cs.wisc.edu m_DelayedCycles(other.m_DelayedCycles) 535876SN/A { } 549885Sstever@gmail.com 553171SN/A virtual ~Message() { } 565876SN/A 578835SAli.Saidi@ARM.com virtual Message* clone() const = 0; 585876SN/A virtual void print(std::ostream& out) const = 0; 595000SN/A virtual void setIncomingLink(int) {} 6010036SAli.Saidi@ARM.com virtual void setVnet(int) {} 618983Snate@binkert.org 623021SN/A /** 633021SN/A * The two functions below are used for reading / writing the message 648835SAli.Saidi@ARM.com * functionally. The methods return true if the address in the packet 659481Snilay@cs.wisc.edu * matches the address / address range in the message. Each message 665000SN/A * class that can be potentially searched for the address needs to 673021SN/A * implement these methods. 683021SN/A */ 693021SN/A virtual bool functionalRead(Packet *pkt) = 0; 703021SN/A //{ fatal("Read functional access not implemented!"); } 715575SN/A virtual bool functionalWrite(Packet *pkt) = 0; 728835SAli.Saidi@ARM.com //{ fatal("Write functional access not implemented!"); } 733171SN/A 749885Sstever@gmail.com void setDelayedCycles(const Cycles cycles) { m_DelayedCycles = cycles; } 755509SN/A const Cycles getDelayedCycles() const {return m_DelayedCycles;} 765509SN/A 7710315Snilay@cs.wisc.edu void setLastEnqueueTime(const Cycles& time) { m_LastEnqueueTime = time; } 789481Snilay@cs.wisc.edu const Cycles getLastEnqueueTime() const {return m_LastEnqueueTime;} 793021SN/A 804938SN/A const Cycles& getTime() const { return m_time; } 813021SN/A void setTime(const Cycles& new_time) { m_time = new_time; } 823021SN/A 838983Snate@binkert.org private: 848983Snate@binkert.org Cycles m_time; 853021SN/A Cycles m_LastEnqueueTime; // my last enqueue time 865000SN/A Cycles m_DelayedCycles; // my delayed cycles 876024SN/A}; 8810036SAli.Saidi@ARM.com 895509SN/Ainline std::ostream& 905000SN/Aoperator<<(std::ostream& out, const Message& obj) 918835SAli.Saidi@ARM.com{ 928835SAli.Saidi@ARM.com obj.print(out); 9310036SAli.Saidi@ARM.com out << std::flush; 948835SAli.Saidi@ARM.com return out; 959481Snilay@cs.wisc.edu} 969481Snilay@cs.wisc.edu 9710036SAli.Saidi@ARM.com#endif // __MEM_RUBY_SLICC_INTERFACE_MESSAGE_HH__ 989481Snilay@cs.wisc.edu