inorder: recognize isSerializeAfter flag
authorKorey Sewell <ksewell@umich.edu>
Fri, 18 Feb 2011 19:29:48 +0000 (14:29 -0500)
committerKorey Sewell <ksewell@umich.edu>
Fri, 18 Feb 2011 19:29:48 +0000 (14:29 -0500)
keep track of when an instruction needs the execution
behind it to be serialized. Without this, in SE Mode
instructions can execute behind a system call exit().

src/cpu/inorder/resources/execution_unit.cc
src/cpu/inorder/resources/execution_unit.hh

index f715d607159e795d7c7f9245d32d6ff2871575df..e4d0c20b915a38066d87e5a8f192473a8c75ab1c 100644 (file)
@@ -42,7 +42,7 @@ ExecutionUnit::ExecutionUnit(string res_name, int res_id, int res_width,
                              int res_latency, InOrderCPU *_cpu,
                              ThePipeline::Params *params)
     : Resource(res_name, res_id, res_width, res_latency, _cpu),
-      lastExecuteTick(0), lastControlTick(0)
+      lastExecuteTick(0), lastControlTick(0), serializeTick(0)
 { }
 
 void
@@ -86,23 +86,39 @@ ExecutionUnit::execute(int slot_num)
     DynInstPtr inst = reqs[slot_num]->inst;
     Fault fault = NoFault;
     int seq_num = inst->seqNum;
+    Tick cur_tick = curTick();
+
+    if (cur_tick == serializeTick) {
+        DPRINTF(InOrderExecute, "Can not execute [tid:%i][sn:%i][PC:%s] %s. "
+                "All instructions are being serialized this cycle\n",
+                inst->readTid(), seq_num, inst->pcState(), inst->instName());
+        exec_req->done(false);
+        return;
+    }
 
-    DPRINTF(InOrderExecute, "[tid:%i] Executing [sn:%i] [PC:%s] %s.\n",
-            inst->readTid(), seq_num, inst->pcState(), inst->instName());
 
     switch (exec_req->cmd)
     {
       case ExecuteInst:
         {
-            if (curTick() != lastExecuteTick) {
-                lastExecuteTick = curTick();
+            DPRINTF(InOrderExecute, "[tid:%i] Executing [sn:%i] [PC:%s] %s.\n",
+                    inst->readTid(), seq_num, inst->pcState(), inst->instName());
+
+            if (cur_tick != lastExecuteTick) {
+                lastExecuteTick = cur_tick;
             }
 
+            assert(!inst->isMemRef());
+
+            if (inst->isSerializeAfter()) {
+                serializeTick = cur_tick;
+                DPRINTF(InOrderExecute, "Serializing execution after [tid:%i] "
+                        "[sn:%i] [PC:%s] %s.\n", inst->readTid(), seq_num,
+                        inst->pcState(), inst->instName());
+            }
 
-            if (inst->isMemRef()) {
-                panic("%s not configured to handle memory ops.\n", resName);
-            } else if (inst->isControl()) {
-                if (lastControlTick == curTick()) {
+            if (inst->isControl()) {
+                if (lastControlTick == cur_tick) {
                     DPRINTF(InOrderExecute, "Can not Execute More than One Control "
                             "Inst Per Cycle. Blocking Request.\n");
                     exec_req->done(false);
index a6694ddb5ebaf33b4529dfbc527db820abc08aaa..b03a6655e56fc7321b4022b8f26c4fe8d16c3748 100644 (file)
@@ -76,6 +76,7 @@ class ExecutionUnit : public Resource {
     Stats::Scalar executions;
     Tick lastExecuteTick;
     Tick lastControlTick;
+    Tick serializeTick;
 };