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.
This commit is contained in:
Éder F. Zulian
2016-11-08 18:35:34 +01:00
parent 8d7cd7db87
commit b38180384a

View File

@@ -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<Dram> tSocket;