Update the Memtester, commit a config file/test for it.
[gem5.git] / src / sim / eventq.hh
index a5cc0c1b610d2cf59b5e98dd592de359643433c2..537bfb91838fcd418651856528c2383bccce5bbe 100644 (file)
@@ -46,6 +46,7 @@
 #include "sim/host.hh" // for Tick
 
 #include "base/fast_alloc.hh"
+#include "base/misc.hh"
 #include "base/trace.hh"
 #include "sim/serialize.hh"
 
@@ -90,7 +91,8 @@ class Event : public Serializable, public FastAlloc
         Squashed = 0x1,
         Scheduled = 0x2,
         AutoDelete = 0x4,
-        AutoSerialize = 0x8
+        AutoSerialize = 0x8,
+        IsExitEvent = 0x10
     };
 
     bool getFlags(Flags f) const { return (_flags & f) == f; }
@@ -134,7 +136,7 @@ class Event : public Serializable, public FastAlloc
         /// same cycle (after unscheduling the old CPU's tick event).
         /// The switch needs to come before any tick events to make
         /// sure we don't tick both CPUs in the same cycle.
-        CPU_Switch_Pri         =   31,
+        CPU_Switch_Pri         =   -31,
 
         /// Serailization needs to occur before tick events also, so
         /// that a serialize/unserialize is identical to an on-line
@@ -214,6 +216,9 @@ class Event : public Serializable, public FastAlloc
     /// Check whether the event is squashed
     bool squashed() { return getFlags(Squashed); }
 
+    /// See if this is a SimExitEvent (without resorting to RTTI)
+    bool isExitEvent() { return getFlags(IsExitEvent); }
+
     /// Get the time that the event is scheduled
     Tick when() const { return _when; }
 
@@ -298,7 +303,7 @@ class EventQueue : public Serializable
     void reschedule(Event *ev);
 
     Tick nextTick() { return head->when(); }
-    void serviceOne();
+    Event *serviceOne();
 
     // process all events up to the given timestamp.  we inline a
     // quick test to see if there are any events to process; if so,
@@ -347,7 +352,8 @@ inline void
 Event::schedule(Tick t)
 {
     assert(!scheduled());
-    assert(t >= curTick);
+//    if (t < curTick)
+//        warn("t is less than curTick, ensure you don't want cycles");
 
     setFlags(Scheduled);
 #if TRACING_ON