X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Ftport.hh;h=eaf5acd5d6afeefb0a181eac9cb77b90b92ba417;hb=ea8b347dc5d375572d8d19770024ec8be5fd5017;hp=bfed29f3496b3e90c1d571c4898ee890dee670d6;hpb=749126e01183821a4c22f27deb0906aa01033206;p=gem5.git diff --git a/src/mem/tport.hh b/src/mem/tport.hh index bfed29f34..eaf5acd5d 100644 --- a/src/mem/tport.hh +++ b/src/mem/tport.hh @@ -37,11 +37,12 @@ * Declaration of SimpleTimingPort. */ -#include "mem/port.hh" -#include "sim/eventq.hh" #include #include +#include "mem/port.hh" +#include "sim/eventq.hh" + /** * A simple port for interfacing objects that basically have only * functional memory behavior (e.g. I/O devices) to the memory system. @@ -85,9 +86,6 @@ class SimpleTimingPort : public Port * When the event time expires it attempts to send the packet. * If it cannot, the packet sent when recvRetry() is called. **/ - typedef EventWrapper - SendEvent; - Event *sendEvent; /** If we need to drain, keep the drain event around until we're done @@ -99,29 +97,23 @@ class SimpleTimingPort : public Port /** Check the list of buffered packets against the supplied * functional request. */ - void checkFunctional(PacketPtr funcPkt); + bool checkFunctional(PacketPtr funcPkt); /** Check whether we have a packet ready to go on the transmit list. */ bool deferredPacketReady() - { return !transmitList.empty() && transmitList.front().tick <= curTick; } + { return !transmitList.empty() && transmitList.front().tick <= curTick(); } - Tick deferredPacketReadyTick() + Tick deferredPacketReadyTime() { return transmitList.empty() ? MaxTick : transmitList.front().tick; } - void schedSendEvent(Tick when) - { - if (waitingOnRetry) { - assert(!sendEvent->scheduled()); - return; - } - - if (!sendEvent->scheduled()) { - sendEvent->schedule(when); - } else if (sendEvent->when() > when) { - sendEvent->reschedule(when); - } - } - + /** + * Schedule a send even if not already waiting for a retry. If the + * requested time is before an already scheduled send event it + * will be rescheduled. + * + * @param when + */ + void schedSendEvent(Tick when); /** Schedule a sendTiming() event to be called in the future. * @param pkt packet to send @@ -131,7 +123,7 @@ class SimpleTimingPort : public Port /** Attempt to send the packet at the head of the deferred packet * list. Caller must guarantee that the deferred packet list is - * non-empty and that the head packet is scheduled for curTick (or + * non-empty and that the head packet is scheduled for curTick() (or * earlier). */ void sendDeferredPacket(); @@ -147,22 +139,18 @@ class SimpleTimingPort : public Port bool recvTiming(PacketPtr pkt); /** - * Simple ports generally don't care about any status - * changes... can always override this in cases where that's not - * true. */ - virtual void recvStatusChange(Status status) { } + * Simple ports are generally used as slave ports (i.e. the + * respond to requests) and thus do not expect to receive any + * range changes (as the neighbouring port has a master role and + * do not have any address ranges. A subclass can override the + * default behaviuor if needed. + */ + virtual void recvRangeChange() { } public: - - SimpleTimingPort(std::string pname, MemObject *_owner = NULL) - : Port(pname, _owner), - sendEvent(new SendEvent(this)), - drainEvent(NULL), - waitingOnRetry(false) - {} - - ~SimpleTimingPort() { delete sendEvent; } + SimpleTimingPort(std::string pname, MemObject *_owner); + ~SimpleTimingPort(); /** Hook for draining timing accesses from the system. The * associated SimObject's drain() functions should be implemented