diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2014-03-23 11:12:05 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2014-03-23 11:12:05 -0400 |
commit | bc83eb2197d94748a8845185ddd4ae33a0b8487a (patch) | |
tree | ec19c8f871348597c8bcbe83e766c91eb8e79645 /src/mem | |
parent | 116985d661f6383bf2b61fa9b9d3df96e52fdb6d (diff) | |
download | gem5-bc83eb2197d94748a8845185ddd4ae33a0b8487a.tar.xz |
mem: Fix bug in DRAM bytes per activate
This patch ensures that we do not sample the bytes per activate when
the row has already been closed.
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/simple_dram.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mem/simple_dram.cc b/src/mem/simple_dram.cc index 505431772..42e36486a 100644 --- a/src/mem/simple_dram.cc +++ b/src/mem/simple_dram.cc @@ -1066,7 +1066,6 @@ SimpleDRAM::doDRAMAccess(DRAMPacket* dram_pkt) // Update bank state if (pageMgmt == Enums::open || pageMgmt == Enums::open_adaptive) { - bank.openRow = dram_pkt->row; bank.freeAt = curTick() + addDelay + accessLat; // If you activated a new row do to this access, the next access @@ -1077,9 +1076,18 @@ SimpleDRAM::doDRAMAccess(DRAMPacket* dram_pkt) bank.tRASDoneAt = actTick + tRAS; recordActivate(actTick, dram_pkt->rank, dram_pkt->bank); - // sample the number of bytes accessed and reset it as - // we are now closing this row - bytesPerActivate.sample(bank.bytesAccessed); + // if we closed an open row as a result of this access, + // then sample the number of bytes accessed before + // resetting it + if (bank.openRow != -1) + bytesPerActivate.sample(bank.bytesAccessed); + + // update the open row + bank.openRow = dram_pkt->row; + + // start counting anew, this covers both the case when we + // auto-precharged, and when this access is forced to + // precharge bank.bytesAccessed = 0; bank.rowAccesses = 0; } @@ -1137,6 +1145,11 @@ SimpleDRAM::doDRAMAccess(DRAMPacket* dram_pkt) DPRINTF(DRAM, "All banks precharged at tick: %ld\n", startTickPrechargeAll); } + + // sample the bytes per activate here since we are closing + // the page + bytesPerActivate.sample(bank.bytesAccessed); + DPRINTF(DRAM, "Auto-precharged bank: %d\n", dram_pkt->bankId); } |