X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fmport.hh;h=b74761256def43310a311fbc69b98b1e7966e578;hb=8573a69d8f7bf7b3f074e3e0ac64994801c551be;hp=5975f89f0d3d1ef556388a0af647554103387158;hpb=e4590131825d27293d9642d2ac118ff03cc894f4;p=gem5.git diff --git a/src/mem/mport.hh b/src/mem/mport.hh index 5975f89f0..b74761256 100644 --- a/src/mem/mport.hh +++ b/src/mem/mport.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2012 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2008 The Regents of The University of Michigan * All rights reserved. * @@ -31,6 +43,7 @@ #ifndef __MEM_MPORT_HH__ #define __MEM_MPORT_HH__ +#include "mem/mem_object.hh" #include "mem/tport.hh" /* @@ -40,41 +53,47 @@ * the underpinnings of SimpleTimingPort, but it tweaks some of the external * functions. */ - -class MessagePort : public SimpleTimingPort +class MessageSlavePort : public SimpleTimingPort { + public: - MessagePort(std::string pname, MemObject *_owner = NULL) : - SimpleTimingPort(pname, _owner) + MessageSlavePort(const std::string &name, MemObject *owner) : + SimpleTimingPort(name, owner) {} - virtual ~MessagePort() + virtual ~MessageSlavePort() {} - void - recvFunctional(PacketPtr pkt) - { - recvAtomic(pkt); - } + protected: Tick recvAtomic(PacketPtr pkt); virtual Tick recvMessage(PacketPtr pkt) = 0; +}; + +class MessageMasterPort : public QueuedMasterPort +{ + public: + + MessageMasterPort(const std::string &name, MemObject *owner) : + QueuedMasterPort(name, owner, queue), queue(*owner, *this) + {} + + virtual ~MessageMasterPort() + {} + + bool recvTimingResp(PacketPtr pkt) { recvResponse(pkt); return true; } + + protected: + + /** A packet queue for outgoing packets. */ + MasterPacketQueue queue; // Accept and ignore responses. virtual Tick recvResponse(PacketPtr pkt) { return 0; } - - // Since by default we're assuming everything we send is accepted, panic. - virtual Tick recvNack(PacketPtr pkt) - { - panic("Unhandled message nack.\n"); - } - - void sendMessageTiming(PacketPtr pkt, Tick latency); - Tick sendMessageAtomic(PacketPtr pkt); }; #endif