cpu.hh (3093:b09c33e66bce) cpu.hh (3221:669a04468c0d)
1/*
2 * Copyright (c) 2004-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;

--- 188 unchanged lines hidden (view full) ---

197 }
198
199 /** The tick event used for scheduling CPU ticks. */
200 ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
201
202 class DeallocateContextEvent : public Event
203 {
204 private:
1/*
2 * Copyright (c) 2004-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;

--- 188 unchanged lines hidden (view full) ---

197 }
198
199 /** The tick event used for scheduling CPU ticks. */
200 ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
201
202 class DeallocateContextEvent : public Event
203 {
204 private:
205 /** Number of Thread to Activate */
205 /** Number of Thread to deactivate */
206 int tid;
207
206 int tid;
207
208 /** Should the thread be removed from the CPU? */
209 bool remove;
210
208 /** Pointer to the CPU. */
209 FullO3CPU<Impl> *cpu;
210
211 public:
212 /** Constructs the event. */
213 DeallocateContextEvent();
214
215 /** Initialize Event */
216 void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
217
218 /** Processes the event, calling activateThread() on the CPU. */
219 void process();
220
211 /** Pointer to the CPU. */
212 FullO3CPU<Impl> *cpu;
213
214 public:
215 /** Constructs the event. */
216 DeallocateContextEvent();
217
218 /** Initialize Event */
219 void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
220
221 /** Processes the event, calling activateThread() on the CPU. */
222 void process();
223
224 /** Sets whether the thread should also be removed from the CPU. */
225 void setRemove(bool _remove) { remove = _remove; }
226
221 /** Returns the description of the event. */
222 const char *description();
223 };
224
225 /** Schedule cpu to deallocate thread context.*/
227 /** Returns the description of the event. */
228 const char *description();
229 };
230
231 /** Schedule cpu to deallocate thread context.*/
226 void scheduleDeallocateContextEvent(int tid, int delay)
232 void scheduleDeallocateContextEvent(int tid, bool remove, int delay)
227 {
228 // Schedule thread to activate, regardless of its current state.
229 if (deallocateContextEvent[tid].squashed())
230 deallocateContextEvent[tid].reschedule(curTick + cycles(delay));
231 else if (!deallocateContextEvent[tid].scheduled())
232 deallocateContextEvent[tid].schedule(curTick + cycles(delay));
233 }
234

--- 56 unchanged lines hidden (view full) ---

291
292 /** Add Thread to Active Threads List. */
293 void activateContext(int tid, int delay);
294
295 /** Remove Thread from Active Threads List */
296 void suspendContext(int tid);
297
298 /** Remove Thread from Active Threads List &&
233 {
234 // Schedule thread to activate, regardless of its current state.
235 if (deallocateContextEvent[tid].squashed())
236 deallocateContextEvent[tid].reschedule(curTick + cycles(delay));
237 else if (!deallocateContextEvent[tid].scheduled())
238 deallocateContextEvent[tid].schedule(curTick + cycles(delay));
239 }
240

--- 56 unchanged lines hidden (view full) ---

297
298 /** Add Thread to Active Threads List. */
299 void activateContext(int tid, int delay);
300
301 /** Remove Thread from Active Threads List */
302 void suspendContext(int tid);
303
304 /** Remove Thread from Active Threads List &&
299 * Remove Thread Context from CPU.
305 * Possibly Remove Thread Context from CPU.
300 */
306 */
301 void deallocateContext(int tid, int delay = 1);
307 bool deallocateContext(int tid, bool remove, int delay = 1);
302
303 /** Remove Thread from Active Threads List &&
304 * Remove Thread Context from CPU.
305 */
306 void haltContext(int tid);
307
308 /** Activate a Thread When CPU Resources are Available. */
309 void activateWhenReady(int tid);

--- 311 unchanged lines hidden (view full) ---

621 Event *drainEvent;
622
623 /** Counter of how many stages have completed draining. */
624 int drainCount;
625
626 /** Pointers to all of the threads in the CPU. */
627 std::vector<Thread *> thread;
628
308
309 /** Remove Thread from Active Threads List &&
310 * Remove Thread Context from CPU.
311 */
312 void haltContext(int tid);
313
314 /** Activate a Thread When CPU Resources are Available. */
315 void activateWhenReady(int tid);

--- 311 unchanged lines hidden (view full) ---

627 Event *drainEvent;
628
629 /** Counter of how many stages have completed draining. */
630 int drainCount;
631
632 /** Pointers to all of the threads in the CPU. */
633 std::vector<Thread *> thread;
634
629 /** Pointer to the icache interface. */
630 MemInterface *icacheInterface;
631 /** Pointer to the dcache interface. */
632 MemInterface *dcacheInterface;
633
634 /** Whether or not the CPU should defer its registration. */
635 bool deferRegistration;
636
637 /** Is there a context switch pending? */
638 bool contextSwitch;
639
640 /** Threads Scheduled to Enter CPU */
641 std::list<int> cpuWaitList;

--- 35 unchanged lines hidden ---
635 /** Whether or not the CPU should defer its registration. */
636 bool deferRegistration;
637
638 /** Is there a context switch pending? */
639 bool contextSwitch;
640
641 /** Threads Scheduled to Enter CPU */
642 std::list<int> cpuWaitList;

--- 35 unchanged lines hidden ---