Function to get the number of bytes in a burst
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
* Felipe S. Prado
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "ConfigurationLoader.h"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
@@ -240,7 +242,7 @@ unsigned int Configuration::getSimMemSizeInBytes()
|
||||
unsigned int chipSize = chipBitSize / 8;
|
||||
// 4. Total memory size in Bytes of one DIMM (with only support of 1 rank on a DIMM)
|
||||
unsigned int memorySize = chipSize * NumberOfDevicesOnDIMM;
|
||||
|
||||
assert(memorySize > 0);
|
||||
return memorySize;
|
||||
}
|
||||
|
||||
@@ -254,3 +256,12 @@ unsigned int Configuration::getDataBusWidth()
|
||||
return dataBusWidth;
|
||||
}
|
||||
|
||||
// Returns the number of bytes in a burst
|
||||
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);
|
||||
return bytesPerBurst;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ struct Configuration
|
||||
|
||||
unsigned int getSimMemSizeInBytes();
|
||||
unsigned int getDataBusWidth();
|
||||
unsigned int getBytesPerBurst();
|
||||
|
||||
private:
|
||||
Configuration();
|
||||
|
||||
@@ -65,10 +65,7 @@ using namespace Data;
|
||||
|
||||
struct Dram : sc_module
|
||||
{
|
||||
unsigned int burstLength = Configuration::getInstance().memSpec.BurstLength;
|
||||
unsigned int dataBusWidth = Configuration::getInstance().getDataBusWidth();
|
||||
// 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;
|
||||
unsigned int bytesPerBurst = Configuration::getInstance().getBytesPerBurst();
|
||||
|
||||
// TLM Related:
|
||||
tlm_utils::simple_target_socket<Dram> tSocket;
|
||||
|
||||
@@ -46,8 +46,7 @@ StlPlayer::StlPlayer(sc_module_name, string pathToTrace, sc_time playerClk, Trac
|
||||
|
||||
this->playerClk = playerClk;
|
||||
this->burstlength = Configuration::getInstance().memSpec.BurstLength;
|
||||
this->bytesPerColumn = xmlAddressDecoder::getInstance().amount["bytes"];
|
||||
this->dataLength = bytesPerColumn * burstlength;
|
||||
this->dataLength = Configuration::getInstance().getBytesPerBurst();
|
||||
this->lineCnt = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ private:
|
||||
unsigned int lineCnt;
|
||||
|
||||
unsigned int burstlength;
|
||||
unsigned int bytesPerColumn;
|
||||
unsigned int dataLength;
|
||||
sc_time playerClk; // May be different from from the memory clock!
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user