summaryrefslogtreecommitdiff
path: root/src/cpu/inorder/resource.cc
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2011-02-18 14:28:37 -0500
committerKorey Sewell <ksewell@umich.edu>2011-02-18 14:28:37 -0500
commitd5961b2b20b498db28c0598f4344f5cb31be850f (patch)
treeb0c329d1cd398beb51f3098978b88d0f18e17b18 /src/cpu/inorder/resource.cc
parentd64226750ef9b2ac85c116f90cdfdb2a755b32d4 (diff)
downloadgem5-d5961b2b20b498db28c0598f4344f5cb31be850f.tar.xz
inorder: update pipeline interface for handling finished resource reqs
formerly, to free up bandwidth in a resource, we could just change the pointer in that resource but at the same time the pipeline stages had visibility to see what happened to a resource request. Now that we are recycling these requests (to avoid too much dynamic allocation), we can't throw away the request too early or the pipeline stage gets bad information. Instead, mark when a request is done with the resource all together and then let the pipeline stage call back to the resource that it's time to free up the bandwidth for more instructions *** inteface notes *** - When an instruction completes and is done in a resource for that cycle, call done() - When an instruction fails and is done with a resource for that cycle, call done(false) - When an instruction completes, but isnt finished with a resource, call completed() - When an instruction fails, but isnt finished with a resource, call completed(false) * * * inorder: tlbmiss wakeup bug fix
Diffstat (limited to 'src/cpu/inorder/resource.cc')
-rw-r--r--src/cpu/inorder/resource.cc38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/cpu/inorder/resource.cc b/src/cpu/inorder/resource.cc
index 757c17e6a..076084d16 100644
--- a/src/cpu/inorder/resource.cc
+++ b/src/cpu/inorder/resource.cc
@@ -44,6 +44,7 @@ Resource::Resource(string res_name, int res_id, int res_width,
// Use to deny a instruction a resource.
deniedReq = new ResourceRequest(this);
+ deniedReq->valid = true;
}
Resource::~Resource()
@@ -97,6 +98,9 @@ Resource::slotsInUse()
void
Resource::freeSlot(int slot_idx)
{
+ DPRINTF(Resource, "Deallocating [slot:%i].\n",
+ slot_idx);
+
// Put slot number on this resource's free list
availSlots.push_back(slot_idx);
@@ -160,6 +164,9 @@ Resource::request(DynInstPtr inst)
slot_num = getSlot(inst);
if (slot_num != -1) {
+ DPRINTF(Resource, "Allocating [slot:%i] for [tid:%i]: [sn:%i]\n",
+ slot_num, inst->readTid(), inst->seqNum);
+
// Get Stage # from Schedule Entry
stage_num = inst->curSkedEntry->stageNum;
unsigned cmd = inst->curSkedEntry->cmd;
@@ -177,10 +184,12 @@ Resource::request(DynInstPtr inst)
inst->readTid());
}
- reqs[slot_num] = inst_req;
-
try_request = true;
+ } else {
+ DPRINTF(Resource, "No slot available for [tid:%i]: [sn:%i]\n",
+ inst->readTid(), inst->seqNum);
}
+
}
if (try_request) {
@@ -352,8 +361,9 @@ int ResourceRequest::resReqID = 0;
int ResourceRequest::maxReqCount = 0;
ResourceRequest::ResourceRequest(Resource *_res)
- : res(_res), inst(NULL), stagePasses(0), valid(false), complSlotNum(-1),
- completed(false), squashed(false), processing(false), memStall(false)
+ : res(_res), inst(NULL), stagePasses(0), valid(false), doneInResource(false),
+ complSlotNum(-1), completed(false), squashed(false), processing(false),
+ memStall(false)
{
}
@@ -384,6 +394,19 @@ ResourceRequest::clearRequest()
valid = false;
inst = NULL;
stagePasses = 0;
+ completed = false;
+ doneInResource = false;
+ squashed = false;
+ memStall = false;
+}
+
+void
+ResourceRequest::freeSlot()
+{
+ assert(res);
+
+ // Free Slot So Another Instruction Can Use This Resource
+ res->freeSlot(slotNum);
}
void
@@ -399,13 +422,8 @@ ResourceRequest::done(bool completed)
if (completed) {
complSlotNum = slotNum;
}
-
- // Free Slot So Another Instruction Can Use This Resource
- res->freeSlot(slotNum);
- // change slot # to -1, since we check slotNum to see if request is
- // still valid
- slotNum = -1;
+ doneInResource = true;
}
ResourceEvent::ResourceEvent()