Assertions added.
For memory modules: - The least significant bits of the physical address are the byte offset of the N-byte-wide memory module. - A single data word has N bytes. - N = 2^(# bits for byte offset). Assert that the number of bytes per burst match the burst length times the data word size in bytes.
This commit is contained in:
@@ -253,6 +253,7 @@ unsigned int Configuration::getSimMemSizeInBytes()
|
||||
unsigned int Configuration::getDataBusWidth()
|
||||
{
|
||||
unsigned int dataBusWidth = memSpec.bitWidth * NumberOfDevicesOnDIMM;
|
||||
assert(dataBusWidth > 0);
|
||||
return dataBusWidth;
|
||||
}
|
||||
|
||||
@@ -262,6 +263,15 @@ unsigned int Configuration::getBytesPerBurst()
|
||||
// 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 = (memSpec.BurstLength * getDataBusWidth()) / 8;
|
||||
assert(bytesPerBurst > 0);
|
||||
|
||||
if (NumberOfDevicesOnDIMM > 1) {
|
||||
// The least significant bits of the physical address are the byte
|
||||
// offset of the N-byte-wide memory module (a single data word has N
|
||||
// bytes. N = 2^(# bits for byte offset)).
|
||||
unsigned int dataWordSizeInBytes = xmlAddressDecoder::getInstance().amount["bytes"];
|
||||
assert(bytesPerBurst == (dataWordSizeInBytes * memSpec.BurstLength));
|
||||
}
|
||||
|
||||
return bytesPerBurst;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user