summaryrefslogtreecommitdiff
path: root/src/cpu/inorder/reg_dep_map.cc
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2010-04-10 23:31:36 -0400
committerKorey Sewell <ksewell@umich.edu>2010-04-10 23:31:36 -0400
commitb49511ae4843fc7af3b28d7dfdb18d4e474b81d3 (patch)
treee7a8e0fe0d96f8cee1a6bb809a43003dcd2701ea /src/cpu/inorder/reg_dep_map.cc
parentd71f9712b3640239f70382baade7439ac783f9a1 (diff)
downloadgem5-b49511ae4843fc7af3b28d7dfdb18d4e474b81d3.tar.xz
inorder: timing for inst forwarding
when insts execute, they mark the time they finish to be used for subsequent isnts they may need forwarding of data. However, the regdepmap was using the wrong value to index into the destination operands of the instruction to be forwarded. Thus, in some cases, we are checking to see if the 3rd destination register for an instruction is executed at a certain time, when there is only 1 dest. register valid. Thus, we get a bad, uninitialized time value that will stall forwarding causing performance loss but still the correct execution.
Diffstat (limited to 'src/cpu/inorder/reg_dep_map.cc')
-rw-r--r--src/cpu/inorder/reg_dep_map.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/cpu/inorder/reg_dep_map.cc b/src/cpu/inorder/reg_dep_map.cc
index 7fac0a905..cd1c3450c 100644
--- a/src/cpu/inorder/reg_dep_map.cc
+++ b/src/cpu/inorder/reg_dep_map.cc
@@ -161,7 +161,7 @@ RegDepMap::canRead(unsigned idx, DynInstPtr inst)
}
ThePipeline::DynInstPtr
-RegDepMap::canForward(unsigned reg_idx, unsigned src_idx, DynInstPtr inst)
+RegDepMap::canForward(unsigned reg_idx, DynInstPtr inst)
{
std::list<DynInstPtr>::iterator list_it = regMap[reg_idx].begin();
std::list<DynInstPtr>::iterator list_end = regMap[reg_idx].end();
@@ -176,13 +176,23 @@ RegDepMap::canForward(unsigned reg_idx, unsigned src_idx, DynInstPtr inst)
}
if (forward_inst) {
+ int dest_reg_idx = forward_inst->getDestIdxNum(reg_idx);
+ assert(dest_reg_idx != -1);
+
if (forward_inst->isExecuted() &&
- forward_inst->readResultTime(src_idx) < curTick) {
+ forward_inst->readResultTime(dest_reg_idx) < curTick) {
return forward_inst;
} else {
- DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, "
- " [sn:%i] has not been executed yet.\n",
- inst->seqNum, forward_inst->seqNum);
+ if (!forward_inst->isExecuted()) {
+ DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, "
+ " [sn:%i] has not been executed yet.\n",
+ inst->seqNum, forward_inst->seqNum);
+ } else if (forward_inst->readResultTime(dest_reg_idx) >= curTick) {
+ DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, "
+ " [sn:%i] executed on tick:%i.\n",
+ inst->seqNum, forward_inst->seqNum, forward_inst->readResultTime(dest_reg_idx));
+ }
+
return NULL;
}
} else {