summaryrefslogtreecommitdiff
path: root/src/cpu/o3/cpu.hh
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2006-07-01 18:52:02 -0400
committerKorey Sewell <ksewell@umich.edu>2006-07-01 18:52:02 -0400
commit62961a291692c960b67158f4152d480c160f8ac8 (patch)
tree0d22ed8ccfc1af44e003bac2b768dbdb5fb49c1e /src/cpu/o3/cpu.hh
parented821702e02b9c02c3b5f18dc61dad1f0fbc7164 (diff)
downloadgem5-62961a291692c960b67158f4152d480c160f8ac8.tar.xz
fix cpu builder to build the correct name...
add activateThread event and functions src/cpu/o3/alpha/cpu_builder.cc: Have CPU builder build a DerivO3CPU not a DerivAlphaO3CPU src/cpu/o3/cpu.cc: add activateThread Event add activateThread function adjust activateContext to schedule a thread to activate within the CPU instead of activating thread right away. This will lead to stages trying to use threads that arent ready yet and wasting execution time & possibly performance. src/cpu/o3/cpu.hh: add activateThread Event add activateThread function add schedule/descheculed activate thread event --HG-- extra : convert_revision : 236d30dc160910507ad36f7f527ab185ed38dc04
Diffstat (limited to 'src/cpu/o3/cpu.hh')
-rw-r--r--src/cpu/o3/cpu.hh53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh
index 9565bbe4f..2a9ecff4e 100644
--- a/src/cpu/o3/cpu.hh
+++ b/src/cpu/o3/cpu.hh
@@ -102,6 +102,7 @@ class FullO3CPU : public BaseO3CPU
typedef typename std::list<DynInstPtr>::iterator ListIt;
friend class O3ThreadContext<Impl>;
+
public:
enum Status {
Running,
@@ -114,6 +115,9 @@ class FullO3CPU : public BaseO3CPU
/** Overall CPU status. */
Status _status;
+ /** Per-thread status in CPU, used for SMT. */
+ Status _threadStatus[Impl::MaxThreads];
+
private:
class TickEvent : public Event
{
@@ -150,6 +154,49 @@ class FullO3CPU : public BaseO3CPU
tickEvent.squash();
}
+ class ActivateThreadEvent : public Event
+ {
+ private:
+ /** Number of Thread to Activate */
+ int tid;
+
+ /** Pointer to the CPU. */
+ FullO3CPU<Impl> *cpu;
+
+ public:
+ /** Constructs the event. */
+ ActivateThreadEvent();
+
+ /** Initialize Event */
+ void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
+
+ /** Processes the event, calling activateThread() on the CPU. */
+ void process();
+
+ /** Returns the description of the event. */
+ const char *description();
+ };
+
+ /** Schedule thread to activate , regardless of its current state. */
+ void scheduleActivateThreadEvent(int tid, int delay)
+ {
+ // Schedule thread to activate, regardless of its current state.
+ if (activateThreadEvent[tid].squashed())
+ activateThreadEvent[tid].reschedule(curTick + cycles(delay));
+ else if (!activateThreadEvent[tid].scheduled())
+ activateThreadEvent[tid].schedule(curTick + cycles(delay));
+ }
+
+ /** Unschedule actiavte thread event, regardless of its current state. */
+ void unscheduleActivateThreadEvent(int tid)
+ {
+ if (activateThreadEvent[tid].scheduled())
+ activateThreadEvent[tid].squash();
+ }
+
+ /** The tick event used for scheduling CPU ticks. */
+ ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
+
public:
/** Constructs a CPU with the given parameters. */
FullO3CPU(Params *params);
@@ -167,6 +214,9 @@ class FullO3CPU : public BaseO3CPU
/** Initialize the CPU */
void init();
+ /** Add Thread to Active Threads List */
+ void activateThread(unsigned int tid);
+
/** Setup CPU to insert a thread's context */
void insertThread(unsigned tid);
@@ -522,6 +572,9 @@ class FullO3CPU : public BaseO3CPU
/** The cycle that the CPU was last running, used for statistics. */
Tick lastRunningCycle;
+ /** The cycle that the CPU was last activated by a new thread*/
+ Tick lastActivatedCycle;
+
/** Number of Threads CPU can process */
unsigned numThreads;