|
|
|
|
@@ -41,7 +41,7 @@ CheckerDDR5::CheckerDDR5()
|
|
|
|
|
if (memSpec == nullptr)
|
|
|
|
|
SC_REPORT_FATAL("CheckerDDR5", "Wrong MemSpec chosen");
|
|
|
|
|
|
|
|
|
|
lastScheduledByCommandAndDIMMRank = std::vector<std::vector<sc_time>>
|
|
|
|
|
lastScheduledByCommandAndDimmRank = std::vector<std::vector<sc_time>>
|
|
|
|
|
(numberOfCommands(), std::vector<sc_time>(memSpec->numberOfDIMMRanks, sc_max_time()));
|
|
|
|
|
lastScheduledByCommandAndPhysicalRank = std::vector<std::vector<sc_time>>
|
|
|
|
|
(numberOfCommands(), std::vector<sc_time>(memSpec->numberOfPhysicalRanks, sc_max_time()));
|
|
|
|
|
@@ -59,7 +59,7 @@ CheckerDDR5::CheckerDDR5()
|
|
|
|
|
last4ActivatesLogical = std::vector<std::queue<sc_time>>(memSpec->numberOfLogicalRanks);
|
|
|
|
|
last4ActivatesPhysical = std::vector<std::queue<sc_time>>(memSpec->numberOfPhysicalRanks);
|
|
|
|
|
|
|
|
|
|
lastBurstLengthByCommandAndDIMMRank = std::vector<std::vector<uint8_t>>
|
|
|
|
|
lastBurstLengthByCommandAndDimmRank = std::vector<std::vector<uint8_t>>
|
|
|
|
|
(4, std::vector<uint8_t>(memSpec->numberOfDIMMRanks));
|
|
|
|
|
lastBurstLengthByCommandAndPhysicalRank = std::vector<std::vector<uint8_t>>
|
|
|
|
|
(4, std::vector<uint8_t>(memSpec->numberOfPhysicalRanks));
|
|
|
|
|
@@ -158,9 +158,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::RD];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::RD][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::RD][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::RD][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::RD][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::RD][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDRD_dpr + tRD_BURST); // 16 tCK + tRTRS
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDRD_dpr); // 16 tCK + tRTRS
|
|
|
|
|
@@ -204,9 +204,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::RDA];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::RDA][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::RDA][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::RDA][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::RDA][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::RDA][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDRD_dpr + tRD_BURST); // 16 tCK + tRTRS
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDRD_dpr); // 16 tCK + tRTRS
|
|
|
|
|
@@ -262,9 +262,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::WR];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::WR][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::WR][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::WR][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::WR][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::WR][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_dpr + tWR_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_dpr); // + 8 tCK
|
|
|
|
|
@@ -308,9 +308,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::WRA];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::WRA][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::WRA][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::WRA][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::WRA][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::WRA][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_dpr + tWR_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRRD_dpr); // + 8 tCK
|
|
|
|
|
@@ -360,9 +360,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::RD];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::RD][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::RD][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::RD][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::RD][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::RD][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_dpr + tRD_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_dpr); // + 8 tCK
|
|
|
|
|
@@ -406,9 +406,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::RDA];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::RDA][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::RDA][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::RDA][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::RDA][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::RDA][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_dpr + tRD_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tRDWR_dpr); // + 8 tCK
|
|
|
|
|
@@ -462,9 +462,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::WR];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::WR][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::WR][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::WR][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::WR][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::WR][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRWR_dpr + tWR_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRWR_dpr); // + 8 tCK
|
|
|
|
|
@@ -518,9 +518,9 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
lastCommandStart = lastScheduledByCommand[Command::WRA];
|
|
|
|
|
if (lastCommandStart != lastScheduledByCommandAndPhysicalRank[Command::WRA][physicalrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDIMMRank[Command::WRA][dimmrank.ID()])
|
|
|
|
|
if (lastCommandStart == lastScheduledByCommandAndDimmRank[Command::WRA][dimmrank.ID()])
|
|
|
|
|
{
|
|
|
|
|
if (lastBurstLengthByCommandAndDIMMRank[Command::WRA][dimmrank.ID()] == 32)
|
|
|
|
|
if (lastBurstLengthByCommandAndDimmRank[Command::WRA][dimmrank.ID()] == 32)
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRWR_dpr + tWR_BURST); // + 8 tCK
|
|
|
|
|
else
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + tWRWR_dpr); // + 8 tCK
|
|
|
|
|
@@ -755,7 +755,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
if (lastCommandStart != sc_max_time())
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr);
|
|
|
|
|
|
|
|
|
|
lastCommandStart = lastScheduledByCommandAndDIMMRank[Command::REFA][dimmrank.ID()];
|
|
|
|
|
lastCommandStart = lastScheduledByCommandAndDimmRank[Command::REFA][dimmrank.ID()];
|
|
|
|
|
if (lastCommandStart != sc_max_time())
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr);
|
|
|
|
|
|
|
|
|
|
@@ -805,7 +805,7 @@ sc_time CheckerDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGr
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dlr);
|
|
|
|
|
|
|
|
|
|
// TODO: check this
|
|
|
|
|
lastCommandStart = lastScheduledByCommandAndDIMMRank[Command::REFA][dimmrank.ID()];
|
|
|
|
|
lastCommandStart = lastScheduledByCommandAndDimmRank[Command::REFA][dimmrank.ID()];
|
|
|
|
|
if (lastCommandStart != sc_max_time())
|
|
|
|
|
earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC_dpr);
|
|
|
|
|
|
|
|
|
|
@@ -839,41 +839,41 @@ void CheckerDDR5::insert(Command command, Rank rank, BankGroup bankgroup, Bank b
|
|
|
|
|
PRINTDEBUGMESSAGE("CheckerDDR5", "Changing state on bank " + std::to_string(bank.ID())
|
|
|
|
|
+ " command is " + commandToString(command));
|
|
|
|
|
|
|
|
|
|
Rank logicalrank = rank;
|
|
|
|
|
Rank physicalrank = Rank(logicalrank.ID() / memSpec->logicalRanksPerPhysicalRank);
|
|
|
|
|
Rank dimmrank = Rank(physicalrank.ID() / memSpec->physicalRanksPerDIMMRank);
|
|
|
|
|
Bank bankingroup = Bank(rank.ID() * memSpec->banksPerGroup + bank.ID() % memSpec->banksPerGroup);
|
|
|
|
|
Rank logicalRank = rank;
|
|
|
|
|
Rank physicalRank = Rank(logicalRank.ID() / memSpec->logicalRanksPerPhysicalRank);
|
|
|
|
|
Rank dimmRank = Rank(physicalRank.ID() / memSpec->physicalRanksPerDIMMRank);
|
|
|
|
|
Bank bankInGroup = Bank(rank.ID() * memSpec->banksPerGroup + bank.ID() % memSpec->banksPerGroup);
|
|
|
|
|
|
|
|
|
|
lastScheduledByCommandAndDIMMRank[command][dimmrank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndPhysicalRank[command][physicalrank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndLogicalRank[command][logicalrank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndDimmRank[command][dimmRank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndPhysicalRank[command][physicalRank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndLogicalRank[command][logicalRank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndBankGroup[command][bankgroup.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndBank[command][bank.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommand[command] = sc_time_stamp();
|
|
|
|
|
|
|
|
|
|
lastCommandOnBus = sc_time_stamp() + memSpec->getCommandLength(command) - memSpec->tCK;
|
|
|
|
|
|
|
|
|
|
lastScheduledByCommandAndBankInGroup[command][bankingroup.ID()] = sc_time_stamp();
|
|
|
|
|
lastScheduledByCommandAndBankInGroup[command][bankInGroup.ID()] = sc_time_stamp();
|
|
|
|
|
|
|
|
|
|
if (isCasCommand(command))
|
|
|
|
|
{
|
|
|
|
|
lastBurstLengthByCommandAndDIMMRank[command][dimmrank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndPhysicalRank[command][physicalrank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndLogicalRank[command][logicalrank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndDimmRank[command][dimmRank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndPhysicalRank[command][physicalRank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndLogicalRank[command][logicalRank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndBankGroup[command][bankgroup.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndBank[command][bank.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommand[command] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndBankInGroup[command][bankingroup.ID()] = burstLength;
|
|
|
|
|
lastBurstLengthByCommandAndBankInGroup[command][bankInGroup.ID()] = burstLength;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (command == Command::ACT || command == Command::REFSB)
|
|
|
|
|
{
|
|
|
|
|
if (last4ActivatesLogical[logicalrank.ID()].size() == 4)
|
|
|
|
|
last4ActivatesLogical[logicalrank.ID()].pop();
|
|
|
|
|
last4ActivatesLogical[logicalrank.ID()].push(lastCommandOnBus);
|
|
|
|
|
if (last4ActivatesLogical[logicalRank.ID()].size() == 4)
|
|
|
|
|
last4ActivatesLogical[logicalRank.ID()].pop();
|
|
|
|
|
last4ActivatesLogical[logicalRank.ID()].push(lastCommandOnBus);
|
|
|
|
|
|
|
|
|
|
if (last4ActivatesPhysical[physicalrank.ID()].size() == 4)
|
|
|
|
|
last4ActivatesPhysical[physicalrank.ID()].pop();
|
|
|
|
|
last4ActivatesPhysical[physicalrank.ID()].push(lastCommandOnBus);
|
|
|
|
|
if (last4ActivatesPhysical[physicalRank.ID()].size() == 4)
|
|
|
|
|
last4ActivatesPhysical[physicalRank.ID()].pop();
|
|
|
|
|
last4ActivatesPhysical[physicalRank.ID()].push(lastCommandOnBus);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|