refactor: add {default/max}DataBytesPerBurst

This commit is contained in:
2025-12-02 10:59:27 +01:00
parent 766a5bade3
commit 2ceabe8e26

View File

@@ -35,6 +35,7 @@
* Lukas Steiner
* Derek Christ
* Marco Mörz
* Thomas Zimmermann
*/
#ifndef MEMSPEC_H
@@ -74,13 +75,17 @@ public:
uint64_t devicesPerRank;
uint64_t rowsPerBank;
uint64_t columnsPerRow;
uint64_t defaultBurstLength;
uint64_t maxBurstLength;
uint64_t dataRate;
uint64_t bitWidth;
uint64_t dataBusWidth;
// Bursts
uint64_t defaultBurstLength;
uint64_t defaultBytesPerBurst;
uint64_t defaultDataBytesPerBurst;
uint64_t maxBurstLength;
uint64_t maxBytesPerBurst;
uint64_t maxDataBytesPerBurst;
// Clock
sc_core::sc_time tCK;
@@ -143,6 +148,16 @@ protected:
return true;
}
/**
* @brief Construct a new MemSpec object.
*
* @details Some standards like LPDDR6 include metadata (e.g. for ECC) in the bursts.
* Because of this, the bursts transfer a non-power-of-two amount of data (e.g. 12 bits/beat *
* 24 beats = 288 bits). On the frontend, the metadata is not known/relevant and the
* non-power-of-two amounts complicate things. For this reason, we split up defaultBytesPerBurst
* and maxBytesPerBurst variables to additional defaultDataBytesPerBurst and
* maxDataBytesPerBurst variables.
*/
template <typename MemSpecType>
MemSpec(const MemSpecType& memSpec,
uint64_t numberOfChannels,
@@ -163,15 +178,17 @@ protected:
devicesPerRank(devicesPerRank),
rowsPerBank(memSpec.memarchitecturespec.nbrOfRows),
columnsPerRow(memSpec.memarchitecturespec.nbrOfColumns),
dataRate(memSpec.memarchitecturespec.dataRate),
bitWidth(memSpec.memarchitecturespec.width),
dataBusWidth(bitWidth * devicesPerRank),
defaultBurstLength(memSpec.memarchitecturespec.burstLength),
maxBurstLength(memSpec.memarchitecturespec.maxBurstLength.has_value()
? memSpec.memarchitecturespec.maxBurstLength.value()
: defaultBurstLength),
dataRate(memSpec.memarchitecturespec.dataRate),
bitWidth(memSpec.memarchitecturespec.width),
dataBusWidth(bitWidth * devicesPerRank),
defaultBytesPerBurst((defaultBurstLength * dataBusWidth) / 8),
maxBytesPerBurst((maxBurstLength * dataBusWidth) / 8),
defaultDataBytesPerBurst(defaultBytesPerBurst),
maxDataBytesPerBurst(maxBytesPerBurst),
tCK(sc_core::sc_time(memSpec.memtimingspec.tCK, TCK_UNIT)),
memoryId(memSpec.memoryId),
memoryType(memSpec.id),