From 59460b91f35efe24a99424c0018d2f9c002e50c8 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 23 Dec 2014 09:31:18 -0500 Subject: 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). --- src/mem/dram_ctrl.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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); -- cgit v1.2.3