Merge branch 'develop' into work/partial_writes
This commit is contained in:
11
.clang-format
Executable file
11
.clang-format
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
AccessModifierOffset: '-4'
|
||||||
|
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
BinPackArguments: 'false'
|
||||||
|
BinPackParameters: 'false'
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
ColumnLimit: '100'
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||||
|
IndentWidth: '4'
|
||||||
|
PointerAlignment: Left
|
||||||
18
.clang-tidy
Normal file
18
.clang-tidy
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Checks: >
|
||||||
|
clang-diagnostic-*,
|
||||||
|
clang-analyzer-*,
|
||||||
|
modernize-*,
|
||||||
|
bugprone-*,
|
||||||
|
concurrency-*,
|
||||||
|
cppcoreguidelines-*,
|
||||||
|
performance-*,
|
||||||
|
portability-*,
|
||||||
|
readability-*,
|
||||||
|
-modernize-use-trailing-return-type,
|
||||||
|
-readability-braces-around-statements,
|
||||||
|
-readability-identifier-length,
|
||||||
|
-readability-function-cognitive-complexity
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: ''
|
||||||
|
AnalyzeTemporaryDtors: false
|
||||||
|
FormatStyle: file
|
||||||
@@ -69,7 +69,8 @@
|
|||||||
"std"
|
"std"
|
||||||
],
|
],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
BasedOnStyle: LLVM
|
|
||||||
AccessModifierOffset: '-4'
|
|
||||||
AllowShortFunctionsOnASingleLine: None
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
AllowShortLoopsOnASingleLine: 'false'
|
|
||||||
AlwaysBreakTemplateDeclarations: 'true'
|
|
||||||
BreakBeforeBraces: Allman
|
|
||||||
ColumnLimit: '120'
|
|
||||||
IndentWidth: '4'
|
|
||||||
PointerAlignment: Right
|
|
||||||
|
|
||||||
...
|
|
||||||
@@ -59,30 +59,30 @@ MemSpecLPDDR5::MemSpecLPDDR5(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
memSpec.memarchitecturespec.entries.at("nbrOfBankGroups")
|
memSpec.memarchitecturespec.entries.at("nbrOfBankGroups")
|
||||||
* memSpec.memarchitecturespec.entries.at("nbrOfRanks"),
|
* memSpec.memarchitecturespec.entries.at("nbrOfRanks"),
|
||||||
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
||||||
per2BankOffset(memSpec.memarchitecturespec.entries.at("per2BankOffset")),
|
|
||||||
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
||||||
tREFIpb (tCK * memSpec.memtimingspec.entries.at("REFIpb")),
|
tREFIpb (tCK * memSpec.memtimingspec.entries.at("REFIpb")),
|
||||||
tRFCab (tCK * memSpec.memtimingspec.entries.at("RFCab")),
|
tRFCab (tCK * memSpec.memtimingspec.entries.at("RFCab")),
|
||||||
tRFCpb (tCK * memSpec.memtimingspec.entries.at("RFCpb")),
|
tRFCpb (tCK * memSpec.memtimingspec.entries.at("RFCpb")),
|
||||||
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRPab (tCK * memSpec.memtimingspec.entries.at("RPab")),
|
tRPab (tCK * memSpec.memtimingspec.entries.at("RPab")),
|
||||||
tRPpb (tCK * memSpec.memtimingspec.entries.at("RPpb")),
|
tRPpb (tCK * memSpec.memtimingspec.entries.at("RPpb")),
|
||||||
tRCab (tCK * memSpec.memtimingspec.entries.at("RCab")),
|
|
||||||
tRCpb (tCK * memSpec.memtimingspec.entries.at("RCpb")),
|
tRCpb (tCK * memSpec.memtimingspec.entries.at("RCpb")),
|
||||||
|
tRCab (tCK * memSpec.memtimingspec.entries.at("RCab")),
|
||||||
tPPD (tCK * memSpec.memtimingspec.entries.at("PPD")),
|
tPPD (tCK * memSpec.memtimingspec.entries.at("PPD")),
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
|
||||||
tRCD_L (tCK * memSpec.memtimingspec.entries.at("RCD_L")),
|
tRCD_L (tCK * memSpec.memtimingspec.entries.at("RCD_L")),
|
||||||
tRCD_S (tCK * memSpec.memtimingspec.entries.at("RCD_S")),
|
tRCD_S (tCK * memSpec.memtimingspec.entries.at("RCD_S")),
|
||||||
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
||||||
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
||||||
//tCCD (tCK * parseUint(memspec["memtimingspec"], "CCD")),
|
|
||||||
tRL (tCK * memSpec.memtimingspec.entries.at("RL")),
|
tRL (tCK * memSpec.memtimingspec.entries.at("RL")),
|
||||||
|
//tCCD (tCK * parseUint(memspec["memtimingspec"], "CCD")),
|
||||||
|
tRBTP (tCK * memSpec.memtimingspec.entries.at("RBTP")),
|
||||||
//tRPST (tCK * parseUint(memspec["memtimingspec"], "RPST")),
|
//tRPST (tCK * parseUint(memspec["memtimingspec"], "RPST")),
|
||||||
//tDQSCK (tCK * parseUint(memspec["memtimingspec"], "DQSCK")),
|
//tDQSCK (tCK * parseUint(memspec["memtimingspec"], "DQSCK")),
|
||||||
tRBTP (tCK * memSpec.memtimingspec.entries.at("RBTP")),
|
|
||||||
tWL (tCK * memSpec.memtimingspec.entries.at("WL")),
|
tWL (tCK * memSpec.memtimingspec.entries.at("WL")),
|
||||||
|
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
||||||
//tDQSS (tCK * parseUint(memspec["memtimingspec"], "DQSS")),
|
//tDQSS (tCK * parseUint(memspec["memtimingspec"], "DQSS")),
|
||||||
//tDQS2DQ (tCK * parseUint(memspec["memtimingspec"], "DQS2DQ")),
|
//tDQS2DQ (tCK * parseUint(memspec["memtimingspec"], "DQS2DQ")),
|
||||||
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS")),
|
||||||
//tWPRE (tCK * parseUint(memspec["memtimingspec"], "WPRE")),
|
//tWPRE (tCK * parseUint(memspec["memtimingspec"], "WPRE")),
|
||||||
//tWTR (tCK * parseUint(memspec["memtimingspec"], "WTR")),
|
//tWTR (tCK * parseUint(memspec["memtimingspec"], "WTR")),
|
||||||
//tXP (tCK * parseUint(memspec["memtimingspec"] "XP")),
|
//tXP (tCK * parseUint(memspec["memtimingspec"] "XP")),
|
||||||
@@ -104,10 +104,10 @@ MemSpecLPDDR5::MemSpecLPDDR5(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tWCK2DQO(tCK * memSpec.memtimingspec.entries.at("WCK2DQO")),
|
tWCK2DQO(tCK * memSpec.memtimingspec.entries.at("WCK2DQO")),
|
||||||
tpbR2act(tCK * memSpec.memtimingspec.entries.at("pbR2act")),
|
tpbR2act(tCK * memSpec.memtimingspec.entries.at("pbR2act")),
|
||||||
tpbR2pbR(tCK * memSpec.memtimingspec.entries.at("pbR2pbR")),
|
tpbR2pbR(tCK * memSpec.memtimingspec.entries.at("pbR2pbR")),
|
||||||
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS")),
|
|
||||||
tBURST16(tCK * 16 / dataRate),
|
tBURST16(tCK * 16 / dataRate),
|
||||||
tBURST32(tCK * 32 / dataRate),
|
tBURST32(tCK * 32 / dataRate),
|
||||||
bankMode(groupsPerRank != 1 ? BankMode::MBG : (banksPerRank == 16 ? BankMode::M16B : BankMode::M8B))
|
bankMode(groupsPerRank != 1 ? BankMode::MBG : (banksPerRank == 16 ? BankMode::M16B : BankMode::M8B)),
|
||||||
|
per2BankOffset(memSpec.memarchitecturespec.entries.at("per2BankOffset"))
|
||||||
{
|
{
|
||||||
commandLengthInCycles[Command::ACT] = 2;
|
commandLengthInCycles[Command::ACT] = 2;
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,8 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector
|
|||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
json_t simulation = json_t::parse(file, parser_callback, true, true).at(Configuration::KEY);
|
json_t simulation = json_t::parse(file, parser_callback, true, true).at(Configuration::KEY);
|
||||||
return simulation.get<DRAMSys::Config::Configuration>();
|
return simulation.get<DRAMSys::Config::Configuration>();
|
||||||
} else {
|
|
||||||
throw std::runtime_error("Failed to open file " + std::string(path));
|
|
||||||
}
|
}
|
||||||
|
throw std::runtime_error("Failed to open file " + std::string(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys::Config
|
} // namespace DRAMSys::Config
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(AddressDistribution, {{AddressDistribution::Invalid
|
|||||||
|
|
||||||
struct TracePlayer
|
struct TracePlayer
|
||||||
{
|
{
|
||||||
uint64_t clkMhz;
|
uint64_t clkMhz{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::optional<unsigned int> maxPendingReadRequests;
|
std::optional<unsigned int> maxPendingReadRequests;
|
||||||
std::optional<unsigned int> maxPendingWriteRequests;
|
std::optional<unsigned int> maxPendingWriteRequests;
|
||||||
@@ -81,10 +81,10 @@ NLOHMANN_JSONIFY_ALL_THINGS(
|
|||||||
|
|
||||||
struct TrafficGeneratorActiveState
|
struct TrafficGeneratorActiveState
|
||||||
{
|
{
|
||||||
unsigned int id;
|
unsigned int id{};
|
||||||
|
|
||||||
uint64_t numRequests;
|
uint64_t numRequests{};
|
||||||
double rwRatio;
|
double rwRatio{};
|
||||||
AddressDistribution addressDistribution;
|
AddressDistribution addressDistribution;
|
||||||
std::optional<uint64_t> addressIncrement;
|
std::optional<uint64_t> addressIncrement;
|
||||||
std::optional<uint64_t> minAddress;
|
std::optional<uint64_t> minAddress;
|
||||||
@@ -120,7 +120,7 @@ NLOHMANN_JSONIFY_ALL_THINGS(TrafficGeneratorStateTransition, from, to, probabili
|
|||||||
|
|
||||||
struct TrafficGenerator
|
struct TrafficGenerator
|
||||||
{
|
{
|
||||||
uint64_t clkMhz;
|
uint64_t clkMhz{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::optional<unsigned int> maxPendingReadRequests;
|
std::optional<unsigned int> maxPendingReadRequests;
|
||||||
std::optional<unsigned int> maxPendingWriteRequests;
|
std::optional<unsigned int> maxPendingWriteRequests;
|
||||||
@@ -130,8 +130,8 @@ struct TrafficGenerator
|
|||||||
std::optional<unsigned> dataLength;
|
std::optional<unsigned> dataLength;
|
||||||
std::optional<unsigned> dataAlignment;
|
std::optional<unsigned> dataAlignment;
|
||||||
|
|
||||||
uint64_t numRequests;
|
uint64_t numRequests{};
|
||||||
double rwRatio;
|
double rwRatio{};
|
||||||
AddressDistribution addressDistribution;
|
AddressDistribution addressDistribution;
|
||||||
std::optional<uint64_t> addressIncrement;
|
std::optional<uint64_t> addressIncrement;
|
||||||
std::optional<uint64_t> minAddress;
|
std::optional<uint64_t> minAddress;
|
||||||
@@ -156,7 +156,7 @@ NLOHMANN_JSONIFY_ALL_THINGS(TrafficGenerator,
|
|||||||
|
|
||||||
struct TrafficGeneratorStateMachine
|
struct TrafficGeneratorStateMachine
|
||||||
{
|
{
|
||||||
uint64_t clkMhz;
|
uint64_t clkMhz{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::optional<unsigned int> maxPendingReadRequests;
|
std::optional<unsigned int> maxPendingReadRequests;
|
||||||
std::optional<unsigned int> maxPendingWriteRequests;
|
std::optional<unsigned int> maxPendingWriteRequests;
|
||||||
@@ -183,13 +183,13 @@ NLOHMANN_JSONIFY_ALL_THINGS(TrafficGeneratorStateMachine,
|
|||||||
|
|
||||||
struct RowHammer
|
struct RowHammer
|
||||||
{
|
{
|
||||||
uint64_t clkMhz;
|
uint64_t clkMhz{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::optional<unsigned int> maxPendingReadRequests;
|
std::optional<unsigned int> maxPendingReadRequests;
|
||||||
std::optional<unsigned int> maxPendingWriteRequests;
|
std::optional<unsigned int> maxPendingWriteRequests;
|
||||||
|
|
||||||
uint64_t numRequests;
|
uint64_t numRequests{};
|
||||||
uint64_t rowIncrement;
|
uint64_t rowIncrement{};
|
||||||
};
|
};
|
||||||
|
|
||||||
NLOHMANN_JSONIFY_ALL_THINGS(
|
NLOHMANN_JSONIFY_ALL_THINGS(
|
||||||
|
|||||||
@@ -74,10 +74,7 @@ void DebugManager::openDebugFile(const std::string &filename)
|
|||||||
debugFile.open(filename);
|
debugFile.open(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugManager::DebugManager()
|
DebugManager::DebugManager() = default;
|
||||||
: debugEnabled(false), writeToConsole(false), writeToFile(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugManager::~DebugManager()
|
DebugManager::~DebugManager()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
DebugManager(const DebugManager&) = delete;
|
DebugManager(const DebugManager&) = delete;
|
||||||
DebugManager& operator=(const DebugManager&) = delete;
|
DebugManager& operator=(const DebugManager&) = delete;
|
||||||
|
DebugManager(DebugManager&&) = delete;
|
||||||
|
DebugManager& operator=(DebugManager&&) = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
void setup(bool _debugEnabled, bool _writeToConsole, bool _writeToFile);
|
void setup(bool _debugEnabled, bool _writeToConsole, bool _writeToFile);
|
||||||
|
|
||||||
void printDebugMessage(const std::string &sender, const std::string &message);
|
void printDebugMessage(const std::string &sender, const std::string &message);
|
||||||
@@ -73,9 +74,9 @@ public:
|
|||||||
void openDebugFile(const std::string &filename);
|
void openDebugFile(const std::string &filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debugEnabled;
|
bool debugEnabled = false;
|
||||||
bool writeToConsole;
|
bool writeToConsole = false;
|
||||||
bool writeToFile;
|
bool writeToFile = false;
|
||||||
|
|
||||||
std::ofstream debugFile;
|
std::ofstream debugFile;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,18 +52,21 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
TlmRecorder::TlmRecorder(const std::string& name, const Configuration& config, const std::string& dbName) :
|
TlmRecorder::TlmRecorder(const std::string &name,
|
||||||
name(name), config(config), memSpec(*config.memSpec), totalNumTransactions(0),
|
const Configuration &config,
|
||||||
simulationTimeCoveredByRecording(SC_ZERO_TIME)
|
const std::string &dbName) :
|
||||||
|
name(name),
|
||||||
|
config(config),
|
||||||
|
memSpec(*config.memSpec),
|
||||||
|
currentDataBuffer(&recordingDataBuffer.at(0)),
|
||||||
|
storageDataBuffer(&recordingDataBuffer.at(1)),
|
||||||
|
simulationTimeCoveredByRecording(SC_ZERO_TIME)
|
||||||
{
|
{
|
||||||
currentDataBuffer = &recordingDataBuffer[0];
|
|
||||||
storageDataBuffer = &recordingDataBuffer[1];
|
|
||||||
|
|
||||||
currentDataBuffer->reserve(transactionCommitRate);
|
currentDataBuffer->reserve(transactionCommitRate);
|
||||||
storageDataBuffer->reserve(transactionCommitRate);
|
storageDataBuffer->reserve(transactionCommitRate);
|
||||||
|
|
||||||
openDB(dbName);
|
openDB(dbName);
|
||||||
char *sErrMsg;
|
char *sErrMsg = nullptr;
|
||||||
sqlite3_exec(db, "PRAGMA main.page_size = 4096", nullptr, nullptr, &sErrMsg);
|
sqlite3_exec(db, "PRAGMA main.page_size = 4096", nullptr, nullptr, &sErrMsg);
|
||||||
sqlite3_exec(db, "PRAGMA main.cache_size=10000", nullptr, nullptr, &sErrMsg);
|
sqlite3_exec(db, "PRAGMA main.cache_size=10000", nullptr, nullptr, &sErrMsg);
|
||||||
sqlite3_exec(db, "PRAGMA main.locking_mode=EXCLUSIVE", nullptr, nullptr, &sErrMsg);
|
sqlite3_exec(db, "PRAGMA main.locking_mode=EXCLUSIVE", nullptr, nullptr, &sErrMsg);
|
||||||
@@ -81,7 +84,7 @@ TlmRecorder::TlmRecorder(const std::string& name, const Configuration& config, c
|
|||||||
|
|
||||||
void TlmRecorder::finalize()
|
void TlmRecorder::finalize()
|
||||||
{
|
{
|
||||||
if (db)
|
if (db != nullptr)
|
||||||
closeConnection();
|
closeConnection();
|
||||||
sqlite3_finalize(insertTransactionStatement);
|
sqlite3_finalize(insertTransactionStatement);
|
||||||
sqlite3_finalize(insertRangeStatement);
|
sqlite3_finalize(insertRangeStatement);
|
||||||
@@ -149,7 +152,7 @@ void TlmRecorder::recordPhase(tlm_generic_payload& trans, const tlm_phase& phase
|
|||||||
}
|
}
|
||||||
else if (isFixedCommandPhase(phase))
|
else if (isFixedCommandPhase(phase))
|
||||||
{
|
{
|
||||||
tlm_generic_payload* keyTrans;
|
tlm_generic_payload* keyTrans = nullptr;
|
||||||
if (ChildExtension::isChildTrans(trans))
|
if (ChildExtension::isChildTrans(trans))
|
||||||
{
|
{
|
||||||
keyTrans = &ChildExtension::getParentTrans(trans);
|
keyTrans = &ChildExtension::getParentTrans(trans);
|
||||||
@@ -213,7 +216,7 @@ void TlmRecorder::introduceTransactionToSystem(tlm_generic_payload& trans)
|
|||||||
{
|
{
|
||||||
totalNumTransactions++;
|
totalNumTransactions++;
|
||||||
|
|
||||||
char commandChar;
|
char commandChar = 0;
|
||||||
tlm_command command = trans.get_command();
|
tlm_command command = trans.get_command();
|
||||||
if (command == TLM_READ_COMMAND)
|
if (command == TLM_READ_COMMAND)
|
||||||
commandChar = 'R';
|
commandChar = 'R';
|
||||||
|
|||||||
@@ -63,8 +63,11 @@ class TlmRecorder
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TlmRecorder(const std::string& name, const Configuration& config, const std::string& dbName);
|
TlmRecorder(const std::string& name, const Configuration& config, const std::string& dbName);
|
||||||
TlmRecorder(const TlmRecorder&) = delete;
|
TlmRecorder(const TlmRecorder &) = delete;
|
||||||
TlmRecorder(TlmRecorder&&) = default;
|
TlmRecorder(TlmRecorder &&) = default;
|
||||||
|
TlmRecorder &operator=(const TlmRecorder &) = delete;
|
||||||
|
TlmRecorder &operator=(TlmRecorder &&) = delete;
|
||||||
|
~TlmRecorder() = default;
|
||||||
|
|
||||||
void recordMcConfig(std::string _mcconfig)
|
void recordMcConfig(std::string _mcconfig)
|
||||||
{
|
{
|
||||||
@@ -89,12 +92,12 @@ public:
|
|||||||
void finalize();
|
void finalize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string name;
|
||||||
const Configuration& config;
|
const Configuration& config;
|
||||||
const MemSpec& memSpec;
|
const MemSpec& memSpec;
|
||||||
|
|
||||||
struct Transaction
|
struct Transaction
|
||||||
{
|
{
|
||||||
Transaction(const Transaction& other) = default;
|
|
||||||
Transaction(uint64_t id, uint64_t address, unsigned int dataLength, char cmd,
|
Transaction(uint64_t id, uint64_t address, unsigned int dataLength, char cmd,
|
||||||
const sc_core::sc_time& timeOfGeneration, Thread thread, Channel channel) :
|
const sc_core::sc_time& timeOfGeneration, Thread thread, Channel channel) :
|
||||||
id(id), address(address), dataLength(dataLength), cmd(cmd), timeOfGeneration(timeOfGeneration),
|
id(id), address(address), dataLength(dataLength), cmd(cmd), timeOfGeneration(timeOfGeneration),
|
||||||
@@ -131,8 +134,6 @@ private:
|
|||||||
std::vector<Phase> recordedPhases;
|
std::vector<Phase> recordedPhases;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
std::string mcconfig, memspec, traces;
|
std::string mcconfig, memspec, traces;
|
||||||
|
|
||||||
void prepareSqlStatements();
|
void prepareSqlStatements();
|
||||||
@@ -162,7 +163,7 @@ private:
|
|||||||
|
|
||||||
std::unordered_map<tlm::tlm_generic_payload*, Transaction> currentTransactionsInSystem;
|
std::unordered_map<tlm::tlm_generic_payload*, Transaction> currentTransactionsInSystem;
|
||||||
|
|
||||||
uint64_t totalNumTransactions;
|
uint64_t totalNumTransactions = 0;
|
||||||
sc_core::sc_time simulationTimeCoveredByRecording;
|
sc_core::sc_time simulationTimeCoveredByRecording;
|
||||||
|
|
||||||
sqlite3 *db = nullptr;
|
sqlite3 *db = nullptr;
|
||||||
|
|||||||
@@ -310,10 +310,7 @@ void ChildExtension::setExtension(tlm::tlm_generic_payload& childTrans, tlm::tlm
|
|||||||
|
|
||||||
bool ChildExtension::isChildTrans(const tlm::tlm_generic_payload& trans)
|
bool ChildExtension::isChildTrans(const tlm::tlm_generic_payload& trans)
|
||||||
{
|
{
|
||||||
if (trans.get_extension<ChildExtension>() != nullptr)
|
return trans.get_extension<ChildExtension>() != nullptr;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tlm_extension_base* ParentExtension::clone() const
|
tlm_extension_base* ParentExtension::clone() const
|
||||||
@@ -358,10 +355,8 @@ bool ParentExtension::notifyChildTransCompletion()
|
|||||||
childTranses.clear();
|
childTranses.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParentExtension::notifyChildTransCompletion(tlm::tlm_generic_payload& trans)
|
bool ParentExtension::notifyChildTransCompletion(tlm::tlm_generic_payload& trans)
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ public:
|
|||||||
static void setIDAndTimeOfGeneration(tlm::tlm_generic_payload& trans, uint64_t threadPayloadID,
|
static void setIDAndTimeOfGeneration(tlm::tlm_generic_payload& trans, uint64_t threadPayloadID,
|
||||||
const sc_core::sc_time& timeOfGeneration);
|
const sc_core::sc_time& timeOfGeneration);
|
||||||
|
|
||||||
tlm::tlm_extension_base* clone() const override;
|
[[nodiscard]] tlm::tlm_extension_base* clone() const override;
|
||||||
void copy_from(const tlm::tlm_extension_base& ext) override;
|
void copy_from(const tlm::tlm_extension_base& ext) override;
|
||||||
|
|
||||||
Thread getThread() const;
|
[[nodiscard]] Thread getThread() const;
|
||||||
Channel getChannel() const;
|
[[nodiscard]] Channel getChannel() const;
|
||||||
uint64_t getThreadPayloadID() const;
|
[[nodiscard]] uint64_t getThreadPayloadID() const;
|
||||||
sc_core::sc_time getTimeOfGeneration() const;
|
[[nodiscard]] sc_core::sc_time getTimeOfGeneration() const;
|
||||||
|
|
||||||
static const ArbiterExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
static const ArbiterExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
||||||
static Thread getThread(const tlm::tlm_generic_payload& trans);
|
static Thread getThread(const tlm::tlm_generic_payload& trans);
|
||||||
@@ -120,16 +120,16 @@ public:
|
|||||||
|
|
||||||
//static ControllerExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
//static ControllerExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
||||||
|
|
||||||
tlm::tlm_extension_base* clone() const override;
|
[[nodiscard]] tlm::tlm_extension_base* clone() const override;
|
||||||
void copy_from(const tlm::tlm_extension_base& ext) override;
|
void copy_from(const tlm::tlm_extension_base& ext) override;
|
||||||
|
|
||||||
uint64_t getChannelPayloadID() const;
|
[[nodiscard]] uint64_t getChannelPayloadID() const;
|
||||||
Rank getRank() const;
|
[[nodiscard]] Rank getRank() const;
|
||||||
BankGroup getBankGroup() const;
|
[[nodiscard]] BankGroup getBankGroup() const;
|
||||||
Bank getBank() const;
|
[[nodiscard]] Bank getBank() const;
|
||||||
Row getRow() const;
|
[[nodiscard]] Row getRow() const;
|
||||||
Column getColumn() const;
|
[[nodiscard]] Column getColumn() const;
|
||||||
unsigned getBurstLength() const;
|
[[nodiscard]] unsigned getBurstLength() const;
|
||||||
|
|
||||||
static const ControllerExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
static const ControllerExtension& getExtension(const tlm::tlm_generic_payload& trans);
|
||||||
static uint64_t getChannelPayloadID(const tlm::tlm_generic_payload& trans);
|
static uint64_t getChannelPayloadID(const tlm::tlm_generic_payload& trans);
|
||||||
@@ -161,7 +161,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
//ChildExtension() = delete;
|
//ChildExtension() = delete;
|
||||||
|
|
||||||
tlm::tlm_extension_base* clone() const override;
|
[[nodiscard]] tlm::tlm_extension_base* clone() const override;
|
||||||
void copy_from(const tlm::tlm_extension_base& ext) override;
|
void copy_from(const tlm::tlm_extension_base& ext) override;
|
||||||
tlm::tlm_generic_payload& getParentTrans();
|
tlm::tlm_generic_payload& getParentTrans();
|
||||||
static tlm::tlm_generic_payload& getParentTrans(tlm::tlm_generic_payload& childTrans);
|
static tlm::tlm_generic_payload& getParentTrans(tlm::tlm_generic_payload& childTrans);
|
||||||
@@ -180,7 +180,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
ParentExtension() = delete;
|
ParentExtension() = delete;
|
||||||
|
|
||||||
tlm_extension_base* clone() const override;
|
[[nodiscard]] tlm_extension_base* clone() const override;
|
||||||
void copy_from(const tlm_extension_base& ext) override;
|
void copy_from(const tlm_extension_base& ext) override;
|
||||||
static void setExtension(tlm::tlm_generic_payload& parentTrans, std::vector<tlm::tlm_generic_payload*> childTranses);
|
static void setExtension(tlm::tlm_generic_payload& parentTrans, std::vector<tlm::tlm_generic_payload*> childTranses);
|
||||||
const std::vector<tlm::tlm_generic_payload*>& getChildTranses();
|
const std::vector<tlm::tlm_generic_payload*>& getChildTranses();
|
||||||
@@ -191,15 +191,12 @@ public:
|
|||||||
class EccExtension : public tlm::tlm_extension<EccExtension>
|
class EccExtension : public tlm::tlm_extension<EccExtension>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tlm_extension_base* clone() const override
|
[[nodiscard]] tlm_extension_base* clone() const override
|
||||||
{
|
{
|
||||||
return new EccExtension;
|
return new EccExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_from(tlm_extension_base const &ext) override
|
void copy_from([[maybe_unused]] tlm_extension_base const & ext) override {}
|
||||||
{
|
|
||||||
auto const &cpyFrom = static_cast<EccExtension const &>(ext);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ bool TimeInterval::intersects(const TimeInterval &other) const
|
|||||||
|
|
||||||
sc_time TimeInterval::getLength() const
|
sc_time TimeInterval::getLength() const
|
||||||
{
|
{
|
||||||
if (end > start)
|
if (start > end)
|
||||||
return end - start;
|
|
||||||
else
|
|
||||||
return start - end;
|
return start - end;
|
||||||
|
|
||||||
|
return end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getPhaseName(const tlm_phase &phase)
|
std::string getPhaseName(const tlm_phase &phase)
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ public:
|
|||||||
TimeInterval() : start(sc_core::SC_ZERO_TIME), end(sc_core::SC_ZERO_TIME) {}
|
TimeInterval() : start(sc_core::SC_ZERO_TIME), end(sc_core::SC_ZERO_TIME) {}
|
||||||
TimeInterval(const sc_core::sc_time& start, const sc_core::sc_time& end) : start(start), end(end) {}
|
TimeInterval(const sc_core::sc_time& start, const sc_core::sc_time& end) : start(start), end(end) {}
|
||||||
|
|
||||||
sc_core::sc_time getLength() const;
|
[[nodiscard]] sc_core::sc_time getLength() const;
|
||||||
bool timeIsInInterval(const sc_core::sc_time &time) const;
|
[[nodiscard]] bool timeIsInInterval(const sc_core::sc_time &time) const;
|
||||||
bool intersects(const TimeInterval &other) const;
|
[[nodiscard]] bool intersects(const TimeInterval &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr const char headline[] =
|
constexpr const std::string_view headline =
|
||||||
"===========================================================================";
|
"===========================================================================";
|
||||||
|
|
||||||
std::string getPhaseName(const tlm::tlm_phase &phase);
|
std::string getPhaseName(const tlm::tlm_phase &phase);
|
||||||
|
|||||||
@@ -71,21 +71,25 @@ enum sc_time_unit string2TimeUnit(const std::string &s)
|
|||||||
{
|
{
|
||||||
if (s == "s")
|
if (s == "s")
|
||||||
return SC_SEC;
|
return SC_SEC;
|
||||||
else if (s == "ms")
|
|
||||||
|
if (s == "ms")
|
||||||
return SC_MS;
|
return SC_MS;
|
||||||
else if (s == "us")
|
|
||||||
|
if (s == "us")
|
||||||
return SC_US;
|
return SC_US;
|
||||||
else if (s == "ns")
|
|
||||||
|
if (s == "ns")
|
||||||
return SC_NS;
|
return SC_NS;
|
||||||
else if (s == "ps")
|
|
||||||
|
if (s == "ps")
|
||||||
return SC_PS;
|
return SC_PS;
|
||||||
else if (s == "fs")
|
|
||||||
|
if (s == "fs")
|
||||||
return SC_FS;
|
return SC_FS;
|
||||||
else {
|
|
||||||
SC_REPORT_FATAL("Configuration",
|
SC_REPORT_FATAL("Configuration",
|
||||||
("Could not convert to enum sc_time_unit: " + s).c_str());
|
("Could not convert to enum sc_time_unit: " + s).c_str());
|
||||||
throw;
|
throw;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configuration::loadSimConfig(const DRAMSys::Config::SimConfig &simConfig)
|
void Configuration::loadSimConfig(const DRAMSys::Config::SimConfig &simConfig)
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class Configuration
|
class Configuration
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
Configuration() = default;
|
|
||||||
Configuration(const Configuration&) = delete;
|
|
||||||
Configuration& operator=(const Configuration &) = delete;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// MCConfig:
|
// MCConfig:
|
||||||
enum class PagePolicy {Open, Closed, OpenAdaptive, ClosedAdaptive} pagePolicy = PagePolicy::Open;
|
enum class PagePolicy {Open, Closed, OpenAdaptive, ClosedAdaptive} pagePolicy = PagePolicy::Open;
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ MemSpec::MemSpec(const DRAMSys::Config::MemSpec& memSpec,
|
|||||||
tCK(sc_time(1.0 / fCKMHz, SC_US)),
|
tCK(sc_time(1.0 / fCKMHz, SC_US)),
|
||||||
memoryId(memSpec.memoryId),
|
memoryId(memSpec.memoryId),
|
||||||
memoryType(memoryType),
|
memoryType(memoryType),
|
||||||
burstDuration(tCK* (static_cast<double>(defaultBurstLength) / dataRate)),
|
burstDuration(tCK* (static_cast<double>(defaultBurstLength) / dataRate))
|
||||||
memorySizeBytes(0)
|
|
||||||
{
|
{
|
||||||
commandLengthInCycles = std::vector<double>(Command::numberOfCommands(), 1);
|
commandLengthInCycles = std::vector<double>(Command::numberOfCommands(), 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ namespace DRAMSys
|
|||||||
class MemSpec
|
class MemSpec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
MemSpec &operator=(const MemSpec &) = delete;
|
||||||
|
MemSpec &operator=(MemSpec &&) = delete;
|
||||||
|
virtual ~MemSpec() = default;
|
||||||
|
|
||||||
const unsigned numberOfChannels;
|
const unsigned numberOfChannels;
|
||||||
const unsigned pseudoChannelsPerChannel;
|
const unsigned pseudoChannelsPerChannel;
|
||||||
const unsigned ranksPerChannel;
|
const unsigned ranksPerChannel;
|
||||||
@@ -84,29 +88,26 @@ public:
|
|||||||
WideIO2, GDDR5, GDDR5X, GDDR6, HBM2, HBM3, STTMRAM
|
WideIO2, GDDR5, GDDR5X, GDDR6, HBM2, HBM3, STTMRAM
|
||||||
} memoryType;
|
} memoryType;
|
||||||
|
|
||||||
virtual ~MemSpec() = default;
|
[[nodiscard]] virtual sc_core::sc_time getRefreshIntervalAB() const;
|
||||||
|
[[nodiscard]] virtual sc_core::sc_time getRefreshIntervalPB() const;
|
||||||
|
[[nodiscard]] virtual sc_core::sc_time getRefreshIntervalP2B() const;
|
||||||
|
[[nodiscard]] virtual sc_core::sc_time getRefreshIntervalSB() const;
|
||||||
|
|
||||||
virtual sc_core::sc_time getRefreshIntervalAB() const;
|
[[nodiscard]] virtual unsigned getPer2BankOffset() const;
|
||||||
virtual sc_core::sc_time getRefreshIntervalPB() const;
|
|
||||||
virtual sc_core::sc_time getRefreshIntervalP2B() const;
|
|
||||||
virtual sc_core::sc_time getRefreshIntervalSB() const;
|
|
||||||
|
|
||||||
virtual unsigned getPer2BankOffset() const;
|
[[nodiscard]] virtual unsigned getRAAIMT() const;
|
||||||
|
[[nodiscard]] virtual unsigned getRAAMMT() const;
|
||||||
|
[[nodiscard]] virtual unsigned getRAADEC() const;
|
||||||
|
|
||||||
virtual unsigned getRAAIMT() const;
|
[[nodiscard]] virtual bool hasRasAndCasBus() const;
|
||||||
virtual unsigned getRAAMMT() const;
|
|
||||||
virtual unsigned getRAADEC() const;
|
|
||||||
|
|
||||||
virtual bool hasRasAndCasBus() const;
|
[[nodiscard]] virtual sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
||||||
|
[[nodiscard]] virtual TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
||||||
|
[[nodiscard]] virtual bool requiresReadModifyWrite(const tlm::tlm_generic_payload& payload) const;
|
||||||
|
|
||||||
virtual sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
[[nodiscard]] sc_core::sc_time getCommandLength(Command command) const;
|
||||||
virtual TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
[[nodiscard]] double getCommandLengthInCycles(Command command) const;
|
||||||
|
[[nodiscard]] uint64_t getSimMemSizeInBytes() const;
|
||||||
virtual bool requiresReadModifyWrite(const tlm::tlm_generic_payload& payload) const;
|
|
||||||
|
|
||||||
sc_core::sc_time getCommandLength(Command) const;
|
|
||||||
double getCommandLengthInCycles(Command) const;
|
|
||||||
uint64_t getSimMemSizeInBytes() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MemSpec(const DRAMSys::Config::MemSpec& memSpec,
|
MemSpec(const DRAMSys::Config::MemSpec& memSpec,
|
||||||
@@ -117,10 +118,13 @@ protected:
|
|||||||
unsigned banksPerChannel, unsigned bankGroupsPerChannel,
|
unsigned banksPerChannel, unsigned bankGroupsPerChannel,
|
||||||
unsigned devicesPerRank);
|
unsigned devicesPerRank);
|
||||||
|
|
||||||
|
MemSpec(const MemSpec &) = default;
|
||||||
|
MemSpec(MemSpec &&) = default;
|
||||||
|
|
||||||
// Command lengths in cycles on bus, usually one clock cycle
|
// Command lengths in cycles on bus, usually one clock cycle
|
||||||
std::vector<double> commandLengthInCycles;
|
std::vector<double> commandLengthInCycles;
|
||||||
sc_core::sc_time burstDuration;
|
sc_core::sc_time burstDuration;
|
||||||
uint64_t memorySizeBytes;
|
uint64_t memorySizeBytes = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ MemSpecDDR3::MemSpecDDR3(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
||||||
tPD (tCKE),
|
tPD (tCKE),
|
||||||
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
||||||
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
||||||
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
||||||
@@ -71,16 +70,17 @@ MemSpecDDR3::MemSpecDDR3(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
||||||
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
||||||
tXS (tCK * memSpec.memtimingspec.entries.at("XS")),
|
tXS (tCK * memSpec.memtimingspec.entries.at("XS")),
|
||||||
tCCD (tCK * memSpec.memtimingspec.entries.at("CCD")),
|
|
||||||
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
|
||||||
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
||||||
tRFC (tCK * memSpec.memtimingspec.entries.at("RFC")),
|
tRFC (tCK * memSpec.memtimingspec.entries.at("RFC")),
|
||||||
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
||||||
|
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
||||||
|
tCCD (tCK * memSpec.memtimingspec.entries.at("CCD")),
|
||||||
|
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
||||||
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
||||||
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
||||||
tAL (tCK * memSpec.memtimingspec.entries.at("AL")),
|
|
||||||
tXPDLL (tCK * memSpec.memtimingspec.entries.at("XPDLL")),
|
tXPDLL (tCK * memSpec.memtimingspec.entries.at("XPDLL")),
|
||||||
tXSDLL (tCK * memSpec.memtimingspec.entries.at("XSDLL")),
|
tXSDLL (tCK * memSpec.memtimingspec.entries.at("XSDLL")),
|
||||||
|
tAL (tCK * memSpec.memtimingspec.entries.at("AL")),
|
||||||
tACTPDEN (tCK * memSpec.memtimingspec.entries.at("ACTPDEN")),
|
tACTPDEN (tCK * memSpec.memtimingspec.entries.at("ACTPDEN")),
|
||||||
tPRPDEN (tCK * memSpec.memtimingspec.entries.at("PRPDEN")),
|
tPRPDEN (tCK * memSpec.memtimingspec.entries.at("PRPDEN")),
|
||||||
tREFPDEN (tCK * memSpec.memtimingspec.entries.at("REFPDEN")),
|
tREFPDEN (tCK * memSpec.memtimingspec.entries.at("REFPDEN")),
|
||||||
@@ -127,41 +127,45 @@ sc_time MemSpecDDR3::getRefreshIntervalAB() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the execution time for commands that have a fixed execution time
|
// Returns the execution time for commands that have a fixed execution time
|
||||||
sc_time MemSpecDDR3::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecDDR3::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD;
|
return tRCD;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + burstDuration;
|
return tRL + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + burstDuration;
|
return tWL + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else
|
|
||||||
{
|
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
"command not known or command doesn't have a fixed execution time");
|
"command not known or command doesn't have a fixed execution time");
|
||||||
return SC_ZERO_TIME;
|
throw;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecDDR3::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecDDR3::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL, tRL + burstDuration};
|
return {tRL, tRL + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL, tWL + burstDuration};
|
return {tWL, tWL + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -93,10 +93,10 @@ public:
|
|||||||
const double iDD3P0;
|
const double iDD3P0;
|
||||||
const double iDD3P1;
|
const double iDD3P1;
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -146,41 +146,44 @@ sc_time MemSpecDDR4::getRefreshIntervalAB() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the execution time for commands that have a fixed execution time
|
// Returns the execution time for commands that have a fixed execution time
|
||||||
sc_time MemSpecDDR4::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecDDR4::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD;
|
return tRCD;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + burstDuration;
|
return tRL + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + burstDuration;
|
return tWL + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecDDR4::getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &) const
|
TimeInterval MemSpecDDR4::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm::tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL, tRL + burstDuration};
|
return {tRL, tRL + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL, tWL + burstDuration};
|
return {tWL, tWL + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -100,10 +100,10 @@ public:
|
|||||||
const double iDD62;
|
const double iDD62;
|
||||||
const double vDD2;
|
const double vDD2;
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -130,44 +130,48 @@ sc_time MemSpecGDDR5::getExecutionTime(Command command, const tlm_generic_payloa
|
|||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
{
|
{
|
||||||
if (payload.get_command() == TLM_READ_COMMAND)
|
if (payload.get_command() == TLM_READ_COMMAND)
|
||||||
return tRCDRD;
|
return tRCDRD;
|
||||||
else
|
|
||||||
return tRCDWR;
|
return tRCDWR;
|
||||||
}
|
}
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
return tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else if (command == Command::REFPB)
|
|
||||||
|
if (command == Command::REFPB)
|
||||||
return tRFCPB;
|
return tRFCPB;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecGDDR5::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecGDDR5::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
return {tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecGDDR5", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpecGDDR5", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -130,44 +130,48 @@ sc_time MemSpecGDDR5X::getExecutionTime(Command command, const tlm_generic_paylo
|
|||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
{
|
{
|
||||||
if (payload.get_command() == TLM_READ_COMMAND)
|
if (payload.get_command() == TLM_READ_COMMAND)
|
||||||
return tRCDRD;
|
return tRCDRD;
|
||||||
else
|
|
||||||
return tRCDWR;
|
return tRCDWR;
|
||||||
}
|
}
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else if (command == Command::REFPB)
|
|
||||||
|
if (command == Command::REFPB)
|
||||||
return tRFCPB;
|
return tRFCPB;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecGDDR5X::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecGDDR5X::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
return {tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecGDDR5X", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpecGDDR5X", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ MemSpecGDDR6::MemSpecGDDR6(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
memSpec.memarchitecturespec.entries.at( "nbrOfBankGroups")
|
memSpec.memarchitecturespec.entries.at( "nbrOfBankGroups")
|
||||||
* memSpec.memarchitecturespec.entries.at("nbrOfRanks"),
|
* memSpec.memarchitecturespec.entries.at("nbrOfRanks"),
|
||||||
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
||||||
per2BankOffset(memSpec.memarchitecturespec.entries.at("per2BankOffset")),
|
|
||||||
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
||||||
@@ -96,7 +95,8 @@ MemSpecGDDR6::MemSpecGDDR6(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tACTPDE (tCK * memSpec.memtimingspec.entries.at("ACTPDE")),
|
tACTPDE (tCK * memSpec.memtimingspec.entries.at("ACTPDE")),
|
||||||
tPREPDE (tCK * memSpec.memtimingspec.entries.at("PREPDE")),
|
tPREPDE (tCK * memSpec.memtimingspec.entries.at("PREPDE")),
|
||||||
tREFPDE (tCK * memSpec.memtimingspec.entries.at("REFPDE")),
|
tREFPDE (tCK * memSpec.memtimingspec.entries.at("REFPDE")),
|
||||||
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS"))
|
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS")),
|
||||||
|
per2BankOffset(memSpec.memarchitecturespec.entries.at("per2BankOffset"))
|
||||||
{
|
{
|
||||||
uint64_t deviceSizeBits = static_cast<uint64_t>(banksPerRank) * rowsPerBank * columnsPerRow * bitWidth;
|
uint64_t deviceSizeBits = static_cast<uint64_t>(banksPerRank) * rowsPerBank * columnsPerRow * bitWidth;
|
||||||
uint64_t deviceSizeBytes = deviceSizeBits / 8;
|
uint64_t deviceSizeBytes = deviceSizeBits / 8;
|
||||||
@@ -143,44 +143,48 @@ sc_time MemSpecGDDR6::getExecutionTime(Command command, const tlm_generic_payloa
|
|||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
{
|
{
|
||||||
if (payload.get_command() == TLM_READ_COMMAND)
|
if (payload.get_command() == TLM_READ_COMMAND)
|
||||||
return tRCDRD + tCK;
|
return tRCDRD + tCK;
|
||||||
else
|
|
||||||
return tRCDWR + tCK;
|
return tRCDWR + tCK;
|
||||||
}
|
}
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFCab;
|
return tRFCab;
|
||||||
else if (command == Command::REFPB || command == Command::REFP2B)
|
|
||||||
|
if (command == Command::REFPB || command == Command::REFP2B)
|
||||||
return tRFCpb;
|
return tRFCpb;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecGDDR6::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecGDDR6::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
return {tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
return {tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecGDDR6", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpecGDDR6", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -91,13 +91,13 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalP2B() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalP2B() const override;
|
||||||
unsigned getPer2BankOffset() const override;
|
[[nodiscard]] unsigned getPer2BankOffset() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned per2BankOffset;
|
unsigned per2BankOffset;
|
||||||
|
|||||||
@@ -131,44 +131,48 @@ sc_time MemSpecHBM2::getExecutionTime(Command command, const tlm_generic_payload
|
|||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
{
|
{
|
||||||
if (payload.get_command() == TLM_READ_COMMAND)
|
if (payload.get_command() == TLM_READ_COMMAND)
|
||||||
return tRCDRD + tCK;
|
return tRCDRD + tCK;
|
||||||
else
|
|
||||||
return tRCDWR + tCK;
|
return tRCDWR + tCK;
|
||||||
}
|
}
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tDQSCK + burstDuration;
|
return tRL + tDQSCK + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + burstDuration;
|
return tWL + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else if (command == Command::REFPB)
|
|
||||||
|
if (command == Command::REFPB)
|
||||||
return tRFCSB;
|
return tRFCSB;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecHBM2::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecHBM2::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tDQSCK, tRL + tDQSCK + burstDuration};
|
return {tRL + tDQSCK, tRL + tDQSCK + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL, tWL + burstDuration};
|
return {tWL, tWL + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecHBM2", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpecHBM2", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
|
|
||||||
bool hasRasAndCasBus() const override;
|
[[nodiscard]] bool hasRasAndCasBus() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ MemSpecLPDDR4::MemSpecLPDDR4(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tREFIpb (tCK * memSpec.memtimingspec.entries.at("REFIPB")),
|
tREFIpb (tCK * memSpec.memtimingspec.entries.at("REFIPB")),
|
||||||
tRFCab (tCK * memSpec.memtimingspec.entries.at("RFCAB")),
|
tRFCab (tCK * memSpec.memtimingspec.entries.at("RFCAB")),
|
||||||
tRFCpb (tCK * memSpec.memtimingspec.entries.at("RFCPB")),
|
tRFCpb (tCK * memSpec.memtimingspec.entries.at("RFCPB")),
|
||||||
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRPab (tCK * memSpec.memtimingspec.entries.at("RPAB")),
|
tRPab (tCK * memSpec.memtimingspec.entries.at("RPAB")),
|
||||||
tRPpb (tCK * memSpec.memtimingspec.entries.at("RPPB")),
|
tRPpb (tCK * memSpec.memtimingspec.entries.at("RPPB")),
|
||||||
tRCab (tCK * memSpec.memtimingspec.entries.at("RCAB")),
|
|
||||||
tRCpb (tCK * memSpec.memtimingspec.entries.at("RCPB")),
|
tRCpb (tCK * memSpec.memtimingspec.entries.at("RCPB")),
|
||||||
|
tRCab (tCK * memSpec.memtimingspec.entries.at("RCAB")),
|
||||||
tPPD (tCK * memSpec.memtimingspec.entries.at("PPD")),
|
tPPD (tCK * memSpec.memtimingspec.entries.at("PPD")),
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
|
||||||
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
||||||
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
||||||
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
||||||
@@ -135,45 +135,50 @@ sc_time MemSpecLPDDR4::getRefreshIntervalPB() const
|
|||||||
return tREFIpb;
|
return tREFIpb;
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time MemSpecLPDDR4::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecLPDDR4::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB)
|
if (command == Command::PREPB)
|
||||||
return tRPpb + tCK;
|
return tRPpb + tCK;
|
||||||
else if (command == Command::PREAB)
|
|
||||||
|
if (command == Command::PREAB)
|
||||||
return tRPab + tCK;
|
return tRPab + tCK;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD + 3 * tCK;
|
return tRCD + 3 * tCK;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tDQSCK + burstDuration + 3 * tCK;
|
return tRL + tDQSCK + burstDuration + 3 * tCK;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return burstDuration + tRTP - 5 * tCK + tRPpb;
|
return burstDuration + tRTP - 5 * tCK + tRPpb;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK;
|
return tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + 4 * tCK + burstDuration + tWR + tRPpb;
|
return tWL + 4 * tCK + burstDuration + tWR + tRPpb;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFCab + tCK;
|
return tRFCab + tCK;
|
||||||
else if (command == Command::REFPB)
|
|
||||||
|
if (command == Command::REFPB)
|
||||||
return tRFCpb + tCK;
|
return tRFCpb + tCK;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecLPDDR4::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecLPDDR4::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tDQSCK + 3 * tCK, tRL + tDQSCK + burstDuration + 3 * tCK};
|
return {tRL + tDQSCK + 3 * tCK, tRL + tDQSCK + burstDuration + 3 * tCK};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL + tDQSS + tDQS2DQ + 3 * tCK, tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK};
|
return {tWL + tDQSS + tDQS2DQ + 3 * tCK, tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecLPDDR4", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpecLPDDR4", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -87,11 +87,11 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ MemSpecSTTMRAM::MemSpecSTTMRAM(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
||||||
tPD (tCKE),
|
tPD (tCKE),
|
||||||
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
||||||
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
||||||
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
||||||
@@ -71,14 +70,15 @@ MemSpecSTTMRAM::MemSpecSTTMRAM(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
||||||
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
||||||
tXS (tCK * memSpec.memtimingspec.entries.at("XS")),
|
tXS (tCK * memSpec.memtimingspec.entries.at("XS")),
|
||||||
|
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
||||||
|
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
||||||
tCCD (tCK * memSpec.memtimingspec.entries.at("CCD")),
|
tCCD (tCK * memSpec.memtimingspec.entries.at("CCD")),
|
||||||
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
tFAW (tCK * memSpec.memtimingspec.entries.at("FAW")),
|
||||||
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
|
||||||
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
||||||
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
||||||
tAL (tCK * memSpec.memtimingspec.entries.at("AL")),
|
|
||||||
tXPDLL (tCK * memSpec.memtimingspec.entries.at("XPDLL")),
|
tXPDLL (tCK * memSpec.memtimingspec.entries.at("XPDLL")),
|
||||||
tXSDLL (tCK * memSpec.memtimingspec.entries.at("XSDLL")),
|
tXSDLL (tCK * memSpec.memtimingspec.entries.at("XSDLL")),
|
||||||
|
tAL (tCK * memSpec.memtimingspec.entries.at("AL")),
|
||||||
tACTPDEN (tCK * memSpec.memtimingspec.entries.at("ACTPDEN")),
|
tACTPDEN (tCK * memSpec.memtimingspec.entries.at("ACTPDEN")),
|
||||||
tPRPDEN (tCK * memSpec.memtimingspec.entries.at("PRPDEN")),
|
tPRPDEN (tCK * memSpec.memtimingspec.entries.at("PRPDEN")),
|
||||||
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS"))
|
tRTRS (tCK * memSpec.memtimingspec.entries.at("RTRS"))
|
||||||
@@ -104,39 +104,41 @@ MemSpecSTTMRAM::MemSpecSTTMRAM(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the execution time for commands that have a fixed execution time
|
// Returns the execution time for commands that have a fixed execution time
|
||||||
sc_time MemSpecSTTMRAM::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecSTTMRAM::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD;
|
return tRCD;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + burstDuration;
|
return tRL + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return tRTP + tRP;
|
return tRTP + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + burstDuration;
|
return tWL + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tWR + tRP;
|
return tWL + burstDuration + tWR + tRP;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
return SC_ZERO_TIME;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecSTTMRAM::getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &) const
|
TimeInterval MemSpecSTTMRAM::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm::tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL, tRL + burstDuration};
|
return {tRL, tRL + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL, tWL + burstDuration};
|
return {tWL, tWL + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ MemSpecWideIO::MemSpecWideIO(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
memSpec.memarchitecturespec.entries.at("nbrOfDevices")),
|
||||||
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
tCKE (tCK * memSpec.memtimingspec.entries.at("CKE")),
|
||||||
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
tCKESR (tCK * memSpec.memtimingspec.entries.at("CKESR")),
|
||||||
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
|
||||||
tAC (tCK * memSpec.memtimingspec.entries.at("AC")),
|
|
||||||
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
tRAS (tCK * memSpec.memtimingspec.entries.at("RAS")),
|
||||||
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
tRC (tCK * memSpec.memtimingspec.entries.at("RC")),
|
||||||
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
tRCD (tCK * memSpec.memtimingspec.entries.at("RCD")),
|
||||||
@@ -70,11 +68,13 @@ MemSpecWideIO::MemSpecWideIO(const DRAMSys::Config::MemSpec &memSpec)
|
|||||||
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
tWR (tCK * memSpec.memtimingspec.entries.at("WR")),
|
||||||
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
tXP (tCK * memSpec.memtimingspec.entries.at("XP")),
|
||||||
tXSR (tCK * memSpec.memtimingspec.entries.at("XSR")),
|
tXSR (tCK * memSpec.memtimingspec.entries.at("XSR")),
|
||||||
tCCD_R (tCK * memSpec.memtimingspec.entries.at("CCD_R")),
|
|
||||||
tCCD_W (tCK * memSpec.memtimingspec.entries.at("CCD_W")),
|
|
||||||
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
tREFI (tCK * memSpec.memtimingspec.entries.at("REFI")),
|
||||||
tRFC (tCK * memSpec.memtimingspec.entries.at("RFC")),
|
tRFC (tCK * memSpec.memtimingspec.entries.at("RFC")),
|
||||||
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
tRP (tCK * memSpec.memtimingspec.entries.at("RP")),
|
||||||
|
tDQSCK (tCK * memSpec.memtimingspec.entries.at("DQSCK")),
|
||||||
|
tAC (tCK * memSpec.memtimingspec.entries.at("AC")),
|
||||||
|
tCCD_R (tCK * memSpec.memtimingspec.entries.at("CCD_R")),
|
||||||
|
tCCD_W (tCK * memSpec.memtimingspec.entries.at("CCD_W")),
|
||||||
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
tRRD (tCK * memSpec.memtimingspec.entries.at("RRD")),
|
||||||
tTAW (tCK * memSpec.memtimingspec.entries.at("TAW")),
|
tTAW (tCK * memSpec.memtimingspec.entries.at("TAW")),
|
||||||
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
tWTR (tCK * memSpec.memtimingspec.entries.at("WTR")),
|
||||||
@@ -133,41 +133,44 @@ sc_time MemSpecWideIO::getRefreshIntervalAB() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the execution time for commands that have a fixed execution time
|
// Returns the execution time for commands that have a fixed execution time
|
||||||
sc_time MemSpecWideIO::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecWideIO::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB || command == Command::PREAB)
|
if (command == Command::PREPB || command == Command::PREAB)
|
||||||
return tRP;
|
return tRP;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD;
|
return tRCD;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tAC + burstDuration;
|
return tRL + tAC + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return burstDuration + tRP;
|
return burstDuration + tRP;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + burstDuration;
|
return tWL + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration - tCK + tWR + tRP;
|
return tWL + burstDuration - tCK + tWR + tRP;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFC;
|
return tRFC;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("getExecutionTime",
|
||||||
SC_REPORT_FATAL("getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecWideIO::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecWideIO::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tAC, tRL + tAC + burstDuration};
|
return {tRL + tAC, tRL + tAC + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL, tWL + burstDuration};
|
return {tWL, tWL + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -98,10 +98,10 @@ public:
|
|||||||
const double iDD62;
|
const double iDD62;
|
||||||
const double vDD2;
|
const double vDD2;
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -117,45 +117,50 @@ sc_time MemSpecWideIO2::getRefreshIntervalPB() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the execution time for commands that have a fixed execution time
|
// Returns the execution time for commands that have a fixed execution time
|
||||||
sc_time MemSpecWideIO2::getExecutionTime(Command command, const tlm_generic_payload &) const
|
sc_time MemSpecWideIO2::getExecutionTime(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::PREPB)
|
if (command == Command::PREPB)
|
||||||
return tRPpb;
|
return tRPpb;
|
||||||
else if (command == Command::PREAB)
|
|
||||||
|
if (command == Command::PREAB)
|
||||||
return tRPab;
|
return tRPab;
|
||||||
else if (command == Command::ACT)
|
|
||||||
|
if (command == Command::ACT)
|
||||||
return tRCD;
|
return tRCD;
|
||||||
else if (command == Command::RD)
|
|
||||||
|
if (command == Command::RD)
|
||||||
return tRL + tDQSCK + burstDuration;
|
return tRL + tDQSCK + burstDuration;
|
||||||
else if (command == Command::RDA)
|
|
||||||
|
if (command == Command::RDA)
|
||||||
return burstDuration - 2 * tCK + tRTP + tRPpb;
|
return burstDuration - 2 * tCK + tRTP + tRPpb;
|
||||||
else if (command == Command::WR || command == Command::MWR)
|
|
||||||
|
if (command == Command::WR || command == Command::MWR)
|
||||||
return tWL + tDQSS + burstDuration;
|
return tWL + tDQSS + burstDuration;
|
||||||
else if (command == Command::WRA || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WRA || command == Command::MWRA)
|
||||||
return tWL + burstDuration + tCK + tWR + tRPpb;
|
return tWL + burstDuration + tCK + tWR + tRPpb;
|
||||||
else if (command == Command::REFAB)
|
|
||||||
|
if (command == Command::REFAB)
|
||||||
return tRFCab;
|
return tRFCab;
|
||||||
else if (command == Command::REFPB)
|
|
||||||
|
if (command == Command::REFPB)
|
||||||
return tRFCpb;
|
return tRFCpb;
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpecWideIO2::getExecutionTime",
|
||||||
SC_REPORT_FATAL("MemSpecWideIO2::getExecutionTime",
|
"command not known or command doesn't have a fixed execution time");
|
||||||
"command not known or command doesn't have a fixed execution time");
|
throw;
|
||||||
return SC_ZERO_TIME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeInterval MemSpecWideIO2::getIntervalOnDataStrobe(Command command, const tlm_generic_payload &) const
|
TimeInterval MemSpecWideIO2::getIntervalOnDataStrobe(Command command, [[maybe_unused]] const tlm_generic_payload & payload) const
|
||||||
{
|
{
|
||||||
if (command == Command::RD || command == Command::RDA)
|
if (command == Command::RD || command == Command::RDA)
|
||||||
return {tRL + tDQSCK, tRL + tDQSCK + burstDuration};
|
return {tRL + tDQSCK, tRL + tDQSCK + burstDuration};
|
||||||
else if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
|
||||||
|
if (command == Command::WR || command == Command::WRA || command == Command::MWR || command == Command::MWRA)
|
||||||
return {tWL + tDQSS, tWL + tDQSS + burstDuration};
|
return {tWL + tDQSS, tWL + tDQSS + burstDuration};
|
||||||
else
|
|
||||||
{
|
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
||||||
SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument");
|
throw;
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ public:
|
|||||||
// Currents and Voltages:
|
// Currents and Voltages:
|
||||||
// TODO: to be completed
|
// TODO: to be completed
|
||||||
|
|
||||||
sc_core::sc_time getRefreshIntervalAB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalAB() const override;
|
||||||
sc_core::sc_time getRefreshIntervalPB() const override;
|
[[nodiscard]] sc_core::sc_time getRefreshIntervalPB() const override;
|
||||||
|
|
||||||
sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] sc_core::sc_time getExecutionTime(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
[[nodiscard]] TimeInterval getIntervalOnDataStrobe(Command command, const tlm::tlm_generic_payload &payload) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -44,12 +44,15 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
BankMachine::BankMachine(const Configuration& config, const SchedulerIF& scheduler, Bank bank)
|
BankMachine::BankMachine(const Configuration& config, const SchedulerIF& scheduler, Bank bank) :
|
||||||
: scheduler(scheduler), memSpec(*config.memSpec), bank(bank),
|
memSpec(*config.memSpec),
|
||||||
|
scheduler(scheduler),
|
||||||
|
bank(bank),
|
||||||
bankgroup(BankGroup(static_cast<std::size_t>(bank) / memSpec.banksPerGroup)),
|
bankgroup(BankGroup(static_cast<std::size_t>(bank) / memSpec.banksPerGroup)),
|
||||||
rank(Rank(static_cast<std::size_t>(bank) / memSpec.banksPerRank)),
|
rank(Rank(static_cast<std::size_t>(bank) / memSpec.banksPerRank)),
|
||||||
refreshManagement(config.refreshManagement)
|
refreshManagement(config.refreshManagement)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CommandTuple::Type BankMachine::getNextCommand()
|
CommandTuple::Type BankMachine::getNextCommand()
|
||||||
{
|
{
|
||||||
@@ -172,41 +175,37 @@ void BankMachineOpen::evaluate()
|
|||||||
|
|
||||||
if (!(sleeping || blocked))
|
if (!(sleeping || blocked))
|
||||||
{
|
{
|
||||||
tlm_generic_payload* newPayload = scheduler.getNextRequest(*this);
|
tlm_generic_payload *newPayload = scheduler.getNextRequest(*this);
|
||||||
if (newPayload == nullptr)
|
if (newPayload == nullptr)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
assert(!keepTrans || currentPayload != nullptr);
|
||||||
|
if (keepTrans)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*newPayload) == openRow)
|
||||||
|
currentPayload = newPayload;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!keepTrans || currentPayload != nullptr);
|
currentPayload = newPayload;
|
||||||
if (keepTrans)
|
}
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*newPayload) == openRow)
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State::Precharged) // bank precharged
|
if (state == State::Precharged) // bank precharged
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
else if (state == State::Activated)
|
else if (state == State::Activated)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
|
if (currentPayload->is_read())
|
||||||
|
nextCommand = Command::RD;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
||||||
if (currentPayload->is_read())
|
|
||||||
nextCommand = Command::RD;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // row miss
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
}
|
}
|
||||||
|
else // row miss
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,35 +219,31 @@ void BankMachineClosed::evaluate()
|
|||||||
|
|
||||||
if (!(sleeping || blocked))
|
if (!(sleeping || blocked))
|
||||||
{
|
{
|
||||||
tlm_generic_payload* newPayload = scheduler.getNextRequest(*this);
|
tlm_generic_payload *newPayload = scheduler.getNextRequest(*this);
|
||||||
if (newPayload == nullptr)
|
if (newPayload == nullptr)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
assert(!keepTrans || currentPayload != nullptr);
|
||||||
|
if (keepTrans)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*newPayload) == openRow)
|
||||||
|
currentPayload = newPayload;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!keepTrans || currentPayload != nullptr);
|
currentPayload = newPayload;
|
||||||
if (keepTrans)
|
}
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*newPayload) == openRow)
|
if (state == State::Precharged) // bank precharged
|
||||||
currentPayload = newPayload;
|
nextCommand = Command::ACT;
|
||||||
}
|
else if (state == State::Activated)
|
||||||
|
{
|
||||||
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
|
if (currentPayload->is_read())
|
||||||
|
nextCommand = Command::RDA;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentPayload = newPayload;
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State::Precharged) // bank precharged
|
|
||||||
nextCommand = Command::ACT;
|
|
||||||
else if (state == State::Activated)
|
|
||||||
{
|
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
|
||||||
if (currentPayload->is_read())
|
|
||||||
nextCommand = Command::RDA;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,55 +258,51 @@ void BankMachineOpenAdaptive::evaluate()
|
|||||||
|
|
||||||
if (!(sleeping || blocked))
|
if (!(sleeping || blocked))
|
||||||
{
|
{
|
||||||
tlm_generic_payload* newPayload = scheduler.getNextRequest(*this);
|
tlm_generic_payload *newPayload = scheduler.getNextRequest(*this);
|
||||||
if (newPayload == nullptr)
|
if (newPayload == nullptr)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
assert(!keepTrans || currentPayload != nullptr);
|
||||||
|
if (keepTrans)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*newPayload) == openRow)
|
||||||
|
currentPayload = newPayload;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!keepTrans || currentPayload != nullptr);
|
currentPayload = newPayload;
|
||||||
if (keepTrans)
|
}
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*newPayload) == openRow)
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State::Precharged) // bank precharged
|
if (state == State::Precharged) // bank precharged
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
else if (state == State::Activated)
|
else if (state == State::Activated)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
if (scheduler.hasFurtherRequest(bank, currentPayload->get_command()) &&
|
||||||
|
!scheduler.hasFurtherRowHit(bank, openRow, currentPayload->get_command()))
|
||||||
{
|
{
|
||||||
if (scheduler.hasFurtherRequest(bank, currentPayload->get_command())
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
&& !scheduler.hasFurtherRowHit(bank, openRow, currentPayload->get_command()))
|
if (currentPayload->is_read())
|
||||||
{
|
nextCommand = Command::RDA;
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
|
||||||
if (currentPayload->is_read())
|
|
||||||
nextCommand = Command::RDA;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
||||||
if (currentPayload->is_read())
|
}
|
||||||
nextCommand = Command::RD;
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
}
|
if (currentPayload->is_read())
|
||||||
|
nextCommand = Command::RD;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // row miss
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
}
|
}
|
||||||
|
else // row miss
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,54 +317,50 @@ void BankMachineClosedAdaptive::evaluate()
|
|||||||
|
|
||||||
if (!(sleeping || blocked))
|
if (!(sleeping || blocked))
|
||||||
{
|
{
|
||||||
tlm_generic_payload* newPayload = scheduler.getNextRequest(*this);
|
tlm_generic_payload *newPayload = scheduler.getNextRequest(*this);
|
||||||
if (newPayload == nullptr)
|
if (newPayload == nullptr)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
assert(!keepTrans || currentPayload != nullptr);
|
||||||
|
if (keepTrans)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*newPayload) == openRow)
|
||||||
|
currentPayload = newPayload;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!keepTrans || currentPayload != nullptr);
|
currentPayload = newPayload;
|
||||||
if (keepTrans)
|
}
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*newPayload) == openRow)
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentPayload = newPayload;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State::Precharged) // bank precharged
|
if (state == State::Precharged) // bank precharged
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
else if (state == State::Activated)
|
else if (state == State::Activated)
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*currentPayload) == openRow) // row hit
|
if (scheduler.hasFurtherRowHit(bank, openRow, currentPayload->get_command()))
|
||||||
{
|
{
|
||||||
if (scheduler.hasFurtherRowHit(bank, openRow, currentPayload->get_command()))
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
{
|
if (currentPayload->is_read())
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
nextCommand = Command::RD;
|
||||||
if (currentPayload->is_read())
|
|
||||||
nextCommand = Command::RD;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(currentPayload->is_read() || currentPayload->is_write());
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWR : Command::WR;
|
||||||
if (currentPayload->is_read())
|
}
|
||||||
nextCommand = Command::RDA;
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
assert(currentPayload->is_read() || currentPayload->is_write());
|
||||||
}
|
if (currentPayload->is_read())
|
||||||
|
nextCommand = Command::RDA;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextCommand = memSpec.requiresReadModifyWrite(*currentPayload) ? Command::MWRA : Command::WRA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // row miss, can happen when RD/WR mode is switched
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
}
|
}
|
||||||
|
else // row miss, can happen when RD/WR mode is switched
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class BankMachine : public ManagerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
void block();
|
void block();
|
||||||
|
|
||||||
[[nodiscard]] Rank getRank() const;
|
[[nodiscard]] Rank getRank() const;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ DECLARE_EXTENDED_PHASE(END_PDNP); // 28
|
|||||||
DECLARE_EXTENDED_PHASE(END_SREF); // 29
|
DECLARE_EXTENDED_PHASE(END_SREF); // 29
|
||||||
|
|
||||||
#ifdef DRAMPOWER
|
#ifdef DRAMPOWER
|
||||||
DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm::tlm_phase);
|
DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm::tlm_phase phase);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool phaseHasDataStrobe(tlm::tlm_phase phase);
|
bool phaseHasDataStrobe(tlm::tlm_phase phase);
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ namespace DRAMSys
|
|||||||
{
|
{
|
||||||
|
|
||||||
Controller::Controller(const sc_module_name& name, const Configuration& config, const AddressDecoder& addressDecoder) :
|
Controller::Controller(const sc_module_name& name, const Configuration& config, const AddressDecoder& addressDecoder) :
|
||||||
ControllerIF(name, config), addressDecoder(addressDecoder),
|
ControllerIF(name, config), thinkDelayFw(config.thinkDelayFw),
|
||||||
thinkDelayFw(config.thinkDelayFw), thinkDelayBw(config.thinkDelayBw),
|
thinkDelayBw(config.thinkDelayBw), phyDelayFw(config.phyDelayFw),
|
||||||
phyDelayFw(config.phyDelayFw), phyDelayBw(config.phyDelayBw),
|
phyDelayBw(config.phyDelayBw), blockingReadDelay(config.blockingReadDelay),
|
||||||
blockingReadDelay(config.blockingReadDelay), blockingWriteDelay(config.blockingWriteDelay),
|
blockingWriteDelay(config.blockingWriteDelay), addressDecoder(addressDecoder),
|
||||||
minBytesPerBurst(config.memSpec->defaultBytesPerBurst),
|
minBytesPerBurst(config.memSpec->defaultBytesPerBurst),
|
||||||
maxBytesPerBurst(config.memSpec->maxBytesPerBurst)
|
maxBytesPerBurst(config.memSpec->maxBytesPerBurst)
|
||||||
{
|
{
|
||||||
@@ -207,8 +207,8 @@ Controller::Controller(const sc_module_name& name, const Configuration& config,
|
|||||||
{
|
{
|
||||||
for (unsigned rankID = 0; rankID < memSpec.ranksPerChannel; rankID++)
|
for (unsigned rankID = 0; rankID < memSpec.ranksPerChannel; rankID++)
|
||||||
{
|
{
|
||||||
powerDownManagers.push_back(std::make_unique<PowerDownManagerStaggered>(bankMachinesOnRank[Rank(rankID)],
|
powerDownManagers.push_back(std::make_unique<PowerDownManagerStaggered>(
|
||||||
Rank(rankID), *checker));
|
bankMachinesOnRank[Rank(rankID)], Rank(rankID)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ void Controller::controllerMethod()
|
|||||||
readyCommands.emplace_back(commandTuple);
|
readyCommands.emplace_back(commandTuple);
|
||||||
|
|
||||||
// (4.3) Check for bank commands (PREPB, ACT, RD/RDA or WR/WRA)
|
// (4.3) Check for bank commands (PREPB, ACT, RD/RDA or WR/WRA)
|
||||||
for (auto it : bankMachinesOnRank[rank])
|
for (auto* it : bankMachinesOnRank[rank])
|
||||||
{
|
{
|
||||||
commandTuple = it->getNextCommand();
|
commandTuple = it->getNextCommand();
|
||||||
if (std::get<CommandTuple::Command>(commandTuple) != Command::NOP)
|
if (std::get<CommandTuple::Command>(commandTuple) != Command::NOP)
|
||||||
@@ -322,7 +322,7 @@ void Controller::controllerMethod()
|
|||||||
|
|
||||||
if (command.isRankCommand())
|
if (command.isRankCommand())
|
||||||
{
|
{
|
||||||
for (auto it : bankMachinesOnRank[rank])
|
for (auto* it : bankMachinesOnRank[rank])
|
||||||
it->update(command);
|
it->update(command);
|
||||||
}
|
}
|
||||||
else if (command.isGroupCommand())
|
else if (command.isGroupCommand())
|
||||||
@@ -442,7 +442,9 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload& trans, tlm_phase&
|
|||||||
return TLM_ACCEPTED;
|
return TLM_ACCEPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload& ,tlm_phase& , sc_time&)
|
tlm_sync_enum Controller::nb_transport_bw([[maybe_unused]] tlm_generic_payload &trans,
|
||||||
|
[[maybe_unused]] tlm_phase &phase,
|
||||||
|
[[maybe_unused]] sc_time &delay)
|
||||||
{
|
{
|
||||||
SC_REPORT_FATAL("Controller", "nb_transport_bw of controller must not be called!");
|
SC_REPORT_FATAL("Controller", "nb_transport_bw of controller must not be called!");
|
||||||
return TLM_ACCEPTED;
|
return TLM_ACCEPTED;
|
||||||
@@ -623,12 +625,10 @@ tlm::tlm_generic_payload& Controller::MemoryManager::allocate()
|
|||||||
{
|
{
|
||||||
return *new tlm_generic_payload(this);
|
return *new tlm_generic_payload(this);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
tlm_generic_payload *result = freePayloads.top();
|
||||||
tlm_generic_payload* result = freePayloads.top();
|
freePayloads.pop();
|
||||||
freePayloads.pop();
|
return *result;
|
||||||
return *result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::MemoryManager::free(tlm::tlm_generic_payload* trans)
|
void Controller::MemoryManager::free(tlm::tlm_generic_payload* trans)
|
||||||
|
|||||||
@@ -116,7 +116,13 @@ private:
|
|||||||
class MemoryManager : public tlm::tlm_mm_interface
|
class MemoryManager : public tlm::tlm_mm_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
MemoryManager() = default;
|
||||||
|
MemoryManager(const MemoryManager &) = delete;
|
||||||
|
MemoryManager(MemoryManager &&) = delete;
|
||||||
|
MemoryManager &operator=(const MemoryManager &) = delete;
|
||||||
|
MemoryManager &operator=(MemoryManager &&) = delete;
|
||||||
~MemoryManager() override;
|
~MemoryManager() override;
|
||||||
|
|
||||||
tlm::tlm_generic_payload& allocate();
|
tlm::tlm_generic_payload& allocate();
|
||||||
void free(tlm::tlm_generic_payload* trans) override;
|
void free(tlm::tlm_generic_payload* trans) override;
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace DRAMSys
|
|||||||
ControllerRecordable::ControllerRecordable(const sc_module_name& name, const Configuration& config,
|
ControllerRecordable::ControllerRecordable(const sc_module_name& name, const Configuration& config,
|
||||||
const AddressDecoder& addressDecoder, TlmRecorder& tlmRecorder)
|
const AddressDecoder& addressDecoder, TlmRecorder& tlmRecorder)
|
||||||
: Controller(name, config, addressDecoder), tlmRecorder(tlmRecorder),
|
: Controller(name, config, addressDecoder), tlmRecorder(tlmRecorder),
|
||||||
activeTimeMultiplier(config.memSpec->tCK / config.memSpec->dataRate), enableWindowing(config.enableWindowing),
|
windowSizeTime(config.windowSize * memSpec.tCK), activeTimeMultiplier(config.memSpec->tCK / config.memSpec->dataRate),
|
||||||
windowSizeTime(config.windowSize * memSpec.tCK)
|
enableWindowing(config.enableWindowing)
|
||||||
{
|
{
|
||||||
if (enableWindowing)
|
if (enableWindowing)
|
||||||
{
|
{
|
||||||
@@ -65,8 +65,9 @@ tlm_sync_enum ControllerRecordable::nb_transport_fw(tlm_generic_payload& trans,
|
|||||||
return Controller::nb_transport_fw(trans, phase, delay);
|
return Controller::nb_transport_fw(trans, phase, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
tlm_sync_enum ControllerRecordable::nb_transport_bw(tlm_generic_payload&,
|
tlm_sync_enum ControllerRecordable::nb_transport_bw([[maybe_unused]] tlm_generic_payload &trans,
|
||||||
tlm_phase&, sc_time&)
|
[[maybe_unused]] tlm_phase &phase,
|
||||||
|
[[maybe_unused]] sc_time &delay)
|
||||||
{
|
{
|
||||||
SC_REPORT_FATAL("Controller", "nb_transport_bw of controller must not be called");
|
SC_REPORT_FATAL("Controller", "nb_transport_bw of controller must not be called");
|
||||||
return TLM_ACCEPTED;
|
return TLM_ACCEPTED;
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class ControllerRecordable final : public Controller
|
|||||||
public:
|
public:
|
||||||
ControllerRecordable(const sc_core::sc_module_name& name, const Configuration& config,
|
ControllerRecordable(const sc_core::sc_module_name& name, const Configuration& config,
|
||||||
const AddressDecoder& addressDecoder, TlmRecorder& tlmRecorder);
|
const AddressDecoder& addressDecoder, TlmRecorder& tlmRecorder);
|
||||||
~ControllerRecordable() override = default;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase,
|
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase,
|
||||||
@@ -57,7 +56,8 @@ protected:
|
|||||||
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase,
|
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase,
|
||||||
sc_core::sc_time& delay) override;
|
sc_core::sc_time& delay) override;
|
||||||
|
|
||||||
void sendToFrontend(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_core::sc_time& delay) override;
|
void sendToFrontend(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase,
|
||||||
|
sc_core::sc_time &delay) override;
|
||||||
|
|
||||||
void controllerMethod() override;
|
void controllerMethod() override;
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,19 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class ManagerIF
|
class ManagerIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
ManagerIF(const ManagerIF &) = default;
|
||||||
|
ManagerIF(ManagerIF &&) = default;
|
||||||
|
ManagerIF &operator=(const ManagerIF &) = default;
|
||||||
|
ManagerIF &operator=(ManagerIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ManagerIF() = default;
|
||||||
|
virtual ~ManagerIF() = default;
|
||||||
|
|
||||||
virtual void evaluate() = 0;
|
virtual void evaluate() = 0;
|
||||||
virtual CommandTuple::Type getNextCommand() = 0;
|
virtual CommandTuple::Type getNextCommand() = 0;
|
||||||
virtual void update(Command) = 0;
|
virtual void update(Command command) = 0;
|
||||||
virtual ~ManagerIF() = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerDDR3::CheckerDDR3(const Configuration& config)
|
CheckerDDR3::CheckerDDR3(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecDDR3*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecDDR3 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerDDR3 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerDDR3(const Configuration& config);
|
explicit CheckerDDR3(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerDDR4::CheckerDDR4(const Configuration& config)
|
CheckerDDR4::CheckerDDR4(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecDDR4*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecDDR4 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerDDR4", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerDDR4", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class CheckerDDR4 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerDDR4(const Configuration& config);
|
explicit CheckerDDR4(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerGDDR5::CheckerGDDR5(const Configuration& config)
|
CheckerGDDR5::CheckerGDDR5(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecGDDR5*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecGDDR5 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerGDDR5", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerGDDR5", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerGDDR5 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerGDDR5(const Configuration& config);
|
explicit CheckerGDDR5(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerGDDR5X::CheckerGDDR5X(const Configuration& config)
|
CheckerGDDR5X::CheckerGDDR5X(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecGDDR5X*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecGDDR5X *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerGDDR5X", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerGDDR5X", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerGDDR5X final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerGDDR5X(const Configuration& config);
|
explicit CheckerGDDR5X(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerGDDR6::CheckerGDDR6(const Configuration& config)
|
CheckerGDDR6::CheckerGDDR6(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecGDDR6*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecGDDR6 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerGDDR6", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerGDDR6", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerGDDR6 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerGDDR6(const Configuration& config);
|
explicit CheckerGDDR6(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerHBM2::CheckerHBM2(const Configuration& config)
|
CheckerHBM2::CheckerHBM2(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecHBM2*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecHBM2 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerHBM2", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerHBM2", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerHBM2 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerHBM2(const Configuration& config);
|
explicit CheckerHBM2(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,10 +44,17 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class CheckerIF
|
class CheckerIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
CheckerIF(const CheckerIF &) = default;
|
||||||
|
CheckerIF(CheckerIF &&) = default;
|
||||||
|
CheckerIF &operator=(const CheckerIF &) = default;
|
||||||
|
CheckerIF &operator=(CheckerIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CheckerIF() = default;
|
||||||
virtual ~CheckerIF() = default;
|
virtual ~CheckerIF() = default;
|
||||||
|
|
||||||
virtual sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
[[nodiscard]] virtual sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const = 0;
|
||||||
virtual void insert(Command command, const tlm::tlm_generic_payload& payload) = 0;
|
virtual void insert(Command command, const tlm::tlm_generic_payload& payload) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerLPDDR4::CheckerLPDDR4(const Configuration& config)
|
CheckerLPDDR4::CheckerLPDDR4(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecLPDDR4*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecLPDDR4 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerLPDDR4", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerLPDDR4", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerLPDDR4 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerLPDDR4(const Configuration& config);
|
explicit CheckerLPDDR4(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerSTTMRAM::CheckerSTTMRAM(const Configuration& config)
|
CheckerSTTMRAM::CheckerSTTMRAM(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecSTTMRAM*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecSTTMRAM *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerSTTMRAM", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerSTTMRAM", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerSTTMRAM final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerSTTMRAM(const Configuration& config);
|
explicit CheckerSTTMRAM(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerWideIO::CheckerWideIO(const Configuration& config)
|
CheckerWideIO::CheckerWideIO(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecWideIO*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecWideIO *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerWideIO", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerWideIO", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerWideIO final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerWideIO(const Configuration& config);
|
explicit CheckerWideIO(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
CheckerWideIO2::CheckerWideIO2(const Configuration& config)
|
CheckerWideIO2::CheckerWideIO2(const Configuration& config) :
|
||||||
|
memSpec(dynamic_cast<const MemSpecWideIO2*>(config.memSpec.get()))
|
||||||
{
|
{
|
||||||
memSpec = dynamic_cast<const MemSpecWideIO2 *>(config.memSpec.get());
|
|
||||||
if (memSpec == nullptr)
|
if (memSpec == nullptr)
|
||||||
SC_REPORT_FATAL("CheckerWideIO2", "Wrong MemSpec chosen");
|
SC_REPORT_FATAL("CheckerWideIO2", "Wrong MemSpec chosen");
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class CheckerWideIO2 final : public CheckerIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CheckerWideIO2(const Configuration& config);
|
explicit CheckerWideIO2(const Configuration& config);
|
||||||
sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
[[nodiscard]] sc_core::sc_time timeToSatisfyConstraints(Command command, const tlm::tlm_generic_payload& payload) const override;
|
||||||
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
void insert(Command command, const tlm::tlm_generic_payload& payload) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -42,9 +42,17 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class CmdMuxIF
|
class CmdMuxIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
CmdMuxIF(const CmdMuxIF &) = default;
|
||||||
|
CmdMuxIF(CmdMuxIF &&) = default;
|
||||||
|
CmdMuxIF &operator=(const CmdMuxIF &) = default;
|
||||||
|
CmdMuxIF &operator=(CmdMuxIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CmdMuxIF() = default;
|
||||||
virtual ~CmdMuxIF() = default;
|
virtual ~CmdMuxIF() = default;
|
||||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) = 0;
|
|
||||||
|
virtual CommandTuple::Type selectCommand(const ReadyCommands & readyCommands) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ CommandTuple::Type CmdMuxOldest::selectCommand(const ReadyCommands &readyCommand
|
|||||||
{
|
{
|
||||||
auto result = readyCommands.cend();
|
auto result = readyCommands.cend();
|
||||||
uint64_t lastPayloadID = UINT64_MAX;
|
uint64_t lastPayloadID = UINT64_MAX;
|
||||||
uint64_t newPayloadID;
|
uint64_t newPayloadID = 0;
|
||||||
sc_time lastTimestamp = scMaxTime;
|
sc_time lastTimestamp = scMaxTime;
|
||||||
sc_time newTimestamp;
|
sc_time newTimestamp;
|
||||||
|
|
||||||
@@ -73,8 +73,7 @@ CommandTuple::Type CmdMuxOldest::selectCommand(const ReadyCommands &readyCommand
|
|||||||
if (result != readyCommands.cend() &&
|
if (result != readyCommands.cend() &&
|
||||||
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
||||||
return *result;
|
return *result;
|
||||||
else
|
return {Command::NOP, nullptr, scMaxTime};
|
||||||
return {Command::NOP, nullptr, scMaxTime};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +102,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC
|
|||||||
auto resultCas = readyCasCommands.cend();
|
auto resultCas = readyCasCommands.cend();
|
||||||
|
|
||||||
uint64_t lastPayloadID = UINT64_MAX;
|
uint64_t lastPayloadID = UINT64_MAX;
|
||||||
uint64_t newPayloadID;
|
uint64_t newPayloadID = 0;
|
||||||
sc_time lastTimestamp = scMaxTime;
|
sc_time lastTimestamp = scMaxTime;
|
||||||
sc_time newTimestamp;
|
sc_time newTimestamp;
|
||||||
|
|
||||||
@@ -179,8 +178,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC
|
|||||||
if (result != readyCommands.cend() &&
|
if (result != readyCommands.cend() &&
|
||||||
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
||||||
return *result;
|
return *result;
|
||||||
else
|
return {Command::NOP, nullptr, scMaxTime};
|
||||||
return {Command::NOP, nullptr, scMaxTime};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class CmdMuxOldest : public CmdMuxIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CmdMuxOldest(const Configuration& config);
|
explicit CmdMuxOldest(const Configuration& config);
|
||||||
CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
CommandTuple::Type selectCommand(const ReadyCommands & readyCommands) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const MemSpec& memSpec;
|
const MemSpec& memSpec;
|
||||||
@@ -57,7 +57,7 @@ class CmdMuxOldestRasCas : public CmdMuxIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CmdMuxOldestRasCas(const Configuration& config);
|
explicit CmdMuxOldestRasCas(const Configuration& config);
|
||||||
CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
CommandTuple::Type selectCommand(const ReadyCommands & readyCommands) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const MemSpec& memSpec;
|
const MemSpec& memSpec;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ CommandTuple::Type CmdMuxStrict::selectCommand(const ReadyCommands &readyCommand
|
|||||||
{
|
{
|
||||||
auto result = readyCommands.cend();
|
auto result = readyCommands.cend();
|
||||||
uint64_t lastPayloadID = UINT64_MAX;
|
uint64_t lastPayloadID = UINT64_MAX;
|
||||||
uint64_t newPayloadID;
|
uint64_t newPayloadID = 0;
|
||||||
sc_time lastTimestamp = scMaxTime;
|
sc_time lastTimestamp = scMaxTime;
|
||||||
sc_time newTimestamp;
|
sc_time newTimestamp;
|
||||||
|
|
||||||
@@ -83,8 +83,7 @@ CommandTuple::Type CmdMuxStrict::selectCommand(const ReadyCommands &readyCommand
|
|||||||
nextPayloadID++;
|
nextPayloadID++;
|
||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
else
|
return {Command::NOP, nullptr, scMaxTime};
|
||||||
return {Command::NOP, nullptr, scMaxTime};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -113,7 +112,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyC
|
|||||||
auto resultCas = readyCasCommands.cend();
|
auto resultCas = readyCasCommands.cend();
|
||||||
|
|
||||||
uint64_t lastPayloadID = UINT64_MAX;
|
uint64_t lastPayloadID = UINT64_MAX;
|
||||||
uint64_t newPayloadID;
|
uint64_t newPayloadID = 0;
|
||||||
sc_time lastTimestamp = scMaxTime;
|
sc_time lastTimestamp = scMaxTime;
|
||||||
sc_time newTimestamp;
|
sc_time newTimestamp;
|
||||||
|
|
||||||
@@ -181,8 +180,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyC
|
|||||||
if (std::get<CommandTuple::Command>(*result).isCasCommand())
|
if (std::get<CommandTuple::Command>(*result).isCasCommand())
|
||||||
nextPayloadID++;
|
nextPayloadID++;
|
||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return {Command::NOP, nullptr, scMaxTime};
|
return {Command::NOP, nullptr, scMaxTime};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class CmdMuxStrict : public CmdMuxIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CmdMuxStrict(const Configuration& config);
|
explicit CmdMuxStrict(const Configuration& config);
|
||||||
CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
CommandTuple::Type selectCommand(const ReadyCommands & readyCommands) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t nextPayloadID = 1;
|
uint64_t nextPayloadID = 1;
|
||||||
@@ -57,7 +57,7 @@ class CmdMuxStrictRasCas : public CmdMuxIF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CmdMuxStrictRasCas(const Configuration& config);
|
explicit CmdMuxStrictRasCas(const Configuration& config);
|
||||||
CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
CommandTuple::Type selectCommand(const ReadyCommands & readyCommands) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t nextPayloadID = 1;
|
uint64_t nextPayloadID = 1;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
void triggerInterruption() override {}
|
void triggerInterruption() override {}
|
||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void update(Command) override {}
|
void update([[maybe_unused]] Command command) override {}
|
||||||
void evaluate() override {}
|
void evaluate() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ using namespace tlm;
|
|||||||
namespace DRAMSys
|
namespace DRAMSys
|
||||||
{
|
{
|
||||||
|
|
||||||
PowerDownManagerStaggered::PowerDownManagerStaggered(ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
PowerDownManagerStaggered::PowerDownManagerStaggered(
|
||||||
Rank rank, CheckerIF& checker)
|
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank, Rank rank) :
|
||||||
: bankMachinesOnRank(bankMachinesOnRank)
|
bankMachinesOnRank(bankMachinesOnRank)
|
||||||
{
|
{
|
||||||
setUpDummy(powerDownPayload, UINT64_MAX - 1, rank);
|
setUpDummy(powerDownPayload, UINT64_MAX - 1, rank);
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ void PowerDownManagerStaggered::evaluate()
|
|||||||
else if (entryTriggered)
|
else if (entryTriggered)
|
||||||
{
|
{
|
||||||
nextCommand = Command::PDEP;
|
nextCommand = Command::PDEP;
|
||||||
for (auto it : bankMachinesOnRank)
|
for (auto *it : bankMachinesOnRank)
|
||||||
{
|
{
|
||||||
if (it->isActivated())
|
if (it->isActivated())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,15 +49,14 @@ class BankMachine;
|
|||||||
class PowerDownManagerStaggered final : public PowerDownManagerIF
|
class PowerDownManagerStaggered final : public PowerDownManagerIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PowerDownManagerStaggered(ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
PowerDownManagerStaggered(ControllerVector<Bank, BankMachine*>& bankMachinesOnRank, Rank rank);
|
||||||
Rank rank, CheckerIF& checker);
|
|
||||||
|
|
||||||
void triggerEntry() override;
|
void triggerEntry() override;
|
||||||
void triggerExit() override;
|
void triggerExit() override;
|
||||||
void triggerInterruption() override;
|
void triggerInterruption() override;
|
||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
void evaluate() override;
|
void evaluate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ namespace DRAMSys
|
|||||||
RefreshManagerAllBank::RefreshManagerAllBank(const Configuration& config,
|
RefreshManagerAllBank::RefreshManagerAllBank(const Configuration& config,
|
||||||
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
||||||
PowerDownManagerIF& powerDownManager, Rank rank)
|
PowerDownManagerIF& powerDownManager, Rank rank)
|
||||||
: bankMachinesOnRank(bankMachinesOnRank), powerDownManager(powerDownManager),
|
: memSpec(*config.memSpec), bankMachinesOnRank(bankMachinesOnRank),
|
||||||
memSpec(*config.memSpec), maxPostponed(static_cast<int>(config.refreshMaxPostponed)),
|
powerDownManager(powerDownManager), maxPostponed(static_cast<int>(config.refreshMaxPostponed)),
|
||||||
maxPulledin(-static_cast<int>(config.refreshMaxPulledin)), refreshManagement(config.refreshManagement)
|
maxPulledin(-static_cast<int>(config.refreshMaxPulledin)), refreshManagement(config.refreshManagement)
|
||||||
{
|
{
|
||||||
timeForNextTrigger = getTimeForFirstTrigger(memSpec.tCK, memSpec.getRefreshIntervalAB(),
|
timeForNextTrigger = getTimeForFirstTrigger(memSpec.tCK, memSpec.getRefreshIntervalAB(),
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void evaluate() override;
|
void evaluate() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
sc_core::sc_time getTimeForNextTrigger() override;
|
sc_core::sc_time getTimeForNextTrigger() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class RefreshManagerDummy final : public RefreshManagerIF
|
|||||||
public:
|
public:
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void evaluate() override {}
|
void evaluate() override {}
|
||||||
void update(Command) override {}
|
void update([[maybe_unused]] Command command) override {}
|
||||||
sc_core::sc_time getTimeForNextTrigger() override;
|
sc_core::sc_time getTimeForNextTrigger() override;
|
||||||
private:
|
private:
|
||||||
const sc_core::sc_time scMaxTime = sc_core::sc_max_time();
|
const sc_core::sc_time scMaxTime = sc_core::sc_max_time();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace DRAMSys
|
|||||||
RefreshManagerPer2Bank::RefreshManagerPer2Bank(const Configuration& config,
|
RefreshManagerPer2Bank::RefreshManagerPer2Bank(const Configuration& config,
|
||||||
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
||||||
PowerDownManagerIF& powerDownManager, Rank rank)
|
PowerDownManagerIF& powerDownManager, Rank rank)
|
||||||
: powerDownManager(powerDownManager), memSpec(*config.memSpec),
|
: memSpec(*config.memSpec), powerDownManager(powerDownManager),
|
||||||
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerRank / 2)),
|
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerRank / 2)),
|
||||||
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerRank / 2))
|
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerRank / 2))
|
||||||
{
|
{
|
||||||
@@ -128,18 +128,17 @@ void RefreshManagerPer2Bank::evaluate()
|
|||||||
timeForNextTrigger += memSpec.getRefreshIntervalP2B();
|
timeForNextTrigger += memSpec.getRefreshIntervalP2B();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
nextCommand = Command::REFP2B;
|
||||||
|
currentRefreshPayload = &refreshPayloads.at(currentIterator->front());
|
||||||
|
for (auto *it : *currentIterator)
|
||||||
{
|
{
|
||||||
nextCommand = Command::REFP2B;
|
if (it->isActivated())
|
||||||
currentRefreshPayload = &refreshPayloads.at(currentIterator->front());
|
|
||||||
for (auto* it : *currentIterator)
|
|
||||||
{
|
{
|
||||||
if (it->isActivated())
|
nextCommand = Command::PREPB;
|
||||||
{
|
currentRefreshPayload = &refreshPayloads.at(it);
|
||||||
nextCommand = Command::PREPB;
|
break;
|
||||||
currentRefreshPayload = &refreshPayloads.at(it);
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: banks should already be blocked for precharge and selection should be skipped
|
// TODO: banks should already be blocked for precharge and selection should be skipped
|
||||||
@@ -150,54 +149,51 @@ void RefreshManagerPer2Bank::evaluate()
|
|||||||
skipSelection = true;
|
skipSelection = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // if (state == RmState::Pulledin)
|
|
||||||
{
|
// if (state == RmState::Pulledin)
|
||||||
bool allBankPairsBusy = true;
|
bool allBankPairsBusy = true;
|
||||||
|
|
||||||
currentIterator = remainingBankMachines.begin();
|
currentIterator = remainingBankMachines.begin();
|
||||||
for (auto bankIt = remainingBankMachines.begin(); bankIt != remainingBankMachines.end(); bankIt++)
|
for (auto bankIt = remainingBankMachines.begin(); bankIt != remainingBankMachines.end();
|
||||||
|
bankIt++)
|
||||||
|
{
|
||||||
|
bool pairIsBusy = false;
|
||||||
|
for (const auto *pairIt : *bankIt)
|
||||||
{
|
{
|
||||||
bool pairIsBusy = false;
|
if (!pairIt->isIdle())
|
||||||
for (const auto* pairIt : *bankIt)
|
|
||||||
{
|
{
|
||||||
if (!pairIt->isIdle())
|
pairIsBusy = true;
|
||||||
{
|
|
||||||
pairIsBusy = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!pairIsBusy)
|
|
||||||
{
|
|
||||||
allBankPairsBusy = false;
|
|
||||||
currentIterator = bankIt;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!pairIsBusy)
|
||||||
if (allBankPairsBusy)
|
|
||||||
{
|
{
|
||||||
state = State::Regular;
|
allBankPairsBusy = false;
|
||||||
timeForNextTrigger += memSpec.getRefreshIntervalP2B();
|
currentIterator = bankIt;
|
||||||
return;
|
break;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = Command::REFP2B;
|
|
||||||
currentRefreshPayload = &refreshPayloads.at(currentIterator->front());
|
|
||||||
for (auto* it : *currentIterator)
|
|
||||||
{
|
|
||||||
if (it->isActivated())
|
|
||||||
{
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
currentRefreshPayload = &refreshPayloads.at(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allBankPairsBusy)
|
||||||
|
{
|
||||||
|
state = State::Regular;
|
||||||
|
timeForNextTrigger += memSpec.getRefreshIntervalP2B();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextCommand = Command::REFP2B;
|
||||||
|
currentRefreshPayload = &refreshPayloads.at(currentIterator->front());
|
||||||
|
for (auto *it : *currentIterator)
|
||||||
|
{
|
||||||
|
if (it->isActivated())
|
||||||
|
{
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
|
currentRefreshPayload = &refreshPayloads.at(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void evaluate() override;
|
void evaluate() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
sc_core::sc_time getTimeForNextTrigger() override;
|
sc_core::sc_time getTimeForNextTrigger() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace DRAMSys
|
|||||||
RefreshManagerPerBank::RefreshManagerPerBank(const Configuration& config,
|
RefreshManagerPerBank::RefreshManagerPerBank(const Configuration& config,
|
||||||
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
||||||
PowerDownManagerIF& powerDownManager, Rank rank)
|
PowerDownManagerIF& powerDownManager, Rank rank)
|
||||||
: powerDownManager(powerDownManager), memSpec(*config.memSpec),
|
: memSpec(*config.memSpec), powerDownManager(powerDownManager),
|
||||||
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerRank)),
|
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerRank)),
|
||||||
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerRank))
|
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerRank))
|
||||||
{
|
{
|
||||||
@@ -109,54 +109,49 @@ void RefreshManagerPerBank::evaluate()
|
|||||||
timeForNextTrigger += memSpec.getRefreshIntervalPB();
|
timeForNextTrigger += memSpec.getRefreshIntervalPB();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: bank should already be blocked for precharge and selection should be skipped
|
||||||
|
if ((*currentIterator)->isActivated())
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: bank should already be blocked for precharge and selection should be skipped
|
nextCommand = Command::REFPB;
|
||||||
if ((*currentIterator)->isActivated())
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nextCommand = Command::REFPB;
|
|
||||||
|
|
||||||
if (forcedRefresh)
|
if (forcedRefresh)
|
||||||
{
|
{
|
||||||
(*currentIterator)->block();
|
(*currentIterator)->block();
|
||||||
skipSelection = true;
|
skipSelection = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else // if (state == RmState::Pulledin)
|
|
||||||
|
// if (state == RmState::Pulledin)
|
||||||
|
bool allBanksBusy = true;
|
||||||
|
|
||||||
|
for (auto it = remainingBankMachines.begin(); it != remainingBankMachines.end(); it++)
|
||||||
{
|
{
|
||||||
bool allBanksBusy = true;
|
if ((*it)->isIdle())
|
||||||
|
|
||||||
for (auto it = remainingBankMachines.begin(); it != remainingBankMachines.end(); it++)
|
|
||||||
{
|
{
|
||||||
if ((*it)->isIdle())
|
currentIterator = it;
|
||||||
{
|
allBanksBusy = false;
|
||||||
currentIterator = it;
|
break;
|
||||||
allBanksBusy = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allBanksBusy)
|
|
||||||
{
|
|
||||||
state = State::Regular;
|
|
||||||
timeForNextTrigger += memSpec.getRefreshIntervalPB();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((*currentIterator)->isActivated())
|
|
||||||
nextCommand = Command::PREPB;
|
|
||||||
else
|
|
||||||
nextCommand = Command::REFPB;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allBanksBusy)
|
||||||
|
{
|
||||||
|
state = State::Regular;
|
||||||
|
timeForNextTrigger += memSpec.getRefreshIntervalPB();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*currentIterator)->isActivated())
|
||||||
|
nextCommand = Command::PREPB;
|
||||||
|
else
|
||||||
|
nextCommand = Command::REFPB;
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void evaluate() override;
|
void evaluate() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
sc_core::sc_time getTimeForNextTrigger() override;
|
sc_core::sc_time getTimeForNextTrigger() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace DRAMSys
|
|||||||
RefreshManagerSameBank::RefreshManagerSameBank(const Configuration& config,
|
RefreshManagerSameBank::RefreshManagerSameBank(const Configuration& config,
|
||||||
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
ControllerVector<Bank, BankMachine*>& bankMachinesOnRank,
|
||||||
PowerDownManagerIF& powerDownManager, Rank rank)
|
PowerDownManagerIF& powerDownManager, Rank rank)
|
||||||
: powerDownManager(powerDownManager), memSpec(*config.memSpec),
|
: memSpec(*config.memSpec), powerDownManager(powerDownManager),
|
||||||
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerGroup)),
|
maxPostponed(static_cast<int>(config.refreshMaxPostponed * memSpec.banksPerGroup)),
|
||||||
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerGroup)),
|
maxPulledin(-static_cast<int>(config.refreshMaxPulledin * memSpec.banksPerGroup)),
|
||||||
refreshManagement(config.refreshManagement)
|
refreshManagement(config.refreshManagement)
|
||||||
@@ -65,7 +65,7 @@ RefreshManagerSameBank::RefreshManagerSameBank(const Configuration& config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// allBankMachines: ((0-4-8-12-16-20-24-28), (1-5-9-13-17-21-25-29), ...)
|
// allBankMachines: ((0-4-8-12-16-20-24-28), (1-5-9-13-17-21-25-29), ...)
|
||||||
std::list<std::vector<BankMachine *>>::iterator it = allBankMachines.begin();
|
auto it = allBankMachines.begin();
|
||||||
for (unsigned bankID = 0; bankID < memSpec.banksPerGroup; bankID++)
|
for (unsigned bankID = 0; bankID < memSpec.banksPerGroup; bankID++)
|
||||||
{
|
{
|
||||||
for (unsigned groupID = 0; groupID < memSpec.groupsPerRank; groupID++)
|
for (unsigned groupID = 0; groupID < memSpec.groupsPerRank; groupID++)
|
||||||
@@ -216,7 +216,7 @@ void RefreshManagerSameBank::evaluate()
|
|||||||
currentIterator = bankIt;
|
currentIterator = bankIt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (groupIt->getRefreshManagementCounter() >= memSpec.getRAAIMT())
|
if (groupIt->getRefreshManagementCounter() >= memSpec.getRAAIMT())
|
||||||
{
|
{
|
||||||
imtCandidates.emplace_back(bankIt);
|
imtCandidates.emplace_back(bankIt);
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ void RefreshManagerSameBank::evaluate()
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!imtCandidates.empty())
|
if (!imtCandidates.empty())
|
||||||
{
|
{
|
||||||
// search for IMT candidates and check if all banks idle
|
// search for IMT candidates and check if all banks idle
|
||||||
bool allGroupsBusy = true;
|
bool allGroupsBusy = true;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
CommandTuple::Type getNextCommand() override;
|
CommandTuple::Type getNextCommand() override;
|
||||||
void evaluate() override;
|
void evaluate() override;
|
||||||
void update(Command) override;
|
void update(Command command) override;
|
||||||
sc_core::sc_time getTimeForNextTrigger() override;
|
sc_core::sc_time getTimeForNextTrigger() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace DRAMSys
|
|||||||
class RespQueueFifo final : public RespQueueIF
|
class RespQueueFifo final : public RespQueueIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void insertPayload(tlm::tlm_generic_payload*, sc_core::sc_time) override;
|
void insertPayload(tlm::tlm_generic_payload* payload, sc_core::sc_time strobeEnd) override;
|
||||||
tlm::tlm_generic_payload* nextPayload() override;
|
tlm::tlm_generic_payload* nextPayload() override;
|
||||||
[[nodiscard]] sc_core::sc_time getTriggerTime() const override;
|
[[nodiscard]] sc_core::sc_time getTriggerTime() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,19 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class RespQueueIF
|
class RespQueueIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
RespQueueIF(const RespQueueIF &) = default;
|
||||||
|
RespQueueIF(RespQueueIF &&) = default;
|
||||||
|
RespQueueIF &operator=(const RespQueueIF &) = default;
|
||||||
|
RespQueueIF &operator=(RespQueueIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void insertPayload(tlm::tlm_generic_payload*, sc_core::sc_time) = 0;
|
RespQueueIF() = default;
|
||||||
|
virtual ~RespQueueIF() = default;
|
||||||
|
|
||||||
|
virtual void insertPayload(tlm::tlm_generic_payload* payload, sc_core::sc_time strobeEnd) = 0;
|
||||||
virtual tlm::tlm_generic_payload* nextPayload() = 0;
|
virtual tlm::tlm_generic_payload* nextPayload() = 0;
|
||||||
[[nodiscard]] virtual sc_core::sc_time getTriggerTime() const = 0;
|
[[nodiscard]] virtual sc_core::sc_time getTriggerTime() const = 0;
|
||||||
virtual ~RespQueueIF() = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DRAMSys
|
} // namespace DRAMSys
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace DRAMSys
|
|||||||
class RespQueueReorder final : public RespQueueIF
|
class RespQueueReorder final : public RespQueueIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void insertPayload(tlm::tlm_generic_payload*, sc_core::sc_time) override;
|
void insertPayload(tlm::tlm_generic_payload* payload, sc_core::sc_time strobeEnd) override;
|
||||||
tlm::tlm_generic_payload* nextPayload() override;
|
tlm::tlm_generic_payload* nextPayload() override;
|
||||||
[[nodiscard]] sc_core::sc_time getTriggerTime() const override;
|
[[nodiscard]] sc_core::sc_time getTriggerTime() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,16 @@ namespace DRAMSys
|
|||||||
|
|
||||||
class BufferCounterIF
|
class BufferCounterIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
BufferCounterIF(const BufferCounterIF &) = default;
|
||||||
|
BufferCounterIF(BufferCounterIF &&) = default;
|
||||||
|
BufferCounterIF &operator=(const BufferCounterIF &) = default;
|
||||||
|
BufferCounterIF &operator=(BufferCounterIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
BufferCounterIF() = default;
|
||||||
virtual ~BufferCounterIF() = default;
|
virtual ~BufferCounterIF() = default;
|
||||||
|
|
||||||
[[nodiscard]] virtual bool hasBufferSpace() const = 0;
|
[[nodiscard]] virtual bool hasBufferSpace() const = 0;
|
||||||
virtual void storeRequest(const tlm::tlm_generic_payload& trans) = 0;
|
virtual void storeRequest(const tlm::tlm_generic_payload& trans) = 0;
|
||||||
virtual void removeRequest(const tlm::tlm_generic_payload& trans) = 0;
|
virtual void removeRequest(const tlm::tlm_generic_payload& trans) = 0;
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ tlm_generic_payload* SchedulerFifo::getNextRequest(const BankMachine& bankMachin
|
|||||||
Bank bank = bankMachine.getBank();
|
Bank bank = bankMachine.getBank();
|
||||||
if (!buffer[bank].empty())
|
if (!buffer[bank].empty())
|
||||||
return buffer[bank].front();
|
return buffer[bank].front();
|
||||||
else
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFifo::hasFurtherRowHit(Bank bank, Row row, tlm_command command) const
|
bool SchedulerFifo::hasFurtherRowHit(Bank bank, Row row, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
if (buffer[bank].size() >= 2)
|
if (buffer[bank].size() >= 2)
|
||||||
{
|
{
|
||||||
@@ -92,12 +92,9 @@ bool SchedulerFifo::hasFurtherRowHit(Bank bank, Row row, tlm_command command) co
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFifo::hasFurtherRequest(Bank bank, tlm_command command) const
|
bool SchedulerFifo::hasFurtherRequest(Bank bank, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
if (buffer[bank].size() >= 2)
|
return buffer[bank].size() >= 2;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned>& SchedulerFifo::getBufferDepth() const
|
const std::vector<unsigned>& SchedulerFifo::getBufferDepth() const
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ class SchedulerFifo final : public SchedulerIF
|
|||||||
public:
|
public:
|
||||||
explicit SchedulerFifo(const Configuration& config);
|
explicit SchedulerFifo(const Configuration& config);
|
||||||
[[nodiscard]] bool hasBufferSpace() const override;
|
[[nodiscard]] bool hasBufferSpace() const override;
|
||||||
void storeRequest(tlm::tlm_generic_payload&) override;
|
void storeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
void removeRequest(tlm::tlm_generic_payload&) override;
|
void removeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const override;
|
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const override;
|
||||||
[[nodiscard]] bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] bool hasFurtherRequest(Bank, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -60,19 +60,19 @@ bool SchedulerFrFcfs::hasBufferSpace() const
|
|||||||
return bufferCounter->hasBufferSpace();
|
return bufferCounter->hasBufferSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerFrFcfs::storeRequest(tlm_generic_payload& trans)
|
void SchedulerFrFcfs::storeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
buffer[ControllerExtension::getBank(trans)].push_back(&trans);
|
buffer[ControllerExtension::getBank(payload)].push_back(&payload);
|
||||||
bufferCounter->storeRequest(trans);
|
bufferCounter->storeRequest(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerFrFcfs::removeRequest(tlm_generic_payload& trans)
|
void SchedulerFrFcfs::removeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
bufferCounter->removeRequest(trans);
|
bufferCounter->removeRequest(payload);
|
||||||
Bank bank = ControllerExtension::getBank(trans);
|
Bank bank = ControllerExtension::getBank(payload);
|
||||||
for (auto it = buffer[bank].begin(); it != buffer[bank].end(); it++)
|
for (auto it = buffer[bank].begin(); it != buffer[bank].end(); it++)
|
||||||
{
|
{
|
||||||
if (*it == &trans)
|
if (*it == &payload)
|
||||||
{
|
{
|
||||||
buffer[bank].erase(it);
|
buffer[bank].erase(it);
|
||||||
break;
|
break;
|
||||||
@@ -89,7 +89,7 @@ tlm_generic_payload* SchedulerFrFcfs::getNextRequest(const BankMachine& bankMach
|
|||||||
{
|
{
|
||||||
// Search for row hit
|
// Search for row hit
|
||||||
Row openRow = bankMachine.getOpenRow();
|
Row openRow = bankMachine.getOpenRow();
|
||||||
for (auto it : buffer[bank])
|
for (auto* it : buffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
return it;
|
return it;
|
||||||
@@ -101,10 +101,10 @@ tlm_generic_payload* SchedulerFrFcfs::getNextRequest(const BankMachine& bankMach
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command command) const
|
bool SchedulerFrFcfs::hasFurtherRowHit(Bank bank, Row row, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
unsigned rowHitCounter = 0;
|
unsigned rowHitCounter = 0;
|
||||||
for (auto it : buffer[bank])
|
for (auto* it : buffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == row)
|
if (ControllerExtension::getRow(*it) == row)
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ bool SchedulerFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command command)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFrFcfs::hasFurtherRequest(Bank bank, tlm_command command) const
|
bool SchedulerFrFcfs::hasFurtherRequest(Bank bank, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
return (buffer[bank].size() >= 2);
|
return (buffer[bank].size() >= 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ class SchedulerFrFcfs final : public SchedulerIF
|
|||||||
public:
|
public:
|
||||||
explicit SchedulerFrFcfs(const Configuration& config);
|
explicit SchedulerFrFcfs(const Configuration& config);
|
||||||
[[nodiscard]] bool hasBufferSpace() const override;
|
[[nodiscard]] bool hasBufferSpace() const override;
|
||||||
void storeRequest(tlm::tlm_generic_payload&) override;
|
void storeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
void removeRequest(tlm::tlm_generic_payload&) override;
|
void removeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const override;
|
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const override;
|
||||||
[[nodiscard]] bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] bool hasFurtherRequest(Bank, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ tlm_generic_payload* SchedulerFrFcfsGrp::getNextRequest(const BankMachine& bankM
|
|||||||
// Filter all row hits
|
// Filter all row hits
|
||||||
Row openRow = bankMachine.getOpenRow();
|
Row openRow = bankMachine.getOpenRow();
|
||||||
std::list<tlm_generic_payload *> rowHits;
|
std::list<tlm_generic_payload *> rowHits;
|
||||||
for (auto it : buffer[bank])
|
for (auto *it : buffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
rowHits.push_back(it);
|
rowHits.push_back(it);
|
||||||
@@ -126,10 +126,10 @@ tlm_generic_payload* SchedulerFrFcfsGrp::getNextRequest(const BankMachine& bankM
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFrFcfsGrp::hasFurtherRowHit(Bank bank, Row row, tlm_command command) const
|
bool SchedulerFrFcfsGrp::hasFurtherRowHit(Bank bank, Row row, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
unsigned rowHitCounter = 0;
|
unsigned rowHitCounter = 0;
|
||||||
for (auto it : buffer[bank])
|
for (auto *it : buffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == row)
|
if (ControllerExtension::getRow(*it) == row)
|
||||||
{
|
{
|
||||||
@@ -141,12 +141,9 @@ bool SchedulerFrFcfsGrp::hasFurtherRowHit(Bank bank, Row row, tlm_command comman
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerFrFcfsGrp::hasFurtherRequest(Bank bank, tlm_command command) const
|
bool SchedulerFrFcfsGrp::hasFurtherRequest(Bank bank, [[maybe_unused]] tlm_command command) const
|
||||||
{
|
{
|
||||||
if (buffer[bank].size() >= 2)
|
return buffer[bank].size() >= 2;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned>& SchedulerFrFcfsGrp::getBufferDepth() const
|
const std::vector<unsigned>& SchedulerFrFcfsGrp::getBufferDepth() const
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ class SchedulerFrFcfsGrp final : public SchedulerIF
|
|||||||
public:
|
public:
|
||||||
explicit SchedulerFrFcfsGrp(const Configuration& config);
|
explicit SchedulerFrFcfsGrp(const Configuration& config);
|
||||||
[[nodiscard]] bool hasBufferSpace() const override;
|
[[nodiscard]] bool hasBufferSpace() const override;
|
||||||
void storeRequest(tlm::tlm_generic_payload&) override;
|
void storeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
void removeRequest(tlm::tlm_generic_payload&) override;
|
void removeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const override;
|
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const override;
|
||||||
[[nodiscard]] bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] bool hasFurtherRequest(Bank, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -63,25 +63,25 @@ bool SchedulerGrpFrFcfs::hasBufferSpace() const
|
|||||||
return bufferCounter->hasBufferSpace();
|
return bufferCounter->hasBufferSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerGrpFrFcfs::storeRequest(tlm_generic_payload& trans)
|
void SchedulerGrpFrFcfs::storeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
if (trans.is_read())
|
if (payload.is_read())
|
||||||
readBuffer[ControllerExtension::getBank(trans)].push_back(&trans);
|
readBuffer[ControllerExtension::getBank(payload)].push_back(&payload);
|
||||||
else
|
else
|
||||||
writeBuffer[ControllerExtension::getBank(trans)].push_back(&trans);
|
writeBuffer[ControllerExtension::getBank(payload)].push_back(&payload);
|
||||||
bufferCounter->storeRequest(trans);
|
bufferCounter->storeRequest(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerGrpFrFcfs::removeRequest(tlm_generic_payload& trans)
|
void SchedulerGrpFrFcfs::removeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
bufferCounter->removeRequest(trans);
|
bufferCounter->removeRequest(payload);
|
||||||
lastCommand = trans.get_command();
|
lastCommand = payload.get_command();
|
||||||
Bank bank = ControllerExtension::getBank(trans);
|
Bank bank = ControllerExtension::getBank(payload);
|
||||||
|
|
||||||
if (trans.is_read())
|
if (payload.is_read())
|
||||||
readBuffer[bank].remove(&trans);
|
readBuffer[bank].remove(&payload);
|
||||||
else
|
else
|
||||||
writeBuffer[bank].remove(&trans);
|
writeBuffer[bank].remove(&payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
tlm_generic_payload* SchedulerGrpFrFcfs::getNextRequest(const BankMachine& bankMachine) const
|
tlm_generic_payload* SchedulerGrpFrFcfs::getNextRequest(const BankMachine& bankMachine) const
|
||||||
@@ -98,7 +98,7 @@ tlm_generic_payload* SchedulerGrpFrFcfs::getNextRequest(const BankMachine& bankM
|
|||||||
{
|
{
|
||||||
// Search for read row hit
|
// Search for read row hit
|
||||||
Row openRow = bankMachine.getOpenRow();
|
Row openRow = bankMachine.getOpenRow();
|
||||||
for (auto it : readBuffer[bank])
|
for (auto *it : readBuffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
return it;
|
return it;
|
||||||
@@ -107,33 +107,13 @@ tlm_generic_payload* SchedulerGrpFrFcfs::getNextRequest(const BankMachine& bankM
|
|||||||
// No read row hit found or bank precharged
|
// No read row hit found or bank precharged
|
||||||
return readBuffer[bank].front();
|
return readBuffer[bank].front();
|
||||||
}
|
}
|
||||||
else if (!writeBuffer[bank].empty())
|
|
||||||
{
|
|
||||||
if (bankMachine.isActivated())
|
|
||||||
{
|
|
||||||
// Search for write row hit
|
|
||||||
Row openRow = bankMachine.getOpenRow();
|
|
||||||
for (auto it : writeBuffer[bank])
|
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No write row hit found or bank precharged
|
|
||||||
return writeBuffer[bank].front();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!writeBuffer[bank].empty())
|
if (!writeBuffer[bank].empty())
|
||||||
{
|
{
|
||||||
if (bankMachine.isActivated())
|
if (bankMachine.isActivated())
|
||||||
{
|
{
|
||||||
// Search for write row hit
|
// Search for write row hit
|
||||||
Row openRow = bankMachine.getOpenRow();
|
Row openRow = bankMachine.getOpenRow();
|
||||||
for (auto it : writeBuffer[bank])
|
for (auto *it : writeBuffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
return it;
|
return it;
|
||||||
@@ -142,24 +122,40 @@ tlm_generic_payload* SchedulerGrpFrFcfs::getNextRequest(const BankMachine& bankM
|
|||||||
// No write row hit found or bank precharged
|
// No write row hit found or bank precharged
|
||||||
return writeBuffer[bank].front();
|
return writeBuffer[bank].front();
|
||||||
}
|
}
|
||||||
else if (!readBuffer[bank].empty())
|
return nullptr;
|
||||||
{
|
|
||||||
if (bankMachine.isActivated())
|
|
||||||
{
|
|
||||||
// Search for read row hit
|
|
||||||
Row openRow = bankMachine.getOpenRow();
|
|
||||||
for (auto it : readBuffer[bank])
|
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No read row hit found or bank precharged
|
|
||||||
return readBuffer[bank].front();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!writeBuffer[bank].empty())
|
||||||
|
{
|
||||||
|
if (bankMachine.isActivated())
|
||||||
|
{
|
||||||
|
// Search for write row hit
|
||||||
|
Row openRow = bankMachine.getOpenRow();
|
||||||
|
for (auto *it : writeBuffer[bank])
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No write row hit found or bank precharged
|
||||||
|
return writeBuffer[bank].front();
|
||||||
|
}
|
||||||
|
if (!readBuffer[bank].empty())
|
||||||
|
{
|
||||||
|
if (bankMachine.isActivated())
|
||||||
|
{
|
||||||
|
// Search for read row hit
|
||||||
|
Row openRow = bankMachine.getOpenRow();
|
||||||
|
for (auto *it : readBuffer[bank])
|
||||||
|
{
|
||||||
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No read row hit found or bank precharged
|
||||||
|
return readBuffer[bank].front();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerGrpFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command command) const
|
bool SchedulerGrpFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command command) const
|
||||||
@@ -168,7 +164,7 @@ bool SchedulerGrpFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command comman
|
|||||||
unsigned rowHitCounter = 0;
|
unsigned rowHitCounter = 0;
|
||||||
if (command == tlm::TLM_READ_COMMAND)
|
if (command == tlm::TLM_READ_COMMAND)
|
||||||
{
|
{
|
||||||
for (auto it : readBuffer[bank])
|
for (auto *it : readBuffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == row)
|
if (ControllerExtension::getRow(*it) == row)
|
||||||
{
|
{
|
||||||
@@ -179,37 +175,29 @@ bool SchedulerGrpFrFcfs::hasFurtherRowHit(Bank bank, Row row, tlm_command comman
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (auto* it : writeBuffer[bank])
|
||||||
{
|
{
|
||||||
for (auto it : writeBuffer[bank])
|
if (ControllerExtension::getRow(*it) == row)
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == row)
|
rowHitCounter++;
|
||||||
{
|
if (rowHitCounter == 2)
|
||||||
rowHitCounter++;
|
return true;
|
||||||
if (rowHitCounter == 2)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerGrpFrFcfs::hasFurtherRequest(Bank bank, tlm_command command) const
|
bool SchedulerGrpFrFcfs::hasFurtherRequest(Bank bank, tlm_command command) const
|
||||||
{
|
{
|
||||||
if (command == tlm::TLM_READ_COMMAND)
|
if (command == tlm::TLM_READ_COMMAND)
|
||||||
{
|
{
|
||||||
if (readBuffer[bank].size() >= 2)
|
return readBuffer[bank].size() >= 2;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (writeBuffer[bank].size() >= 2)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return writeBuffer[bank].size() >= 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned>& SchedulerGrpFrFcfs::getBufferDepth() const
|
const std::vector<unsigned>& SchedulerGrpFrFcfs::getBufferDepth() const
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ class SchedulerGrpFrFcfs final : public SchedulerIF
|
|||||||
public:
|
public:
|
||||||
explicit SchedulerGrpFrFcfs(const Configuration& config);
|
explicit SchedulerGrpFrFcfs(const Configuration& config);
|
||||||
[[nodiscard]] bool hasBufferSpace() const override;
|
[[nodiscard]] bool hasBufferSpace() const override;
|
||||||
void storeRequest(tlm::tlm_generic_payload&) override;
|
void storeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
void removeRequest(tlm::tlm_generic_payload&) override;
|
void removeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const override;
|
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const override;
|
||||||
[[nodiscard]] bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] bool hasFurtherRequest(Bank, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -67,25 +67,25 @@ bool SchedulerGrpFrFcfsWm::hasBufferSpace() const
|
|||||||
return bufferCounter->hasBufferSpace();
|
return bufferCounter->hasBufferSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerGrpFrFcfsWm::storeRequest(tlm_generic_payload& trans)
|
void SchedulerGrpFrFcfsWm::storeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
if (trans.is_read())
|
if (payload.is_read())
|
||||||
readBuffer[ControllerExtension::getBank(trans)].push_back(&trans);
|
readBuffer[ControllerExtension::getBank(payload)].push_back(&payload);
|
||||||
else
|
else
|
||||||
writeBuffer[ControllerExtension::getBank(trans)].push_back(&trans);
|
writeBuffer[ControllerExtension::getBank(payload)].push_back(&payload);
|
||||||
bufferCounter->storeRequest(trans);
|
bufferCounter->storeRequest(payload);
|
||||||
evaluateWriteMode();
|
evaluateWriteMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerGrpFrFcfsWm::removeRequest(tlm_generic_payload& trans)
|
void SchedulerGrpFrFcfsWm::removeRequest(tlm_generic_payload& payload)
|
||||||
{
|
{
|
||||||
bufferCounter->removeRequest(trans);
|
bufferCounter->removeRequest(payload);
|
||||||
Bank bank = ControllerExtension::getBank(trans);
|
Bank bank = ControllerExtension::getBank(payload);
|
||||||
|
|
||||||
if (trans.is_read())
|
if (payload.is_read())
|
||||||
readBuffer[bank].remove(&trans);
|
readBuffer[bank].remove(&payload);
|
||||||
else
|
else
|
||||||
writeBuffer[bank].remove(&trans);
|
writeBuffer[bank].remove(&payload);
|
||||||
|
|
||||||
evaluateWriteMode();
|
evaluateWriteMode();
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ tlm_generic_payload* SchedulerGrpFrFcfsWm::getNextRequest(const BankMachine& ban
|
|||||||
{
|
{
|
||||||
// Search for read row hit
|
// Search for read row hit
|
||||||
Row openRow = bankMachine.getOpenRow();
|
Row openRow = bankMachine.getOpenRow();
|
||||||
for (auto it : readBuffer[bank])
|
for (auto *it : readBuffer[bank])
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
return it;
|
return it;
|
||||||
@@ -111,32 +111,29 @@ tlm_generic_payload* SchedulerGrpFrFcfsWm::getNextRequest(const BankMachine& ban
|
|||||||
// No read row hit found or bank precharged
|
// No read row hit found or bank precharged
|
||||||
return readBuffer[bank].front();
|
return readBuffer[bank].front();
|
||||||
}
|
}
|
||||||
else
|
return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!writeBuffer[bank].empty())
|
||||||
{
|
{
|
||||||
if (!writeBuffer[bank].empty())
|
if (bankMachine.isActivated())
|
||||||
{
|
{
|
||||||
if (bankMachine.isActivated())
|
// Search for write row hit
|
||||||
|
Row openRow = bankMachine.getOpenRow();
|
||||||
|
for (auto* it : writeBuffer[bank])
|
||||||
{
|
{
|
||||||
// Search for write row hit
|
if (ControllerExtension::getRow(*it) == openRow)
|
||||||
Row openRow = bankMachine.getOpenRow();
|
return it;
|
||||||
for (auto it : writeBuffer[bank])
|
|
||||||
{
|
|
||||||
if (ControllerExtension::getRow(*it) == openRow)
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// No row hit found or bank precharged
|
|
||||||
return writeBuffer[bank].front();
|
|
||||||
}
|
}
|
||||||
else
|
// No row hit found or bank precharged
|
||||||
return nullptr;
|
return writeBuffer[bank].front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerGrpFrFcfsWm::hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const
|
bool SchedulerGrpFrFcfsWm::hasFurtherRowHit(Bank bank, Row row, [[maybe_unused]] tlm::tlm_command command) const
|
||||||
{
|
{
|
||||||
unsigned rowHitCounter = 0;
|
unsigned rowHitCounter = 0;
|
||||||
if (!writeMode)
|
if (!writeMode)
|
||||||
@@ -152,27 +149,28 @@ bool SchedulerGrpFrFcfsWm::hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (auto* it : writeBuffer[bank])
|
||||||
{
|
{
|
||||||
for (auto it : writeBuffer[bank])
|
if (ControllerExtension::getRow(*it) == row)
|
||||||
{
|
{
|
||||||
if (ControllerExtension::getRow(*it) == row)
|
rowHitCounter++;
|
||||||
{
|
if (rowHitCounter == 2)
|
||||||
rowHitCounter++;
|
return true;
|
||||||
if (rowHitCounter == 2)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SchedulerGrpFrFcfsWm::hasFurtherRequest(Bank bank, tlm::tlm_command command) const
|
bool SchedulerGrpFrFcfsWm::hasFurtherRequest(Bank bank, [[maybe_unused]] tlm::tlm_command command) const
|
||||||
{
|
{
|
||||||
if (!writeMode)
|
if (!writeMode)
|
||||||
|
{
|
||||||
return (readBuffer[bank].size() >= 2);
|
return (readBuffer[bank].size() >= 2);
|
||||||
else
|
}
|
||||||
return (writeBuffer[bank].size() >= 2);
|
|
||||||
|
return (writeBuffer[bank].size() >= 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned>& SchedulerGrpFrFcfsWm::getBufferDepth() const
|
const std::vector<unsigned>& SchedulerGrpFrFcfsWm::getBufferDepth() const
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ class SchedulerGrpFrFcfsWm final : public SchedulerIF
|
|||||||
public:
|
public:
|
||||||
explicit SchedulerGrpFrFcfsWm(const Configuration& config);
|
explicit SchedulerGrpFrFcfsWm(const Configuration& config);
|
||||||
[[nodiscard]] bool hasBufferSpace() const override;
|
[[nodiscard]] bool hasBufferSpace() const override;
|
||||||
void storeRequest(tlm::tlm_generic_payload&) override;
|
void storeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
void removeRequest(tlm::tlm_generic_payload&) override;
|
void removeRequest(tlm::tlm_generic_payload& payload) override;
|
||||||
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const override;
|
[[nodiscard]] tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const override;
|
||||||
[[nodiscard]] bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] bool hasFurtherRequest(Bank, tlm::tlm_command) const override;
|
[[nodiscard]] bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const override;
|
||||||
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
[[nodiscard]] const std::vector<unsigned>& getBufferDepth() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -47,14 +47,22 @@ class BankMachine;
|
|||||||
|
|
||||||
class SchedulerIF
|
class SchedulerIF
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
SchedulerIF(const SchedulerIF &) = default;
|
||||||
|
SchedulerIF(SchedulerIF &&) = default;
|
||||||
|
SchedulerIF &operator=(const SchedulerIF &) = default;
|
||||||
|
SchedulerIF &operator=(SchedulerIF &&) = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
SchedulerIF() = default;
|
||||||
virtual ~SchedulerIF() = default;
|
virtual ~SchedulerIF() = default;
|
||||||
|
|
||||||
[[nodiscard]] virtual bool hasBufferSpace() const = 0;
|
[[nodiscard]] virtual bool hasBufferSpace() const = 0;
|
||||||
virtual void storeRequest(tlm::tlm_generic_payload&) = 0;
|
virtual void storeRequest(tlm::tlm_generic_payload& payload) = 0;
|
||||||
virtual void removeRequest(tlm::tlm_generic_payload&) = 0;
|
virtual void removeRequest(tlm::tlm_generic_payload& payload) = 0;
|
||||||
[[nodiscard]] virtual tlm::tlm_generic_payload* getNextRequest(const BankMachine&) const = 0;
|
[[nodiscard]] virtual tlm::tlm_generic_payload* getNextRequest(const BankMachine& bankMachine) const = 0;
|
||||||
[[nodiscard]] virtual bool hasFurtherRowHit(Bank, Row, tlm::tlm_command) const = 0;
|
[[nodiscard]] virtual bool hasFurtherRowHit(Bank bank, Row row, tlm::tlm_command command) const = 0;
|
||||||
[[nodiscard]] virtual bool hasFurtherRequest(Bank, tlm::tlm_command) const = 0;
|
[[nodiscard]] virtual bool hasFurtherRequest(Bank bank, tlm::tlm_command command) const = 0;
|
||||||
[[nodiscard]] virtual const std::vector<unsigned>& getBufferDepth() const = 0;
|
[[nodiscard]] virtual const std::vector<unsigned>& getBufferDepth() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user