From 9b31fef5552a0e76ffea5a1d1ed951f70b242063 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 14 Apr 2023 10:03:59 +0200 Subject: [PATCH] Use local copies of sc_max_time() instead of calling the function. --- .../controller/checker/CheckerDDR5.cpp | 206 ++++++------ .../DRAMSys/controller/checker/CheckerDDR5.h | 2 +- .../controller/checker/CheckerHBM3.cpp | 310 +++++++++--------- .../DRAMSys/controller/checker/CheckerHBM3.h | 1 + .../controller/checker/CheckerLPDDR5.cpp | 174 +++++----- .../controller/checker/CheckerLPDDR5.h | 1 + .../DRAMSys/controller/Controller.cpp | 14 +- .../DRAMSys/controller/Controller.h | 1 + .../controller/checker/CheckerDDR3.cpp | 176 +++++----- .../DRAMSys/controller/checker/CheckerDDR3.h | 1 + .../controller/checker/CheckerDDR4.cpp | 206 ++++++------ .../DRAMSys/controller/checker/CheckerDDR4.h | 3 +- .../controller/checker/CheckerGDDR5.cpp | 228 ++++++------- .../DRAMSys/controller/checker/CheckerGDDR5.h | 1 + .../controller/checker/CheckerGDDR5X.cpp | 228 ++++++------- .../controller/checker/CheckerGDDR5X.h | 1 + .../controller/checker/CheckerGDDR6.cpp | 242 +++++++------- .../DRAMSys/controller/checker/CheckerGDDR6.h | 1 + .../controller/checker/CheckerHBM2.cpp | 190 +++++------ .../DRAMSys/controller/checker/CheckerHBM2.h | 1 + .../controller/checker/CheckerLPDDR4.cpp | 216 ++++++------ .../controller/checker/CheckerLPDDR4.h | 1 + .../controller/checker/CheckerSTTMRAM.cpp | 154 ++++----- .../controller/checker/CheckerSTTMRAM.h | 1 + .../controller/checker/CheckerWideIO.cpp | 166 +++++----- .../controller/checker/CheckerWideIO.h | 1 + .../controller/checker/CheckerWideIO2.cpp | 202 ++++++------ .../controller/checker/CheckerWideIO2.h | 1 + .../controller/cmdmux/CmdMuxOldest.cpp | 12 +- .../DRAMSys/controller/cmdmux/CmdMuxOldest.h | 2 + .../controller/cmdmux/CmdMuxStrict.cpp | 10 +- .../DRAMSys/controller/cmdmux/CmdMuxStrict.h | 2 + .../refresh/RefreshManagerAllBank.cpp | 2 +- .../refresh/RefreshManagerAllBank.h | 1 + .../refresh/RefreshManagerDummy.cpp | 2 +- .../controller/refresh/RefreshManagerDummy.h | 2 + .../refresh/RefreshManagerPer2Bank.cpp | 2 +- .../refresh/RefreshManagerPer2Bank.h | 2 + .../refresh/RefreshManagerPerBank.cpp | 2 +- .../refresh/RefreshManagerPerBank.h | 2 + .../refresh/RefreshManagerSameBank.cpp | 2 +- .../refresh/RefreshManagerSameBank.h | 1 + .../controller/respqueue/RespQueueFifo.cpp | 2 +- .../controller/respqueue/RespQueueFifo.h | 1 + .../controller/respqueue/RespQueueReorder.cpp | 2 +- .../controller/respqueue/RespQueueReorder.h | 1 + 46 files changed, 1397 insertions(+), 1382 deletions(-) diff --git a/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.cpp b/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.cpp index d1c9d87b..c8d40f49 100644 --- a/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.cpp +++ b/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.cpp @@ -48,22 +48,22 @@ CheckerDDR5::CheckerDDR5(const Configuration& config) SC_REPORT_FATAL("CheckerDDR5", "Wrong MemSpec chosen"); lastScheduledByCommandAndDimmRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->dimmRanksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->dimmRanksPerChannel, scMaxTime)); lastScheduledByCommandAndPhysicalRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->physicalRanksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->physicalRanksPerChannel, scMaxTime)); lastScheduledByCommandAndLogicalRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->logicalRanksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->logicalRanksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); // Required for Same Bank Refresh lastScheduledByCommandAndBankInGroup = std::vector>(Command::numberOfCommands(), - std::vector(memSpec->ranksPerChannel * memSpec->banksPerGroup, sc_max_time())); - lastCommandOnBus = sc_max_time(); - dummyCommandOnBus.start = sc_max_time(); - dummyCommandOnBus.end = sc_max_time(); + std::vector(memSpec->ranksPerChannel * memSpec->banksPerGroup, scMaxTime)); + lastCommandOnBus = scMaxTime; + dummyCommandOnBus.start = scMaxTime; + dummyCommandOnBus.end = scMaxTime; last4ActivatesLogical = std::vector>(memSpec->logicalRanksPerChannel); last4ActivatesPhysical = std::vector>(memSpec->physicalRanksPerChannel); @@ -137,19 +137,19 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L_slr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RD][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RD][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::RD][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST32); @@ -177,15 +177,15 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L_slr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RDA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RDA][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::RDA][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST32); @@ -215,7 +215,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WR][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDA + tBURST16); @@ -225,7 +225,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WR][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_L_WTR_slr + tBURST16); @@ -234,7 +234,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WR][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::WR][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_S_WTR_slr + tBURST16); @@ -243,7 +243,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::WR][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::WR][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_WTR_dlr + tBURST16); @@ -271,7 +271,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WRA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_L_WTR_slr + tBURST16); @@ -280,7 +280,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WRA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::WRA][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_S_WTR_slr + tBURST16); @@ -289,7 +289,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::WRA][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::WRA][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_WTR_dlr + tBURST16); @@ -324,11 +324,11 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RD][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_L_RTW_slr + tBURST16); @@ -337,7 +337,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RD][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::RD][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_S_RTW_slr + tBURST16); @@ -346,7 +346,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RD][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::RD][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_RTW_dlr + tBURST16); @@ -374,7 +374,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RDA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_L_RTW_slr + tBURST16); @@ -383,7 +383,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RDA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::RDA][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_S_RTW_slr + tBURST16); @@ -392,7 +392,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RDA][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::RDA][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tCCD_RTW_dlr + tBURST16); @@ -420,7 +420,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WR][bankGroup.ID()] == 32) { @@ -439,11 +439,11 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WR][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S_WR_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::WR][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::WR][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST32); @@ -471,7 +471,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WRA][bankGroup.ID()] == 32) { @@ -490,11 +490,11 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WRA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S_WR_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::WRA][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndPhysicalRank[Command::WRA][physicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST32); @@ -524,27 +524,27 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_L_slr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::ACT][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_S_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::ACT][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_dlr); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDAACT); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WRA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAACT + tBURST16); @@ -553,51 +553,51 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::PREAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::PRESB][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::REFAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RFMAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr - cmdLengthDiff); // TODO: No tRFC_dlr and tRFC_dpr between REFAB and ACT? lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::REFSB][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_slr - cmdLengthDiff); // TODO: No tRFCsb_dlr between REFSB and ACT? lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::REFSB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFSBRD_slr - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::REFSB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFSBRD_dlr - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::RFMSB][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_slr - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RFMSB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFSBRD_slr - cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RFMSB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFSBRD_dlr - cmdLengthDiff); if (last4ActivatesLogical[logicalRank.ID()].size() >= 4) @@ -611,15 +611,15 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WR][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + cmdLengthDiff); @@ -628,33 +628,33 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PREPB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PREAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PRESB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::ACT][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RD][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RDA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WR][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::WR][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + cmdLengthDiff); @@ -663,7 +663,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WRA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::WRA][logicalRank.ID()]) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + cmdLengthDiff); @@ -672,11 +672,11 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PREPB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PREAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); // PRESB tPPD @@ -684,19 +684,19 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PRESB) { lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::ACT][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::RD][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::RDA][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::WR][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankInGroup[Command::WR][bankInGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + cmdLengthDiff); @@ -705,7 +705,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::WRA][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankInGroup[Command::WRA][bankInGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + cmdLengthDiff); @@ -714,27 +714,27 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PREPB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); // PREA tRP lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::PRESB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); } else if (command == Command::REFAB || command == Command::RFMAB) { lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::ACT][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RDA][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDAACT + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::WRA][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndLogicalRank[Command::WRA][logicalRank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + tBURST16 + memSpec->tRP + cmdLengthDiff); @@ -743,35 +743,35 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::PREPB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::PREAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::REFAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::REFAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr); lastCommandStart = lastScheduledByCommandAndDimmRank[Command::REFAB][dimmRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RFMAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RFMAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr); lastCommandStart = lastScheduledByCommandAndDimmRank[Command::RFMAB][dimmRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr); // REFSB tRFCsb_slr/dlr @@ -780,19 +780,19 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::REFSB || command == Command::RFMSB) { lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::ACT][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::ACT][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_L_slr + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::RDA][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDAACT + cmdLengthDiff); lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::WRA][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankInGroup[Command::WRA][bankInGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAACT + tBURST16 + cmdLengthDiff); @@ -801,57 +801,57 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::PREPB][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); // PREA tRP lastCommandStart = lastScheduledByCommandAndBankInGroup[Command::PRESB][bankInGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::REFAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr); // TODO: check this lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::REFAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr); // TODO: check this lastCommandStart = lastScheduledByCommandAndDimmRank[Command::REFAB][dimmRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RFMAB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_slr); // TODO: check this lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RFMAB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr); // TODO: check this lastCommandStart = lastScheduledByCommandAndDimmRank[Command::RFMAB][dimmRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::REFSB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::REFSB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_dlr); lastCommandStart = lastScheduledByCommandAndLogicalRank[Command::RFMSB][logicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_slr); lastCommandStart = lastScheduledByCommandAndPhysicalRank[Command::RFMSB][physicalRank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCsb_dlr); if (last4ActivatesLogical[logicalRank.ID()].size() >= 4) @@ -865,10 +865,10 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, const tlm_generic else SC_REPORT_FATAL("CheckerDDR5", "Unknown command!"); - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); - if (dummyCommandOnBus.start != sc_max_time()) + if (dummyCommandOnBus.start != scMaxTime) { TimeInterval currentCommandOnBus(earliestTimeToStart, earliestTimeToStart + memSpec->getCommandLength(command)); diff --git a/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.h b/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.h index c03cd051..78c92ecf 100644 --- a/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.h +++ b/extensions/standards/DDR5/DRAMSys/controller/checker/CheckerDDR5.h @@ -79,8 +79,8 @@ private: // TODO: store BL of last RD and WR globally or for each hierarchy? + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time cmdLengthDiff; - sc_core::sc_time tBURST16; sc_core::sc_time tBURST32; sc_core::sc_time tWTRA; diff --git a/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.cpp b/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.cpp index 85cb7782..0b375e0b 100644 --- a/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.cpp +++ b/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.cpp @@ -48,14 +48,14 @@ CheckerHBM3::CheckerHBM3(const Configuration &config) SC_REPORT_FATAL("CheckerHBM3", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector>( - Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector>( - Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector>( - Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnRasBus = sc_max_time(); - lastCommandOnCasBus = sc_max_time(); + Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnRasBus = scMaxTime; + lastCommandOnCasBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); bankwiseRefreshCounter = std::vector(memSpec->ranksPerChannel); @@ -81,27 +81,27 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK / 2); @@ -109,51 +109,51 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::RD) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -161,51 +161,51 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::WR) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -213,52 +213,52 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + 2 * memSpec->tCK + std::max(memSpec->tWR - memSpec->tRTP, memSpec->tWTRL)); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -266,51 +266,51 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::WRA) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -318,77 +318,77 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::REFPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RFMPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RFMPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS - memSpec->tCK); if (last4Activates[rank.ID()].size() >= 4) @@ -399,47 +399,47 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -447,39 +447,39 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK / 2); @@ -487,79 +487,79 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::REFPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::RFMPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RFMPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (bankwiseRefreshCounter[rank.ID()] == 0) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); @@ -575,40 +575,40 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(memSpec->tRTP + memSpec->tRP, tRDSRE)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -616,23 +616,23 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::RFMAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -640,47 +640,47 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::RFMAB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::REFPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::RFMPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RFMPB][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::RFMPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -688,23 +688,23 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -712,23 +712,23 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -736,7 +736,7 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -744,7 +744,7 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -752,7 +752,7 @@ sc_time CheckerHBM3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); diff --git a/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.h b/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.h index 1215b2d0..f7da11e2 100644 --- a/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.h +++ b/extensions/standards/HBM3/DRAMSys/controller/checker/CheckerHBM3.h @@ -68,6 +68,7 @@ private: std::vector> last4Activates; std::vector bankwiseRefreshCounter; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tRDPDE; sc_core::sc_time tRDSRE; sc_core::sc_time tWRPRE; diff --git a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp index 7f7397db..b491c2b9 100644 --- a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp +++ b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp @@ -49,13 +49,13 @@ CheckerLPDDR5::CheckerLPDDR5(const Configuration& config) else { lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); @@ -90,11 +90,11 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD_L + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RD][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_L_32); @@ -103,7 +103,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RD][rank.ID()] == 32) { @@ -118,8 +118,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? - lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommand[Command::RD] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -130,7 +130,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RDA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_L_32); @@ -139,7 +139,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RDA][rank.ID()] == 32) { @@ -154,8 +154,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? - lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::RDA] == 32) @@ -167,7 +167,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WR][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -178,7 +178,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WR][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -189,8 +189,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? - lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::WR] == 32) @@ -202,7 +202,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WRA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -213,7 +213,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WRA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -224,8 +224,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? - lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::WRA] == 32) @@ -244,11 +244,11 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD_S + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RD][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL @@ -259,7 +259,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RD][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL @@ -270,8 +270,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? - lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::RD] == 32) @@ -283,7 +283,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::RDA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL @@ -294,7 +294,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RDA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL @@ -305,8 +305,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? - lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::RDA] == 32) @@ -318,7 +318,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WR][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_L_32); @@ -327,7 +327,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WR][rank.ID()] == 32) { @@ -342,8 +342,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? - lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) { // TODO: BG mode with BL32 if (lastBurstLengthByCommand[Command::WR] == 32) @@ -353,7 +353,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBankGroup[Command::WRA][bankGroup.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_L_32); @@ -362,7 +362,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WRA][rank.ID()] == 32) { @@ -377,8 +377,8 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? - lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommand[Command::WRA] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 + memSpec->tCK); @@ -389,15 +389,15 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RDA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -408,7 +408,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RDA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -419,31 +419,31 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tpbR2act - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFP2B][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tpbR2act - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFP2B][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb - memSpec->tCK); if (last4Activates[rank.ID()].size() >= 4) @@ -452,11 +452,11 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RD][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -467,7 +467,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WR][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -478,17 +478,17 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RD][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -499,7 +499,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RDA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -510,7 +510,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WR][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -521,7 +521,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WRA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -532,17 +532,17 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::RDA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -553,7 +553,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndRank[Command::WRA][rank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -564,29 +564,29 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); } else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RDA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -597,7 +597,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WRA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -608,19 +608,19 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tpbR2pbR); if (last4Activates[rank.ID()].size() >= 4) @@ -631,19 +631,19 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener Bank secondBank = Bank(bank.ID() + memSpec->getPer2BankOffset()); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][secondBank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RDA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -654,7 +654,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][secondBank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::RDA][secondBank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->BL_n_min_32 @@ -665,7 +665,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WRA][bank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -676,7 +676,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][secondBank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (lastBurstLengthByCommandAndBank[Command::WRA][secondBank.ID()] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL @@ -687,23 +687,23 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][secondBank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndBank[Command::REFP2B][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::REFP2B][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tpbR2pbR); if (last4Activates[rank.ID()].size() >= 4) @@ -713,7 +713,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, const tlm_gener SC_REPORT_FATAL("CheckerLPDDR5", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.h b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.h index eeec8f6d..8590f3d6 100644 --- a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.h +++ b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.h @@ -66,6 +66,7 @@ private: std::vector> lastBurstLengthByCommandAndBank; std::vector lastBurstLengthByCommand; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST16; sc_core::sc_time tBURST32; sc_core::sc_time tRDWR; diff --git a/src/libdramsys/DRAMSys/controller/Controller.cpp b/src/libdramsys/DRAMSys/controller/Controller.cpp index f8743220..66c7b785 100644 --- a/src/libdramsys/DRAMSys/controller/Controller.cpp +++ b/src/libdramsys/DRAMSys/controller/Controller.cpp @@ -348,7 +348,7 @@ void Controller::controllerMethod() + phyDelayBw + thinkDelayBw); sc_time triggerTime = respQueue->getTriggerTime(); - if (triggerTime != sc_max_time()) + if (triggerTime != scMaxTime) dataResponseEvent.notify(triggerTime - sc_time_stamp()); ranksNumberOfPayloads[rank.ID()]--; // TODO: move to a different place? @@ -365,7 +365,7 @@ void Controller::controllerMethod() } // (6) Restart bank machines, refresh managers and power-down managers to issue new requests for the future - sc_time timeForNextTrigger = sc_max_time(); + sc_time timeForNextTrigger = scMaxTime; sc_time localTime; for (auto& it : bankMachines) { @@ -411,7 +411,7 @@ void Controller::controllerMethod() } } - if (timeForNextTrigger != sc_max_time()) + if (timeForNextTrigger != scMaxTime) controllerEvent.notify(timeForNextTrigger - sc_time_stamp()); } @@ -561,12 +561,12 @@ void Controller::manageResponses() bwDelay = SC_ZERO_TIME; sendToFrontend(*transToRelease.payload, bwPhase, bwDelay); - transToRelease.arrival = sc_max_time(); + transToRelease.arrival = scMaxTime; } else { sc_time triggerTime = respQueue->getTriggerTime(); - if (triggerTime != sc_max_time()) + if (triggerTime != scMaxTime) dataResponseEvent.notify(triggerTime - sc_time_stamp()); } } @@ -581,13 +581,13 @@ void Controller::manageResponses() bwDelay = SC_ZERO_TIME; sendToFrontend(*transToRelease.payload, bwPhase, bwDelay); - transToRelease.arrival = sc_max_time(); + transToRelease.arrival = scMaxTime; } } else { sc_time triggerTime = respQueue->getTriggerTime(); - if (triggerTime != sc_max_time()) + if (triggerTime != scMaxTime) dataResponseEvent.notify(triggerTime - sc_time_stamp()); } } diff --git a/src/libdramsys/DRAMSys/controller/Controller.h b/src/libdramsys/DRAMSys/controller/Controller.h index b8e190d7..d5cf89f9 100644 --- a/src/libdramsys/DRAMSys/controller/Controller.h +++ b/src/libdramsys/DRAMSys/controller/Controller.h @@ -70,6 +70,7 @@ protected: std::unique_ptr scheduler; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); const sc_core::sc_time thinkDelayFw; const sc_core::sc_time thinkDelayBw; const sc_core::sc_time phyDelayFw; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.cpp index 81585509..52c22803 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.cpp @@ -48,11 +48,11 @@ CheckerDDR3::CheckerDDR3(const Configuration& config) SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); tBURST = memSpec->defaultBurstLength / memSpec->dataRate * memSpec->tCK; @@ -79,54 +79,54 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, const tlm_generic assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP - memSpec->tAL); } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); lastCommandStart = lastScheduledByCommand[Command::WR]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::WR || command == Command::WRA) @@ -134,89 +134,89 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, const tlm_generic assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -225,201 +225,201 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tACTPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, memSpec->tAL + memSpec->tRTP + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerDDR3", "Unknown command!"); - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.h b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.h index 8aa5372a..154d15c3 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR3.h @@ -60,6 +60,7 @@ private: // Four activate window std::vector> last4Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDWR; sc_core::sc_time tRDWR_R; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.cpp index 3ce6dc91..b3f0b226 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.cpp @@ -46,17 +46,17 @@ CheckerDDR4::CheckerDDR4(const Configuration& config) memSpec = dynamic_cast(config.memSpec.get()); if (memSpec == nullptr) SC_REPORT_FATAL("CheckerDDR4", "Wrong MemSpec chosen"); - + lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); - + tBURST = memSpec->defaultBurstLength / memSpec->dataRate * memSpec->tCK; tRDWR = memSpec->tRL + tBURST + memSpec->tCK - memSpec->tWL + memSpec->tWPRE; tRDWR_R = memSpec->tRL + tBURST + memSpec->tRTRS - memSpec->tWL + memSpec->tWPRE; @@ -71,12 +71,6 @@ CheckerDDR4::CheckerDDR4(const Configuration& config) sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, const tlm_generic_payload& payload) const { - if (auto hit = cache.find(&payload); hit != cache.end()) - { - if (hit->second.first == command) - return hit->second.second; - } - Rank rank = ControllerExtension::getRank(payload); BankGroup bankGroup = ControllerExtension::getBankGroup(payload); Bank bank = ControllerExtension::getBank(payload); @@ -89,70 +83,70 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, const tlm_generic assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP - memSpec->tAL); } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); lastCommandStart = lastScheduledByCommand[Command::WR]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::WR || command == Command::WRA) @@ -160,101 +154,101 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, const tlm_generic assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD_S); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD_S); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -263,205 +257,203 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tACTPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, memSpec->tAL + memSpec->tRTP + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerDDR4", "Unknown command!"); - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); - cache.insert_or_assign(&payload, std::pair{command, earliestTimeToStart}); - return earliestTimeToStart; } @@ -486,6 +478,4 @@ void CheckerDDR4::insert(Command command, const tlm_generic_payload& payload) last4Activates[rank.ID()].pop(); last4Activates[rank.ID()].push(sc_time_stamp()); } - - cache.clear(); } diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.h b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.h index 364e9427..8740bca3 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerDDR4.h @@ -63,6 +63,7 @@ private: // Four activate window std::vector> last4Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDWR; sc_core::sc_time tRDWR_R; @@ -75,8 +76,6 @@ private: sc_core::sc_time tRDPDEN; sc_core::sc_time tWRPDEN; sc_core::sc_time tWRAPDEN; - - mutable std::unordered_map> cache; }; #endif // CHECKERDDR4_H diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.cpp index 5fc7d80c..9eabb6aa 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.cpp @@ -48,13 +48,13 @@ CheckerGDDR5::CheckerGDDR5(const Configuration& config) SC_REPORT_FATAL("CheckerGDDR5", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); last32Activates = std::vector>(memSpec->ranksPerChannel); @@ -84,70 +84,70 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, const tlm_generi assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP); } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::WR || command == Command::WRA) @@ -155,109 +155,109 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, const tlm_generi assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -269,145 +269,145 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, const tlm_generi else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (bankwiseRefreshCounter[rank.ID()] == 0) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); @@ -416,7 +416,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, const tlm_generi } lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -428,112 +428,112 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, const tlm_generi else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(memSpec->tRTP + memSpec->tRP, tRDSRE)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXPN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else SC_REPORT_FATAL("CheckerGDDR5", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.h b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.h index 3dd19f6b..1b3e0b39 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5.h @@ -65,6 +65,7 @@ private: std::vector bankwiseRefreshCounter; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDSRE; sc_core::sc_time tWRSRE; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.cpp index 68bbcecb..a0eed3bd 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.cpp @@ -48,13 +48,13 @@ CheckerGDDR5X::CheckerGDDR5X(const Configuration& config) SC_REPORT_FATAL("CheckerGDDR5X", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); last32Activates = std::vector>(memSpec->ranksPerChannel); @@ -86,70 +86,70 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, const tlm_gener assert(!(memSpec->dataRate == 8) || (burstLength == 16)); // QDR mode (ODR wrt CK) lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP); } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::WR || command == Command::WRA) @@ -159,109 +159,109 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, const tlm_gener assert(!(memSpec->dataRate == 8) || (burstLength == 16)); // QDR mode (ODR wrt CK) lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -273,145 +273,145 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (bankwiseRefreshCounter[rank.ID()] == 0) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); @@ -420,7 +420,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, const tlm_gener } lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -432,112 +432,112 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(memSpec->tRTP + memSpec->tRP, tRDSRE)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCPB); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else SC_REPORT_FATAL("CheckerGDDR5X", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.h b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.h index 771e4b60..ca2e17aa 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR5X.h @@ -65,6 +65,7 @@ private: std::vector bankwiseRefreshCounter; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDSRE; sc_core::sc_time tWRSRE; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.cpp index 1be0ccb5..447f9867 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.cpp @@ -48,13 +48,13 @@ CheckerGDDR6::CheckerGDDR6(const Configuration& config) SC_REPORT_FATAL("CheckerGDDR6", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); bankwiseRefreshCounter = std::vector(memSpec->ranksPerChannel); @@ -83,70 +83,70 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, const tlm_generi assert(ControllerExtension::getBurstLength(payload) == 16); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP); } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_L); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_S); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::WR || command == Command::WRA) @@ -154,109 +154,109 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, const tlm_generi assert(ControllerExtension::getBurstLength(payload) == 16); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tLK); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -265,145 +265,145 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, const tlm_generi else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (bankwiseRefreshCounter[rank.ID()] == 0) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); @@ -412,7 +412,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, const tlm_generi } lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -421,140 +421,140 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, const tlm_generi else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tACTPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPREPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPREPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPREPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tREFPDE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDSRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(memSpec->tRTP + memSpec->tRP, tRDSRE)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerGDDR6", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.h b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.h index 281ab583..7f8b1340 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerGDDR6.h @@ -63,6 +63,7 @@ private: std::vector bankwiseRefreshCounter; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDSRE; sc_core::sc_time tWRSRE; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.cpp index ebe67169..e4ff9f63 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.cpp @@ -48,14 +48,14 @@ CheckerHBM2::CheckerHBM2(const Configuration& config) SC_REPORT_FATAL("CheckerHBM2", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndBankGroup = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->bankGroupsPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnRasBus = sc_max_time(); - lastCommandOnCasBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnRasBus = scMaxTime; + lastCommandOnCasBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); bankwiseRefreshCounter = std::vector(memSpec->ranksPerChannel); @@ -86,50 +86,50 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic assert(!(memSpec->ranksPerChannel == 2) || (burstLength == 4)); // Pseudo-channel mode lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RDA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP); } lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRDS); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -141,35 +141,35 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic assert(!(memSpec->ranksPerChannel == 2) || (burstLength == 4)); // Pseudo-channel mode lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTW); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDL); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); @@ -177,55 +177,55 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP - memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::PDXP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD - memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::SREFEX]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS - memSpec->tCK); if (last4Activates[rank.ID()].size() >= 4) @@ -236,19 +236,19 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -256,31 +256,31 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -288,39 +288,39 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommand[Command::PDXP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB); lastCommandStart = lastScheduledByCommand[Command::SREFEX]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -328,51 +328,51 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankGroup.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommand[Command::PDXP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) { if (bankwiseRefreshCounter[rank.ID()] == 0) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB); @@ -381,7 +381,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic } lastCommandStart = lastScheduledByCommand[Command::SREFEX]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -392,23 +392,23 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommand[Command::RD]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommand[Command::RDA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommand[Command::WR]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDE); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDE); lastCommandStart = lastScheduledByCommand[Command::PDXA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -416,7 +416,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommand[Command::PDEA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -424,23 +424,23 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommand[Command::RD]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommand[Command::RDA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDE); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDE); lastCommandStart = lastScheduledByCommand[Command::PDXP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommand[Command::SREFEX]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -448,7 +448,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommand[Command::PDEP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -456,39 +456,39 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommand[Command::ACT]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::RDA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(memSpec->tRTP + memSpec->tRP, tRDSRE)); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommand[Command::PREPB]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommand[Command::PREAB]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommand[Command::PDXP]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommand[Command::REFAB]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommand[Command::REFPB]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB); lastCommandStart = lastScheduledByCommand[Command::SREFEX]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -496,7 +496,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommand[Command::SREFEN]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); @@ -506,12 +506,12 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, const tlm_generic if (command.isRasCommand()) { - if (lastCommandOnRasBus != sc_max_time()) + if (lastCommandOnRasBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else { - if (lastCommandOnCasBus != sc_max_time()) + if (lastCommandOnCasBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); } diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.h b/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.h index 50b7c527..442ed36e 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerHBM2.h @@ -64,6 +64,7 @@ private: std::vector> last4Activates; std::vector bankwiseRefreshCounter; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDPDE; sc_core::sc_time tRDSRE; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.cpp index e7f164e8..34d211bc 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.cpp @@ -48,11 +48,11 @@ CheckerLPDDR4::CheckerLPDDR4(const Configuration& config) SC_REPORT_FATAL("CheckerLPDDR4", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); tBURST = memSpec->defaultBurstLength / memSpec->dataRate * memSpec->tCK; @@ -87,50 +87,50 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - tRDPRE); } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::WR || command == Command::WRA) @@ -140,93 +140,93 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDAACT); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAACT); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR - 2 * memSpec->tCK); if (last4Activates[rank.ID()].size() >= 4) @@ -235,141 +235,141 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); if (last4Activates[rank.ID()].size() >= 4) @@ -378,136 +378,136 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tACTPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tREFPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tREFPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tREFPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, tRDPRE + memSpec->tRPpb)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRPpb)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tSR); } else SC_REPORT_FATAL("CheckerLPDDR4", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.h b/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.h index b01f1699..31ee2862 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerLPDDR4.h @@ -60,6 +60,7 @@ private: // Four activate window std::vector> last4Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDWR; sc_core::sc_time tRDWR_R; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.cpp index a087f9c2..e3b43462 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.cpp @@ -48,11 +48,11 @@ CheckerSTTMRAM::CheckerSTTMRAM(const Configuration& config) SC_REPORT_FATAL("CheckerSTTMRAM", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); tBURST = memSpec->defaultBurstLength / memSpec->dataRate * memSpec->tCK; @@ -79,56 +79,56 @@ sc_time CheckerSTTMRAM::timeToSatisfyConstraints(Command command, const tlm_gene assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? - lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? - lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - memSpec->tRTP - memSpec->tAL); } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); lastCommandStart = lastScheduledByCommand[Command::WR]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); lastCommandStart = lastScheduledByCommand[Command::WRA]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::WR || command == Command::WRA) @@ -136,85 +136,85 @@ sc_time CheckerSTTMRAM::timeToSatisfyConstraints(Command command, const tlm_gene assert(ControllerExtension::getBurstLength(payload) == 8); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD - memSpec->tAL); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSDLL); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); if (last4Activates[rank.ID()].size() >= 4) @@ -223,159 +223,159 @@ sc_time CheckerSTTMRAM::timeToSatisfyConstraints(Command command, const tlm_gene else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tAL + memSpec->tRTP); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tACTPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPD); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, memSpec->tAL + memSpec->tRTP + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXS); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerSTTMRAM", "Unknown command!"); - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.h b/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.h index 212bacf3..e95ccad8 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerSTTMRAM.h @@ -60,6 +60,7 @@ private: // Four activate window std::vector> last4Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDWR; sc_core::sc_time tRDWR_R; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.cpp index 4b9df385..c6b77185 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.cpp @@ -48,11 +48,11 @@ CheckerWideIO::CheckerWideIO(const Configuration& config) SC_REPORT_FATAL("CheckerWideIO", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last2Activates = std::vector>(memSpec->ranksPerChannel); tBURST = memSpec->defaultBurstLength * memSpec->tCK; @@ -81,50 +81,50 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - tBURST); } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::WR || command == Command::WRA) @@ -134,85 +134,85 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, const tlm_gener assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); if (last2Activates[rank.ID()].size() >= 2) @@ -221,182 +221,182 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, const tlm_gener else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, tBURST + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerWideIO", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.h b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.h index a525ea35..cf30dfbc 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO.h @@ -60,6 +60,7 @@ private: // Four activate window std::vector> last2Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDWR; sc_core::sc_time tRDWR_R; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.cpp b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.cpp index 525382ad..fa0052cb 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.cpp +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.cpp @@ -48,11 +48,11 @@ CheckerWideIO2::CheckerWideIO2(const Configuration& config) SC_REPORT_FATAL("CheckerWideIO2", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, sc_max_time())); + (Command::numberOfCommands(), std::vector(memSpec->banksPerChannel, scMaxTime)); lastScheduledByCommandAndRank = std::vector> - (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, sc_max_time())); - lastScheduledByCommand = std::vector(Command::numberOfCommands(), sc_max_time()); - lastCommandOnBus = sc_max_time(); + (Command::numberOfCommands(), std::vector(memSpec->ranksPerChannel, scMaxTime)); + lastScheduledByCommand = std::vector(Command::numberOfCommands(), scMaxTime); + lastCommandOnBus = scMaxTime; last4Activates = std::vector>(memSpec->ranksPerChannel); tBURST = memSpec->defaultBurstLength / memSpec->dataRate * memSpec->tCK; @@ -82,50 +82,50 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, const tlm_gene assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE - tRDPRE); } lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_R); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::WR || command == Command::WRA) @@ -135,93 +135,93 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, const tlm_gene assert(burstLength <= memSpec->maxBurstLength); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCD); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RD] != lastScheduledByCommandAndRank[Command::RD][rank.ID()] ? lastScheduledByCommand[Command::RD] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR); - lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::RDA] != lastScheduledByCommandAndRank[Command::RDA][rank.ID()] ? lastScheduledByCommand[Command::RDA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_R); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WR] != lastScheduledByCommandAndRank[Command::WR][rank.ID()] ? lastScheduledByCommand[Command::WR] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD); - lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : sc_max_time(); - if (lastCommandStart != sc_max_time()) + lastCommandStart = lastScheduledByCommand[Command::WRA] != lastScheduledByCommandAndRank[Command::WRA][rank.ID()] ? lastScheduledByCommand[Command::WRA] : scMaxTime; + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tBURST + memSpec->tRTRS); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::ACT) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndBank[Command::REFPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); if (last4Activates[rank.ID()].size() >= 4) @@ -230,141 +230,141 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, const tlm_gene else if (command == Command::PREPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); } else if (command == Command::PREAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); } else if(command == Command::REFAB) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if(command == Command::REFPB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPRE + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PREPB][bank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); if (last4Activates[rank.ID()].size() >= 4) @@ -373,108 +373,108 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, const tlm_gene else if (command == Command::PDEA) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDXA) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::PDEP) { lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRAPDEN); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::PDXP) { lastCommandStart = lastScheduledByCommandAndRank[Command::PDEP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKE); } else if (command == Command::SREFEN) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tRDPDEN, tRDPRE + memSpec->tRPpb)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + std::max(tWRAPDEN, tWRPRE + memSpec->tRPpb)); lastCommandStart = lastScheduledByCommandAndRank[Command::PREPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PREAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXP); lastCommandStart = lastScheduledByCommandAndRank[Command::REFAB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab); lastCommandStart = lastScheduledByCommandAndRank[Command::REFPB][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEX][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tXSR); } else if (command == Command::SREFEX) { lastCommandStart = lastScheduledByCommandAndRank[Command::SREFEN][rank.ID()]; - if (lastCommandStart != sc_max_time()) + if (lastCommandStart != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCKESR); } else SC_REPORT_FATAL("CheckerWideIO2", "Unknown command!"); // Check if command bus is free - if (lastCommandOnBus != sc_max_time()) + if (lastCommandOnBus != scMaxTime) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; diff --git a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.h b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.h index ef102ea6..6a890316 100644 --- a/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.h +++ b/src/libdramsys/DRAMSys/controller/checker/CheckerWideIO2.h @@ -60,6 +60,7 @@ private: // Four activate window std::vector> last4Activates; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); sc_core::sc_time tBURST; sc_core::sc_time tRDPRE; sc_core::sc_time tRDPDEN; diff --git a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.cpp b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.cpp index 6ebbe109..f9edeca9 100644 --- a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.cpp +++ b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.cpp @@ -45,7 +45,7 @@ CommandTuple::Type CmdMuxOldest::selectCommand(const ReadyCommands &readyCommand auto result = readyCommands.cend(); uint64_t lastPayloadID = UINT64_MAX; uint64_t newPayloadID; - sc_time lastTimestamp = sc_max_time(); + sc_time lastTimestamp = scMaxTime; sc_time newTimestamp; for (auto it = readyCommands.cbegin(); it != readyCommands.cend(); it++) @@ -71,7 +71,7 @@ CommandTuple::Type CmdMuxOldest::selectCommand(const ReadyCommands &readyCommand std::get(*result) == sc_time_stamp()) return *result; else - return {Command::NOP, nullptr, sc_max_time()}; + return {Command::NOP, nullptr, scMaxTime}; } @@ -101,7 +101,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC uint64_t lastPayloadID = UINT64_MAX; uint64_t newPayloadID; - sc_time lastTimestamp = sc_max_time(); + sc_time lastTimestamp = scMaxTime; sc_time newTimestamp; for (auto it = readyRasCommands.cbegin(); it != readyRasCommands.cend(); it++) @@ -124,7 +124,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC } lastPayloadID = UINT64_MAX; - lastTimestamp = sc_max_time(); + lastTimestamp = scMaxTime; for (auto it = readyCasCommands.cbegin(); it != readyCasCommands.cend(); it++) { @@ -153,7 +153,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC readyRasCasCommands.emplace_back(*resultCas); lastPayloadID = UINT64_MAX; - lastTimestamp = sc_max_time(); + lastTimestamp = scMaxTime; for (auto it = readyRasCasCommands.cbegin(); it != readyRasCasCommands.cend(); it++) { @@ -177,5 +177,5 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyC std::get(*result) == sc_time_stamp()) return *result; else - return {Command::NOP, nullptr, sc_max_time()}; + return {Command::NOP, nullptr, scMaxTime}; } diff --git a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.h b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.h index 3df42450..cf6349ea 100644 --- a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.h +++ b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxOldest.h @@ -46,6 +46,7 @@ public: private: const MemSpec& memSpec; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; @@ -60,6 +61,7 @@ private: ReadyCommands readyRasCommands; ReadyCommands readyCasCommands; ReadyCommands readyRasCasCommands; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // CMDMUXOLDEST_H diff --git a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.cpp b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.cpp index 89777c0e..bcc30072 100644 --- a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.cpp +++ b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.cpp @@ -45,7 +45,7 @@ CommandTuple::Type CmdMuxStrict::selectCommand(const ReadyCommands &readyCommand auto result = readyCommands.cend(); uint64_t lastPayloadID = UINT64_MAX; uint64_t newPayloadID; - sc_time lastTimestamp = sc_max_time(); + sc_time lastTimestamp = scMaxTime; sc_time newTimestamp; for (auto it = readyCommands.cbegin(); it != readyCommands.cend(); it++) @@ -81,7 +81,7 @@ CommandTuple::Type CmdMuxStrict::selectCommand(const ReadyCommands &readyCommand return *result; } else - return {Command::NOP, nullptr, sc_max_time()}; + return {Command::NOP, nullptr, scMaxTime}; } @@ -111,7 +111,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyC uint64_t lastPayloadID = UINT64_MAX; uint64_t newPayloadID; - sc_time lastTimestamp = sc_max_time(); + sc_time lastTimestamp = scMaxTime; sc_time newTimestamp; for (auto it = readyRasCommands.cbegin(); it != readyRasCommands.cend(); it++) @@ -152,7 +152,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyC readyRasCasCommands.emplace_back(*resultCas); lastPayloadID = UINT64_MAX; - lastTimestamp = sc_max_time(); + lastTimestamp = scMaxTime; for (auto it = readyRasCasCommands.cbegin(); it != readyRasCasCommands.cend(); it++) { @@ -180,5 +180,5 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyC return *result; } else - return {Command::NOP, nullptr, sc_max_time()}; + return {Command::NOP, nullptr, scMaxTime}; } diff --git a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.h b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.h index da384d5d..16e77e9b 100644 --- a/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.h +++ b/src/libdramsys/DRAMSys/controller/cmdmux/CmdMuxStrict.h @@ -47,6 +47,7 @@ public: private: uint64_t nextPayloadID = 1; const MemSpec& memSpec; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; class CmdMuxStrictRasCas : public CmdMuxIF @@ -61,6 +62,7 @@ private: ReadyCommands readyRasCommands; ReadyCommands readyCasCommands; ReadyCommands readyRasCasCommands; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // CMDMUXSTRICT_H diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.cpp b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.cpp index 24c39842..eb88a2ec 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.cpp +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.cpp @@ -210,7 +210,7 @@ void RefreshManagerAllBank::update(Command command) break; case Command::SREFEN: sleeping = true; - timeForNextTrigger = sc_max_time(); + timeForNextTrigger = scMaxTime; break; case Command::PDXA: case Command::PDXP: sleeping = false; diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.h b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.h index 222cda22..68ffaa9c 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.h +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerAllBank.h @@ -75,6 +75,7 @@ private: bool sleeping = false; const bool refreshManagement; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // REFRESHMANAGERALLBANK_H diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.cpp b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.cpp index f8bf824a..54b0caed 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.cpp +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.cpp @@ -44,5 +44,5 @@ CommandTuple::Type RefreshManagerDummy::getNextCommand() sc_time RefreshManagerDummy::getTimeForNextTrigger() { - return sc_max_time(); + return scMaxTime; } \ No newline at end of file diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.h b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.h index 23087403..65c408d0 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.h +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerDummy.h @@ -46,6 +46,8 @@ public: void evaluate() override {} void update(Command) override {} sc_core::sc_time getTimeForNextTrigger() override; +private: + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // REFRESHMANAGERDUMMY_H diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.cpp b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.cpp index 9792f4e7..e7a2cd1a 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.cpp +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.cpp @@ -233,7 +233,7 @@ void RefreshManagerPer2Bank::update(Command command) break; case Command::SREFEN: sleeping = true; - timeForNextTrigger = sc_max_time(); + timeForNextTrigger = scMaxTime; break; case Command::PDXA: case Command::PDXP: sleeping = false; diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.h b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.h index b246d239..db517555 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.h +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPer2Bank.h @@ -79,6 +79,8 @@ private: bool sleeping = false; bool skipSelection = false; + + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // REFRESHMANAGERPER2BANK_H diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.cpp b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.cpp index 809ed246..ff04f4dc 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.cpp +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.cpp @@ -192,7 +192,7 @@ void RefreshManagerPerBank::update(Command command) break; case Command::SREFEN: sleeping = true; - timeForNextTrigger = sc_max_time(); + timeForNextTrigger = scMaxTime; break; case Command::PDXA: case Command::PDXP: sleeping = false; diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.h b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.h index 21d41b2d..e7f88bff 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.h +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerPerBank.h @@ -78,6 +78,8 @@ private: bool sleeping = false; bool skipSelection = false; + + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // REFRESHMANAGERPERBANK_H diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.cpp b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.cpp index 41a52e8a..ef7264e8 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.cpp +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.cpp @@ -306,7 +306,7 @@ void RefreshManagerSameBank::update(Command command) break; case Command::SREFEN: sleeping = true; - timeForNextTrigger = sc_max_time(); + timeForNextTrigger = scMaxTime; break; case Command::PDXA: case Command::PDXP: sleeping = false; diff --git a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.h b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.h index ace44f16..d368c582 100644 --- a/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.h +++ b/src/libdramsys/DRAMSys/controller/refresh/RefreshManagerSameBank.h @@ -79,6 +79,7 @@ private: bool skipSelection = false; const bool refreshManagement; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // REFRESHMANAGERSAMEBANK_H diff --git a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.cpp b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.cpp index 2186a70f..234a52e9 100644 --- a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.cpp +++ b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.cpp @@ -64,5 +64,5 @@ sc_time RespQueueFifo::getTriggerTime() const if (triggerTime > sc_time_stamp()) return triggerTime; } - return sc_max_time(); + return scMaxTime; } diff --git a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.h b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.h index 6b96b972..253f4b72 100644 --- a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.h +++ b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueFifo.h @@ -51,6 +51,7 @@ public: private: std::queue> buffer; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // RESPQUEUEFIFO_H diff --git a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.cpp b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.cpp index 117c5635..4a425a14 100644 --- a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.cpp +++ b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.cpp @@ -72,5 +72,5 @@ sc_time RespQueueReorder::getTriggerTime() const return triggerTime; } } - return sc_max_time(); + return scMaxTime; } diff --git a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.h b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.h index 2f3b5fdf..ccb69dbc 100644 --- a/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.h +++ b/src/libdramsys/DRAMSys/controller/respqueue/RespQueueReorder.h @@ -51,6 +51,7 @@ public: private: uint64_t nextPayloadID = 1; std::map> buffer; + const sc_core::sc_time scMaxTime = sc_core::sc_max_time(); }; #endif // RESPQUEUEREORDER_H