From b38180384aa308abb7e26c9a9f1a2d8ebd9166f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Tue, 8 Nov 2016 18:35:34 +0100 Subject: [PATCH] Prevent wrong burst size calculation. For the case of a single x4 device the value assigned to "bytesPerBurst" would be zero because of integer division. --- DRAMSys/simulator/src/simulation/Dram.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h index e84edd52..8440487b 100644 --- a/DRAMSys/simulator/src/simulation/Dram.h +++ b/DRAMSys/simulator/src/simulation/Dram.h @@ -68,8 +68,10 @@ struct Dram : sc_module unsigned int burstLength = Configuration::getInstance().memSpec.BurstLength; // All DRAM chips on a DIMM operate in lockstep, // which constituing aggregate data bus width = chip's bus width * # locksteep-operated chips + // The bus width is given in bits, e.g., 64-bit data bus, 128-bit data bus, etc. unsigned int dataBusWidth = Configuration::getInstance().memSpec.bitWidth * Configuration::getInstance().NumberOfDevicesOnDIMM; - unsigned int bytesPerBurst = burstLength * (dataBusWidth / 8); + // First multiply to get the number of bits in a burst, then divide by 8 to get the value in bytes (the order is important. Think on a single x4 device) + unsigned int bytesPerBurst = (burstLength * dataBusWidth) / 8; // TLM Related: tlm_utils::simple_target_socket tSocket;