changeset 1fdf8f79a3c1 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=1fdf8f79a3c1
description:
        merge

diffstat:

45 files changed, 2656 insertions(+), 1396 deletions(-)
src/cpu/inorder/InOrderCPU.py                                  |    5 
src/cpu/inorder/SConscript                                     |    6 
src/cpu/inorder/cpu.cc                                         |  702 +++++-----
src/cpu/inorder/cpu.hh                                         |  199 +-
src/cpu/inorder/first_stage.cc                                 |   83 -
src/cpu/inorder/first_stage.hh                                 |    2 
src/cpu/inorder/inorder_dyn_inst.cc                            |   44 
src/cpu/inorder/inorder_dyn_inst.hh                            |   37 
src/cpu/inorder/pipeline_stage.cc                              |  329 +++-
src/cpu/inorder/pipeline_stage.hh                              |   57 
src/cpu/inorder/pipeline_traits.cc                             |   45 
src/cpu/inorder/pipeline_traits.hh                             |    9 
src/cpu/inorder/reg_dep_map.cc                                 |   24 
src/cpu/inorder/reg_dep_map.hh                                 |    2 
src/cpu/inorder/resource.cc                                    |  105 +
src/cpu/inorder/resource.hh                                    |   71 -
src/cpu/inorder/resource_pool.cc                               |  296 +++-
src/cpu/inorder/resource_pool.hh                               |   21 
src/cpu/inorder/resources/cache_unit.cc                        |  644 +++++++--
src/cpu/inorder/resources/cache_unit.hh                        |   66 
src/cpu/inorder/resources/execution_unit.cc                    |   17 
src/cpu/inorder/resources/execution_unit.hh                    |    6 
src/cpu/inorder/resources/fetch_seq_unit.cc                    |   37 
src/cpu/inorder/resources/fetch_seq_unit.hh                    |    7 
src/cpu/inorder/resources/graduation_unit.cc                   |    2 
src/cpu/inorder/resources/graduation_unit.hh                   |    2 
src/cpu/inorder/resources/inst_buffer.cc                       |    3 
src/cpu/inorder/resources/mult_div_unit.hh                     |    1 
src/cpu/inorder/resources/use_def.cc                           |  227 ++-
src/cpu/inorder/resources/use_def.hh                           |   12 
src/cpu/inorder/thread_context.cc                              |    6 
src/cpu/inorder/thread_context.hh                              |    1 
src/cpu/inorder/thread_state.hh                                |   13 
tests/long/50.vortex/ref/alpha/tru64/inorder-timing/config.ini |    4 
tests/long/50.vortex/ref/alpha/tru64/inorder-timing/simout     |    8 
tests/long/50.vortex/ref/alpha/tru64/inorder-timing/stats.txt  |  234 +--
tests/long/70.twolf/ref/alpha/tru64/inorder-timing/config.ini  |    4 
tests/long/70.twolf/ref/alpha/tru64/inorder-timing/simout      |    8 
tests/long/70.twolf/ref/alpha/tru64/inorder-timing/stats.txt   |  270 ++-
tests/quick/00.hello/ref/alpha/linux/inorder-timing/config.ini |    6 
tests/quick/00.hello/ref/alpha/linux/inorder-timing/simout     |    8 
tests/quick/00.hello/ref/alpha/linux/inorder-timing/stats.txt  |  207 +-
tests/quick/00.hello/ref/mips/linux/inorder-timing/config.ini  |    1 
tests/quick/00.hello/ref/mips/linux/inorder-timing/simout      |   12 
tests/quick/00.hello/ref/mips/linux/inorder-timing/stats.txt   |  209 +-

diffs (truncated from 7207 to 300 lines):

diff -r 5fe4afb992f5 -r 1fdf8f79a3c1 src/cpu/inorder/InOrderCPU.py
--- a/src/cpu/inorder/InOrderCPU.py     Sun Jan 31 22:21:01 2010 -0800
+++ b/src/cpu/inorder/InOrderCPU.py     Sun Jan 31 22:28:13 2010 -0800
@@ -30,10 +30,15 @@
 from m5.proxy import *
 from BaseCPU import BaseCPU
 
+class ThreadModel(Enum):
+    vals = ['Single', 'SMT', 'SwitchOnCacheMiss']
+
 class InOrderCPU(BaseCPU):
     type = 'InOrderCPU'
     activity = Param.Unsigned(0, "Initial count")
 
+    threadModel = Param.ThreadModel('SMT', "Multithreading model (SE-MODE 
only)")
+    
     cachePorts = Param.Unsigned(2, "Cache Ports")
     stageWidth = Param.Unsigned(1, "Stage width")
 
diff -r 5fe4afb992f5 -r 1fdf8f79a3c1 src/cpu/inorder/SConscript
--- a/src/cpu/inorder/SConscript        Sun Jan 31 22:21:01 2010 -0800
+++ b/src/cpu/inorder/SConscript        Sun Jan 31 22:28:13 2010 -0800
@@ -52,12 +52,16 @@
        TraceFlag('InOrderUseDef')
        TraceFlag('InOrderMDU')
        TraceFlag('InOrderGraduation')
+       TraceFlag('ThreadModel')
        TraceFlag('RefCount')
+       TraceFlag('AddrDep')    
+       
 
        CompoundFlag('InOrderCPUAll', [ 'InOrderStage', 'InOrderStall', 
'InOrderCPU',
               'InOrderMDU', 'InOrderAGEN', 'InOrderFetchSeq', 'InOrderTLB', 
'InOrderBPred',
               'InOrderDecode', 'InOrderExecute', 'InOrderInstBuffer', 
'InOrderUseDef',
-              'InOrderGraduation', 'InOrderCachePort', 'RegDepMap', 
'Resource'])
+              'InOrderGraduation', 'InOrderCachePort', 'RegDepMap', 'Resource',
+              'ThreadModel'])
 
        Source('pipeline_traits.cc')        
        Source('inorder_dyn_inst.cc')
diff -r 5fe4afb992f5 -r 1fdf8f79a3c1 src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc    Sun Jan 31 22:21:01 2010 -0800
+++ b/src/cpu/inorder/cpu.cc    Sun Jan 31 22:28:13 2010 -0800
@@ -84,25 +84,25 @@
 }
 
 InOrderCPU::CPUEvent::CPUEvent(InOrderCPU *_cpu, CPUEventType e_type,
-                             Fault fault, ThreadID _tid, unsigned _vpe)
-    : Event(CPU_Tick_Pri), cpu(_cpu)
+                               Fault fault, ThreadID _tid, DynInstPtr inst,
+                               unsigned event_pri_offset)
+    : Event(Event::Priority((unsigned int)CPU_Tick_Pri + event_pri_offset)),
+      cpu(_cpu)
 {
-    setEvent(e_type, fault, _tid, _vpe);
+    setEvent(e_type, fault, _tid, inst);
 }
 
 
 std::string InOrderCPU::eventNames[NumCPUEvents] =
 {
     "ActivateThread",
-    "DeallocateThread",
+    "ActivateNextReadyThread",
+    "DeactivateThread",
+    "HaltThread",
     "SuspendThread",
-    "DisableThreads",
-    "EnableThreads",
-    "DisableVPEs",
-    "EnableVPEs",
     "Trap",
     "InstGraduated",
-    "SquashAll",
+    "SquashFromMemStall",
     "UpdatePCs"
 };
 
@@ -115,28 +115,24 @@
         cpu->activateThread(tid);
         break;
 
-      //@TODO: Consider Implementing "Suspend Thread" as Separate from 
Deallocate
-      case SuspendThread: // Suspend & Deallocate are same for now.
-        //cpu->suspendThread(tid);
-        //break;
-      case DeallocateThread:
-        cpu->deallocateThread(tid);
+      case ActivateNextReadyThread:
+        cpu->activateNextReadyThread();
         break;
 
-      case EnableVPEs:
-        cpu->enableVPEs(vpe);
+      case DeactivateThread:
+        cpu->deactivateThread(tid);
         break;
 
-      case DisableVPEs:
-        cpu->disableVPEs(tid, vpe);
+      case HaltThread:
+        cpu->haltThread(tid);
         break;
 
-      case EnableThreads:
-        cpu->enableThreads(vpe);
+      case SuspendThread: 
+        cpu->suspendThread(tid);
         break;
 
-      case DisableThreads:
-        cpu->disableThreads(tid, vpe);
+      case SquashFromMemStall:
+        cpu->squashDueToMemStall(inst->squashingStage, inst->seqNum, tid);
         break;
 
       case Trap:
@@ -144,12 +140,14 @@
         break;
 
       default:
-        fatal("Unrecognized Event Type %d", cpuEventType);
+        fatal("Unrecognized Event Type %s", eventNames[cpuEventType]);    
     }
-
+    
     cpu->cpuEventRemoveList.push(this);
 }
 
+    
+
 const char *
 InOrderCPU::CPUEvent::description()
 {
@@ -185,11 +183,15 @@
       system(params->system),
       physmem(system->physmem),
 #endif // FULL_SYSTEM
+#ifdef DEBUG
+      cpuEventNum(0),
+      resReqCount(0),
+#endif // DEBUG
       switchCount(0),
       deferRegistration(false/*params->deferRegistration*/),
       stageTracing(params->stageTracing),
-      numVirtProcs(1)
-{
+      instsPerSwitch(0)
+{    
     ThreadID active_threads;
     cpu_params = params;
 
@@ -208,6 +210,24 @@
               "in your InOrder implementation or "
               "edit your workload size.");
     }
+
+    
+    if (active_threads > 1) {
+        threadModel = (InOrderCPU::ThreadModel) params->threadModel;
+
+        if (threadModel == SMT) {
+            DPRINTF(InOrderCPU, "Setting Thread Model to SMT.\n");            
+        } else if (threadModel == SwitchOnCacheMiss) {
+            DPRINTF(InOrderCPU, "Setting Thread Model to "
+                    "Switch On Cache Miss\n");
+        }
+        
+    } else {
+        threadModel = Single;
+    }
+     
+        
+    
 #endif
 
     // Bind the fetch & data ports from the resource pool.
@@ -238,6 +258,9 @@
             Process* dummy_proc = params->workload[0];
             thread[tid] = new Thread(this, tid, dummy_proc);
         }
+        
+        // Eventually set this with parameters...
+        asid[tid] = tid;
 #endif
 
         // Setup the TC that will serve as the interface to the threads/CPU.
@@ -293,15 +316,30 @@
         memset(floatRegs.i[tid], 0, sizeof(floatRegs.i[tid]));
         isa[tid].clear();
 
-        isa[tid].expandForMultithreading(numThreads, numVirtProcs);
+        isa[tid].expandForMultithreading(numThreads, 1/*numVirtProcs*/);
+
+        // Define dummy instructions and resource requests to be used.
+        dummyInst[tid] = new InOrderDynInst(this, 
+                                            thread[tid], 
+                                            0, 
+                                            tid, 
+                                            asid[tid]);
+
+        dummyReq[tid] = new ResourceRequest(resPool->getResource(0), 
+                                            dummyInst[tid], 
+                                            0, 
+                                            0, 
+                                            0, 
+                                            0);        
     }
 
+    dummyReqInst = new InOrderDynInst(this, NULL, 0, 0, 0);
+    dummyReqInst->setSquashed();
+
+    dummyBufferInst = new InOrderDynInst(this, NULL, 0, 0, 0);
+    dummyBufferInst->setSquashed();
+    
     lastRunningCycle = curTick;
-    contextSwitch = false;
-
-    // Define dummy instructions and resource requests to be used.
-    DynInstPtr dummyBufferInst = new InOrderDynInst(this, NULL, 0, 0);
-    dummyReq = new ResourceRequest(NULL, NULL, 0, 0, 0, 0);
 
     // Reset CPU to reset state.
 #if FULL_SYSTEM
@@ -311,10 +349,17 @@
     reset();
 #endif
 
+    dummyBufferInst->resetInstCount();
+    
     // Schedule First Tick Event, CPU will reschedule itself from here on out.
     scheduleTickEvent(0);
 }
 
+InOrderCPU::~InOrderCPU()
+{
+    delete resPool;
+}
+
 
 void
 InOrderCPU::regStats()
@@ -322,7 +367,28 @@
     /* Register the Resource Pool's stats here.*/
     resPool->regStats();
 
+#ifdef DEBUG
+    maxResReqCount
+        .name(name() + ".maxResReqCount")
+        .desc("Maximum number of live resource requests in CPU")
+        .prereq(maxResReqCount);   
+#endif
+
+    /* Register for each Pipeline Stage */
+    for (int stage_num=0; stage_num < ThePipeline::NumStages; stage_num++) {
+        pipelineStage[stage_num]->regStats();
+    }
+
     /* Register any of the InOrderCPU's stats here.*/
+    instsPerCtxtSwitch
+        .name(name() + ".instsPerContextSwitch")
+        .desc("Instructions Committed Per Context Switch")
+        .prereq(instsPerCtxtSwitch);
+    
+    numCtxtSwitches
+        .name(name() + ".contextSwitches")
+        .desc("Number of context switches");
+            
     timesIdled
         .name(name() + ".timesIdled")
         .desc("Number of times that the entire CPU went into an idle state and"
@@ -331,9 +397,17 @@
 
     idleCycles
         .name(name() + ".idleCycles")
-        .desc("Total number of cycles that the CPU has spent unscheduled due "
-              "to idling")
-        .prereq(idleCycles);
+        .desc("Number of cycles cpu's stages were not processed");
+
+    runCycles
+        .name(name() + ".runCycles")
+        .desc("Number of cycles cpu stages are processed.");
+
+    activity
+        .name(name() + ".activity")
+        .desc("Percentage of cycles cpu is active")
+        .precision(6);
+    activity = (runCycles / numCycles) * 100;
 
     threadCycles
         .init(numThreads)
@@ -342,7 +416,7 @@
 
     smtCycles
         .name(name() + ".smtCycles")
-        .desc("Total number of cycles that the CPU was simultaneous 
multithreading.(SMT)");
+        .desc("Total number of cycles that the CPU was in SMT-mode");
 
     committedInsts
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to