summaryrefslogtreecommitdiff
path: root/src/mem/dram_ctrl.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-12-23 09:31:18 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-12-23 09:31:18 -0500
commit59460b91f35efe24a99424c0018d2f9c002e50c8 (patch)
tree3371fdc57dd5a032ff4b5fa4b4d51b796b8e71cd /src/mem/dram_ctrl.cc
parent2f7baf9dbe7fd2cd716885adacf508a5b89e9eb8 (diff)
downloadgem5-59460b91f35efe24a99424c0018d2f9c002e50c8.tar.xz
config: Expose the DRAM ranks as a command-line option
This patch gives the user direct influence over the number of DRAM ranks to make it easier to tune the memory density without affecting the bandwidth (previously the only means of scaling the device count was through the number of channels). The patch also adds some basic sanity checks to ensure that the number of ranks is a power of two (since we rely on bit slices in the address decoding).
Diffstat (limited to 'src/mem/dram_ctrl.cc')
-rw-r--r--src/mem/dram_ctrl.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mem/dram_ctrl.cc b/src/mem/dram_ctrl.cc
index 42abc63a8..44ac3d512 100644
--- a/src/mem/dram_ctrl.cc
+++ b/src/mem/dram_ctrl.cc
@@ -92,6 +92,11 @@ DRAMCtrl::DRAMCtrl(const DRAMCtrlParams* p) :
busBusyUntil(0), prevArrival(0),
nextReqTime(0), activeRank(0), timeStampOffset(0)
{
+ // sanity check the ranks since we rely on bit slicing for the
+ // address decoding
+ fatal_if(!isPowerOf2(ranksPerChannel), "DRAM rank count of %d is not "
+ "allowed, must be a power of two\n", ranksPerChannel);
+
for (int i = 0; i < ranksPerChannel; i++) {
Rank* rank = new Rank(*this, p);
ranks.push_back(rank);