eventq.hh (5503:cf464d02bc57) | eventq.hh (5543:3af77710f397) |
---|---|
1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 34 unchanged lines hidden (view full) --- 43#include <vector> 44 45#include "base/fast_alloc.hh" 46#include "base/misc.hh" 47#include "base/trace.hh" 48#include "sim/serialize.hh" 49#include "sim/host.hh" 50 | 1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 34 unchanged lines hidden (view full) --- 43#include <vector> 44 45#include "base/fast_alloc.hh" 46#include "base/misc.hh" 47#include "base/trace.hh" 48#include "sim/serialize.hh" 49#include "sim/host.hh" 50 |
51class EventQueue; // forward declaration | 51class EventQueue; // forward declaration |
52 53////////////////////// 54// 55// Main Event Queue 56// 57// Events on this queue are processed at the *beginning* of each 58// cycle, before the pipeline simulation is performed. 59// --- 28 unchanged lines hidden (view full) --- 88 89 friend Event *insertBefore(Event *event, Event *curr); 90 friend Event *removeItem(Event *event, Event *last); 91 92 /// queue to which this event belongs (though it may or may not be 93 /// scheduled on this queue yet) 94 EventQueue *_queue; 95 | 52 53////////////////////// 54// 55// Main Event Queue 56// 57// Events on this queue are processed at the *beginning* of each 58// cycle, before the pipeline simulation is performed. 59// --- 28 unchanged lines hidden (view full) --- 88 89 friend Event *insertBefore(Event *event, Event *curr); 90 friend Event *removeItem(Event *event, Event *last); 91 92 /// queue to which this event belongs (though it may or may not be 93 /// scheduled on this queue yet) 94 EventQueue *_queue; 95 |
96 Tick _when; //!< timestamp when event should be processed 97 short _priority; //!< event priority | 96 Tick _when; //!< timestamp when event should be processed 97 short _priority; //!< event priority |
98 short _flags; 99 100#ifndef NDEBUG 101 /// Global counter to generate unique IDs for Event instances 102 static Counter instanceCounter; 103 104 /// This event's unique ID. We can also use pointer values for 105 /// this but they're not consistent across runs making debugging --- 30 unchanged lines hidden (view full) --- 136 bool getFlags(Flags f) const { return (_flags & f) == f; } 137 void setFlags(Flags f) { _flags |= f; } 138 void clearFlags(Flags f) { _flags &= ~f; } 139 140 protected: 141 EventQueue *queue() const { return _queue; } 142 143 // This function isn't really useful if TRACING_ON is not defined | 98 short _flags; 99 100#ifndef NDEBUG 101 /// Global counter to generate unique IDs for Event instances 102 static Counter instanceCounter; 103 104 /// This event's unique ID. We can also use pointer values for 105 /// this but they're not consistent across runs making debugging --- 30 unchanged lines hidden (view full) --- 136 bool getFlags(Flags f) const { return (_flags & f) == f; } 137 void setFlags(Flags f) { _flags |= f; } 138 void clearFlags(Flags f) { _flags &= ~f; } 139 140 protected: 141 EventQueue *queue() const { return _queue; } 142 143 // This function isn't really useful if TRACING_ON is not defined |
144 virtual void trace(const char *action); //!< trace event activity | 144 virtual void trace(const char *action); //!< trace event activity |
145 146 public: 147 /// Event priorities, to provide tie-breakers for events scheduled 148 /// at the same cycle. Most events are scheduled at the default 149 /// priority; these values are used to control events that need to 150 /// be ordered within a cycle. 151 enum Priority { 152 /// Minimum priority | 145 146 public: 147 /// Event priorities, to provide tie-breakers for events scheduled 148 /// at the same cycle. Most events are scheduled at the default 149 /// priority; these values are used to control events that need to 150 /// be ordered within a cycle. 151 enum Priority { 152 /// Minimum priority |
153 Minimum_Pri = SHRT_MIN, | 153 Minimum_Pri = SHRT_MIN, |
154 155 /// If we enable tracing on a particular cycle, do that as the 156 /// very first thing so we don't miss any of the events on 157 /// that cycle (even if we enter the debugger). 158 Trace_Enable_Pri = -101, 159 160 /// Breakpoints should happen before anything else (except 161 /// enabling trace output), so we don't miss any action when 162 /// debugging. | 154 155 /// If we enable tracing on a particular cycle, do that as the 156 /// very first thing so we don't miss any of the events on 157 /// that cycle (even if we enter the debugger). 158 Trace_Enable_Pri = -101, 159 160 /// Breakpoints should happen before anything else (except 161 /// enabling trace output), so we don't miss any action when 162 /// debugging. |
163 Debug_Break_Pri = -100, | 163 Debug_Break_Pri = -100, |
164 165 /// CPU switches schedule the new CPU's tick event for the 166 /// same cycle (after unscheduling the old CPU's tick event). 167 /// The switch needs to come before any tick events to make 168 /// sure we don't tick both CPUs in the same cycle. | 164 165 /// CPU switches schedule the new CPU's tick event for the 166 /// same cycle (after unscheduling the old CPU's tick event). 167 /// The switch needs to come before any tick events to make 168 /// sure we don't tick both CPUs in the same cycle. |
169 CPU_Switch_Pri = -31, | 169 CPU_Switch_Pri = -31, |
170 171 /// For some reason "delayed" inter-cluster writebacks are 172 /// scheduled before regular writebacks (which have default 173 /// priority). Steve? | 170 171 /// For some reason "delayed" inter-cluster writebacks are 172 /// scheduled before regular writebacks (which have default 173 /// priority). Steve? |
174 Delayed_Writeback_Pri = -1, | 174 Delayed_Writeback_Pri = -1, |
175 176 /// Default is zero for historical reasons. | 175 176 /// Default is zero for historical reasons. |
177 Default_Pri = 0, | 177 Default_Pri = 0, |
178 179 /// Serailization needs to occur before tick events also, so 180 /// that a serialize/unserialize is identical to an on-line 181 /// CPU switch. | 178 179 /// Serailization needs to occur before tick events also, so 180 /// that a serialize/unserialize is identical to an on-line 181 /// CPU switch. |
182 Serialize_Pri = 32, | 182 Serialize_Pri = 32, |
183 184 /// CPU ticks must come after other associated CPU events 185 /// (such as writebacks). | 183 184 /// CPU ticks must come after other associated CPU events 185 /// (such as writebacks). |
186 CPU_Tick_Pri = 50, | 186 CPU_Tick_Pri = 50, |
187 188 /// Statistics events (dump, reset, etc.) come after 189 /// everything else, but before exit. | 187 188 /// Statistics events (dump, reset, etc.) come after 189 /// everything else, but before exit. |
190 Stat_Event_Pri = 90, | 190 Stat_Event_Pri = 90, |
191 192 /// Progress events come at the end. 193 Progress_Event_Pri = 95, 194 195 /// If we want to exit on this cycle, it's the very last thing 196 /// we do. | 191 192 /// Progress events come at the end. 193 Progress_Event_Pri = 95, 194 195 /// If we want to exit on this cycle, it's the very last thing 196 /// we do. |
197 Sim_Exit_Pri = 100, | 197 Sim_Exit_Pri = 100, |
198 199 /// Maximum priority | 198 199 /// Maximum priority |
200 Maximum_Pri = SHRT_MAX | 200 Maximum_Pri = SHRT_MAX |
201 }; 202 203 /* 204 * Event constructor 205 * @param queue that the event gets scheduled on 206 */ 207 Event(EventQueue *q, Priority p = Default_Pri) 208 : nextBin(NULL), nextInBin(NULL), _queue(q), _priority(p), _flags(None) --- 324 unchanged lines hidden --- | 201 }; 202 203 /* 204 * Event constructor 205 * @param queue that the event gets scheduled on 206 */ 207 Event(EventQueue *q, Priority p = Default_Pri) 208 : nextBin(NULL), nextInBin(NULL), _queue(q), _priority(p), _flags(None) --- 324 unchanged lines hidden --- |