Deleted Added
sdiff udiff text old ( 2871:7ed5c9ef3eb6 ) new ( 2875:9b6f6b75b187 )
full compact
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;

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

52//#include "cpu/o3/thread_context.hh"
53#include "sim/process.hh"
54
55template <class>
56class Checker;
57class ThreadContext;
58template <class>
59class O3ThreadContext;
60
61class Checkpoint;
62class MemObject;
63class Process;
64
65class BaseO3CPU : public BaseCPU
66{
67 //Stuff that's pretty ISA independent will go here.
68 public:
69 typedef BaseCPU::Params Params;

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

194 {
195 if (activateThreadEvent[tid].scheduled())
196 activateThreadEvent[tid].squash();
197 }
198
199 /** The tick event used for scheduling CPU ticks. */
200 ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
201
202 public:
203 /** Constructs a CPU with the given parameters. */
204 FullO3CPU(Params *params);
205 /** Destructor. */
206 ~FullO3CPU();
207
208 /** Registers statistics. */
209 void fullCPURegStats();
210
211 /** Returns a specific port. */
212 Port *getPort(const std::string &if_name, int idx);
213
214 /** Ticks CPU, calling tick() on each stage, and checking the overall
215 * activity to see if the CPU should deschedule itself.
216 */
217 void tick();
218
219 /** Initialize the CPU */
220 void init();
221
222 /** Returns the Number of Active Threads in the CPU */
223 int numActiveThreads()
224 { return activeThreads.size(); }
225
226 /** Add Thread to Active Threads List */
227 void activateThread(unsigned int tid);
228
229 /** Setup CPU to insert a thread's context */
230 void insertThread(unsigned tid);
231
232 /** Remove all of a thread's context from CPU */
233 void removeThread(unsigned tid);
234
235 /** Count the Total Instructions Committed in the CPU. */
236 virtual Counter totalInstructions() const

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

247 void activateContext(int tid, int delay);
248
249 /** Remove Thread from Active Threads List */
250 void suspendContext(int tid);
251
252 /** Remove Thread from Active Threads List &&
253 * Remove Thread Context from CPU.
254 */
255 void deallocateContext(int tid);
256
257 /** Remove Thread from Active Threads List &&
258 * Remove Thread Context from CPU.
259 */
260 void haltContext(int tid);
261
262 /** Activate a Thread When CPU Resources are Available. */
263 void activateWhenReady(int tid);
264
265 /** Add or Remove a Thread Context in the CPU. */
266 void doContextSwitch();
267
268 /** Update The Order In Which We Process Threads. */
269 void updateThreadPriority();
270
271 /** Serialize state. */
272 virtual void serialize(std::ostream &os);
273
274 /** Unserialize from a checkpoint. */
275 virtual void unserialize(Checkpoint *cp, const std::string &section);
276
277 public:
278 /** Executes a syscall on this cycle.
279 * ---------------------------------------
280 * Note: this is a virtual function. CPU-Specific
281 * functionality defined in derived classes
282 */
283 virtual void syscall(int tid) { panic("Unimplemented!"); }
284
285 /** Starts draining the CPU's pipeline of all instructions in
286 * order to stop all memory accesses. */
287 virtual bool drain(Event *drain_event);
288
289 /** Resumes execution after a drain. */
290 virtual void resume();
291
292 /** Signals to this CPU that a stage has completed switching out. */
293 void signalDrained();
294
295 /** Switches out this CPU. */
296 virtual void switchOut();
297
298 /** Takes over from another CPU. */
299 virtual void takeOverFrom(BaseCPU *oldCPU);
300
301 /** Get the current instruction sequence number, and increment it. */
302 InstSeqNum getAndIncrementInstSeq()
303 { return globalSeqNum++; }
304
305#if FULL_SYSTEM
306 /** Check if this address is a valid instruction address. */
307 bool validInstAddr(Addr addr) { return true; }

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

564
565 /** Pointer to physical memory. */
566 PhysicalMemory *physmem;
567#endif
568
569 /** Pointer to memory. */
570 MemObject *mem;
571
572 /** Event to call process() on once draining has completed. */
573 Event *drainEvent;
574
575 /** Counter of how many stages have completed draining. */
576 int drainCount;
577
578 /** Pointers to all of the threads in the CPU. */
579 std::vector<Thread *> thread;
580
581 /** Pointer to the icache interface. */
582 MemInterface *icacheInterface;
583 /** Pointer to the dcache interface. */
584 MemInterface *dcacheInterface;
585

--- 43 unchanged lines hidden ---