CPU: Fix bug when a split transaction is issued to a faster cache
authorAli Saidi <Ali.Saidi@ARM.com>
Mon, 15 Nov 2010 20:04:03 +0000 (14:04 -0600)
committerAli Saidi <Ali.Saidi@ARM.com>
Mon, 15 Nov 2010 20:04:03 +0000 (14:04 -0600)
In the case of a split transaction and a cache that is faster than a CPU we
could get two responses before next_tick expires. Add an event that is
scheduled in this case and return false rather than asserting.

src/cpu/simple/timing.cc
src/cpu/simple/timing.hh

index 2abe9cd59474e3b49246a04afff5deee716f7d50..7307f2fc9e0de179691353c729f695836530ef7c 100644 (file)
@@ -999,7 +999,16 @@ TimingSimpleCPU::DcachePort::recvTiming(PacketPtr pkt)
         if (next_tick == curTick) {
             cpu->completeDataAccess(pkt);
         } else {
-            tickEvent.schedule(pkt, next_tick);
+            if (!tickEvent.scheduled()) {
+                tickEvent.schedule(pkt, next_tick);
+            } else {
+                // In the case of a split transaction and a cache that is
+                // faster than a CPU we could get two responses before
+                // next_tick expires
+                if (!retryEvent.scheduled())
+                    schedule(retryEvent, next_tick);
+                return false;
+            }
         }
 
         return true;
index 65cbe309897514766ca6a1325f0db98cf04938ca..2b0c8942a36b2943229ce6f7b0b7e6a7926f752c 100644 (file)
@@ -140,7 +140,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
       public:
 
         CpuPort(const std::string &_name, TimingSimpleCPU *_cpu, Tick _lat)
-            : Port(_name, _cpu), cpu(_cpu), lat(_lat)
+            : Port(_name, _cpu), cpu(_cpu), lat(_lat), retryEvent(this)
         { }
 
         bool snoopRangeSent;
@@ -161,12 +161,14 @@ class TimingSimpleCPU : public BaseSimpleCPU
         {
             PacketPtr pkt;
             TimingSimpleCPU *cpu;
+            CpuPort *port;
 
             TickEvent(TimingSimpleCPU *_cpu) : cpu(_cpu) {}
             const char *description() const { return "Timing CPU tick"; }
             void schedule(PacketPtr _pkt, Tick t);
         };
 
+        EventWrapper<Port, &Port::sendRetry> retryEvent;
     };
 
     class IcachePort : public CpuPort