summaryrefslogtreecommitdiff
path: root/src/mem/dram_ctrl.cc
diff options
context:
space:
mode:
authorOmar Naji <Omar.Naji@arm.com>2014-12-23 09:31:18 -0500
committerOmar Naji <Omar.Naji@arm.com>2014-12-23 09:31:18 -0500
commit152c02354ee53f4f4f10ac01911eb92386ef6fd2 (patch)
treecd91a77e1da368bdc5cf5574d92bd6a09cd7fe2a /src/mem/dram_ctrl.cc
parente76e8e28a3d62e20d2df75b60943442e78fa212b (diff)
downloadgem5-152c02354ee53f4f4f10ac01911eb92386ef6fd2.tar.xz
mem: Fix a bug in the DRAM controller arbitration
Fix a minor issue that affects multi-rank systems.
Diffstat (limited to 'src/mem/dram_ctrl.cc')
-rw-r--r--src/mem/dram_ctrl.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mem/dram_ctrl.cc b/src/mem/dram_ctrl.cc
index 8378debf1..62ae9e984 100644
--- a/src/mem/dram_ctrl.cc
+++ b/src/mem/dram_ctrl.cc
@@ -1477,7 +1477,13 @@ DRAMCtrl::minBankPrep(const deque<DRAMPacket*>& queue,
// Offset by tRCD to correlate with ACT timing variables
Tick min_cmd_at = busBusyUntil - tCL - tRCD;
- // Prioritize same rank accesses that can issue B2B
+ // if we have multiple ranks and all
+ // waiting packets are accessing a rank which was previously active
+ // then bank_mask_same_rank will be set to a value while bank_mask will
+ // remain 0. In this case, the function should return the value of
+ // bank_mask_same_rank.
+ // else if waiting packets access a rank which was previously active and
+ // other ranks, prioritize same rank accesses that can issue B2B
// Only optimize for same ranks when the command type
// does not change; do not want to unnecessarily incur tWTR
//
@@ -1485,8 +1491,8 @@ DRAMCtrl::minBankPrep(const deque<DRAMPacket*>& queue,
// 1) Commands that access the same rank as previous burst
// and can prep the bank seamlessly.
// 2) Commands (any rank) with earliest bank prep
- if (!switched_cmd_type && same_rank_match &&
- min_act_at_same_rank <= min_cmd_at) {
+ if ((bank_mask == 0) || (!switched_cmd_type && same_rank_match &&
+ min_act_at_same_rank <= min_cmd_at)) {
bank_mask = bank_mask_same_rank;
}