changeset b4907f87b96a in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=b4907f87b96a
description:
        inorder-mdu: multiplier latency fix
        mdu was workign incorrectly for 4+ latency due to incorrectly assuming
        multiply was finished the next stage

diffstat:

2 files changed, 33 insertions(+), 1 deletion(-)
src/cpu/inorder/resources/mult_div_unit.cc |   32 +++++++++++++++++++++++++++-
src/cpu/inorder/resources/mult_div_unit.hh |    2 +

diffs (63 lines):

diff -r 9fb0ec9b5304 -r b4907f87b96a src/cpu/inorder/resources/mult_div_unit.cc
--- a/src/cpu/inorder/resources/mult_div_unit.cc        Thu Sep 17 02:56:06 
2009 -0700
+++ b/src/cpu/inorder/resources/mult_div_unit.cc        Thu Sep 17 15:45:27 
2009 -0400
@@ -91,7 +91,32 @@
     Resource::freeSlot(slot_idx);    
 }
 
+//@TODO: Should we push this behavior into base-class to generically
+//       accomodate all multicyle resources?
+void
+MultDivUnit::requestAgain(DynInstPtr inst, bool &service_request)
+{
+    ResReqPtr mult_div_req = findRequest(inst);
+    assert(mult_div_req);
 
+    service_request = true;
+
+    // Check to see if this instruction is requesting the same command
+    // or a different one
+    if (mult_div_req->cmd != inst->resSched.top()->cmd) {
+        // If different, then update command in the request
+        mult_div_req->cmd = inst->resSched.top()->cmd;
+        DPRINTF(InOrderMDU,
+                "[tid:%i]: [sn:%i]: Updating the command for this 
instruction\n",
+                inst->readTid(), inst->seqNum);
+    } else {
+        // If same command, just check to see if memory access was completed
+        // but dont try to re-execute
+        DPRINTF(InOrderMDU,
+                "[tid:%i]: [sn:%i]: requesting this resource again\n",
+                inst->readTid(), inst->seqNum);
+    }
+}
 int
 MultDivUnit::getSlot(DynInstPtr inst)
 {
@@ -232,8 +257,13 @@
         //      counting down the time
         {
             DPRINTF(InOrderMDU, "End MDU called ...\n");    
-            if (mult_div_req->getInst()->isExecuted())
+            if (mult_div_req->getInst()->isExecuted()) {
+                DPRINTF(InOrderMDU, "Mult/Div finished.\n");                   
 
                 mult_div_req->done();            
+            } else {                
+                mult_div_req->setCompleted(false);
+            }
+            
         }
         break;
 
diff -r 9fb0ec9b5304 -r b4907f87b96a src/cpu/inorder/resources/mult_div_unit.hh
--- a/src/cpu/inorder/resources/mult_div_unit.hh        Thu Sep 17 02:56:06 
2009 -0700
+++ b/src/cpu/inorder/resources/mult_div_unit.hh        Thu Sep 17 15:45:27 
2009 -0400
@@ -82,6 +82,8 @@
     /** Register extra resource stats */
     virtual void regStats();
 
+    void requestAgain(DynInstPtr inst, bool &try_request);
+
   protected:
     /** Latency & Repeat Rate for Multiply Insts */
     unsigned multRepeatRate;
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to