From 234088c52999dd29833e7321273df7afdd022181 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 24 Mar 2020 16:51:13 +0100 Subject: [PATCH 01/23] Moved from relative to absolute times in controller. --- .../library/src/controller/BankMachine.cpp | 71 ++++++++----------- DRAMSys/library/src/controller/Controller.cpp | 16 ++--- .../src/controller/checker/CheckerDDR3.cpp | 4 +- .../src/controller/checker/CheckerDDR3.h | 2 +- .../src/controller/checker/CheckerDDR4.cpp | 4 +- .../src/controller/checker/CheckerDDR4.h | 2 +- .../src/controller/checker/CheckerGDDR5.cpp | 20 ++---- .../src/controller/checker/CheckerGDDR5.h | 2 +- .../src/controller/checker/CheckerGDDR5X.cpp | 20 ++---- .../src/controller/checker/CheckerGDDR5X.h | 2 +- .../src/controller/checker/CheckerGDDR6.cpp | 20 ++---- .../src/controller/checker/CheckerGDDR6.h | 2 +- .../src/controller/checker/CheckerHBM2.cpp | 4 +- .../src/controller/checker/CheckerHBM2.h | 2 +- .../src/controller/checker/CheckerIF.h | 2 +- .../src/controller/checker/CheckerLPDDR4.cpp | 4 +- .../src/controller/checker/CheckerLPDDR4.h | 2 +- .../src/controller/checker/CheckerWideIO.cpp | 4 +- .../src/controller/checker/CheckerWideIO.h | 2 +- .../src/controller/checker/CheckerWideIO2.cpp | 4 +- .../src/controller/checker/CheckerWideIO2.h | 2 +- .../powerdown/PowerDownManagerDummy.cpp | 2 +- .../powerdown/PowerDownManagerStaggered.cpp | 6 +- .../src/controller/refresh/RefreshManager.cpp | 19 +++-- .../refresh/RefreshManagerBankwise.cpp | 19 +++-- .../refresh/RefreshManagerDummy.cpp | 2 +- 26 files changed, 93 insertions(+), 146 deletions(-) diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index c0aaa913..44661324 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -118,21 +118,20 @@ BankMachineOpen::BankMachineOpen(SchedulerIF *scheduler, CheckerIF *checker, Ban sc_time BankMachineOpen::start() { timeToSchedule = sc_max_time(); - sc_time delay = sc_max_time() - sc_time_stamp(); if (sleeping) - return delay; + return timeToSchedule; if (currentPayload == nullptr) { currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - return delay; + return timeToSchedule; } if (currentState == BmState::Precharged && !blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); nextCommand = Command::ACT; } else if (currentState == BmState::Activated) @@ -141,12 +140,12 @@ sc_time BankMachineOpen::start() { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RD, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank); nextCommand = Command::RD; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WR, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank); nextCommand = Command::WR; } else @@ -154,13 +153,11 @@ sc_time BankMachineOpen::start() } else if (!blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); nextCommand = Command::PRE; } } - - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } BankMachineClosed::BankMachineClosed(SchedulerIF *scheduler, CheckerIF *checker, Bank bank) @@ -169,40 +166,38 @@ BankMachineClosed::BankMachineClosed(SchedulerIF *scheduler, CheckerIF *checker, sc_time BankMachineClosed::start() { timeToSchedule = sc_max_time(); - sc_time delay = sc_max_time() - sc_time_stamp(); if (sleeping) - return delay; + return timeToSchedule; if (currentPayload == nullptr) { currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - return delay; + return timeToSchedule; } if (currentState == BmState::Precharged && !blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); nextCommand = Command::ACT; } else if (currentState == BmState::Activated) { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); nextCommand = Command::RDA; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); nextCommand = Command::WRA; } else SC_REPORT_FATAL("BankMachine", "Wrong TLM command"); } - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } BankMachineOpenAdaptive::BankMachineOpenAdaptive(SchedulerIF *scheduler, CheckerIF *checker, Bank bank) @@ -211,21 +206,20 @@ BankMachineOpenAdaptive::BankMachineOpenAdaptive(SchedulerIF *scheduler, Checker sc_time BankMachineOpenAdaptive::start() { timeToSchedule = sc_max_time(); - sc_time delay = sc_max_time() - sc_time_stamp(); if (sleeping) - return delay; + return timeToSchedule; if (currentPayload == nullptr) { currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - return delay; + return timeToSchedule; } if (currentState == BmState::Precharged && !blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); nextCommand = Command::ACT; } else if (currentState == BmState::Activated) @@ -236,12 +230,12 @@ sc_time BankMachineOpenAdaptive::start() { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); nextCommand = Command::RDA; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); nextCommand = Command::WRA; } else @@ -251,12 +245,12 @@ sc_time BankMachineOpenAdaptive::start() { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RD, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank); nextCommand = Command::RD; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WR, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank); nextCommand = Command::WR; } else @@ -265,12 +259,11 @@ sc_time BankMachineOpenAdaptive::start() } else if (!blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); nextCommand = Command::PRE; } } - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } BankMachineClosedAdaptive::BankMachineClosedAdaptive(SchedulerIF *scheduler, CheckerIF *checker, Bank bank) @@ -279,21 +272,20 @@ BankMachineClosedAdaptive::BankMachineClosedAdaptive(SchedulerIF *scheduler, Che sc_time BankMachineClosedAdaptive::start() { timeToSchedule = sc_max_time(); - sc_time delay = sc_max_time() - sc_time_stamp(); if (sleeping) - return delay; + return timeToSchedule; if (currentPayload == nullptr) { currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - return delay; + return timeToSchedule; } if (currentState == BmState::Precharged && !blocked) // row miss { - delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank); nextCommand = Command::ACT; } else if (currentState == BmState::Activated) @@ -304,12 +296,12 @@ sc_time BankMachineClosedAdaptive::start() { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RD, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank); nextCommand = Command::RD; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WR, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank); nextCommand = Command::WR; } else @@ -319,12 +311,12 @@ sc_time BankMachineClosedAdaptive::start() { if (currentPayload->get_command() == TLM_READ_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank); nextCommand = Command::RDA; } else if (currentPayload->get_command() == TLM_WRITE_COMMAND) { - delay = checker->delayToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank); nextCommand = Command::WRA; } else @@ -333,11 +325,10 @@ sc_time BankMachineClosedAdaptive::start() } else if (!blocked) // row miss TODO: remove this, can never happen { - delay = checker->delayToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); + timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank); nextCommand = Command::PRE; SC_REPORT_FATAL("BankMachine", "Should never be reached for this policy"); } } - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 54811455..4abdeedb 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -303,22 +303,22 @@ void Controller::controllerMethod() // (6) Restart bank machines and refresh managers to issue new requests for the future // TODO: check if all calls are necessary - sc_time delayForNextTrigger = sc_max_time(); + sc_time timeForNextTrigger = sc_max_time(); for (auto it : bankMachines) { - sc_time localDelay = it->start(); - if (!(localDelay == SC_ZERO_TIME && readyCmdBlocked)) - delayForNextTrigger = std::min(delayForNextTrigger, localDelay); + sc_time localTime = it->start(); + if (!(localTime == sc_time_stamp() && readyCmdBlocked)) + timeForNextTrigger = std::min(timeForNextTrigger, localTime); } if (payloadToAcquire != nullptr && sc_time_stamp() >= timeToAcquire && scheduler->hasBufferSpace(payloadToAcquire)) acquirePayload(); for (auto it : refreshManagers) - delayForNextTrigger = std::min(delayForNextTrigger, it->start()); + timeForNextTrigger = std::min(timeForNextTrigger, it->start()); for (auto it : powerDownManagers) - delayForNextTrigger = std::min(delayForNextTrigger, it->start()); + timeForNextTrigger = std::min(timeForNextTrigger, it->start()); - if (!(delayForNextTrigger == (sc_max_time() - sc_time_stamp()))) - controllerEvent.notify(delayForNextTrigger); + if (timeForNextTrigger != sc_max_time()) + controllerEvent.notify(timeForNextTrigger - sc_time_stamp()); } tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp index ad58c159..0c7ecb6a 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp @@ -52,7 +52,7 @@ CheckerDDR3::CheckerDDR3() burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; } -sc_time CheckerDDR3::delayToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const +sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -364,7 +364,7 @@ sc_time CheckerDDR3::delayToSatisfyConstraints(Command command, Rank rank, BankG // Check if command bus is free earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerDDR3::insert(Command command, Rank rank, BankGroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.h b/DRAMSys/library/src/controller/checker/CheckerDDR3.h index 5ee8144b..022902e4 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.h +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.h @@ -45,7 +45,7 @@ class CheckerDDR3 final : public CheckerIF { public: CheckerDDR3(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp index 8576d1b6..e4ca5462 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp @@ -54,7 +54,7 @@ CheckerDDR4::CheckerDDR4() burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; } -sc_time CheckerDDR4::delayToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const +sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -247,7 +247,7 @@ sc_time CheckerDDR4::delayToSatisfyConstraints(Command command, Rank rank, BankG // Check if command bus is free earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerDDR4::insert(Command command, Rank rank, BankGroup bankgroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.h b/DRAMSys/library/src/controller/checker/CheckerDDR4.h index 2ff961a9..b3c86a99 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.h +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.h @@ -45,7 +45,7 @@ class CheckerDDR4 final : public CheckerIF { public: CheckerDDR4(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp index f607942f..9ea840bf 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp @@ -55,7 +55,7 @@ CheckerGDDR5::CheckerGDDR5() burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; } -sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const +sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -108,8 +108,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank if (last32Activates[rank.ID()].size() == 32) earliestTimeToStart = std::max(earliestTimeToStart, last32Activates[rank.ID()].front() + memSpec->t32AW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::RD || command == Command::RDA) { @@ -159,8 +157,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + burstClocks + memSpec->tWTRS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::WR || command == Command::WRA) { @@ -190,8 +186,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PRE) { @@ -210,8 +204,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PREA) { @@ -239,8 +231,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFA) { @@ -268,8 +258,6 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::REFA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFB) { @@ -316,15 +304,15 @@ sc_time CheckerGDDR5::delayToSatisfyConstraints(Command command, Rank rank, Bank if (last32Activates[rank.ID()].size() == 32) earliestTimeToStart = std::max(earliestTimeToStart, last32Activates[rank.ID()].front() + memSpec->t32AW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else { reportFatal("CheckerGDDR5", "Unknown command!"); } + // Check if command bus is free + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerGDDR5::insert(Command command, Rank rank, BankGroup bankgroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.h b/DRAMSys/library/src/controller/checker/CheckerGDDR5.h index a17b7c28..1ce6a54d 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.h @@ -45,7 +45,7 @@ class CheckerGDDR5 final : public CheckerIF { public: CheckerGDDR5(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp index 1f1aee32..06cbddfe 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp @@ -55,7 +55,7 @@ CheckerGDDR5X::CheckerGDDR5X() burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; } -sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const +sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -108,8 +108,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban if (last32Activates[rank.ID()].size() == 32) earliestTimeToStart = std::max(earliestTimeToStart, last32Activates[rank.ID()].front() + memSpec->t32AW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::RD || command == Command::RDA) { @@ -159,8 +157,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + burstClocks + memSpec->tWTRS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::WR || command == Command::WRA) { @@ -190,8 +186,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PRE) { @@ -210,8 +204,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PREA) { @@ -239,8 +231,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFA) { @@ -268,8 +258,6 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::REFA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFB) { @@ -316,15 +304,15 @@ sc_time CheckerGDDR5X::delayToSatisfyConstraints(Command command, Rank rank, Ban if (last32Activates[rank.ID()].size() == 32) earliestTimeToStart = std::max(earliestTimeToStart, last32Activates[rank.ID()].front() + memSpec->t32AW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else { reportFatal("CheckerGDDR5X", "Unknown command!"); } + // Check if command bus is free + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerGDDR5X::insert(Command command, Rank rank, BankGroup bankgroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h index 355ca555..d77b9e5c 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h @@ -45,7 +45,7 @@ class CheckerGDDR5X final : public CheckerIF { public: CheckerGDDR5X(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp index 1a1ae3ae..b9313dd5 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp @@ -54,7 +54,7 @@ CheckerGDDR6::CheckerGDDR6() burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; } -sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const +sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -104,8 +104,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank if (lastActivates[rank.ID()].size() == 4) earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::RD || command == Command::RDA) { @@ -155,8 +153,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + burstClocks + memSpec->tWTRS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::WR || command == Command::WRA) { @@ -186,8 +182,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PRE) { @@ -206,8 +200,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::PREA) { @@ -235,8 +227,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tPPD); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFA) { @@ -264,8 +254,6 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::REFA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else if (command == Command::REFB) { @@ -309,15 +297,15 @@ sc_time CheckerGDDR6::delayToSatisfyConstraints(Command command, Rank rank, Bank if (lastActivates[rank.ID()].size() == 4) earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW); - - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); } else { reportFatal("CheckerGDDR6", "Unknown command!"); } + // Check if command bus is free + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerGDDR6::insert(Command command, Rank rank, BankGroup bankgroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.h b/DRAMSys/library/src/controller/checker/CheckerGDDR6.h index f61007e6..a0fdd8bf 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.h @@ -45,7 +45,7 @@ class CheckerGDDR6 final : public CheckerIF { public: CheckerGDDR6(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp index 31d028e9..1b7de13f 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp @@ -55,7 +55,7 @@ CheckerHBM2::CheckerHBM2() burstClocks = (memSpec->BurstLength / 2) * memSpec->clk; } -sc_time CheckerHBM2::delayToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const +sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -312,7 +312,7 @@ sc_time CheckerHBM2::delayToSatisfyConstraints(Command command, Rank rank, BankG reportFatal("CheckerHBM2", "Unknown command!"); } - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerHBM2::insert(Command command, Rank rank, BankGroup bankgroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.h b/DRAMSys/library/src/controller/checker/CheckerHBM2.h index 06c688b2..6ba92816 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.h +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.h @@ -45,7 +45,7 @@ class CheckerHBM2 final : public CheckerIF { public: CheckerHBM2(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerIF.h b/DRAMSys/library/src/controller/checker/CheckerIF.h index 64e43f5a..9bc99979 100644 --- a/DRAMSys/library/src/controller/checker/CheckerIF.h +++ b/DRAMSys/library/src/controller/checker/CheckerIF.h @@ -46,7 +46,7 @@ class CheckerIF public: virtual ~CheckerIF() {} - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const = 0; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const = 0; virtual void insert(Command, Rank, BankGroup, Bank) = 0; }; diff --git a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp index ed7b9116..5f7da450 100644 --- a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp @@ -50,7 +50,7 @@ CheckerLPDDR4::CheckerLPDDR4() lastActivates = std::vector>(memSpec->NumberOfRanks); } -sc_time CheckerLPDDR4::delayToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const +sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -269,7 +269,7 @@ sc_time CheckerLPDDR4::delayToSatisfyConstraints(Command command, Rank rank, Ban // Check if command bus is free earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerLPDDR4::insert(Command command, Rank rank, BankGroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.h b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.h index fbadc16e..f52c732e 100644 --- a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.h +++ b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.h @@ -45,7 +45,7 @@ class CheckerLPDDR4 final : public CheckerIF { public: CheckerLPDDR4(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp index 118abc31..7250f4bd 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp @@ -52,7 +52,7 @@ CheckerWideIO::CheckerWideIO() burstClocks = memSpec->BurstLength * memSpec->clk; } -sc_time CheckerWideIO::delayToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const +sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -216,7 +216,7 @@ sc_time CheckerWideIO::delayToSatisfyConstraints(Command command, Rank rank, Ban // Check if command bus is free earliestTimeToStart = std::max(earliestTimeToStart, lastScheduled + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerWideIO::insert(Command command, Rank rank, BankGroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.h b/DRAMSys/library/src/controller/checker/CheckerWideIO.h index 6bcc0796..105078d0 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.h +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.h @@ -45,7 +45,7 @@ class CheckerWideIO final : public CheckerIF { public: CheckerWideIO(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp index 463e3eb8..5230dfa7 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp @@ -50,7 +50,7 @@ CheckerWideIO2::CheckerWideIO2() lastActivates = std::vector>(memSpec->NumberOfRanks); } -sc_time CheckerWideIO2::delayToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const +sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const { sc_time lastCommandStart; sc_time earliestTimeToStart = sc_time_stamp(); @@ -262,7 +262,7 @@ sc_time CheckerWideIO2::delayToSatisfyConstraints(Command command, Rank rank, Ba // Check if command bus is free earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); - return (earliestTimeToStart - sc_time_stamp()); + return earliestTimeToStart; } void CheckerWideIO2::insert(Command command, Rank rank, BankGroup, Bank bank) diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO2.h b/DRAMSys/library/src/controller/checker/CheckerWideIO2.h index 7c27933d..7068601a 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO2.h +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO2.h @@ -45,7 +45,7 @@ class CheckerWideIO2 final : public CheckerIF { public: CheckerWideIO2(); - virtual sc_time delayToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; + virtual sc_time timeToSatisfyConstraints(Command, Rank, BankGroup, Bank) const override; virtual void insert(Command, Rank, BankGroup, Bank) override; private: diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp index b24db7fb..91f666b3 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp @@ -41,5 +41,5 @@ std::pair PowerDownManagerDummy::getNextCommand( sc_time PowerDownManagerDummy::start() { - return sc_max_time() - sc_time_stamp(); + return sc_max_time(); } diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp index cf3cc839..bc8d676f 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp @@ -88,7 +88,6 @@ std::pair PowerDownManagerStaggered::getNextComm sc_time PowerDownManagerStaggered::start() { timeToSchedule = sc_max_time(); - sc_time delay = sc_max_time() - sc_time_stamp(); if (triggered) { @@ -110,11 +109,10 @@ sc_time PowerDownManagerStaggered::start() else // if (state == PdmState::Refresh) nextCommand = Command::REFA; - delay = checker->delayToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); - timeToSchedule = sc_time_stamp() + delay; + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); } - return delay; + return timeToSchedule; } void PowerDownManagerStaggered::updateState(Command command) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp b/DRAMSys/library/src/controller/refresh/RefreshManager.cpp index 148c8828..3f2f9801 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManager.cpp @@ -78,7 +78,7 @@ sc_time RefreshManager::start() { powerDownManager->triggerExit(TriggerSource::RefreshManager); if (sleeping) - return sc_max_time() - sc_time_stamp(); + return timeToSchedule; if (sc_time_stamp() >= timeForNextTrigger + memSpec->getRefreshIntervalAB()) { @@ -86,7 +86,6 @@ sc_time RefreshManager::start() state = RmState::Regular; } - sc_time delay; if (state == RmState::Regular) { bool forcedRefresh = (flexibilityCounter == maxPostponed); @@ -94,7 +93,7 @@ sc_time RefreshManager::start() { flexibilityCounter++; timeForNextTrigger += memSpec->getRefreshIntervalAB(); - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } else { @@ -108,9 +107,8 @@ sc_time RefreshManager::start() nextCommand = Command::PREA; else nextCommand = Command::REFA; - delay = checker->delayToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); - timeToSchedule = sc_time_stamp() + delay; - return delay; + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); + return timeToSchedule; } } else // if (state == RmState::Pulledin) @@ -119,19 +117,18 @@ sc_time RefreshManager::start() { state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalAB(); - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } else { // nextCommand stays Command::REFA - delay = checker->delayToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); - timeToSchedule = sc_time_stamp() + delay; - return delay; + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); + return timeToSchedule; } } } else - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } void RefreshManager::updateState(Command command, tlm_generic_payload *) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 0475ec6b..9d9f64aa 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -76,7 +76,7 @@ sc_time RefreshManagerBankwise::start() { powerDownManager->triggerExit(TriggerSource::RefreshManager); if (sleeping) - return sc_max_time() - sc_time_stamp(); + return timeToSchedule; if (sc_time_stamp() >= timeForNextTrigger + memSpec->getRefreshIntervalPB()) { @@ -84,7 +84,6 @@ sc_time RefreshManagerBankwise::start() state = RmState::Regular; } - sc_time delay; if (state == RmState::Regular) { currentIterator = remainingBankMachines.begin(); @@ -107,7 +106,7 @@ sc_time RefreshManagerBankwise::start() { flexibilityCounter++; timeForNextTrigger += memSpec->getRefreshIntervalPB(); - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } else { @@ -115,10 +114,9 @@ sc_time RefreshManagerBankwise::start() nextCommand = Command::PRE; else nextCommand = Command::REFB; - delay = checker->delayToSatisfyConstraints(nextCommand, rank, + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, currentBankMachine->getBankGroup(), currentBankMachine->getBank()); - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } } else // if (state == RmState::Pulledin) @@ -140,7 +138,7 @@ sc_time RefreshManagerBankwise::start() { state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalPB(); - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } else { @@ -148,15 +146,14 @@ sc_time RefreshManagerBankwise::start() nextCommand = Command::PRE; else nextCommand = Command::REFB; - delay = checker->delayToSatisfyConstraints(nextCommand, rank, + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, currentBankMachine->getBankGroup(), currentBankMachine->getBank()); - timeToSchedule = sc_time_stamp() + delay; - return delay; + return timeToSchedule; } } } else - return timeForNextTrigger - sc_time_stamp(); + return timeForNextTrigger; } void RefreshManagerBankwise::updateState(Command command, tlm_generic_payload *payload) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp index c6c1428c..92cc8cf2 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp @@ -41,5 +41,5 @@ std::pair RefreshManagerDummy::getNextCommand() sc_time RefreshManagerDummy::start() { - return sc_max_time() - sc_time_stamp(); + return sc_max_time(); } From 2e9ee20ec4851d3d3630114bb1952cd46b184d7b Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 24 Mar 2020 16:59:31 +0100 Subject: [PATCH 02/23] Added response queues with fifo and reorder policies. --- DRAMSys/library/CMakeLists.txt | 188 ++++++++++-------- DRAMSys/library/src/controller/Controller.cpp | 31 ++- DRAMSys/library/src/controller/Controller.h | 5 +- .../controller/respqueue/RespQueueFifo.cpp | 65 ++++++ .../src/controller/respqueue/RespQueueFifo.h | 57 ++++++ .../src/controller/respqueue/RespQueueIF.h | 51 +++++ .../controller/respqueue/RespQueueReorder.cpp | 72 +++++++ .../controller/respqueue/RespQueueReorder.h | 58 ++++++ 8 files changed, 434 insertions(+), 93 deletions(-) create mode 100644 DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp create mode 100644 DRAMSys/library/src/controller/respqueue/RespQueueFifo.h create mode 100644 DRAMSys/library/src/controller/respqueue/RespQueueIF.h create mode 100644 DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp create mode 100644 DRAMSys/library/src/controller/respqueue/RespQueueReorder.h diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index e43b84a8..fac67d98 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -47,90 +47,116 @@ set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ Version") set(DCMAKE_SH="CMAKE_SH-NOTFOUND") include_directories( - src/simulation - src/simulation/dram - src/controller - src/controller/checker - src/controller/cmdmux - src/controller/powerdown - src/controller/refresh - src/controller/scheduler - src/common - src/common/third_party/DRAMPower/src - src/configuration - src/configuration/memspec - src/error - src/error/ECC + src/common + src/common/third_party/DRAMPower/src + src/configuration + src/configuration/memspec + src/controller + src/controller/checker + src/controller/cmdmux + src/controller/powerdown + src/controller/refresh + src/controller/respqueue + src/controller/scheduler + src/error + src/error/ECC + src/simulation + src/simulation/dram ) add_library(DRAMSysLibrary - src/common/third_party/tinyxml2/tinyxml2.cpp - src/common/TlmRecorder.cpp - src/common/DebugManager.cpp - src/configuration/Configuration.cpp - src/simulation/MemoryManager.cpp - src/simulation/TemperatureController.cpp - src/configuration/ConfigurationLoader.cpp - src/controller/Command.cpp - src/error/errormodel.cpp - src/simulation/TracePlayer.cpp - src/simulation/TraceSetup.cpp - src/simulation/DRAMSys.cpp - src/simulation/Setup.cpp - src/error/ECC/Bit.cpp - src/error/ECC/ECC.cpp - src/error/ECC/Word.cpp - src/error/eccbaseclass.cpp - src/error/ecchamming.cpp - src/common/AddressDecoder.cpp - src/simulation/dram/Dram.cpp - src/simulation/Arbiter.cpp - src/common/CongenAddressDecoder.cpp - src/common/XmlAddressDecoder.cpp - src/common/timingCalculations.cpp - src/common/dramExtensions.cpp - src/common/utils.cpp - src/simulation/dram/DramDDR3.cpp - src/simulation/dram/DramDDR4.cpp - src/simulation/dram/DramRecordable.cpp - src/simulation/dram/DramWideIO.cpp - src/configuration/memspec/MemSpec.cpp - src/controller/BankMachine.cpp - src/controller/Controller.cpp - src/controller/scheduler/SchedulerFifo.cpp - src/controller/scheduler/SchedulerFrFcfs.cpp - src/controller/cmdmux/CmdMuxStrict.cpp - src/controller/cmdmux/CmdMuxOldest.cpp - src/controller/ControllerRecordable.cpp - src/controller/checker/CheckerDDR3.cpp - src/controller/refresh/RefreshManager.cpp - src/controller/refresh/RefreshManagerDummy.cpp - src/controller/refresh/RefreshManagerBankwise.cpp - src/controller/checker/CheckerWideIO.cpp - src/configuration/memspec/MemSpecDDR3.cpp - src/configuration/memspec/MemSpecDDR4.cpp - src/configuration/memspec/MemSpecWideIO.cpp - src/configuration/memspec/MemSpecLPDDR4.cpp - src/controller/checker/CheckerDDR4.cpp - src/simulation/dram/DramLPDDR4.cpp - src/controller/checker/CheckerLPDDR4.cpp - src/configuration/memspec/MemSpecWideIO2.cpp - src/simulation/dram/DramWideIO2.cpp - src/controller/checker/CheckerWideIO2.cpp - src/configuration/memspec/MemSpecHBM2.cpp - src/simulation/dram/DramHBM2.cpp - src/controller/checker/CheckerHBM2.cpp - src/configuration/memspec/MemSpecGDDR5.cpp - src/configuration/memspec/MemSpecGDDR5X.cpp - src/configuration/memspec/MemSpecGDDR6.cpp - src/controller/checker/CheckerGDDR5.cpp - src/controller/checker/CheckerGDDR5X.cpp - src/controller/checker/CheckerGDDR6.cpp - src/simulation/dram/DramGDDR5.cpp - src/simulation/dram/DramGDDR5X.cpp - src/simulation/dram/DramGDDR6.cpp - src/controller/powerdown/PowerDownManagerStaggered.cpp - src/controller/powerdown/PowerDownManagerDummy.cpp + src/common/third_party/tinyxml2/tinyxml2.cpp + src/common/TlmRecorder.cpp + src/common/DebugManager.cpp + src/common/CongenAddressDecoder.cpp + src/common/XmlAddressDecoder.cpp + src/common/timingCalculations.cpp + src/common/dramExtensions.cpp + src/common/utils.cpp + src/common/AddressDecoder.cpp + src/common/protocol.h + src/common/tlm2_base_protocol_checker.h + + src/configuration/Configuration.cpp + src/configuration/ConfigurationLoader.cpp + src/configuration/TemperatureSimConfig.h + + src/configuration/memspec/MemSpec.cpp + src/configuration/memspec/MemSpecDDR3.cpp + src/configuration/memspec/MemSpecDDR4.cpp + src/configuration/memspec/MemSpecLPDDR4.cpp + src/configuration/memspec/MemSpecWideIO.cpp + src/configuration/memspec/MemSpecWideIO2.cpp + src/configuration/memspec/MemSpecGDDR5.cpp + src/configuration/memspec/MemSpecGDDR5X.cpp + src/configuration/memspec/MemSpecGDDR6.cpp + src/configuration/memspec/MemSpecHBM2.cpp + + src/controller/BankMachine.cpp + src/controller/Command.cpp + src/controller/GenericController.h + src/controller/Controller.cpp + src/controller/ControllerRecordable.cpp + + src/controller/checker/CheckerIF.h + src/controller/checker/CheckerDDR3.cpp + src/controller/checker/CheckerDDR4.cpp + src/controller/checker/CheckerLPDDR4.cpp + src/controller/checker/CheckerWideIO.cpp + src/controller/checker/CheckerWideIO2.cpp + src/controller/checker/CheckerGDDR5.cpp + src/controller/checker/CheckerGDDR5X.cpp + src/controller/checker/CheckerGDDR6.cpp + src/controller/checker/CheckerHBM2.cpp + + src/controller/cmdmux/CmdMuxIF.h + src/controller/cmdmux/CmdMuxOldest.cpp + src/controller/cmdmux/CmdMuxStrict.cpp + + src/controller/powerdown/PowerDownManagerIF.h + src/controller/powerdown/PowerDownManagerDummy.cpp + src/controller/powerdown/PowerDownManagerStaggered.cpp + + src/controller/refresh/RefreshManagerIF.h + src/controller/refresh/RefreshManagerDummy.cpp + src/controller/refresh/RefreshManager.cpp + src/controller/refresh/RefreshManagerBankwise.cpp + + src/controller/respqueue/RespQueueIF.h + src/controller/respqueue/RespQueueFifo.cpp + src/controller/respqueue/RespQueueReorder.cpp + + src/controller/scheduler/SchedulerIF.h + src/controller/scheduler/SchedulerFifo.cpp + src/controller/scheduler/SchedulerFrFcfs.cpp + + src/error/eccbaseclass.cpp + src/error/ecchamming.cpp + src/error/errormodel.cpp + + src/error/ECC/Bit.cpp + src/error/ECC/ECC.cpp + src/error/ECC/Word.cpp + + src/simulation/Arbiter.cpp + src/simulation/DRAMSys.cpp + src/simulation/MemoryManager.cpp + src/simulation/Setup.cpp + src/simulation/TemperatureController.cpp + src/simulation/TracePlayer.cpp + src/simulation/TraceSetup.cpp + + src/simulation/dram/Dram.cpp + src/simulation/dram/DramRecordable.cpp + src/simulation/dram/DramDDR3.cpp + src/simulation/dram/DramDDR4.cpp + src/simulation/dram/DramLPDDR4.cpp + src/simulation/dram/DramWideIO.cpp + src/simulation/dram/DramWideIO2.cpp + src/simulation/dram/DramGDDR5.cpp + src/simulation/dram/DramGDDR5X.cpp + src/simulation/dram/DramGDDR6.cpp + src/simulation/dram/DramHBM2.cpp ) # Build: diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 4abdeedb..f5f2b720 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -55,12 +55,14 @@ #include "refresh/RefreshManagerBankwise.h" #include "powerdown/PowerDownManagerStaggered.h" #include "powerdown/PowerDownManagerDummy.h" +#include "respqueue/RespQueueFifo.h" +#include "respqueue/RespQueueReorder.h" Controller::Controller(sc_module_name name) : GenericController(name) { SC_METHOD(controllerMethod); - sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEventQueue; + sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEvent; dont_initialize(); Configuration &config = Configuration::getInstance(); @@ -187,6 +189,8 @@ Controller::Controller(sc_module_name name) : } } + respQueue = new RespQueueFifo(); + startBandwidthIdleCollector(); } @@ -194,6 +198,7 @@ Controller::~Controller() { endBandwithIdleCollector(); + delete respQueue; for (auto it : refreshManagers) delete it; for (auto it : powerDownManagers) @@ -212,14 +217,17 @@ void Controller::controllerMethod() releasePayload(); // (2) Send next result to arbiter - if (payloadToRelease == nullptr && !responseQueue.empty()) - { - std::pair element = responseQueue.front(); - if (sc_time_stamp() >= element.first) - { - payloadToRelease = element.second; - responseQueue.pop(); + if (payloadToRelease == nullptr) + { + payloadToRelease = respQueue->nextPayload(); + + if (payloadToRelease != nullptr) sendToFrontend(payloadToRelease, BEGIN_RESP); + else + { + sc_time triggerTime = respQueue->getTriggerTime(); + if (triggerTime != sc_max_time()) + dataResponseEvent.notify(triggerTime - sc_time_stamp()); } } @@ -357,8 +365,11 @@ tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &trans, if (phase == END_RD || phase == END_RDA || phase == END_WR || phase == END_WRA) { // TODO: check this part (order of responses) - responseQueue.push({(sc_time_stamp() + delay), &trans}); - dataResponseEventQueue.notify(delay); + respQueue->insertPayload(&trans, delay); + + sc_time triggerTime = respQueue->getTriggerTime(); + if (triggerTime != sc_max_time()) + dataResponseEvent.notify(triggerTime - sc_time_stamp()); Rank rank = DramExtension::getRank(trans); ranksNumberOfPayloads[rank.ID()]--; diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index 6200bb69..45474e56 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -51,6 +51,7 @@ #include "checker/CheckerIF.h" #include "refresh/RefreshManagerIF.h" #include "powerdown/PowerDownManagerIF.h" +#include "respqueue/RespQueueIF.h" using namespace tlm; @@ -81,6 +82,7 @@ private: tlm_generic_payload *payloadToRelease = nullptr; sc_time timeToRelease = sc_max_time(); std::queue> responseQueue; + RespQueueIF *respQueue; std::vector bankMachines; std::vector> bankMachinesOnRank; @@ -94,8 +96,7 @@ private: void acquirePayload(); void controllerMethod(); - sc_event beginReqEvent, endRespEvent, controllerEvent; - sc_event_queue dataResponseEventQueue; + sc_event beginReqEvent, endRespEvent, controllerEvent, dataResponseEvent; // Bandwidth related sc_time idleStart; diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp new file mode 100644 index 00000000..43752fef --- /dev/null +++ b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#include "RespQueueFifo.h" + +void RespQueueFifo::insertPayload(tlm_generic_payload *payload, sc_time delay) +{ + buffer.push({payload, sc_time_stamp() + delay}); +} + +tlm_generic_payload *RespQueueFifo::nextPayload() +{ + if (!buffer.empty()) + { + std::pair element = buffer.front(); + if (element.second <= sc_time_stamp()) + { + buffer.pop(); + return element.first; + } + } + return nullptr; +} + +sc_time RespQueueFifo::getTriggerTime() const +{ + if (!buffer.empty()) + { + sc_time triggerTime = buffer.front().second; + if (triggerTime > sc_time_stamp()) + return triggerTime; + } + return sc_max_time(); +} diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h new file mode 100644 index 00000000..d68c3393 --- /dev/null +++ b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#ifndef RESPQUEUEFIFO_H +#define RESPQUEUEFIFO_H + +#include +#include +#include "RespQueueIF.h" +#include +#include + +using namespace tlm; + +class RespQueueFifo final : public RespQueueIF +{ +public: + virtual void insertPayload(tlm_generic_payload *, sc_time) override; + virtual tlm_generic_payload *nextPayload() override; + virtual sc_time getTriggerTime() const override; + +private: + std::queue> buffer; +}; + +#endif // RESPQUEUEFIFO_H diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueIF.h b/DRAMSys/library/src/controller/respqueue/RespQueueIF.h new file mode 100644 index 00000000..2e882f47 --- /dev/null +++ b/DRAMSys/library/src/controller/respqueue/RespQueueIF.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#ifndef RESPQUEUEIF_H +#define RESPQUEUEIF_H + +#include +#include + +using namespace tlm; + +class RespQueueIF +{ +public: + virtual void insertPayload(tlm_generic_payload *, sc_time) = 0; + virtual tlm_generic_payload *nextPayload() = 0; + virtual sc_time getTriggerTime() const = 0; +}; + +#endif // RESPQUEUEIF_H diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp new file mode 100644 index 00000000..bf332cf5 --- /dev/null +++ b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2019, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#include "RespQueueReorder.h" +#include "../../common/dramExtensions.h" + +void RespQueueReorder::insertPayload(tlm_generic_payload *payload, sc_time delay) +{ + buffer[DramExtension::getPayloadID(payload)] = {payload, sc_time_stamp() + delay}; +} + +tlm_generic_payload *RespQueueReorder::nextPayload() +{ + if (!buffer.empty()) + { + if (buffer.begin()->first == currentPayloadID) + { + std::pair element = buffer.begin()->second; + if (element.second <= sc_time_stamp()) + { + buffer.erase(currentPayloadID++); + return element.first; + } + } + } + return nullptr; +} + +sc_time RespQueueReorder::getTriggerTime() const +{ + if (!buffer.empty()) + { + if (buffer.begin()->first == currentPayloadID) + { + sc_time triggerTime = buffer.begin()->second.second; + if (triggerTime > sc_time_stamp()) + return triggerTime; + } + } + return sc_max_time(); +} diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h new file mode 100644 index 00000000..3b2b3c9f --- /dev/null +++ b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#ifndef RESPQUEUEREORDER_H +#define RESPQUEUEREORDER_H + +#include +#include +#include "RespQueueIF.h" +#include + +using namespace tlm; + +class RespQueueReorder final : public RespQueueIF +{ +public: + virtual void insertPayload(tlm_generic_payload *, sc_time) override; + virtual tlm_generic_payload *nextPayload() override; + virtual sc_time getTriggerTime() const override; + +private: + uint64_t currentPayloadID = 0; + // Muss die Zeit aller Payloads gespeichert werden? + std::map> buffer; +}; + +#endif // RESPQUEUEREORDER_H From db20c3a61460cee98ed9221be52cecbe03f8ab46 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 25 Mar 2020 16:37:30 +0100 Subject: [PATCH 03/23] Bank machines now consider lately-arriving requests. --- .../library/src/controller/BankMachine.cpp | 28 +++-------- DRAMSys/library/src/controller/Controller.cpp | 40 +++++++-------- DRAMSys/library/src/controller/Controller.h | 4 +- .../controller/respqueue/RespQueueFifo.cpp | 4 +- .../controller/respqueue/RespQueueReorder.cpp | 4 +- .../controller/scheduler/SchedulerFifo.cpp | 27 +++++----- .../src/controller/scheduler/SchedulerFifo.h | 5 +- .../controller/scheduler/SchedulerFrFcfs.cpp | 49 ++++++++++--------- .../controller/scheduler/SchedulerFrFcfs.h | 1 + .../src/controller/scheduler/SchedulerIF.h | 1 + 10 files changed, 81 insertions(+), 82 deletions(-) diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index 44661324..bab8247f 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -122,12 +122,9 @@ sc_time BankMachineOpen::start() if (sleeping) return timeToSchedule; + currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - { - currentPayload = scheduler->getNextRequest(this); - if (currentPayload == nullptr) - return timeToSchedule; - } + return timeToSchedule; if (currentState == BmState::Precharged && !blocked) // row miss { @@ -170,12 +167,9 @@ sc_time BankMachineClosed::start() if (sleeping) return timeToSchedule; + currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - { - currentPayload = scheduler->getNextRequest(this); - if (currentPayload == nullptr) - return timeToSchedule; - } + return timeToSchedule; if (currentState == BmState::Precharged && !blocked) // row miss { @@ -210,12 +204,9 @@ sc_time BankMachineOpenAdaptive::start() if (sleeping) return timeToSchedule; + currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - { - currentPayload = scheduler->getNextRequest(this); - if (currentPayload == nullptr) - return timeToSchedule; - } + return timeToSchedule; if (currentState == BmState::Precharged && !blocked) // row miss { @@ -276,12 +267,9 @@ sc_time BankMachineClosedAdaptive::start() if (sleeping) return timeToSchedule; + currentPayload = scheduler->getNextRequest(this); if (currentPayload == nullptr) - { - currentPayload = scheduler->getNextRequest(this); - if (currentPayload == nullptr) - return timeToSchedule; - } + return timeToSchedule; if (currentState == BmState::Precharged && !blocked) // row miss { diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index f5f2b720..d1e078c7 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -66,7 +66,7 @@ Controller::Controller(sc_module_name name) : dont_initialize(); Configuration &config = Configuration::getInstance(); - MemSpec *memSpec = config.memSpec; + memSpec = config.memSpec; ranksNumberOfPayloads = std::vector(memSpec->NumberOfRanks); // instantiate timing checker @@ -257,7 +257,7 @@ void Controller::controllerMethod() std::pair commandPair; std::vector> readyCommands; // (5.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX) - for (unsigned rankID = 0; rankID < Configuration::getInstance().memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) { commandPair = powerDownManagers[rankID]->getNextCommand(); if (commandPair.second != nullptr) @@ -303,6 +303,23 @@ void Controller::controllerMethod() powerDownManagers[rank.ID()]->updateState(commandPair.first); checker->insert(commandPair.first, rank, bankgroup, bank); + if (isCasCommand(commandPair.first)) + { + scheduler->removeRequest(commandPair.second); + respQueue->insertPayload(commandPair.second, memSpec->getIntervalOnDataStrobe(commandPair.first).end); + + sc_time triggerTime = respQueue->getTriggerTime(); + if (triggerTime != sc_max_time()) + dataResponseEvent.notify(triggerTime - sc_time_stamp()); + + ranksNumberOfPayloads[rank.ID()]--; + if (ranksNumberOfPayloads[rank.ID()] == 0) + { + refreshManagers[rank.ID()]->notifyIdle(); + powerDownManagers[rank.ID()]->triggerEntry(TriggerSource::Controller); + } + } + sendToDram(commandPair.first, commandPair.second); } else @@ -356,29 +373,12 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, return TLM_ACCEPTED; } -tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &trans, +tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &, tlm_phase &phase, sc_time &delay) { PRINTDEBUGMESSAGE(name(), "[bw] " + phaseNameToString(phase) + " notification in " + delay.to_string()); - if (phase == END_RD || phase == END_RDA || phase == END_WR || phase == END_WRA) - { - // TODO: check this part (order of responses) - respQueue->insertPayload(&trans, delay); - - sc_time triggerTime = respQueue->getTriggerTime(); - if (triggerTime != sc_max_time()) - dataResponseEvent.notify(triggerTime - sc_time_stamp()); - - Rank rank = DramExtension::getRank(trans); - ranksNumberOfPayloads[rank.ID()]--; - if (ranksNumberOfPayloads[rank.ID()] == 0) - { - refreshManagers[rank.ID()]->notifyIdle(); - powerDownManagers[rank.ID()]->triggerEntry(TriggerSource::Controller); - } - } return TLM_ACCEPTED; } diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index 45474e56..391a22cb 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -82,13 +82,15 @@ private: tlm_generic_payload *payloadToRelease = nullptr; sc_time timeToRelease = sc_max_time(); std::queue> responseQueue; - RespQueueIF *respQueue; + + MemSpec *memSpec; std::vector bankMachines; std::vector> bankMachinesOnRank; CmdMuxIF *commandMux; SchedulerIF *scheduler; CheckerIF *checker; + RespQueueIF *respQueue; std::vector refreshManagers; std::vector powerDownManagers; diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp index 43752fef..df839a3c 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp +++ b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp @@ -34,9 +34,9 @@ #include "RespQueueFifo.h" -void RespQueueFifo::insertPayload(tlm_generic_payload *payload, sc_time delay) +void RespQueueFifo::insertPayload(tlm_generic_payload *payload, sc_time strobeEnd) { - buffer.push({payload, sc_time_stamp() + delay}); + buffer.push({payload, strobeEnd}); } tlm_generic_payload *RespQueueFifo::nextPayload() diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp index bf332cf5..eadcbcc7 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp +++ b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp @@ -35,9 +35,9 @@ #include "RespQueueReorder.h" #include "../../common/dramExtensions.h" -void RespQueueReorder::insertPayload(tlm_generic_payload *payload, sc_time delay) +void RespQueueReorder::insertPayload(tlm_generic_payload *payload, sc_time strobeEnd) { - buffer[DramExtension::getPayloadID(payload)] = {payload, sc_time_stamp() + delay}; + buffer[DramExtension::getPayloadID(payload)] = {payload, strobeEnd}; } tlm_generic_payload *RespQueueReorder::nextPayload() diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index ce31bc50..dc02e4c0 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -36,7 +36,7 @@ SchedulerFifo::SchedulerFifo() { - buffer = std::vector> + buffer = std::vector> (Configuration::getInstance().memSpec->NumberOfBanks); maxNumberOfRequests = Configuration::getInstance().MaxNrOfTransactions; } @@ -51,28 +51,29 @@ bool SchedulerFifo::hasBufferSpace(tlm_generic_payload *payload) void SchedulerFifo::storeRequest(tlm_generic_payload *payload) { - buffer[DramExtension::getBank(payload).ID()].push(payload); + buffer[DramExtension::getBank(payload).ID()].push_back(payload); +} + +void SchedulerFifo::removeRequest(tlm_generic_payload *payload) +{ + buffer[DramExtension::getBank(payload).ID()].pop_front(); } tlm_generic_payload *SchedulerFifo::getNextRequest(BankMachine *bankMachine) { unsigned bankID = bankMachine->getBank().ID(); if (!buffer[bankID].empty()) - { - tlm_generic_payload *front = buffer[bankID].front(); - buffer[bankID].pop(); - return front; - } + return buffer[bankID].front(); else return nullptr; } bool SchedulerFifo::hasRowHit(Bank bank, Row row) { - if (!buffer[bank.ID()].empty()) + if (buffer[bank.ID()].size() >= 2) { - tlm_generic_payload *front = buffer[bank.ID()].front(); - if (DramExtension::getRow(front) == row) + tlm_generic_payload *nextRequest = buffer[bank.ID()][1]; + if (DramExtension::getRow(nextRequest) == row) return true; } return false; @@ -80,8 +81,8 @@ bool SchedulerFifo::hasRowHit(Bank bank, Row row) bool SchedulerFifo::hasRequest(Bank bank) { - if (buffer[bank.ID()].empty()) - return false; - else + if (buffer[bank.ID()].size() >= 2) return true; + else + return false; } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h index f2d9f8be..cc1698e6 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h @@ -37,7 +37,7 @@ #include #include -#include +#include #include "SchedulerIF.h" #include "../../common/dramExtensions.h" #include "../BankMachine.h" @@ -50,11 +50,12 @@ public: SchedulerFifo(); virtual bool hasBufferSpace(tlm_generic_payload *) override; virtual void storeRequest(tlm_generic_payload *) override; + virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; virtual bool hasRowHit(Bank, Row) override; virtual bool hasRequest(Bank) override; private: - std::vector> buffer; + std::vector> buffer; unsigned maxNumberOfRequests; }; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index eb784508..4447f5f4 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -56,56 +56,61 @@ void SchedulerFrFcfs::storeRequest(tlm_generic_payload *payload) buffer[DramExtension::getBank(payload).ID()].push_back(payload); } +void SchedulerFrFcfs::removeRequest(tlm_generic_payload *payload) +{ + unsigned bankID = DramExtension::getBank(payload).ID(); + for (auto it = buffer[bankID].begin(); it != buffer[bankID].end(); it++) + { + if (*it == payload) + { + buffer[bankID].erase(it); + return; + } + } + SC_REPORT_FATAL("SchedulerFrFcfs", "removeRequest failed!"); +} + tlm_generic_payload *SchedulerFrFcfs::getNextRequest(BankMachine *bankMachine) { unsigned bankID = bankMachine->getBank().ID(); if (!buffer[bankID].empty()) { BmState currentState = bankMachine->getState(); - if (currentState == BmState::Precharged) - { - tlm_generic_payload *result = buffer[bankID].front(); - buffer[bankID].pop_front(); - return result; - } - else if (currentState == BmState::Activated) + if (currentState == BmState::Activated) { // Search for row hit Row openRow = bankMachine->getOpenRow(); for (auto it = buffer[bankID].begin(); it != buffer[bankID].end(); it++) { if (DramExtension::getRow(*it) == openRow) - { - tlm_generic_payload *result = *it; - buffer[bankID].erase(it); - return result; - } + return *it; } - // No row hit found - tlm_generic_payload *result = buffer[bankID].front(); - buffer[bankID].pop_front(); - return result; } - else - SC_REPORT_FATAL("SchedulerFrFcfs", "Wrong BM state!"); + // No row hit found or bank precharged + return buffer[bankID].front(); } return nullptr; } bool SchedulerFrFcfs::hasRowHit(Bank bank, Row row) { + unsigned rowHitCounter = 0; for (auto it = buffer[bank.ID()].begin(); it != buffer[bank.ID()].end(); it++) { if (DramExtension::getRow(*it) == row) - return true; + { + rowHitCounter++; + if (rowHitCounter == 2) + return true; + } } return false; } bool SchedulerFrFcfs::hasRequest(Bank bank) { - if (buffer[bank.ID()].empty()) - return false; - else + if (buffer[bank.ID()].size() >= 2) return true; + else + return false; } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h index 5bf4f264..8f0cc714 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h @@ -50,6 +50,7 @@ public: SchedulerFrFcfs(); virtual bool hasBufferSpace(tlm_generic_payload *) override; virtual void storeRequest(tlm_generic_payload *) override; + virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; virtual bool hasRowHit(Bank, Row) override; virtual bool hasRequest(Bank) override; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h index c882a3b0..fc4f06ef 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h @@ -51,6 +51,7 @@ public: virtual ~SchedulerIF() {} virtual bool hasBufferSpace(tlm_generic_payload *) = 0; virtual void storeRequest(tlm_generic_payload *) = 0; + virtual void removeRequest(tlm_generic_payload *) = 0; virtual tlm_generic_payload *getNextRequest(BankMachine *) = 0; virtual bool hasRowHit(Bank, Row) = 0; virtual bool hasRequest(Bank) = 0; From cdaa20990994450536255b6e226b47a216dd1b9d Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 25 Mar 2020 16:44:49 +0100 Subject: [PATCH 04/23] Renaming of scheduler methods to avoid confusion. --- DRAMSys/library/src/controller/BankMachine.cpp | 4 ++-- DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp | 4 ++-- DRAMSys/library/src/controller/scheduler/SchedulerFifo.h | 4 ++-- DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp | 4 ++-- DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h | 4 ++-- DRAMSys/library/src/controller/scheduler/SchedulerIF.h | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index bab8247f..3bb27498 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -217,7 +217,7 @@ sc_time BankMachineOpenAdaptive::start() { if (DramExtension::getRow(currentPayload) == currentRow) // row hit { - if (scheduler->hasRequest(bank) && !scheduler->hasRowHit(bank, currentRow)) + if (scheduler->hasFurtherRequest(bank) && !scheduler->hasFurtherRowHit(bank, currentRow)) { if (currentPayload->get_command() == TLM_READ_COMMAND) { @@ -280,7 +280,7 @@ sc_time BankMachineClosedAdaptive::start() { if (DramExtension::getRow(currentPayload) == currentRow) // row hit { - if (scheduler->hasRowHit(bank, currentRow)) + if (scheduler->hasFurtherRowHit(bank, currentRow)) { if (currentPayload->get_command() == TLM_READ_COMMAND) { diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index dc02e4c0..dba1ffb2 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -68,7 +68,7 @@ tlm_generic_payload *SchedulerFifo::getNextRequest(BankMachine *bankMachine) return nullptr; } -bool SchedulerFifo::hasRowHit(Bank bank, Row row) +bool SchedulerFifo::hasFurtherRowHit(Bank bank, Row row) { if (buffer[bank.ID()].size() >= 2) { @@ -79,7 +79,7 @@ bool SchedulerFifo::hasRowHit(Bank bank, Row row) return false; } -bool SchedulerFifo::hasRequest(Bank bank) +bool SchedulerFifo::hasFurtherRequest(Bank bank) { if (buffer[bank.ID()].size() >= 2) return true; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h index cc1698e6..42761560 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h @@ -52,8 +52,8 @@ public: virtual void storeRequest(tlm_generic_payload *) override; virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; - virtual bool hasRowHit(Bank, Row) override; - virtual bool hasRequest(Bank) override; + virtual bool hasFurtherRowHit(Bank, Row) override; + virtual bool hasFurtherRequest(Bank) override; private: std::vector> buffer; unsigned maxNumberOfRequests; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 4447f5f4..457b6306 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -92,7 +92,7 @@ tlm_generic_payload *SchedulerFrFcfs::getNextRequest(BankMachine *bankMachine) return nullptr; } -bool SchedulerFrFcfs::hasRowHit(Bank bank, Row row) +bool SchedulerFrFcfs::hasFurtherRowHit(Bank bank, Row row) { unsigned rowHitCounter = 0; for (auto it = buffer[bank.ID()].begin(); it != buffer[bank.ID()].end(); it++) @@ -107,7 +107,7 @@ bool SchedulerFrFcfs::hasRowHit(Bank bank, Row row) return false; } -bool SchedulerFrFcfs::hasRequest(Bank bank) +bool SchedulerFrFcfs::hasFurtherRequest(Bank bank) { if (buffer[bank.ID()].size() >= 2) return true; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h index 8f0cc714..8e123e0d 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h @@ -52,8 +52,8 @@ public: virtual void storeRequest(tlm_generic_payload *) override; virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; - virtual bool hasRowHit(Bank, Row) override; - virtual bool hasRequest(Bank) override; + virtual bool hasFurtherRowHit(Bank, Row) override; + virtual bool hasFurtherRequest(Bank) override; private: std::vector> buffer; unsigned maxNumberOfRequests; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h index fc4f06ef..d7504bbb 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h @@ -53,8 +53,8 @@ public: virtual void storeRequest(tlm_generic_payload *) = 0; virtual void removeRequest(tlm_generic_payload *) = 0; virtual tlm_generic_payload *getNextRequest(BankMachine *) = 0; - virtual bool hasRowHit(Bank, Row) = 0; - virtual bool hasRequest(Bank) = 0; + virtual bool hasFurtherRowHit(Bank, Row) = 0; + virtual bool hasFurtherRequest(Bank) = 0; }; #endif // SCHEDULERIF_H From 75e70478261b3d8a63de712c7267e351f979b55c Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 25 Mar 2020 22:46:18 +0100 Subject: [PATCH 05/23] Added FR-FCFS Grouping scheduler, updated config files. --- DRAMSys/library/CMakeLists.txt | 1 + .../resources/configs/mcconfigs/.gitignore | 1 - .../resources/configs/mcconfigs/fifo.xml | 8 +- .../configs/mcconfigs/fifoStrict.xml | 44 ------ .../resources/configs/mcconfigs/fifo_ecc.xml | 43 ------ .../resources/configs/mcconfigs/fr_fcfs.xml | 9 +- .../configs/mcconfigs/fr_fcfs_bw_buffer16.xml | 42 ------ .../fr_fcfs_bw_buffer16_close_page.xml | 42 ------ .../configs/mcconfigs/fr_fcfs_grp.xml | 10 +- .../mcconfigs/fr_fcfs_nbw_buffer16.xml | 38 ----- .../fr_fcfs_nbw_buffer16_close_page.xml | 42 ------ .../configs/mcconfigs/fr_fcfs_rp.xml | 43 ------ .../resources/configs/mcconfigs/grp.xml | 43 ------ .../resources/configs/mcconfigs/par_bs.xml | 43 ------ .../resources/configs/mcconfigs/rgrmccfg.xml | 42 ------ .../resources/configs/mcconfigs/sms.xml | 43 ------ .../resources/simulations/ddr3-example.xml | 6 +- .../src/configuration/Configuration.cpp | 12 +- .../library/src/configuration/Configuration.h | 5 +- .../src/configuration/memspec/MemSpec.cpp | 14 -- .../src/configuration/memspec/MemSpec.h | 5 +- DRAMSys/library/src/controller/Controller.cpp | 83 ++++++----- .../controller/scheduler/SchedulerFrFcfs.cpp | 3 +- .../scheduler/SchedulerFrFcfsGrp.cpp | 138 ++++++++++++++++++ .../controller/scheduler/SchedulerFrFcfsGrp.h | 64 ++++++++ 25 files changed, 283 insertions(+), 541 deletions(-) delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/.gitignore delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fifoStrict.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fifo_ecc.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16_close_page.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16_close_page.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_rp.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/grp.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/par_bs.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/rgrmccfg.xml delete mode 100644 DRAMSys/library/resources/configs/mcconfigs/sms.xml create mode 100644 DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp create mode 100644 DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index fac67d98..1725607b 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -129,6 +129,7 @@ add_library(DRAMSysLibrary src/controller/scheduler/SchedulerIF.h src/controller/scheduler/SchedulerFifo.cpp src/controller/scheduler/SchedulerFrFcfs.cpp + src/controller/scheduler/SchedulerFrFcfsGrp.cpp src/error/eccbaseclass.cpp src/error/ecchamming.cpp diff --git a/DRAMSys/library/resources/configs/mcconfigs/.gitignore b/DRAMSys/library/resources/configs/mcconfigs/.gitignore deleted file mode 100644 index c5a87587..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -memconfig.xml \ No newline at end of file diff --git a/DRAMSys/library/resources/configs/mcconfigs/fifo.xml b/DRAMSys/library/resources/configs/mcconfigs/fifo.xml index fc05a577..24dc2490 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fifo.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fifo.xml @@ -1,7 +1,13 @@ - + + + + + + + diff --git a/DRAMSys/library/resources/configs/mcconfigs/fifoStrict.xml b/DRAMSys/library/resources/configs/mcconfigs/fifoStrict.xml deleted file mode 100644 index 1226d09a..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fifoStrict.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fifo_ecc.xml b/DRAMSys/library/resources/configs/mcconfigs/fifo_ecc.xml deleted file mode 100644 index fc05a577..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fifo_ecc.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml index 35e118dc..a91a9092 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml @@ -1,8 +1,13 @@ - - + + + + + + + diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16.xml deleted file mode 100644 index d92d32da..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16_close_page.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16_close_page.xml deleted file mode 100644 index d4aa4a4c..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_bw_buffer16_close_page.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml index 042cc5fb..00a190a7 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml @@ -1,7 +1,13 @@ - - + + + + + + + + diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16.xml deleted file mode 100644 index 7cb5befd..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16_close_page.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16_close_page.xml deleted file mode 100644 index aa65b3ff..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_nbw_buffer16_close_page.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_rp.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_rp.xml deleted file mode 100644 index 4c0b43c6..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_rp.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/grp.xml b/DRAMSys/library/resources/configs/mcconfigs/grp.xml deleted file mode 100644 index 8b34759d..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/grp.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/par_bs.xml b/DRAMSys/library/resources/configs/mcconfigs/par_bs.xml deleted file mode 100644 index aaec39ca..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/par_bs.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/rgrmccfg.xml b/DRAMSys/library/resources/configs/mcconfigs/rgrmccfg.xml deleted file mode 100644 index 2f8fb337..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/rgrmccfg.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/sms.xml b/DRAMSys/library/resources/configs/mcconfigs/sms.xml deleted file mode 100644 index 3d9433da..00000000 --- a/DRAMSys/library/resources/configs/mcconfigs/sms.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/simulations/ddr3-example.xml b/DRAMSys/library/resources/simulations/ddr3-example.xml index c6140385..2c948758 100644 --- a/DRAMSys/library/resources/simulations/ddr3-example.xml +++ b/DRAMSys/library/resources/simulations/ddr3-example.xml @@ -8,9 +8,9 @@ - + - + - ddr3_example.stl + ddr3_example.stl diff --git a/DRAMSys/library/src/configuration/Configuration.cpp b/DRAMSys/library/src/configuration/Configuration.cpp index 826343d6..0c2fb4f2 100644 --- a/DRAMSys/library/src/configuration/Configuration.cpp +++ b/DRAMSys/library/src/configuration/Configuration.cpp @@ -136,14 +136,16 @@ void Configuration::setParameter(std::string name, std::string value) { if (name == "BankwiseLogic") BankwiseLogic = string2bool(value); - else if (name == "OpenPagePolicy") - OpenPagePolicy = string2bool(value); - else if (name == "AdaptivePagePolicy") - AdaptivePagePolicy = string2bool(value); + else if (name == "PagePolicy") + pagePolicy = value; else if (name == "MaxNrOfTransactions") MaxNrOfTransactions = string2int(value); else if (name == "Scheduler") - Scheduler = value; + scheduler = value; + else if (name == "CmdMux") + cmdMux = value; + else if (name == "RespQueue") + respQueue = value; else if (name == "SJFProbability") { if (string2int(value) > 100 || string2int(value) < 0) diff --git a/DRAMSys/library/src/configuration/Configuration.h b/DRAMSys/library/src/configuration/Configuration.h index e8fb6bc6..af4c8a28 100644 --- a/DRAMSys/library/src/configuration/Configuration.h +++ b/DRAMSys/library/src/configuration/Configuration.h @@ -64,10 +64,9 @@ struct Configuration // MCConfig: bool BankwiseLogic = false; - bool OpenPagePolicy = true; - bool AdaptivePagePolicy = false; unsigned int MaxNrOfTransactions = 8; - std::string Scheduler; + std::string pagePolicy; + std::string scheduler, cmdMux, respQueue; unsigned int SJFProbability; unsigned int RequestBufferSize; unsigned int Capsize = 5; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp index 6e96ff4a..3632316b 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp @@ -71,17 +71,3 @@ unsigned MemSpec::getCommandLength(Command command) const { return commandLength[command]; } - -//sc_time MemSpec::getMinExecutionTimeForPowerDownCmd(Command command) const -//{ -// if (command == Command::PDEA || command == Command::PDEP) -// return tCKE; -// else if (command == Command::SREFEN) -// return tCKESR; -// else -// { -// SC_REPORT_FATAL("getMinimalExecutionTime", -// "command is not know or command has a fixed execution time"); -// return SC_ZERO_TIME; -// } -//} diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index 0e95ed05..2dc5d628 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -64,9 +64,6 @@ struct MemSpec unsigned getCommandLength(Command) const; - // Returns the minimum execution time for commands that have a variable execution time - //virtual sc_time getMinExecutionTimeForPowerDownCmd(Command command) const = 0; - std::string MemoryId = "not defined."; std::string MemoryType = "not defined."; @@ -87,7 +84,7 @@ struct MemSpec double clkMHz; sc_time clk; - // Command lengths on bus, standardly one clock cycle + // Command lengths on bus, usually one clock cycle std::vector commandLength; }; diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index d1e078c7..9585157b 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -35,10 +35,6 @@ #include "Controller.h" #include "../configuration/Configuration.h" -#include "scheduler/SchedulerFifo.h" -#include "scheduler/SchedulerFrFcfs.h" -#include "cmdmux/CmdMuxStrict.h" -#include "cmdmux/CmdMuxOldest.h" #include "../common/dramExtensions.h" #include "../common/protocol.h" #include "checker/CheckerDDR3.h" @@ -50,13 +46,18 @@ #include "checker/CheckerGDDR5.h" #include "checker/CheckerGDDR5X.h" #include "checker/CheckerGDDR6.h" +#include "scheduler/SchedulerFifo.h" +#include "scheduler/SchedulerFrFcfs.h" +#include "scheduler/SchedulerFrFcfsGrp.h" +#include "cmdmux/CmdMuxStrict.h" +#include "cmdmux/CmdMuxOldest.h" +#include "respqueue/RespQueueFifo.h" +#include "respqueue/RespQueueReorder.h" #include "refresh/RefreshManager.h" #include "refresh/RefreshManagerDummy.h" #include "refresh/RefreshManagerBankwise.h" #include "powerdown/PowerDownManagerStaggered.h" #include "powerdown/PowerDownManagerDummy.h" -#include "respqueue/RespQueueFifo.h" -#include "respqueue/RespQueueReorder.h" Controller::Controller(sc_module_name name) : GenericController(name) @@ -92,46 +93,52 @@ Controller::Controller(sc_module_name name) : SC_REPORT_FATAL("Controller", "Unsupported DRAM type!"); // instantiate scheduler and command mux - if (config.Scheduler == "FifoStrict") - { + if (config.scheduler == "Fifo") scheduler = new SchedulerFifo(); - commandMux = new CmdMuxStrict(); - } - else if (config.Scheduler == "FrFcfs") - { + else if (config.scheduler == "FrFcfs") scheduler = new SchedulerFrFcfs(); - commandMux = new CmdMuxOldest(); - } + else if (config.scheduler == "FrFcfsGrp") + scheduler = new SchedulerFrFcfsGrp(); else SC_REPORT_FATAL("Controller", "Selected scheduler not supported!"); + if (config.cmdMux == "Oldest") + commandMux = new CmdMuxOldest(); + else if (config.cmdMux == "Strict") + commandMux = new CmdMuxStrict(); + else + SC_REPORT_FATAL("Controller", "Selected cmdmux not supported!"); + + if (config.respQueue == "Fifo") + respQueue = new RespQueueFifo(); + else if (config.respQueue == "Reorder") + respQueue = new RespQueueReorder(); + else + SC_REPORT_FATAL("Controller", "Selected respqueue not supported!"); + // instantiate bank machines (one per bank) - if (config.OpenPagePolicy) + if (config.pagePolicy == "Open") { - if (config.AdaptivePagePolicy) - { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) - bankMachines.push_back(new BankMachineOpenAdaptive(scheduler, checker, Bank(bankID))); - } - else - { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) - bankMachines.push_back(new BankMachineOpen(scheduler, checker, Bank(bankID))); - } + for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + bankMachines.push_back(new BankMachineOpen(scheduler, checker, Bank(bankID))); + } + else if (config.pagePolicy == "OpenAdaptive") + { + for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + bankMachines.push_back(new BankMachineOpenAdaptive(scheduler, checker, Bank(bankID))); + } + else if (config.pagePolicy == "Closed") + { + for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + bankMachines.push_back(new BankMachineClosed(scheduler, checker, Bank(bankID))); + } + else if (config.pagePolicy == "ClosedAdaptive") + { + for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + bankMachines.push_back(new BankMachineClosedAdaptive(scheduler, checker, Bank(bankID))); } else - { - if (config.AdaptivePagePolicy) - { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) - bankMachines.push_back(new BankMachineClosedAdaptive(scheduler, checker, Bank(bankID))); - } - else - { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) - bankMachines.push_back(new BankMachineClosed(scheduler, checker, Bank(bankID))); - } - } + SC_REPORT_FATAL("Controller", "Selected page policy not supported!"); for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) { @@ -189,8 +196,6 @@ Controller::Controller(sc_module_name name) : } } - respQueue = new RespQueueFifo(); - startBandwidthIdleCollector(); } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 457b6306..3003f967 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -75,8 +75,7 @@ tlm_generic_payload *SchedulerFrFcfs::getNextRequest(BankMachine *bankMachine) unsigned bankID = bankMachine->getBank().ID(); if (!buffer[bankID].empty()) { - BmState currentState = bankMachine->getState(); - if (currentState == BmState::Activated) + if (bankMachine->getState() == BmState::Activated) { // Search for row hit Row openRow = bankMachine->getOpenRow(); diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp new file mode 100644 index 00000000..67f7f77e --- /dev/null +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2020, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#include "SchedulerFrFcfsGrp.h" + +SchedulerFrFcfsGrp::SchedulerFrFcfsGrp() +{ + buffer = std::vector> + (Configuration::getInstance().memSpec->NumberOfBanks); + maxNumberOfRequests = Configuration::getInstance().MaxNrOfTransactions; +} + +bool SchedulerFrFcfsGrp::hasBufferSpace(tlm_generic_payload *payload) +{ + if (buffer[DramExtension::getBank(payload).ID()].size() < maxNumberOfRequests) + return true; + else + return false; +} + +void SchedulerFrFcfsGrp::storeRequest(tlm_generic_payload *payload) +{ + buffer[DramExtension::getBank(payload).ID()].push_back(payload); +} + +void SchedulerFrFcfsGrp::removeRequest(tlm_generic_payload *payload) +{ + lastCommand = payload->get_command(); + unsigned bankID = DramExtension::getBank(payload).ID(); + for (auto it = buffer[bankID].begin(); it != buffer[bankID].end(); it++) + { + if (*it == payload) + { + buffer[bankID].erase(it); + return; + } + } + SC_REPORT_FATAL("SchedulerFrFcfs", "removeRequest failed!"); +} + +tlm_generic_payload *SchedulerFrFcfsGrp::getNextRequest(BankMachine *bankMachine) +{ + unsigned bankID = bankMachine->getBank().ID(); + if (!buffer[bankID].empty()) + { + if (bankMachine->getState() == BmState::Activated) + { + // Filter all row hits + Row openRow = bankMachine->getOpenRow(); + std::list rowHits; + for (auto it = buffer[bankID].begin(); it != buffer[bankID].end(); it++) + { + if (DramExtension::getRow(*it) == openRow) + rowHits.push_back(*it); + } + + if (!rowHits.empty()) + { + for (auto outerIt = rowHits.begin(); outerIt != rowHits.end(); outerIt++) + { + if ((*outerIt)->get_command() == lastCommand) + { + bool hazardDetected = false; + for (auto innerIt = rowHits.begin(); *innerIt != *outerIt; innerIt++) + { + if ((*outerIt)->get_address() == (*innerIt)->get_address()) + { + hazardDetected = true; + break; + } + } + if (!hazardDetected) + return *outerIt; + } + } + // no rd/wr hit found -> take first row hit + return *rowHits.begin(); + } + } + // No row hit found or bank precharged + return buffer[bankID].front(); + } + return nullptr; +} + +bool SchedulerFrFcfsGrp::hasFurtherRowHit(Bank bank, Row row) +{ + unsigned rowHitCounter = 0; + for (auto it = buffer[bank.ID()].begin(); it != buffer[bank.ID()].end(); it++) + { + if (DramExtension::getRow(*it) == row) + { + rowHitCounter++; + if (rowHitCounter == 2) + return true; + } + } + return false; +} + +bool SchedulerFrFcfsGrp::hasFurtherRequest(Bank bank) +{ + if (buffer[bank.ID()].size() >= 2) + return true; + else + return false; +} diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h new file mode 100644 index 00000000..50537fc6 --- /dev/null +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2020, University of Kaiserslautern + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Lukas Steiner + */ + +#ifndef SCHEDULERFRFCFSGRP_H +#define SCHEDULERFRFCFSGRP_H + +#include +#include +#include + +#include "SchedulerIF.h" +#include "../../common/dramExtensions.h" +#include "../BankMachine.h" + +using namespace tlm; + +class SchedulerFrFcfsGrp : public SchedulerIF +{ +public: + SchedulerFrFcfsGrp(); + virtual bool hasBufferSpace(tlm_generic_payload *) override; + virtual void storeRequest(tlm_generic_payload *) override; + virtual void removeRequest(tlm_generic_payload *) override; + virtual tlm_generic_payload *getNextRequest(BankMachine *) override; + virtual bool hasFurtherRowHit(Bank, Row) override; + virtual bool hasFurtherRequest(Bank) override; +private: + std::vector> buffer; + unsigned maxNumberOfRequests; + tlm_command lastCommand = TLM_READ_COMMAND; +}; + +#endif // SCHEDULERFRFCFSGRP_H From 51b861451861ec8fdbf01e3e8a9d3ca05fcd21dc Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Thu, 26 Mar 2020 15:45:00 +0100 Subject: [PATCH 06/23] Updated configuration of DRAMSys. --- DRAMSys/library/CMakeLists.txt | 2 +- .../resources/configs/mcconfigs/fifo.xml | 47 +--- .../resources/configs/mcconfigs/fr_fcfs.xml | 47 +--- .../configs/mcconfigs/fr_fcfs_grp.xml | 47 +--- DRAMSys/library/src/common/TlmRecorder.cpp | 12 +- .../src/configuration/Configuration.cpp | 235 ++++-------------- .../library/src/configuration/Configuration.h | 96 ++----- .../src/configuration/ConfigurationLoader.cpp | 8 +- DRAMSys/library/src/controller/Controller.cpp | 38 +-- DRAMSys/library/src/controller/Controller.h | 2 +- .../src/controller/GenericController.h | 2 +- .../refresh/RefreshManagerBankwise.cpp | 6 +- ...Manager.cpp => RefreshManagerRankwise.cpp} | 20 +- ...reshManager.h => RefreshManagerRankwise.h} | 10 +- .../controller/scheduler/SchedulerFifo.cpp | 4 +- .../src/controller/scheduler/SchedulerFifo.h | 2 +- .../controller/scheduler/SchedulerFrFcfs.cpp | 4 +- .../controller/scheduler/SchedulerFrFcfs.h | 2 +- .../scheduler/SchedulerFrFcfsGrp.cpp | 4 +- .../controller/scheduler/SchedulerFrFcfsGrp.h | 2 +- DRAMSys/library/src/error/errormodel.cpp | 6 +- DRAMSys/library/src/simulation/Arbiter.cpp | 8 +- DRAMSys/library/src/simulation/DRAMSys.cpp | 44 ++-- .../src/simulation/TemperatureController.h | 2 +- .../library/src/simulation/TracePlayer.cpp | 2 +- DRAMSys/library/src/simulation/TraceSetup.cpp | 2 +- DRAMSys/library/src/simulation/dram/Dram.cpp | 12 +- .../library/src/simulation/dram/DramDDR3.cpp | 2 +- .../library/src/simulation/dram/DramDDR4.cpp | 2 +- .../library/src/simulation/dram/DramGDDR5.cpp | 2 +- .../src/simulation/dram/DramGDDR5X.cpp | 2 +- .../library/src/simulation/dram/DramGDDR6.cpp | 2 +- .../library/src/simulation/dram/DramHBM2.cpp | 2 +- .../src/simulation/dram/DramLPDDR4.cpp | 2 +- .../src/simulation/dram/DramRecordable.cpp | 12 +- .../src/simulation/dram/DramRecordable.h | 2 +- .../src/simulation/dram/DramWideIO.cpp | 2 +- .../src/simulation/dram/DramWideIO2.cpp | 2 +- DRAMSys/simulator/main.cpp | 2 +- 39 files changed, 217 insertions(+), 483 deletions(-) rename DRAMSys/library/src/controller/refresh/{RefreshManager.cpp => RefreshManagerRankwise.cpp} (90%) rename DRAMSys/library/src/controller/refresh/{RefreshManager.h => RefreshManagerRankwise.h} (91%) diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index 1725607b..1593d159 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -119,7 +119,7 @@ add_library(DRAMSysLibrary src/controller/refresh/RefreshManagerIF.h src/controller/refresh/RefreshManagerDummy.cpp - src/controller/refresh/RefreshManager.cpp + src/controller/refresh/RefreshManagerRankwise.cpp src/controller/refresh/RefreshManagerBankwise.cpp src/controller/respqueue/RespQueueIF.h diff --git a/DRAMSys/library/resources/configs/mcconfigs/fifo.xml b/DRAMSys/library/resources/configs/mcconfigs/fifo.xml index 24dc2490..629ad725 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fifo.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fifo.xml @@ -1,49 +1,20 @@ - + - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml index a91a9092..dada4e70 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs.xml @@ -1,49 +1,20 @@ - + - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml index 00a190a7..06104618 100644 --- a/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml +++ b/DRAMSys/library/resources/configs/mcconfigs/fr_fcfs_grp.xml @@ -1,49 +1,20 @@ - + - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index d917d47c..f02231a2 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -337,18 +337,18 @@ void TlmRecorder::insertGeneralInfo() memspec.length(), NULL); sqlite3_bind_text(insertGeneralInfoStatement, 9, traces.c_str(), traces.length(), NULL); - if (!Configuration::getInstance().EnableWindowing) + if (!Configuration::getInstance().enableWindowing) sqlite3_bind_int64(insertGeneralInfoStatement, 10, 0); else sqlite3_bind_int64(insertGeneralInfoStatement, 10, (Configuration::getInstance().memSpec->clk * - Configuration::getInstance().WindowSize).value()); - if (Configuration::getInstance().ControllerCoreRefEnablePostpone - || Configuration::getInstance().ControllerCoreRefEnablePullIn) { + Configuration::getInstance().windowSize).value()); + if ((Configuration::getInstance().refreshMaxPostponed > 0) + || (Configuration::getInstance().refreshMaxPulledin > 0)) { sqlite3_bind_int(insertGeneralInfoStatement, 11, 1); sqlite3_bind_int(insertGeneralInfoStatement, 12, - std::max(Configuration::getInstance().ControllerCoreRefMaxPulledIn, - Configuration::getInstance().ControllerCoreRefMaxPostponed)); + std::max(Configuration::getInstance().refreshMaxPostponed, + Configuration::getInstance().refreshMaxPulledin)); } else { sqlite3_bind_int(insertGeneralInfoStatement, 11, 0); sqlite3_bind_int(insertGeneralInfoStatement, 12, 0); diff --git a/DRAMSys/library/src/configuration/Configuration.cpp b/DRAMSys/library/src/configuration/Configuration.cpp index 0c2fb4f2..e8357d6e 100644 --- a/DRAMSys/library/src/configuration/Configuration.cpp +++ b/DRAMSys/library/src/configuration/Configuration.cpp @@ -47,28 +47,6 @@ using namespace std; string Configuration::memspecUri = ""; string Configuration::mcconfigUri = ""; -bool string2bool(string s) -{ - if (s.compare("0") == 0) { - return false; - } else if (s.compare("1") == 0) { - return true; - } else { - SC_REPORT_FATAL("Configuration", ("Could not convert to bool: " + s).c_str()); - return false; - } -} - -int string2int(string s) -{ - return std::stoi(s); -} - -unsigned long long string2ull(string s) -{ - return std::stoull(s); -} - StorageMode string2StoreMode(string s) { if (s == "NoStorage") @@ -83,34 +61,6 @@ StorageMode string2StoreMode(string s) } } -EPowerDownMode string2PDNMode(string s) -{ - if (s == "NoPowerDown") - return EPowerDownMode::NoPowerDown; - else if (s == "Staggered") - return EPowerDownMode::Staggered; - else if (s == "TimeoutPDN") - return EPowerDownMode::TimeoutPDN; - else if (s == "TimeoutSREF") - return EPowerDownMode::TimeoutSREF; - else { - SC_REPORT_FATAL("Configuration", ("Unknown PowerDownMode: " + s).c_str()); - throw; - } -} - -ECCControllerMode string2ECCControllerMode(string s) -{ - if (s == "Disabled") - return ECCControllerMode::Disabled; - else if (s == "Hamming") - return ECCControllerMode::Hamming; - else { - SC_REPORT_FATAL("Configuration", ("Unknown ECCControllerMode: " + s).c_str()); - throw; - } -} - enum sc_time_unit string2TimeUnit(string s) { if (s == "s") @@ -134,150 +84,81 @@ enum sc_time_unit string2TimeUnit(string s) void Configuration::setParameter(std::string name, std::string value) { - if (name == "BankwiseLogic") - BankwiseLogic = string2bool(value); - else if (name == "PagePolicy") + // MCConfig + if (name == "PagePolicy") pagePolicy = value; - else if (name == "MaxNrOfTransactions") - MaxNrOfTransactions = string2int(value); else if (name == "Scheduler") scheduler = value; + else if (name == "RequestBufferSize") + requestBufferSize = std::stoul(value); else if (name == "CmdMux") cmdMux = value; else if (name == "RespQueue") respQueue = value; - else if (name == "SJFProbability") - { - if (string2int(value) > 100 || string2int(value) < 0) - SC_REPORT_FATAL("Configuration", - ("Invalid value for parameter " + name + - ". This parameter must be between 0 and 100.").c_str()); - else - SJFProbability = string2int(value); - } - else if (name == "RequestBufferSize") - RequestBufferSize = string2int(value); - else if (name == "Capsize") - Capsize = string2int(value); + else if (name == "RefreshPolicy") + refreshPolicy = value; + else if (name == "RefreshMode") + refreshMode = std::stoul(value); + else if (name == "RefreshMaxPostponed") + refreshMaxPostponed = std::stoul(value); + else if (name == "RefreshMaxPulledin") + refreshMaxPulledin = std::stoul(value); + else if (name == "PowerDownPolicy") + powerDownPolicy = value; else if (name == "PowerDownTimeout") - powerDownTimeoutInClk = string2int(value); - else if (name == "PowerDownMode") - PowerDownMode = string2PDNMode(value); - else if (name == "ReadWriteGrouping") - ReadWriteGrouping = string2bool(value); - else if (name == "ReorderBuffer") - ReorderBuffer = string2bool(value); - + powerDownTimeout = std::stoul(value); //SimConfig------------------------------------------------ else if (name == "SimulationName") - SimulationName = value; + simulationName = value; else if (name == "DatabaseRecording") - DatabaseRecording = string2bool(value); + databaseRecording = std::stoul(value); else if (name == "PowerAnalysis") - PowerAnalysis = string2bool(value); + powerAnalysis = std::stoul(value); else if (name == "EnableWindowing") - EnableWindowing = string2bool(value); + enableWindowing = std::stoul(value); else if (name == "WindowSize") { - if (string2int(value) < 1) + windowSize = std::stoul(value); + if (windowSize == 0) SC_REPORT_FATAL("Configuration", ("Invalid value for parameter " + name + ". This parameter must be at least one.").c_str()); - else - WindowSize = string2int(value); } else if (name == "Debug") - Debug = string2bool(value); + debug = std::stoul(value); else if (name == "NumberOfMemChannels") - NumberOfMemChannels = string2int(value); - else if (name == "ControllerCoreRefDisable") - ControllerCoreRefDisable = string2bool(value); - else if (name == "ControllerCoreRGR") - RowGranularRef = string2bool(value); - else if (name == "ControllerCoreRGRRowInc") - RowInc = string2int(value); - else if (name == "ControllerCoreRefMode") - { - RefMode = string2int(value); - if (RefMode != 1 && RefMode != 2 && RefMode != 4) - SC_REPORT_FATAL("Configuration", (name + " invalid value.").c_str()); - } - else if (name == "ControllerCoreRefNumARCmdsIntREFI") - NumAR = string2int(value); - else if (name == "ControllerCoreRGRB0") - RGRB0 = string2bool(value); - else if (name == "ControllerCoreRGRB1") - RGRB1 = string2bool(value); - else if (name == "ControllerCoreRGRB2") - RGRB2 = string2bool(value); - else if (name == "ControllerCoreRGRB3") - RGRB3 = string2bool(value); - else if (name == "ControllerCoreRGRB4") - RGRB4 = string2bool(value); - else if (name == "ControllerCoreRGRB5") - RGRB5 = string2bool(value); - else if (name == "ControllerCoreRGRB6") - RGRB6 = string2bool(value); - else if (name == "ControllerCoreRGRB7") - RGRB7 = string2bool(value); - else if (name == "ControllerCoreRGRB8") - RGRB8 = string2bool(value); - else if (name == "ControllerCoreRGRB9") - RGRB9 = string2bool(value); - else if (name == "ControllerCoreRGRB10") - RGRB10 = string2bool(value); - else if (name == "ControllerCoreRGRB11") - RGRB11 = string2bool(value); - else if (name == "ControllerCoreRGRB12") - RGRB12 = string2bool(value); - else if (name == "ControllerCoreRGRB13") - RGRB13 = string2bool(value); - else if (name == "ControllerCoreRGRB14") - RGRB14 = string2bool(value); - else if (name == "ControllerCoreRGRB15") - RGRB15 = string2bool(value); - else if (name == "ControllerCoreRefForceMaxPostponeBurst") - ControllerCoreRefForceMaxPostponeBurst = string2bool(value); - else if (name == "ControllerCoreRefEnablePostpone") - ControllerCoreRefEnablePostpone = string2bool(value); - else if (name == "ControllerCoreRefEnablePullIn") - ControllerCoreRefEnablePullIn = string2bool(value); - else if (name == "ControllerCoreRefMaxPostponed") - ControllerCoreRefMaxPostponed = string2int(value); - else if (name == "ControllerCoreRefMaxPulledIn") - ControllerCoreRefMaxPulledIn = string2int(value); + numberOfMemChannels = std::stoul(value); else if (name == "ThermalSimulation") - ThermalSimulation = string2bool(value); + thermalSimulation = std::stoul(value); else if (name == "SimulationProgressBar") - SimulationProgressBar = string2bool(value); + simulationProgressBar = std::stoul(value); else if (name == "NumberOfDevicesOnDIMM") { - if (string2int(value) < 1) + numberOfDevicesOnDIMM = std::stoul(value); + if (numberOfDevicesOnDIMM == 0) SC_REPORT_FATAL("Configuration", ("Invalid value for parameter " + name + ". This parameter must be at least one.").c_str()); - else - NumberOfDevicesOnDIMM = string2int(value); } else if (name == "AddressOffset") { #ifdef DRAMSYS_GEM5 - AddressOffset = string2ull(value); + addressOffset = std::stoull(value); #else - AddressOffset = 0; + addressOffset = 0; #endif } else if (name == "UseMalloc") - UseMalloc = string2bool(value); + useMalloc = std::stoul(value); else if (name == "CheckTLM2Protocol") - CheckTLM2Protocol = string2bool(value); + checkTLM2Protocol = std::stoul(value); else if (name == "ECCControllerMode") - ECCMode = string2ECCControllerMode(value); + ECCMode = value; // Specification for ErrorChipSeed, ErrorCSVFile path and StoreMode else if (name == "ErrorChipSeed") - ErrorChipSeed = string2int(value); + errorChipSeed = std::stoul(value); else if (name == "ErrorCSVFile") - ErrorCSVFile = value; + errorCSVFile = value; else if (name == "StoreMode") StoreMode = string2StoreMode(value); // Temperature Simulation related @@ -289,7 +170,7 @@ void Configuration::setParameter(std::string name, std::string value) temperatureSim.TemperatureScale = value; } else if (name == "StaticTemperatureDefaultValue") - temperatureSim.StaticTemperatureDefaultValue = string2int(value); + temperatureSim.StaticTemperatureDefaultValue = std::stoi(value); else if (name == "ThermalSimPeriod") temperatureSim.ThermalSimPeriod = std::stod(value.c_str()); else if (name == "ThermalSimUnit") @@ -302,15 +183,15 @@ void Configuration::setParameter(std::string name, std::string value) else if (name == "IceServerIp") temperatureSim.IceServerIp = value; else if (name == "IceServerPort") - temperatureSim.IceServerPort = string2int(value); + temperatureSim.IceServerPort = std::stoul(value); else if (name == "SimPeriodAdjustFactor") temperatureSim.SimPeriodAdjustFactor = std::stoi(value.c_str()); else if (name == "NPowStableCyclesToIncreasePeriod") temperatureSim.NPowStableCyclesToIncreasePeriod = std::stoi(value.c_str()); else if (name == "GenerateTemperatureMap") - temperatureSim.GenerateTemperatureMap = string2bool(value); + temperatureSim.GenerateTemperatureMap = std::stoul(value); else if (name == "GeneratePowerMap") - temperatureSim.GeneratePowerMap = string2bool(value); + temperatureSim.GeneratePowerMap = std::stoul(value); else SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str()); @@ -351,7 +232,7 @@ std::uint64_t Configuration::getSimMemSizeInBytes() // 3. Calculate size of one DRAM chip in bytes std::uint64_t chipSize = chipBitSize / 8; // 4. Total memory size in Bytes of one DIMM (with only support of 1 rank on a DIMM) - std::uint64_t memorySize = chipSize * NumberOfDevicesOnDIMM; + std::uint64_t memorySize = chipSize * numberOfDevicesOnDIMM; std::cout << headline << std::endl; std::cout << "Per Channel Configuration:" << std::endl << std::endl; @@ -365,7 +246,7 @@ std::uint64_t Configuration::getSimMemSizeInBytes() std::cout << " Chip data bus width: " << bitWidth << std::endl; std::cout << " Chip size in bits: " << chipBitSize << std::endl; std::cout << " Chip Size in bytes: " << chipSize << std::endl; - std::cout << " Devices/Chips on DIMM: " << NumberOfDevicesOnDIMM << std::endl; + std::cout << " Devices/Chips on DIMM: " << numberOfDevicesOnDIMM << std::endl; std::cout << std::endl; assert(memorySize > 0); @@ -378,7 +259,7 @@ std::uint64_t Configuration::getSimMemSizeInBytes() // The bus width is given in bits, e.g., 64-bit data bus, 128-bit data bus, etc. unsigned int Configuration::getDataBusWidth() { - unsigned int dataBusWidth = memSpec->bitWidth * NumberOfDevicesOnDIMM; + unsigned int dataBusWidth = memSpec->bitWidth * numberOfDevicesOnDIMM; assert(dataBusWidth > 0); return dataBusWidth; } @@ -390,7 +271,7 @@ unsigned int Configuration::getBytesPerBurst() unsigned int bytesPerBurst = (memSpec->BurstLength * getDataBusWidth()) / 8; assert(bytesPerBurst > 0); - if (NumberOfDevicesOnDIMM > 1) { + if (numberOfDevicesOnDIMM > 1) { // The least significant bits of the physical address are the byte // offset of the N-byte-wide memory module (DIMM) (a single data word // or burst element has N bytes. N = 2^(# bits for byte offset)). @@ -402,36 +283,20 @@ unsigned int Configuration::getBytesPerBurst() return bytesPerBurst; } -bool Configuration::getRGRBank(unsigned int w) -{ - bool flg = w == 0 ? RGRB0 : w == 1 ? RGRB1 : w == 2 ? RGRB2 : w == 3 ? RGRB3 : w - == 4 ? RGRB4 : w == 5 ? RGRB5 : w == 6 ? RGRB6 : w == 7 ? RGRB7 : w == 8 ? RGRB8 - : w == 9 ? RGRB9 : w == 10 ? RGRB10 : w == 11 ? RGRB11 : w == 12 ? RGRB12 : w == - 13 ? RGRB13 : w == 14 ? RGRB14 : w == 15 ? RGRB15 : true; - return flg; -} -unsigned int Configuration::getNumAR(void) -{ - return NumAR; -} -unsigned int Configuration::getRowInc(void) -{ - return RowInc; -} - -unsigned int Configuration::getRefMode(void) -{ - return RefMode; -} - // Changes the number of bytes depeding on the ECC Controller. This function is needed for modules which get data directly or indirectly from the ECC Controller unsigned int Configuration::adjustNumBytesAfterECC(unsigned nBytes) { // Manipulate the number of bytes only if there is an ECC Controller selected - if (ECCMode == ECCControllerMode::Disabled) + if (ECCMode == "Disabled") return nBytes; - else { + else if (ECCMode == "Hamming") + { assert(pECC != nullptr); return pECC->AllocationSize(nBytes); } + else + { + SC_REPORT_FATAL("Configuration", ("ECC mode " + ECCMode + " unsupported").c_str()); + return 0; + } } diff --git a/DRAMSys/library/src/configuration/Configuration.h b/DRAMSys/library/src/configuration/Configuration.h index af4c8a28..6004f43c 100644 --- a/DRAMSys/library/src/configuration/Configuration.h +++ b/DRAMSys/library/src/configuration/Configuration.h @@ -50,10 +50,6 @@ enum class StorageMode {NoStorage, Store, ErrorModel}; -enum class EPowerDownMode {NoPowerDown, Staggered, TimeoutPDN, TimeoutSREF}; - -enum class ECCControllerMode {Disabled, Hamming}; - struct Configuration { static std::string memspecUri; @@ -63,68 +59,34 @@ struct Configuration DEF_SINGLETON(Configuration); // MCConfig: - bool BankwiseLogic = false; - unsigned int MaxNrOfTransactions = 8; - std::string pagePolicy; - std::string scheduler, cmdMux, respQueue; - unsigned int SJFProbability; - unsigned int RequestBufferSize; - unsigned int Capsize = 5; - sc_time getPowerDownTimeout() - { - return powerDownTimeoutInClk * memSpec->clk; - } - EPowerDownMode PowerDownMode = EPowerDownMode::Staggered; - bool ReadWriteGrouping = false; - bool ReorderBuffer = false; - + std::string pagePolicy = "Open"; + std::string scheduler = "Fifo"; + std::string cmdMux = "Oldest"; + std::string respQueue = "Fifo"; + unsigned int requestBufferSize = 8; + std::string refreshPolicy = "Rankwise"; + unsigned int refreshMode = 1; + unsigned int refreshMaxPostponed = 0; + unsigned int refreshMaxPulledin = 0; + std::string powerDownPolicy = "NoPowerDown"; + unsigned int powerDownTimeout = 3; // SimConfig - std::string SimulationName = "default"; - bool DatabaseRecording = true; - bool PowerAnalysis = false; - bool EnableWindowing = false; - unsigned int WindowSize = 1000; - bool Debug = false; - unsigned int NumberOfMemChannels = 1; - bool ControllerCoreRefDisable = false; - bool RowGranularRef = false; - bool RGRB0 = true; - bool RGRB1 = true; - bool RGRB2 = true; - bool RGRB3 = true; - bool RGRB4 = true; - bool RGRB5 = true; - bool RGRB6 = true; - bool RGRB7 = true; - bool RGRB8 = true; - bool RGRB9 = true; - bool RGRB10 = true; - bool RGRB11 = true; - bool RGRB12 = true; - bool RGRB13 = true; - bool RGRB14 = true; - bool RGRB15 = true; - unsigned int NumAR = 8192; - unsigned int RefMode = 1; - unsigned int RowInc = 1; - bool getRGRBank(unsigned int); - unsigned int getNumAR(void); - unsigned int getRowInc(void); - unsigned int getRefMode(void); - bool ControllerCoreRefForceMaxPostponeBurst = false; - bool ControllerCoreRefEnablePostpone = false; - bool ControllerCoreRefEnablePullIn = false; - unsigned int ControllerCoreRefMaxPostponed = 8; - unsigned int ControllerCoreRefMaxPulledIn = 8; - bool ThermalSimulation = false; - bool SimulationProgressBar = false; - unsigned int NumberOfDevicesOnDIMM = 1; - bool CheckTLM2Protocol = false; - ECCControllerMode ECCMode = ECCControllerMode::Disabled; + std::string simulationName = "default"; + bool databaseRecording = false; + bool powerAnalysis = false; + bool enableWindowing = false; + unsigned int windowSize = 1000; + bool debug = false; + unsigned int numberOfMemChannels = 1; + bool thermalSimulation = false; + bool simulationProgressBar = false; + unsigned int numberOfDevicesOnDIMM = 8; + bool checkTLM2Protocol = false; + std::string ECCMode = "Disabled"; ECCBaseClass *pECC = nullptr; bool gem5 = false; - bool UseMalloc = false; - unsigned long long int AddressOffset = 0; + bool useMalloc = false; + unsigned long long int addressOffset = 0; // MemSpec (from DRAM-Power XML) MemSpec *memSpec; @@ -133,8 +95,8 @@ struct Configuration void setParameters(std::map parameterMap); //Configs for Seed, csv file and StorageMode - unsigned int ErrorChipSeed; - std::string ErrorCSVFile = "not defined."; + unsigned int errorChipSeed; + std::string errorCSVFile = "not defined."; StorageMode StoreMode; // Temperature Simulation related @@ -146,10 +108,6 @@ struct Configuration unsigned int adjustNumBytesAfterECC(unsigned bytes); void setPathToResources(std::string path); std::string getPathToResources(); - -private: - Configuration() {} - unsigned int powerDownTimeoutInClk = 3; }; #endif // CONFIGURATION_H diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index 29a46b3e..d0bf8cfa 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -318,18 +318,18 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) memSpec->tCCD_S = clk * queryUIntParameter(timings, "CCD_S"); memSpec->tCCD_L = clk * queryUIntParameter(timings, "CCD_L"); memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - unsigned refMode = Configuration::getInstance().getRefMode(); - if (refMode == 1) + unsigned refreshMode = Configuration::getInstance().refreshMode; + if (refreshMode == 1) { memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); } - else if (refMode == 2) + else if (refreshMode == 2) { memSpec->tREFI = clk * (queryUIntParameter(timings, "REFI") / 2); memSpec->tRFC = clk * queryUIntParameter(timings, "RFC2"); } - else if (refMode == 4) + else if (refreshMode == 4) { memSpec->tREFI = clk * (queryUIntParameter(timings, "REFI") / 2); memSpec->tRFC = clk * queryUIntParameter(timings, "RFC4"); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 9585157b..80d5d3df 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -53,7 +53,7 @@ #include "cmdmux/CmdMuxOldest.h" #include "respqueue/RespQueueFifo.h" #include "respqueue/RespQueueReorder.h" -#include "refresh/RefreshManager.h" +#include "refresh/RefreshManagerRankwise.h" #include "refresh/RefreshManagerDummy.h" #include "refresh/RefreshManagerBankwise.h" #include "powerdown/PowerDownManagerStaggered.h" @@ -103,9 +103,9 @@ Controller::Controller(sc_module_name name) : SC_REPORT_FATAL("Controller", "Selected scheduler not supported!"); if (config.cmdMux == "Oldest") - commandMux = new CmdMuxOldest(); + cmdMux = new CmdMuxOldest(); else if (config.cmdMux == "Strict") - commandMux = new CmdMuxStrict(); + cmdMux = new CmdMuxStrict(); else SC_REPORT_FATAL("Controller", "Selected cmdmux not supported!"); @@ -147,7 +147,7 @@ Controller::Controller(sc_module_name name) : } // instantiate power-down managers (one per rank) - if (config.PowerDownMode == EPowerDownMode::NoPowerDown) + if (config.powerDownPolicy == "NoPowerDown") { for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) { @@ -155,7 +155,7 @@ Controller::Controller(sc_module_name name) : powerDownManagers.push_back(manager); } } - else if (config.PowerDownMode == EPowerDownMode::Staggered) + else if (config.powerDownPolicy == "Staggered") { for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) { @@ -169,12 +169,22 @@ Controller::Controller(sc_module_name name) : SC_REPORT_FATAL("Controller", "Selected power-down mode not supported!"); // instantiate refresh managers (one per rank) - if (config.ControllerCoreRefDisable) + if (config.refreshPolicy == "NoRefresh") { for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) refreshManagers.push_back(new RefreshManagerDummy()); } - else if (config.BankwiseLogic) + else if (config.refreshPolicy == "Rankwise") + { + for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + { + RefreshManagerIF *manager = new RefreshManagerRankwise + (bankMachinesOnRank[rankID], powerDownManagers[rankID], Rank(rankID), checker); + refreshManagers.push_back(manager); + controllerEvent.notify(manager->start()); + } + } + else if (config.refreshPolicy == "Bankwise") { for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) { @@ -186,15 +196,7 @@ Controller::Controller(sc_module_name name) : } } else - { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) - { - RefreshManagerIF *manager = new RefreshManager - (bankMachinesOnRank[rankID], powerDownManagers[rankID], Rank(rankID), checker); - refreshManagers.push_back(manager); - controllerEvent.notify(manager->start()); - } - } + SC_REPORT_FATAL("Controller", "Selected refresh mode not supported!"); startBandwidthIdleCollector(); } @@ -210,7 +212,7 @@ Controller::~Controller() delete it; for (auto it : bankMachines) delete it; - delete commandMux; + delete cmdMux; delete scheduler; delete checker; } @@ -289,7 +291,7 @@ void Controller::controllerMethod() bool readyCmdBlocked = false; if (!readyCommands.empty()) { - commandPair = commandMux->selectCommand(readyCommands); + commandPair = cmdMux->selectCommand(readyCommands); if (commandPair.second != nullptr) // can happen with FIFO strict { Rank rank = DramExtension::getRank(commandPair.second); diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index 391a22cb..f9ab37f9 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -87,7 +87,7 @@ private: std::vector bankMachines; std::vector> bankMachinesOnRank; - CmdMuxIF *commandMux; + CmdMuxIF *cmdMux; SchedulerIF *scheduler; CheckerIF *checker; RespQueueIF *respQueue; diff --git a/DRAMSys/library/src/controller/GenericController.h b/DRAMSys/library/src/controller/GenericController.h index 896d6fcd..113b3dbc 100644 --- a/DRAMSys/library/src/controller/GenericController.h +++ b/DRAMSys/library/src/controller/GenericController.h @@ -37,7 +37,7 @@ public: // BusWidth e.g. 8 or 64 * Configuration::getInstance().memSpec->bitWidth // Number of devices on a DIMM e.g. 8 - * Configuration::getInstance().NumberOfDevicesOnDIMM ) / ( 1024 ); + * Configuration::getInstance().numberOfDevicesOnDIMM ) / ( 1024 ); std::cout << name() << std::string(" Total Time: ") << sc_time_stamp().to_string() diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 9d9f64aa..899d93e3 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -53,10 +53,8 @@ RefreshManagerBankwise::RefreshManagerBankwise(std::vector &bankM } remainingBankMachines = allBankMachines; - if (config.ControllerCoreRefEnablePostpone) - maxPostponed = config.ControllerCoreRefMaxPostponed * memSpec->BanksPerRank; - if (config.ControllerCoreRefEnablePullIn) - maxPulledin = -(config.ControllerCoreRefMaxPulledIn * memSpec->BanksPerRank); + maxPostponed = config.refreshMaxPostponed * memSpec->BanksPerRank; + maxPulledin = -(config.refreshMaxPulledin * memSpec->BanksPerRank); } std::pair RefreshManagerBankwise::getNextCommand() diff --git a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp similarity index 90% rename from DRAMSys/library/src/controller/refresh/RefreshManager.cpp rename to DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index 3f2f9801..68a20b61 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -32,12 +32,12 @@ * Author: Lukas Steiner */ -#include "RefreshManager.h" +#include "RefreshManagerRankwise.h" #include "../../common/dramExtensions.h" #include "../../configuration/Configuration.h" #include "../../common/utils.h" -RefreshManager::RefreshManager(std::vector &bankMachines, +RefreshManagerRankwise::RefreshManagerRankwise(std::vector &bankMachines, PowerDownManagerIF *powerDownManager, Rank rank, CheckerIF *checker) : bankMachines(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) { @@ -46,23 +46,21 @@ RefreshManager::RefreshManager(std::vector &bankMachines, timeForNextTrigger = memSpec->getRefreshIntervalAB(); setUpDummy(refreshPayload, rank); - if (config.ControllerCoreRefEnablePostpone) - maxPostponed = config.ControllerCoreRefMaxPostponed; - if (config.ControllerCoreRefEnablePullIn) - maxPulledin = -config.ControllerCoreRefMaxPulledIn; + maxPostponed = config.refreshMaxPostponed; + maxPulledin = -config.refreshMaxPulledin; } -void RefreshManager::notifyActive() +void RefreshManagerRankwise::notifyActive() { controllerIdle = false; } -void RefreshManager::notifyIdle() +void RefreshManagerRankwise::notifyIdle() { controllerIdle = true; } -std::pair RefreshManager::getNextCommand() +std::pair RefreshManagerRankwise::getNextCommand() { if (sc_time_stamp() == timeToSchedule) return std::pair(nextCommand, &refreshPayload); @@ -70,7 +68,7 @@ std::pair RefreshManager::getNextCommand() return std::pair(Command::NOP, nullptr); } -sc_time RefreshManager::start() +sc_time RefreshManagerRankwise::start() { timeToSchedule = sc_max_time(); @@ -131,7 +129,7 @@ sc_time RefreshManager::start() return timeForNextTrigger; } -void RefreshManager::updateState(Command command, tlm_generic_payload *) +void RefreshManagerRankwise::updateState(Command command, tlm_generic_payload *) { if (command == Command::ACT) activatedBanks++; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManager.h b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h similarity index 91% rename from DRAMSys/library/src/controller/refresh/RefreshManager.h rename to DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h index e6a2942a..c6e6786d 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManager.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h @@ -32,8 +32,8 @@ * Author: Lukas Steiner */ -#ifndef REFRESHMANAGER_H -#define REFRESHMANAGER_H +#ifndef REFRESHMANAGERRANKWISE_H +#define REFRESHMANAGERRANKWISE_H #include "RefreshManagerIF.h" #include "../../configuration/memspec/MemSpec.h" @@ -43,10 +43,10 @@ using namespace tlm; -class RefreshManager final : public RefreshManagerIF +class RefreshManagerRankwise final : public RefreshManagerIF { public: - RefreshManager(std::vector &, PowerDownManagerIF *, Rank, CheckerIF *); + RefreshManagerRankwise(std::vector &, PowerDownManagerIF *, Rank, CheckerIF *); virtual std::pair getNextCommand() override; virtual sc_time start() override; @@ -77,4 +77,4 @@ private: bool sleeping = false; }; -#endif // REFRESHMANAGER_H +#endif // REFRESHMANAGERRANKWISE_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index dba1ffb2..47b67b86 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -38,12 +38,12 @@ SchedulerFifo::SchedulerFifo() { buffer = std::vector> (Configuration::getInstance().memSpec->NumberOfBanks); - maxNumberOfRequests = Configuration::getInstance().MaxNrOfTransactions; + requestBufferSize = Configuration::getInstance().requestBufferSize; } bool SchedulerFifo::hasBufferSpace(tlm_generic_payload *payload) { - if (buffer[DramExtension::getBank(payload).ID()].size() < maxNumberOfRequests) + if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) return true; else return false; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h index 42761560..3acee039 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h @@ -56,7 +56,7 @@ public: virtual bool hasFurtherRequest(Bank) override; private: std::vector> buffer; - unsigned maxNumberOfRequests; + unsigned requestBufferSize; }; #endif // SCHEDULERFIFO_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 3003f967..667430d7 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -40,12 +40,12 @@ SchedulerFrFcfs::SchedulerFrFcfs() { buffer = std::vector> (Configuration::getInstance().memSpec->NumberOfBanks); - maxNumberOfRequests = Configuration::getInstance().MaxNrOfTransactions; + requestBufferSize = Configuration::getInstance().requestBufferSize; } bool SchedulerFrFcfs::hasBufferSpace(tlm_generic_payload *payload) { - if (buffer[DramExtension::getBank(payload).ID()].size() < maxNumberOfRequests) + if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) return true; else return false; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h index 8e123e0d..c0250513 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h @@ -56,7 +56,7 @@ public: virtual bool hasFurtherRequest(Bank) override; private: std::vector> buffer; - unsigned maxNumberOfRequests; + unsigned requestBufferSize; }; #endif // SCHEDULERFRFCFS_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp index 67f7f77e..109fd78d 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp @@ -38,12 +38,12 @@ SchedulerFrFcfsGrp::SchedulerFrFcfsGrp() { buffer = std::vector> (Configuration::getInstance().memSpec->NumberOfBanks); - maxNumberOfRequests = Configuration::getInstance().MaxNrOfTransactions; + requestBufferSize = Configuration::getInstance().requestBufferSize; } bool SchedulerFrFcfsGrp::hasBufferSpace(tlm_generic_payload *payload) { - if (buffer[DramExtension::getBank(payload).ID()].size() < maxNumberOfRequests) + if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) return true; else return false; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h index 50537fc6..0b7418df 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h @@ -57,7 +57,7 @@ public: virtual bool hasFurtherRequest(Bank) override; private: std::vector> buffer; - unsigned maxNumberOfRequests; + unsigned requestBufferSize; tlm_command lastCommand = TLM_READ_COMMAND; }; diff --git a/DRAMSys/library/src/error/errormodel.cpp b/DRAMSys/library/src/error/errormodel.cpp index b23b8dff..6a14a16f 100644 --- a/DRAMSys/library/src/error/errormodel.cpp +++ b/DRAMSys/library/src/error/errormodel.cpp @@ -43,8 +43,8 @@ void errorModel::init() { - powerAnalysis = Configuration::getInstance().PowerAnalysis; - thermalSim = Configuration::getInstance().ThermalSimulation; + powerAnalysis = Configuration::getInstance().powerAnalysis; + thermalSim = Configuration::getInstance().thermalSimulation; // Get Configuration parameters: burstLenght = Configuration::getInstance().memSpec->BurstLength; numberOfColumns = Configuration::getInstance().memSpec->NumberOfColumns; @@ -514,7 +514,7 @@ double errorModel::getTemperature() void errorModel::parseInputData() { - std::string fileName = Configuration::getInstance().ErrorCSVFile; + std::string fileName = Configuration::getInstance().errorCSVFile; std::ifstream inputFile(fileName); if (inputFile.is_open()) { diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index f275e057..18b62a4a 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -48,7 +48,7 @@ Arbiter::Arbiter(sc_module_name name) : // Anytime an transaction comes from a memory unity to the arbiter the "bw" callback is called. iSocket.register_nb_transport_bw(this, &Arbiter::nb_transport_bw); - for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; ++i) + for (size_t i = 0; i < Configuration::getInstance().numberOfMemChannels; ++i) { channelIsFree.push_back(true); pendingRequests.push_back(queue()); @@ -74,7 +74,7 @@ tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, { // adjust address offset: payload.set_address(payload.get_address() - - Configuration::getInstance().AddressOffset); + Configuration::getInstance().addressOffset); // In the begin request phase the socket ID is appended to the payload. // It will extracted from the payload and used later. @@ -112,7 +112,7 @@ unsigned int Arbiter::transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans) { // adjust address offset: trans.set_address(trans.get_address() - - Configuration::getInstance().AddressOffset); + Configuration::getInstance().addressOffset); DecodedAddress decodedAddress = AddressDecoder::getInstance().decodeAddress( trans.get_address()); @@ -127,7 +127,7 @@ void Arbiter::peqCallback(tlm_generic_payload &payload, const tlm_phase &phase) // Check the valid range of initiatorSocket ID and channel Id // TODO: initiatorSocket ID not checked - assert(channelId < Configuration::getInstance().NumberOfMemChannels); + assert(channelId < Configuration::getInstance().numberOfMemChannels); // Phases initiated by the intiator side from arbiter's point of view (devices performing memory requests to the arbiter) if (phase == BEGIN_REQ) diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index f705a6fc..5224d926 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -134,12 +134,12 @@ DRAMSys::DRAMSys(sc_module_name name, AddressDecoder::getInstance().print(); // Setup the debug manager: - setupDebugManager(Configuration::getInstance().SimulationName); + setupDebugManager(Configuration::getInstance().simulationName); // If a simulation file is passed as argument to DRAMSys the simulation ID // is prepended to the simulation name if found. std::string simName; - simName = Configuration::getInstance().SimulationName; + simName = Configuration::getInstance().simulationName; tinyxml2::XMLDocument simulationdoc; loadXML(simulationToRun, simulationdoc); tinyxml2::XMLElement *simulation = @@ -151,7 +151,7 @@ DRAMSys::DRAMSys(sc_module_name name, if (r != NULL) { std::string sid; sid = r; - simName = sid + '_' + Configuration::getInstance().SimulationName; + simName = sid + '_' + Configuration::getInstance().simulationName; } } } @@ -196,7 +196,7 @@ void DRAMSys::setupTlmRecorders(const string &traceName, { // Create TLM Recorders, one per channel. for (size_t i = 0; - i < Configuration::getInstance().NumberOfMemChannels; + i < Configuration::getInstance().numberOfMemChannels; i++) { std::string sqlScriptURI = pathToResources + string("scripts/createTraceDB.sql"); @@ -213,7 +213,7 @@ void DRAMSys::setupTlmRecorders(const string &traceName, tlmRecorder->recordMCconfig(Configuration::getInstance().mcconfigUri); tlmRecorder->recordMemspec(Configuration::getInstance().memspecUri); - std::string traceNames = Configuration::getInstance().SimulationName; + std::string traceNames = Configuration::getInstance().simulationName; tlmRecorder->recordTracenames(traceNames); tlmRecorders.push_back(tlmRecorder); @@ -229,19 +229,17 @@ void DRAMSys::instantiateModules(const string &traceName, // Create and properly initialize TLM recorders. // They need to be ready before creating some modules. - bool recordingEnabled = Configuration::getInstance().DatabaseRecording; + bool recordingEnabled = Configuration::getInstance().databaseRecording; if (recordingEnabled) setupTlmRecorders(traceName, pathToResources); // Create new ECC Controller - switch (Configuration::getInstance().ECCMode) { - case ECCControllerMode::Hamming: + if (Configuration::getInstance().ECCMode == "Hamming") ecc = new ECCHamming("ECCHamming"); - break; - default: + else if (Configuration::getInstance().ECCMode == "Disabled") ecc = nullptr; - break; - } + else + SC_REPORT_FATAL("DRAMSys", "Unsupported ECC mode"); // Save ECC Controller into the configuration struct to adjust it dynamically Configuration::getInstance().pECC = ecc; @@ -251,7 +249,7 @@ void DRAMSys::instantiateModules(const string &traceName, // Create DRAM std::string memoryType = Configuration::getInstance().memSpec->MemoryType; - for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) + for (size_t i = 0; i < Configuration::getInstance().numberOfMemChannels; i++) { std::string str = "controller" + std::to_string(i); @@ -329,12 +327,11 @@ void DRAMSys::instantiateModules(const string &traceName, dram = new DramGDDR6(str.c_str()); } else - { SC_REPORT_FATAL("DRAMSys", "Unsupported DRAM type"); - } + drams.push_back(dram); - if (Configuration::getInstance().CheckTLM2Protocol) { + if (Configuration::getInstance().checkTLM2Protocol) { str = "TLMCheckerController" + std::to_string(i); tlm_utils::tlm2_base_protocol_checker<> *controllerTlmChecker = new tlm_utils::tlm2_base_protocol_checker<>(str.c_str()); @@ -346,17 +343,20 @@ void DRAMSys::instantiateModules(const string &traceName, void DRAMSys::bindSockets() { // If ECC Controller enabled, put it between Trace and arbiter - if (Configuration::getInstance().ECCMode != ECCControllerMode::Disabled) { + if (Configuration::getInstance().ECCMode == "Hamming") + { assert(ecc != nullptr); tSocket.bind(ecc->t_socket); ecc->i_socket.bind(arbiter->tSocket); - } else { - tSocket.bind(arbiter->tSocket); } + else if (Configuration::getInstance().ECCMode == "Disabled") + tSocket.bind(arbiter->tSocket); + else + SC_REPORT_FATAL("DRAMSys", "Unsupported ECC mode"); - if (Configuration::getInstance().CheckTLM2Protocol) { + if (Configuration::getInstance().checkTLM2Protocol) { for (size_t i = 0; - i < Configuration::getInstance().NumberOfMemChannels; + i < Configuration::getInstance().numberOfMemChannels; i++) { arbiter->iSocket.bind(controllersTlmCheckers[i]->target_socket); controllersTlmCheckers[i]->initiator_socket.bind( @@ -365,7 +365,7 @@ void DRAMSys::bindSockets() } } else { for (size_t i = 0; - i < Configuration::getInstance().NumberOfMemChannels; + i < Configuration::getInstance().numberOfMemChannels; i++) { arbiter->iSocket.bind(controllers[i]->tSocket); controllers[i]->iSocket.bind(drams[i]->tSocket); diff --git a/DRAMSys/library/src/simulation/TemperatureController.h b/DRAMSys/library/src/simulation/TemperatureController.h index aeb02e00..a0ecc5b3 100644 --- a/DRAMSys/library/src/simulation/TemperatureController.h +++ b/DRAMSys/library/src/simulation/TemperatureController.h @@ -61,7 +61,7 @@ public: SC_CTOR(TemperatureController) { temperatureScale = Configuration::getInstance().temperatureSim.TemperatureScale; - dynamicTempSimEnabled = Configuration::getInstance().ThermalSimulation; + dynamicTempSimEnabled = Configuration::getInstance().thermalSimulation; staticTemperature = Configuration::getInstance().temperatureSim.StaticTemperatureDefaultValue; diff --git a/DRAMSys/library/src/simulation/TracePlayer.cpp b/DRAMSys/library/src/simulation/TracePlayer.cpp index f9aa8fb6..1b660c22 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.cpp +++ b/DRAMSys/library/src/simulation/TracePlayer.cpp @@ -85,7 +85,7 @@ void TracePlayer::peqCallback(tlm_generic_payload &payload, } else if (phase == BEGIN_RESP) { payload.release(); sendToTarget(payload, END_RESP, SC_ZERO_TIME); - if (Configuration::getInstance().SimulationProgressBar) + if (Configuration::getInstance().simulationProgressBar) listener->transactionFinished(); transactionsReceived++; diff --git a/DRAMSys/library/src/simulation/TraceSetup.cpp b/DRAMSys/library/src/simulation/TraceSetup.cpp index 79a241d6..53922968 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.cpp +++ b/DRAMSys/library/src/simulation/TraceSetup.cpp @@ -97,7 +97,7 @@ traceSetup::traceSetup(std::string uri, } devices->push_back(player); - if (Configuration::getInstance().SimulationProgressBar) { + if (Configuration::getInstance().simulationProgressBar) { totalTransactions += player->getNumberOfLines(stlFile); } } diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index b23e9c58..5f2577df 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -73,7 +73,7 @@ Dram::Dram(sc_module_name name) : sc_module(name), tSocket("socket") uint64_t memorySize = Configuration::getInstance().getSimMemSizeInBytes(); if (StoreMode == StorageMode::Store) { - if (Configuration::getInstance().UseMalloc) + if (Configuration::getInstance().useMalloc) { memory = (unsigned char *)malloc(memorySize); if (!memory) @@ -97,13 +97,13 @@ Dram::Dram(sc_module_name name) : sc_module(name), tSocket("socket") Dram::~Dram() { - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { libDRAMPower *DRAMPower = dynamic_cast(this->DRAMPower); if (DRAMPower == nullptr) SC_REPORT_FATAL("Dram", "Power Analysis active but libDRAMPowerIF instantiated"); - if (!Configuration::getInstance().DatabaseRecording) + if (!Configuration::getInstance().databaseRecording) DRAMPower->calcEnergy(); // Print the final total energy and the average power for @@ -111,19 +111,19 @@ Dram::~Dram() std::cout << name() << std::string(" Total Energy: ") << std::fixed << std::setprecision( 2 ) << DRAMPower->getEnergy().total_energy - * Configuration::getInstance().NumberOfDevicesOnDIMM + * Configuration::getInstance().numberOfDevicesOnDIMM << std::string(" pJ") << std::endl; std::cout << name() << std::string(" Average Power: ") << std::fixed << std::setprecision( 2 ) << DRAMPower->getPower().average_power - * Configuration::getInstance().NumberOfDevicesOnDIMM + * Configuration::getInstance().numberOfDevicesOnDIMM << std::string(" mW") << std::endl; } delete DRAMPower; - if (Configuration::getInstance().UseMalloc) + if (Configuration::getInstance().useMalloc) free(memory); } diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index bcdb03eb..199f2ce5 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -50,7 +50,7 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramDDR3", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { sc_time clk = memSpec->clk; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index 7fb03743..db8378d0 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -50,7 +50,7 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramDDR4", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { sc_time clk = memSpec->clk; diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp index 3e580346..af72caa0 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp @@ -50,7 +50,7 @@ DramGDDR5::DramGDDR5(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramGDDR5", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramGDDR5", "DRAMPower not supported for GDDR5"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp index a3f492e7..3f935863 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp @@ -50,7 +50,7 @@ DramGDDR5X::DramGDDR5X(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramGDDR5X", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramGDDR5X", "DRAMPower not supported for GDDR5X"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp index 8260db52..de6254c1 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp @@ -50,7 +50,7 @@ DramGDDR6::DramGDDR6(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramGDDR6", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramGDDR6", "DRAMPower not supported for GDDR6"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp index 3ee73ea0..2d1b907b 100644 --- a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp @@ -50,7 +50,7 @@ DramHBM2::DramHBM2(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramHBM2", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramHBM2", "DRAMPower not supported for HBM2"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp index 38df1da5..43f85278 100644 --- a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp @@ -50,7 +50,7 @@ DramLPDDR4::DramLPDDR4(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramLPDDR4", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramLPDDR4", "DRAMPower not supported for LPDDR4"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index 97c03e38..e08c764b 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -57,7 +57,7 @@ DramRecordable::DramRecordable(sc_module_name name, TlmRecorder *tlmRe { // Create a thread that is triggered every $powerWindowSize // to generate a Power over Time plot in the Trace analyzer: - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { DRAMPower = dynamic_cast(Dram::DRAMPower); if (DRAMPower == nullptr) @@ -69,12 +69,12 @@ DramRecordable::DramRecordable(sc_module_name name, TlmRecorder *tlmRe template DramRecordable::~DramRecordable() { - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { DRAMPower->calcEnergy(); tlmRecorder->recordPower(sc_time_stamp().to_seconds(), DRAMPower->getPower().window_average_power - * Configuration::getInstance().NumberOfDevicesOnDIMM); + * Configuration::getInstance().numberOfDevicesOnDIMM); } tlmRecorder->closeConnection(); } @@ -133,15 +133,15 @@ void DramRecordable::powerWindow() // Store the time (in seconds) and the current average power (in mW) into the database tlmRecorder->recordPower(sc_time_stamp().to_seconds(), DRAMPower->getPower().window_average_power - * Configuration::getInstance().NumberOfDevicesOnDIMM); + * Configuration::getInstance().numberOfDevicesOnDIMM); // Here considering that DRAMPower provides the energy in pJ and the power in mW PRINTDEBUGMESSAGE(this->name(), string("\tWindow Energy: \t") + to_string( DRAMPower->getEnergy().window_energy * - Configuration::getInstance().NumberOfDevicesOnDIMM) + string("\t[pJ]")); + Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[pJ]")); PRINTDEBUGMESSAGE(this->name(), string("\tWindow Average Power: \t") + to_string( DRAMPower->getPower().window_average_power * - Configuration::getInstance().NumberOfDevicesOnDIMM) + string("\t[mW]")); + Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[mW]")); } while (true); } diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.h b/DRAMSys/library/src/simulation/dram/DramRecordable.h index c11f9a81..bb83826b 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.h +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.h @@ -59,7 +59,7 @@ private: libDRAMPower *DRAMPower; sc_time powerWindowSize = Configuration::getInstance().memSpec->clk * - Configuration::getInstance().WindowSize; + Configuration::getInstance().windowSize; // When working with floats, we have to decide ourselves what is an // acceptable definition for "equal". Here the number is compared with a diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index 1ee85597..dda63013 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -52,7 +52,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramWideIO", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) { sc_time clk = memSpec->clk; diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp index dde791fa..3e76d8d1 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp @@ -50,7 +50,7 @@ DramWideIO2::DramWideIO2(sc_module_name name) : Dram(name) if (memSpec == nullptr) SC_REPORT_FATAL("DramWideIO2", "Wrong MemSpec chosen"); - if (Configuration::getInstance().PowerAnalysis) + if (Configuration::getInstance().powerAnalysis) SC_REPORT_FATAL("DramWideIO2", "DRAMPower not supported for WideIO2"); else DRAMPower = new libDRAMPowerDummy(); diff --git a/DRAMSys/simulator/main.cpp b/DRAMSys/simulator/main.cpp index 0cd387ac..3598536b 100644 --- a/DRAMSys/simulator/main.cpp +++ b/DRAMSys/simulator/main.cpp @@ -94,7 +94,7 @@ int sc_main(int argc, char **argv) // Bind STL Players with DRAMSys: for (size_t i = 0; i < players.size(); i++) { - if(Configuration::getInstance().CheckTLM2Protocol) + if(Configuration::getInstance().checkTLM2Protocol) { string str = "TLMCheckerPlayer" + std::to_string(i); tlm_utils::tlm2_base_protocol_checker<> *playerTlmChecker = From e306c6c1186ac1fdccbec153c45c1441454c396b Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Thu, 26 Mar 2020 17:38:15 +0100 Subject: [PATCH 07/23] More updates of configuration. --- DRAMSys/library/CMakeLists.txt | 1 + .../src/configuration/Configuration.cpp | 29 +------------------ .../library/src/configuration/Configuration.h | 4 +-- DRAMSys/library/src/simulation/StlPlayer.h | 6 ++-- .../library/src/simulation/TracePlayer.cpp | 9 +++--- DRAMSys/library/src/simulation/TracePlayer.h | 9 +++--- DRAMSys/library/src/simulation/dram/Dram.cpp | 29 ++++++++++++------- DRAMSys/library/src/simulation/dram/Dram.h | 3 +- .../library/src/simulation/dram/DramDDR3.cpp | 2 +- .../library/src/simulation/dram/DramDDR4.cpp | 2 +- .../library/src/simulation/dram/DramGDDR5.cpp | 2 +- .../src/simulation/dram/DramGDDR5X.cpp | 2 +- .../library/src/simulation/dram/DramGDDR6.cpp | 2 +- .../library/src/simulation/dram/DramHBM2.cpp | 2 +- .../src/simulation/dram/DramLPDDR4.cpp | 2 +- .../src/simulation/dram/DramWideIO.cpp | 24 +++++++-------- .../src/simulation/dram/DramWideIO2.cpp | 2 +- 17 files changed, 55 insertions(+), 75 deletions(-) diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index 1593d159..5df9597d 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -146,6 +146,7 @@ add_library(DRAMSysLibrary src/simulation/TemperatureController.cpp src/simulation/TracePlayer.cpp src/simulation/TraceSetup.cpp + src/simulation/StlPlayer.h src/simulation/dram/Dram.cpp src/simulation/dram/DramRecordable.cpp diff --git a/DRAMSys/library/src/configuration/Configuration.cpp b/DRAMSys/library/src/configuration/Configuration.cpp index e8357d6e..d443543c 100644 --- a/DRAMSys/library/src/configuration/Configuration.cpp +++ b/DRAMSys/library/src/configuration/Configuration.cpp @@ -47,20 +47,6 @@ using namespace std; string Configuration::memspecUri = ""; string Configuration::mcconfigUri = ""; -StorageMode string2StoreMode(string s) -{ - if (s == "NoStorage") - return StorageMode::NoStorage; - else if (s == "Store") - return StorageMode::Store; - else if (s == "ErrorModel") - return StorageMode::ErrorModel; - else { - SC_REPORT_FATAL("Configuration", ("Unknown StorageMode: " + s).c_str()); - throw; - } -} - enum sc_time_unit string2TimeUnit(string s) { if (s == "s") @@ -160,7 +146,7 @@ void Configuration::setParameter(std::string name, std::string value) else if (name == "ErrorCSVFile") errorCSVFile = value; else if (name == "StoreMode") - StoreMode = string2StoreMode(value); + storeMode = value; // Temperature Simulation related else if (name == "TemperatureScale") { @@ -203,19 +189,6 @@ void Configuration::setPathToResources(std::string path) temperatureSim.setPathToResources(path); } -std::string Configuration::getPathToResources() -{ - return pathToResources; -} -// TODO: Never used -void Configuration::setParameters(std::map - parameterMap) -{ - for (auto item : parameterMap) { - setParameter(item.first, item.second); - } -} - // Returns the total memory size in bytes std::uint64_t Configuration::getSimMemSizeInBytes() { diff --git a/DRAMSys/library/src/configuration/Configuration.h b/DRAMSys/library/src/configuration/Configuration.h index 6004f43c..69fb9fec 100644 --- a/DRAMSys/library/src/configuration/Configuration.h +++ b/DRAMSys/library/src/configuration/Configuration.h @@ -92,12 +92,11 @@ struct Configuration MemSpec *memSpec; void setParameter(std::string name, std::string value); - void setParameters(std::map parameterMap); //Configs for Seed, csv file and StorageMode unsigned int errorChipSeed; std::string errorCSVFile = "not defined."; - StorageMode StoreMode; + std::string storeMode; // Temperature Simulation related TemperatureSimConfig temperatureSim; @@ -107,7 +106,6 @@ struct Configuration unsigned int getBytesPerBurst(); unsigned int adjustNumBytesAfterECC(unsigned bytes); void setPathToResources(std::string path); - std::string getPathToResources(); }; #endif // CONFIGURATION_H diff --git a/DRAMSys/library/src/simulation/StlPlayer.h b/DRAMSys/library/src/simulation/StlPlayer.h index e45e1233..3e228417 100644 --- a/DRAMSys/library/src/simulation/StlPlayer.h +++ b/DRAMSys/library/src/simulation/StlPlayer.h @@ -66,8 +66,6 @@ public: this->lineCnt = 0; } - - void nextPayload() { std::string line; @@ -136,8 +134,8 @@ public: unsigned long long addr = std::stoull(address.c_str(), 0, 16); // Get the data if necessary. - if (Configuration::getInstance().StoreMode != StorageMode::NoStorage - && cmd != TLM_READ_COMMAND) { + if (storageEnabled && cmd == TLM_WRITE_COMMAND) + { // The input trace file must provide the data to be stored into the memory. iss >> dataStr; if (dataStr.empty()) diff --git a/DRAMSys/library/src/simulation/TracePlayer.cpp b/DRAMSys/library/src/simulation/TracePlayer.cpp index 1b660c22..a47fbb3a 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.cpp +++ b/DRAMSys/library/src/simulation/TracePlayer.cpp @@ -41,13 +41,12 @@ TracePlayer::TracePlayer(sc_module_name name, TracePlayerListener *listener) : sc_module(name), payloadEventQueue(this, &TracePlayer::peqCallback), - numberOfTransactions(0), - transactionsSent(0), - transactionsReceived(0), - listener(listener), - finished(false) + listener(listener) { iSocket.register_nb_transport_bw(this, &TracePlayer::nb_transport_bw); + + if (Configuration::getInstance().storeMode != "NoStorage") + storageEnabled = true; } gp *TracePlayer::allocatePayload() diff --git a/DRAMSys/library/src/simulation/TracePlayer.h b/DRAMSys/library/src/simulation/TracePlayer.h index b866e5ce..4bb1fdbd 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.h +++ b/DRAMSys/library/src/simulation/TracePlayer.h @@ -70,7 +70,8 @@ protected: void finish(); void terminate(); void setNumberOfTransactions(unsigned int n); - unsigned int numberOfTransactions; + unsigned int numberOfTransactions = 0; + bool storageEnabled; private: tlm_sync_enum nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, @@ -79,10 +80,10 @@ private: void sendToTarget(tlm_generic_payload &payload, const tlm_phase &phase, const sc_time &delay); MemoryManager memoryManager; - unsigned int transactionsSent; - unsigned int transactionsReceived; + unsigned int transactionsSent = 0; + unsigned int transactionsReceived = 0; TracePlayerListener *listener; - bool finished; + bool finished = false; }; #endif // TRACEPLAYER_H diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index 5f2577df..ed0ffc01 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -66,12 +66,21 @@ using namespace DRAMPower; Dram::Dram(sc_module_name name) : sc_module(name), tSocket("socket") { + Configuration &config = Configuration::getInstance(); // Adjust number of bytes per burst dynamically to the selected ecc controller - // TODO: ECC only used for WideIO? - bytesPerBurst = Configuration::getInstance().adjustNumBytesAfterECC(bytesPerBurst); + bytesPerBurst = config.adjustNumBytesAfterECC(bytesPerBurst); + + if (config.storeMode == "NoStorage") + storeMode = StorageMode::NoStorage; + else if (config.storeMode == "Store") + storeMode = StorageMode::Store; + else if (config.storeMode == "ErrorModel") + storeMode = StorageMode::ErrorModel; + else + SC_REPORT_FATAL(this->name(), "Unsupported storage mode"); uint64_t memorySize = Configuration::getInstance().getSimMemSizeInBytes(); - if (StoreMode == StorageMode::Store) + if (storeMode == StorageMode::Store) { if (Configuration::getInstance().useMalloc) { @@ -155,7 +164,7 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::WR, bank, cycle); // save data: - if (StoreMode == StorageMode::Store) // Use Storage + if (storeMode == StorageMode::Store) // Use Storage { unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); @@ -166,7 +175,7 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::RD, bank, cycle); // load data: - if (StoreMode == StorageMode::Store) // use StorageMode + if (storeMode == StorageMode::Store) // use StorageMode { unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); @@ -177,7 +186,7 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::WRA, bank, cycle); // save data: - if (StoreMode == StorageMode::Store) // Use Storage + if (storeMode == StorageMode::Store) // Use Storage { unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); @@ -188,7 +197,7 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::RDA, bank, cycle); // Load data: - if (StoreMode == StorageMode::Store) // use StorageMode + if (storeMode == StorageMode::Store) // use StorageMode { unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); @@ -245,7 +254,7 @@ unsigned int Dram::transport_dbg(tlm_generic_payload &trans) PRINTDEBUGMESSAGE(name(), "transport_dgb"); // TODO: This part is not tested yet, neither with traceplayers nor with GEM5 coupling - if (StoreMode == StorageMode::NoStorage) + if (storeMode == StorageMode::NoStorage) { SC_REPORT_FATAL("DRAM", "Debug Transport is used in combination with NoStorage"); @@ -262,7 +271,7 @@ unsigned int Dram::transport_dbg(tlm_generic_payload &trans) if (cmd == TLM_READ_COMMAND) { - if (StoreMode == StorageMode::Store) + if (storeMode == StorageMode::Store) { // Use Storage unsigned char *phyAddr = memory + trans.get_address(); memcpy(ptr, phyAddr, trans.get_data_length()); @@ -275,7 +284,7 @@ unsigned int Dram::transport_dbg(tlm_generic_payload &trans) } else if (cmd == TLM_WRITE_COMMAND) { - if (StoreMode == StorageMode::Store) + if (storeMode == StorageMode::Store) { // Use Storage unsigned char *phyAddr = memory + trans.get_address(); memcpy(phyAddr, ptr, trans.get_data_length()); diff --git a/DRAMSys/library/src/simulation/dram/Dram.h b/DRAMSys/library/src/simulation/dram/Dram.h index e317768c..bab0ee3c 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.h +++ b/DRAMSys/library/src/simulation/dram/Dram.h @@ -64,7 +64,8 @@ protected: MemSpec *memSpec = Configuration::getInstance().memSpec; // Data Storage: - StorageMode StoreMode = Configuration::getInstance().StoreMode; + enum class StorageMode {NoStorage, Store, ErrorModel} storeMode; + unsigned char *memory; libDRAMPowerDummy *DRAMPower; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index 199f2ce5..736dad5d 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -42,7 +42,7 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramDDR3", "Error Model not supported for DDR3"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index db8378d0..5082b2f7 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -42,7 +42,7 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramDDR4", "Error Model not supported for DDR4"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp index af72caa0..773aa690 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp @@ -42,7 +42,7 @@ DramGDDR5::DramGDDR5(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR5", "Error Model not supported for GDDR5"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp index 3f935863..5342a5e5 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp @@ -42,7 +42,7 @@ DramGDDR5X::DramGDDR5X(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR5X", "Error Model not supported for GDDR5X"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp index de6254c1..029d000d 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp @@ -42,7 +42,7 @@ DramGDDR6::DramGDDR6(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR6", "Error Model not supported for GDDR6"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp index 2d1b907b..735e5256 100644 --- a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp @@ -42,7 +42,7 @@ DramHBM2::DramHBM2(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramHBM2", "Error Model not supported for HBM2"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp index 43f85278..c09c5d5b 100644 --- a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp @@ -42,7 +42,7 @@ DramLPDDR4::DramLPDDR4(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramLPDDR4", "Error Model not supported for LPDDR4"); // Parameters for DRAMPower diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index dda63013..c6733ddb 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -145,7 +145,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) libDRAMPower *DRAMPower = new libDRAMPower(powerSpec, 0); // For each bank in a channel a error Model is created: - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) { for (unsigned i = 0; i < memSpec->NumberOfBanks; i++) { @@ -159,7 +159,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) } else { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramWideIO", "Error modeling without power analysis is not supported"); DRAMPower = new libDRAMPowerDummy(); } @@ -197,19 +197,19 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, sendToController(payload, END_ACT, delay + memSpec->getExecutionTime(Command::ACT, payload)); unsigned int row = DramExtension::getExtension(payload).getRow().ID(); - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) ememory[bank]->activate(row); } else if (phase == BEGIN_WR) { DRAMPower->doCommand(MemCommand::WR, bank, cycle); // save data: - if (StoreMode == StorageMode::Store) // Use Storage + if (storeMode == StorageMode::Store) // Use Storage { unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); } - else if (StoreMode == StorageMode::ErrorModel) // Use Storage with Error Model + else if (storeMode == StorageMode::ErrorModel) // Use Storage with Error Model { ememory[bank]->store(payload); } @@ -219,12 +219,12 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::RD, bank, cycle); // load data: - if (StoreMode == StorageMode::Store) // use StorageMode + if (storeMode == StorageMode::Store) // use StorageMode { unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); } - else if (StoreMode == StorageMode::ErrorModel) // use StorageMode with errormodel + else if (storeMode == StorageMode::ErrorModel) // use StorageMode with errormodel { ememory[bank]->load(payload); } @@ -234,12 +234,12 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::WRA, bank, cycle); // save data: - if (StoreMode == StorageMode::Store) // Use Storage + if (storeMode == StorageMode::Store) // Use Storage { unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); } - else if (StoreMode == StorageMode::ErrorModel) // Use Storage with Error Model + else if (storeMode == StorageMode::ErrorModel) // Use Storage with Error Model { ememory[bank]->store(payload); } @@ -249,12 +249,12 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { DRAMPower->doCommand(MemCommand::RDA, bank, cycle); // Load data: - if (StoreMode == StorageMode::Store) // use StorageMode + if (storeMode == StorageMode::Store) // use StorageMode { unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); } - else if (StoreMode == StorageMode::ErrorModel) // use StorageMode with errormodel + else if (storeMode == StorageMode::ErrorModel) // use StorageMode with errormodel { ememory[bank]->load(payload); } @@ -267,7 +267,7 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, delay + memSpec->getExecutionTime(Command::REFA, payload)); unsigned int row = DramExtension::getExtension(payload).getRow().ID(); - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) ememory[bank]->refresh(row); } else if (phase == BEGIN_REFB) diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp index 3e76d8d1..127bee12 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp @@ -42,7 +42,7 @@ DramWideIO2::DramWideIO2(sc_module_name name) : Dram(name) { - if (StoreMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramWideIO2", "Error Model not supported for WideIO2"); // Parameters for DRAMPower From aa246c31bf2eedafa676a531e5bc82a57a547578 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 27 Mar 2020 15:08:50 +0100 Subject: [PATCH 08/23] Fix of clock alignment in Arbiter. --- DRAMSys/library/src/simulation/Arbiter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index 18b62a4a..a8c31caa 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -68,8 +68,9 @@ Arbiter::Arbiter(sc_module_name name) : tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, tlm_phase &phase, sc_time &fwDelay) { - sc_time notDelay = clkAlign(sc_time_stamp() + fwDelay) - - (sc_time_stamp() + fwDelay); + sc_time notDelay = std::ceil((sc_time_stamp() + fwDelay) / Configuration::getInstance().memSpec->clk) + * Configuration::getInstance().memSpec->clk - sc_time_stamp(); + if (phase == BEGIN_REQ) { // adjust address offset: From b1efbb8721c65ac822171e845cb12100d03a8fa0 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 27 Mar 2020 15:29:58 +0100 Subject: [PATCH 09/23] Code cleanup for open sourcing. --- DRAMSys/library/CMakeLists.txt | 29 ++++---- .../library/src/common/XmlAddressDecoder.cpp | 4 +- .../library/src/common/timingCalculations.cpp | 71 ------------------- .../library/src/common/timingCalculations.h | 52 -------------- .../src/configuration/ConfigurationLoader.cpp | 3 +- DRAMSys/library/src/controller/Controller.cpp | 2 +- DRAMSys/library/src/controller/Controller.h | 4 +- .../{GenericController.h => ControllerIF.h} | 24 +++---- DRAMSys/library/src/simulation/Arbiter.h | 1 - DRAMSys/library/src/simulation/DRAMSys.cpp | 2 +- DRAMSys/library/src/simulation/DRAMSys.h | 5 +- .../library/src/simulation/TraceGenerator.h | 2 +- DRAMSys/library/src/simulation/TracePlayer.h | 1 - DRAMSys/library/src/simulation/TraceSetup.cpp | 9 ++- DRAMSys/library/src/simulation/dram/Dram.cpp | 1 - 15 files changed, 43 insertions(+), 167 deletions(-) delete mode 100644 DRAMSys/library/src/common/timingCalculations.cpp delete mode 100644 DRAMSys/library/src/common/timingCalculations.h rename DRAMSys/library/src/controller/{GenericController.h => ControllerIF.h} (81%) diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index 5df9597d..f0b04c92 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -65,17 +65,16 @@ include_directories( ) add_library(DRAMSysLibrary - src/common/third_party/tinyxml2/tinyxml2.cpp - src/common/TlmRecorder.cpp - src/common/DebugManager.cpp - src/common/CongenAddressDecoder.cpp - src/common/XmlAddressDecoder.cpp - src/common/timingCalculations.cpp - src/common/dramExtensions.cpp - src/common/utils.cpp src/common/AddressDecoder.cpp + src/common/CongenAddressDecoder.cpp + src/common/DebugManager.cpp + src/common/dramExtensions.cpp src/common/protocol.h src/common/tlm2_base_protocol_checker.h + src/common/TlmRecorder.cpp + src/common/utils.cpp + src/common/XmlAddressDecoder.cpp + src/common/third_party/tinyxml2/tinyxml2.cpp src/configuration/Configuration.cpp src/configuration/ConfigurationLoader.cpp @@ -94,7 +93,7 @@ add_library(DRAMSysLibrary src/controller/BankMachine.cpp src/controller/Command.cpp - src/controller/GenericController.h + src/controller/ControllerIF.h src/controller/Controller.cpp src/controller/ControllerRecordable.cpp @@ -141,12 +140,18 @@ add_library(DRAMSysLibrary src/simulation/Arbiter.cpp src/simulation/DRAMSys.cpp + src/simulation/ExampleInitiator.h + src/simulation/IArbiter.h src/simulation/MemoryManager.cpp + src/simulation/ReorderBuffer.h src/simulation/Setup.cpp - src/simulation/TemperatureController.cpp - src/simulation/TracePlayer.cpp - src/simulation/TraceSetup.cpp + src/simulation/SimpleArbiter.h src/simulation/StlPlayer.h + src/simulation/TemperatureController.cpp + src/simulation/TraceGenerator.h + src/simulation/TracePlayer.cpp + src/simulation/TracePlayerListener.h + src/simulation/TraceSetup.cpp src/simulation/dram/Dram.cpp src/simulation/dram/DramRecordable.cpp diff --git a/DRAMSys/library/src/common/XmlAddressDecoder.cpp b/DRAMSys/library/src/common/XmlAddressDecoder.cpp index 0dcc2d5d..c5c8d0ca 100644 --- a/DRAMSys/library/src/common/XmlAddressDecoder.cpp +++ b/DRAMSys/library/src/common/XmlAddressDecoder.cpp @@ -124,10 +124,10 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI) Configuration &config = Configuration::getInstance(); MemSpec *memSpec = config.memSpec; - if (config.NumberOfMemChannels != amount.channel || memSpec->NumberOfRanks != amount.rank + if (config.numberOfMemChannels != amount.channel || memSpec->NumberOfRanks != amount.rank || memSpec->NumberOfBankGroups != amount.bankgroup || memSpec->NumberOfBanks != amount.bank || memSpec->NumberOfRows != amount.row || memSpec->NumberOfColumns != amount.column - || config.NumberOfDevicesOnDIMM * memSpec->bitWidth != amount.bytes * 8) + || config.numberOfDevicesOnDIMM * memSpec->bitWidth != amount.bytes * 8) SC_REPORT_FATAL("XmlAddressDecoder", "Memspec and addressmapping do not match"); } diff --git a/DRAMSys/library/src/common/timingCalculations.cpp b/DRAMSys/library/src/common/timingCalculations.cpp deleted file mode 100644 index be69fb44..00000000 --- a/DRAMSys/library/src/common/timingCalculations.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015, University of Kaiserslautern - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: - * Janik Schlemminger - * Matthias Jung - */ - -#include "timingCalculations.h" -#include "../configuration/memspec/MemSpec.h" -#include "DebugManager.h" -#include "../configuration/Configuration.h" -#include "utils.h" - -sc_time getDelayToMeetConstraint(sc_time previous, sc_time start, - sc_time constraint) -{ - if (previous + constraint > start) - return previous + constraint - start; - else - return SC_ZERO_TIME; -} - -const sc_time FrequencyToClk(double frequencyMhz) -{ - return sc_time(1 / frequencyMhz, SC_US); -} - -const sc_time clkAlign(sc_time time, Alignment alignment) -{ - sc_time clk = Configuration::getInstance().memSpec->clk; - if (alignment == UP) - return ceil(time / clk) * clk; - else - return floor(time / clk) * clk; -} - -bool isClkAligned(sc_time time, sc_time clk) -{ - return !((time / clk) - ceil(time / clk)); -} - - diff --git a/DRAMSys/library/src/common/timingCalculations.h b/DRAMSys/library/src/common/timingCalculations.h deleted file mode 100644 index 7288b93c..00000000 --- a/DRAMSys/library/src/common/timingCalculations.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015, University of Kaiserslautern - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: - * Janik Schlemminger - * Matthias Jung - */ - -#ifndef TIMINGCALCULATIONS_H -#define TIMINGCALCULATIONS_H - -#include -#include -#include "dramExtensions.h" - -sc_time getDelayToMeetConstraint(sc_time previous, sc_time start, - sc_time constraint); - -enum Alignment {UP, DOWN}; -const sc_time clkAlign(sc_time time, Alignment alignment = UP); -bool isClkAligned(sc_time time, sc_time clk); -const sc_time FrequencyToClk(double frequencyMhz); - -#endif // TIMINGCALCULATIONS_H diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index d0bf8cfa..60fff667 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -46,7 +46,6 @@ #include "memspec/MemSpecGDDR5.h" #include "memspec/MemSpecGDDR5X.h" #include "memspec/MemSpecGDDR6.h" -#include "../common/timingCalculations.h" using namespace tinyxml2; using namespace std; @@ -225,7 +224,7 @@ void ConfigurationLoader::loadCommons(Configuration &config, XMLElement *xmlSpec // Clock XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); memSpec->clkMHz = queryDoubleParameter(timings, "clkMhz"); - memSpec->clk = FrequencyToClk(memSpec->clkMHz); + memSpec->clk = sc_time(1.0 / memSpec->clkMHz, SC_US); } void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 80d5d3df..2831a030 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -60,7 +60,7 @@ #include "powerdown/PowerDownManagerDummy.h" Controller::Controller(sc_module_name name) : - GenericController(name) + ControllerIF(name) { SC_METHOD(controllerMethod); sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEvent; diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index f9ab37f9..53ba66cf 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -42,7 +42,7 @@ #include #include #include -#include "GenericController.h" +#include "ControllerIF.h" #include "../common/dramExtensions.h" #include "BankMachine.h" #include "cmdmux/CmdMuxIF.h" @@ -59,7 +59,7 @@ class BankMachine; class SchedulerIF; class PowerDownManagerStaggered; -class Controller : public GenericController +class Controller : public ControllerIF { public: Controller(sc_module_name); diff --git a/DRAMSys/library/src/controller/GenericController.h b/DRAMSys/library/src/controller/ControllerIF.h similarity index 81% rename from DRAMSys/library/src/controller/GenericController.h rename to DRAMSys/library/src/controller/ControllerIF.h index 113b3dbc..6abe4569 100644 --- a/DRAMSys/library/src/controller/GenericController.h +++ b/DRAMSys/library/src/controller/ControllerIF.h @@ -1,5 +1,5 @@ -#ifndef GENERICCONTROLLER_H -#define GENERICCONTROLLER_H +#ifndef CONTROLLERIF_H +#define CONTROLLERIF_H #include #include @@ -11,15 +11,15 @@ using namespace tlm; // Utiliy class to pass around the DRAMSys, without having to propagate the template defintions // throughout all classes -class GenericController : public sc_module +class ControllerIF : public sc_module { public: // Already create and bind sockets to the virtual functions - tlm_utils::simple_target_socket tSocket; // Arbiter side - tlm_utils::simple_initiator_socket iSocket; // DRAM side + tlm_utils::simple_target_socket tSocket; // Arbiter side + tlm_utils::simple_initiator_socket iSocket; // DRAM side // Destructor - virtual ~GenericController() + virtual ~ControllerIF() { sc_time activeTime = numberOfTransactionsServed * Configuration::getInstance().memSpec->BurstLength @@ -60,14 +60,14 @@ public: protected: // Bind sockets with virtual functions - GenericController(sc_module_name name) : + ControllerIF(sc_module_name name) : sc_module(name), tSocket("tSocket"), iSocket("iSocket") { - tSocket.register_nb_transport_fw(this, &GenericController::nb_transport_fw); - tSocket.register_transport_dbg(this, &GenericController::transport_dbg); - iSocket.register_nb_transport_bw(this, &GenericController::nb_transport_bw); + tSocket.register_nb_transport_fw(this, &ControllerIF::nb_transport_fw); + tSocket.register_transport_dbg(this, &ControllerIF::transport_dbg); + iSocket.register_nb_transport_bw(this, &ControllerIF::nb_transport_bw); } - SC_HAS_PROCESS(GenericController); + SC_HAS_PROCESS(ControllerIF); // Virtual transport functions virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &, tlm_phase &, sc_time &) = 0; @@ -80,4 +80,4 @@ protected: }; -#endif // GENERICCONTROLLER_H +#endif // CONTROLLERIF_H diff --git a/DRAMSys/library/src/simulation/Arbiter.h b/DRAMSys/library/src/simulation/Arbiter.h index b8576eda..beb1771d 100644 --- a/DRAMSys/library/src/simulation/Arbiter.h +++ b/DRAMSys/library/src/simulation/Arbiter.h @@ -48,7 +48,6 @@ #include #include "../common/XmlAddressDecoder.h" #include "../common/dramExtensions.h" -#include "../common/timingCalculations.h" #include "../configuration/ConfigurationLoader.h" using namespace std; diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index 5224d926..2ae31554 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -253,7 +253,7 @@ void DRAMSys::instantiateModules(const string &traceName, { std::string str = "controller" + std::to_string(i); - GenericController *controller; + ControllerIF *controller; if (recordingEnabled) controller = new ControllerRecordable(str.c_str(), tlmRecorders[i]); else diff --git a/DRAMSys/library/src/simulation/DRAMSys.h b/DRAMSys/library/src/simulation/DRAMSys.h index 354241f0..9c838c97 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.h +++ b/DRAMSys/library/src/simulation/DRAMSys.h @@ -51,7 +51,7 @@ #include "../common/third_party/tinyxml2/tinyxml2.h" #include "../common/tlm2_base_protocol_checker.h" #include "../error/eccbaseclass.h" -#include "../controller/GenericController.h" +#include "../controller/ControllerIF.h" #include "../common/TlmRecorder.h" class DRAMSys : public sc_module @@ -87,8 +87,7 @@ private: // All transactions pass through the same arbiter Arbiter *arbiter; // Each DRAM unit has a controller - std::vector controllers; - //std::vector controllers; + std::vector controllers; // TODO: Each DRAM has a reorder buffer (check this!) ReorderBuffer *reorder; diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/library/src/simulation/TraceGenerator.h index 4631c5a9..47be2a16 100644 --- a/DRAMSys/library/src/simulation/TraceGenerator.h +++ b/DRAMSys/library/src/simulation/TraceGenerator.h @@ -52,7 +52,7 @@ public: if (clkMhz == 0) clk = Configuration::getInstance().memSpec->clk; else - clk = FrequencyToClk(clkMhz); + clk = sc_time(1.0 / clkMhz, SC_US); this->burstlenght = Configuration::getInstance().memSpec->BurstLength; } diff --git a/DRAMSys/library/src/simulation/TracePlayer.h b/DRAMSys/library/src/simulation/TracePlayer.h index 4bb1fdbd..4d3f4f7c 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.h +++ b/DRAMSys/library/src/simulation/TracePlayer.h @@ -50,7 +50,6 @@ #include "../configuration/Configuration.h" #include "../common/DebugManager.h" #include "../common/XmlAddressDecoder.h" -#include "../common/timingCalculations.h" #include "TracePlayerListener.h" using namespace std; diff --git a/DRAMSys/library/src/simulation/TraceSetup.cpp b/DRAMSys/library/src/simulation/TraceSetup.cpp index 53922968..18f9fdae 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.cpp +++ b/DRAMSys/library/src/simulation/TraceSetup.cpp @@ -61,13 +61,12 @@ traceSetup::traceSetup(std::string uri, device = device->NextSiblingElement("device")) { sc_time playerClk; - unsigned int frequency = device->IntAttribute("clkMhz"); + unsigned int frequencyMHz = device->IntAttribute("clkMhz"); - if (frequency == 0) { + if (frequencyMHz == 0) reportFatal("traceSetup", "No Frequency Defined"); - } else { - playerClk = FrequencyToClk(frequency); - } + else + playerClk = sc_time(1.0 / frequencyMHz, SC_US); std::string name = device->GetText(); diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index ed0ffc01..7c0f9369 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -54,7 +54,6 @@ #include #include "../../common/DebugManager.h" #include "../../common/dramExtensions.h" -#include "../../common/timingCalculations.h" #include "../../configuration/Configuration.h" #include "../../common/protocol.h" #include "../../common/utils.h" From bcffb0c55b8c9887a724c54f6a3e8daf7651ae06 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 27 Mar 2020 16:32:52 +0100 Subject: [PATCH 10/23] Removed namespace std. --- DRAMSys/library/src/common/DebugManager.cpp | 15 +++-- DRAMSys/library/src/common/TlmRecorder.cpp | 4 +- .../library/src/common/XmlAddressDecoder.cpp | 2 +- DRAMSys/library/src/common/utils.cpp | 17 +++--- .../src/configuration/Configuration.cpp | 8 +-- .../src/configuration/ConfigurationLoader.cpp | 13 ++--- DRAMSys/library/src/error/eccbaseclass.h | 3 +- DRAMSys/library/src/simulation/Arbiter.cpp | 3 +- DRAMSys/library/src/simulation/Arbiter.h | 9 ++- DRAMSys/library/src/simulation/DRAMSys.cpp | 56 +++++++++---------- DRAMSys/library/src/simulation/DRAMSys.h | 14 ++--- .../library/src/simulation/ExampleInitiator.h | 2 - DRAMSys/library/src/simulation/IArbiter.h | 1 - .../library/src/simulation/MemoryManager.cpp | 7 +-- .../library/src/simulation/ReorderBuffer.h | 3 +- .../library/src/simulation/SimpleArbiter.h | 2 - DRAMSys/library/src/simulation/StlPlayer.h | 29 +++++----- .../library/src/simulation/TraceGenerator.h | 1 - .../library/src/simulation/TracePlayer.cpp | 2 +- DRAMSys/library/src/simulation/TracePlayer.h | 3 +- DRAMSys/library/src/simulation/TraceSetup.cpp | 4 +- DRAMSys/library/src/simulation/dram/Dram.h | 1 - DRAMSys/simulator/main.cpp | 14 ++--- 23 files changed, 93 insertions(+), 120 deletions(-) diff --git a/DRAMSys/library/src/common/DebugManager.cpp b/DRAMSys/library/src/common/DebugManager.cpp index ec50b87e..02c1da73 100644 --- a/DRAMSys/library/src/common/DebugManager.cpp +++ b/DRAMSys/library/src/common/DebugManager.cpp @@ -39,14 +39,13 @@ #ifdef DEBUGGING #include "../configuration/Configuration.h" -using namespace std; -void DebugManager::printDebugMessage(string sender, string message) +void DebugManager::printDebugMessage(std::string sender, std::string message) { if (Configuration::getInstance().Debug) { if (writeToConsole) - cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << - endl; + std::cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << + std::endl; if (writeToFile && debugFile) debugFile << " at " << sc_time_stamp() << " in " << sender << "\t: " << message @@ -54,13 +53,13 @@ void DebugManager::printDebugMessage(string sender, string message) } } -void DebugManager::printMessage(string sender, string message) +void DebugManager::printMessage(std::string sender, std::string message) { - cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << - endl; + std::cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << + std::endl; } -void DebugManager::openDebugFile(string filename) +void DebugManager::openDebugFile(std::string filename) { if (debugFile) debugFile.close(); diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index f02231a2..8fe6b343 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -100,7 +100,7 @@ void TlmRecorder::recordPhase(tlm_generic_payload &trans, std::string phaseBeginPrefix = "BEGIN_"; std::string phaseEndPrefix = "END_"; - if (phaseName.find(phaseBeginPrefix) != string::npos) { + if (phaseName.find(phaseBeginPrefix) != std::string::npos) { phaseName.erase(0, phaseBeginPrefix.length()); assert(currentTransactionsInSystem.count(&trans) != 0); currentTransactionsInSystem[&trans].insertPhase(phaseName, time); @@ -439,7 +439,7 @@ void TlmRecorder::executeSqlStatement(sqlite3_stmt *statement) int errorCode = sqlite3_step(statement); if (errorCode != SQLITE_DONE) { reportFatal("Error in TraceRecorder", - string("Could not execute statement. Error code: ") + to_string(errorCode)); + std::string("Could not execute statement. Error code: ") + std::to_string(errorCode)); } sqlite3_reset(statement); } diff --git a/DRAMSys/library/src/common/XmlAddressDecoder.cpp b/DRAMSys/library/src/common/XmlAddressDecoder.cpp index c5c8d0ca..d6e321d5 100644 --- a/DRAMSys/library/src/common/XmlAddressDecoder.cpp +++ b/DRAMSys/library/src/common/XmlAddressDecoder.cpp @@ -53,7 +53,7 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI) tinyxml2::XMLDocument doc; loadXML(addressConfigURI, doc); tinyxml2::XMLElement *addressMap = doc.RootElement(); - string xmlNodeName(addressMap->Name()); + std::string xmlNodeName(addressMap->Name()); if (xmlNodeName != "addressmapping") reportFatal("AddressDecorder", "addressmap node expected"); diff --git a/DRAMSys/library/src/common/utils.cpp b/DRAMSys/library/src/common/utils.cpp index 3b9cdc1e..2e1795b8 100644 --- a/DRAMSys/library/src/common/utils.cpp +++ b/DRAMSys/library/src/common/utils.cpp @@ -42,7 +42,6 @@ #include "dramExtensions.h" #include -using namespace std; using namespace tinyxml2; using namespace tlm; @@ -78,7 +77,7 @@ std::string phaseNameToString(tlm_phase phase) return str; } -unsigned int queryUIntParameter(XMLElement *node, string name) +unsigned int queryUIntParameter(XMLElement *node, std::string name) { int result = 0; XMLElement *element; @@ -109,7 +108,7 @@ bool parameterExists(tinyxml2::XMLElement *node, std::string name) return false; } -double queryDoubleParameter(XMLElement *node, string name) +double queryDoubleParameter(XMLElement *node, std::string name) { double result = 0; XMLElement *element; @@ -128,7 +127,7 @@ double queryDoubleParameter(XMLElement *node, string name) return 0; } -bool queryBoolParameter(XMLElement *node, string name) +bool queryBoolParameter(XMLElement *node, std::string name) { bool result = false; XMLElement *element;// = node->FirstChildElement("parameter"); @@ -147,7 +146,7 @@ bool queryBoolParameter(XMLElement *node, string name) return 0; } -string queryStringParameter(XMLElement *node, string name) +std::string queryStringParameter(XMLElement *node, std::string name) { XMLElement *element; for (element = node->FirstChildElement("parameter"); element != NULL; @@ -161,7 +160,7 @@ string queryStringParameter(XMLElement *node, string name) return 0; } -string errorToString(XMLError error) +std::string errorToString(XMLError error) { switch (error) { case XML_NO_ERROR: @@ -209,7 +208,7 @@ string errorToString(XMLError error) } } -void loadXML(string uri, XMLDocument &doc) +void loadXML(std::string uri, XMLDocument &doc) { XMLError error = doc.LoadFile(uri.c_str()); @@ -219,12 +218,12 @@ void loadXML(string uri, XMLDocument &doc) } } -string loadTextFileContents(string filename) +std::string loadTextFileContents(std::string filename) { ifstream in(filename.c_str(), ios::in | ios::binary); if (in) { - string contents; + std::string contents; in.seekg(0, ios::end); contents.resize(in.tellg()); in.seekg(0, ios::beg); diff --git a/DRAMSys/library/src/configuration/Configuration.cpp b/DRAMSys/library/src/configuration/Configuration.cpp index d443543c..d9d2a711 100644 --- a/DRAMSys/library/src/configuration/Configuration.cpp +++ b/DRAMSys/library/src/configuration/Configuration.cpp @@ -42,12 +42,10 @@ #include "ConfigurationLoader.h" #include "../common/XmlAddressDecoder.h" -using namespace std; +std::string Configuration::memspecUri = ""; +std::string Configuration::mcconfigUri = ""; -string Configuration::memspecUri = ""; -string Configuration::mcconfigUri = ""; - -enum sc_time_unit string2TimeUnit(string s) +enum sc_time_unit string2TimeUnit(std::string s) { if (s == "s") return SC_SEC; diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index 60fff667..a1935765 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -48,10 +48,9 @@ #include "memspec/MemSpecGDDR6.h" using namespace tinyxml2; -using namespace std; void ConfigurationLoader::loadSimConfig(Configuration &config, - string simconfigUri) + std::string simconfigUri) { tinyxml2::XMLDocument doc; @@ -65,7 +64,7 @@ void ConfigurationLoader::loadSimConfig(Configuration &config, { if (simconfig->Attribute("src")) { XMLDocument doc; - string src(simconfig->Attribute("src")); + std::string src(simconfig->Attribute("src")); loadXML(src, doc); loadSimConfig(config, doc.FirstChildElement("simconfig")); } @@ -111,7 +110,7 @@ void ConfigurationLoader::loadConfigFromUri(Configuration &config, } void ConfigurationLoader::loadMCConfig(Configuration &config, - string mcconfigUri) + std::string mcconfigUri) { tinyxml2::XMLDocument doc; config.mcconfigUri = mcconfigUri; @@ -126,7 +125,7 @@ void ConfigurationLoader::loadMCConfig(Configuration &config, if (mcconfig->Attribute("src")) { XMLDocument doc; - string src(mcconfig->Attribute("src")); + std::string src(mcconfig->Attribute("src")); config.mcconfigUri = src; loadXML(src, doc); loadMCConfig(config, doc.FirstChildElement("mcconfig")); @@ -135,7 +134,7 @@ void ConfigurationLoader::loadMCConfig(Configuration &config, loadConfig(config, mcconfig); } -void ConfigurationLoader::loadMemSpec(Configuration &config, string memspecUri) +void ConfigurationLoader::loadMemSpec(Configuration &config, std::string memspecUri) { tinyxml2::XMLDocument doc; config.memspecUri = memspecUri; @@ -147,7 +146,7 @@ void ConfigurationLoader::loadMemSpec(Configuration &config, string memspecUri) void ConfigurationLoader::loadMemSpec(Configuration &config, XMLElement *memspec) { - string memoryType = queryStringParameter(memspec, "memoryType"); + std::string memoryType = queryStringParameter(memspec, "memoryType"); if (memoryType == "DDR4") { Configuration::getInstance().memSpec = new MemSpecDDR4(); diff --git a/DRAMSys/library/src/error/eccbaseclass.h b/DRAMSys/library/src/error/eccbaseclass.h index 720be2d7..a3889307 100644 --- a/DRAMSys/library/src/error/eccbaseclass.h +++ b/DRAMSys/library/src/error/eccbaseclass.h @@ -11,7 +11,6 @@ #include "../common/XmlAddressDecoder.h" #include "../common/DebugManager.h" -using namespace std; using namespace tlm; class ECCBaseClass : sc_module @@ -23,7 +22,7 @@ public: }; private: - map m_mDataPointer; + std::map m_mDataPointer; public: // Function prototype for calculated the size of memory needed for saving the encoded data diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index a8c31caa..199d6a34 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -37,7 +37,6 @@ #include "Arbiter.h" -using namespace std; using namespace tlm; Arbiter::Arbiter(sc_module_name name) : @@ -51,7 +50,7 @@ Arbiter::Arbiter(sc_module_name name) : for (size_t i = 0; i < Configuration::getInstance().numberOfMemChannels; ++i) { channelIsFree.push_back(true); - pendingRequests.push_back(queue()); + pendingRequests.push_back(std::queue()); nextPayloadID.push_back(0); } diff --git a/DRAMSys/library/src/simulation/Arbiter.h b/DRAMSys/library/src/simulation/Arbiter.h index beb1771d..0d0f399d 100644 --- a/DRAMSys/library/src/simulation/Arbiter.h +++ b/DRAMSys/library/src/simulation/Arbiter.h @@ -50,7 +50,6 @@ #include "../common/dramExtensions.h" #include "../configuration/ConfigurationLoader.h" -using namespace std; using namespace tlm; class Arbiter : public sc_module @@ -65,14 +64,14 @@ public: private: tlm_utils::peq_with_cb_and_phase payloadEventQueue; - vector channelIsFree; + std::vector channelIsFree; // used to account for the request_accept_delay in the dram controllers // This is a queue of new transactions. The phase of a new request is BEGIN_REQ. - vector> pendingRequests; + std::vector> pendingRequests; // used to account for the response_accept_delay in the initiators (traceplayer, core etc.) // This is a queue of responses comming from the memory side. The phase of these transactions is BEGIN_RESP. - std::map> receivedResponses; + std::map> receivedResponses; // Initiated by initiator side // This function is called when an arbiter's target socket receives a transaction from a device @@ -84,7 +83,7 @@ private: tlm_sync_enum nb_transport_bw(int channelId, tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay); - virtual unsigned int transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans); + virtual unsigned int transport_dbg(int /*id*/, tlm_generic_payload &trans); void peqCallback(tlm_generic_payload &payload, const tlm_phase &phase); diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index 2ae31554..1cb1719c 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -65,11 +65,9 @@ #include "../controller/Controller.h" #include "../controller/ControllerRecordable.h" -using namespace std; - DRAMSys::DRAMSys(sc_module_name name, - string simulationToRun, - string pathToResources) : sc_module(name), tSocket("DRAMSys_tSocket") + std::string simulationToRun, + std::string pathToResources) : sc_module(name), tSocket("DRAMSys_tSocket") { // Initialize ecc pointer ecc = nullptr; @@ -77,11 +75,11 @@ DRAMSys::DRAMSys(sc_module_name name, logo(); // Read Configuration Setup: - string memspec; - string mcconfig; - string amconfig; - string simconfig; - string thermalconfig; + std::string memspec; + std::string mcconfig; + std::string amconfig; + std::string simconfig; + std::string thermalconfig; // TODO: Setup never used? Setup setup(simulationToRun, @@ -165,22 +163,22 @@ DRAMSys::DRAMSys(sc_module_name name, void DRAMSys::logo() { -#define REDTXT(s) string(("\033[0;31m"+string((s))+"\033[0m")) -#define BOLDBLUETXT(s) string(("\033[1;34m"+string((s))+"\033[0m")) - cout << endl; - cout << REDTXT(" |||") << endl; - cout << REDTXT(" +---+ Microelectronic Systems") << endl; - cout << REDTXT("=| |= Design Research Group") << endl; - cout << REDTXT("=| |= ") << BOLDBLUETXT("University of Kaiserslautern") - << endl; - cout << REDTXT(" +---+ ") << endl; - cout << REDTXT(" ||| ") << "DRAMSys v4.0" << endl; - cout << endl; +#define REDTXT(s) std::string("\033[0;31m"+std::string(s)+"\033[0m") +#define BOLDBLUETXT(s) std::string("\033[1;34m"+std::string(s)+"\033[0m") + std::cout << std::endl; + std::cout << REDTXT(" |||") << std::endl; + std::cout << REDTXT(" +---+ Microelectronic Systems") << std::endl; + std::cout << REDTXT("=| |= Design Research Group") << std::endl; + std::cout << REDTXT("=| |= ") << BOLDBLUETXT("University of Kaiserslautern") + << std::endl; + std::cout << REDTXT(" +---+ ") << std::endl; + std::cout << REDTXT(" ||| ") << "DRAMSys v4.0" << std::endl; + std::cout << std::endl; #undef REDTXT #undef BOLDBLUETXT } -void DRAMSys::setupDebugManager(const string &traceName __attribute__((unused))) +void DRAMSys::setupDebugManager(const std::string &traceName __attribute__((unused))) { #ifdef DEBUGGING auto &dbg = DebugManager::getInstance(); @@ -191,18 +189,18 @@ void DRAMSys::setupDebugManager(const string &traceName __attribute__((unused))) #endif } -void DRAMSys::setupTlmRecorders(const string &traceName, - const string &pathToResources) +void DRAMSys::setupTlmRecorders(const std::string &traceName, + const std::string &pathToResources) { // Create TLM Recorders, one per channel. for (size_t i = 0; i < Configuration::getInstance().numberOfMemChannels; i++) { std::string sqlScriptURI = pathToResources - + string("scripts/createTraceDB.sql"); + + std::string("scripts/createTraceDB.sql"); std::string dbName = traceName - + string("_ch") + + std::string("_ch") + std::to_string(i) + ".tdb"; @@ -220,8 +218,8 @@ void DRAMSys::setupTlmRecorders(const string &traceName, } } -void DRAMSys::instantiateModules(const string &traceName, - const string &pathToResources) +void DRAMSys::instantiateModules(const std::string &traceName, + const std::string &pathToResources) { // The first call to getInstance() creates the Temperature Controller. // The same instance will be accessed by all other modules. @@ -401,8 +399,8 @@ DRAMSys::~DRAMSys() } } -void DRAMSys::report(string message) +void DRAMSys::report(std::string message) { PRINTDEBUGMESSAGE(name(), message); - cout << message << endl; + std::cout << message << std::endl; } diff --git a/DRAMSys/library/src/simulation/DRAMSys.h b/DRAMSys/library/src/simulation/DRAMSys.h index 9c838c97..15410755 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.h +++ b/DRAMSys/library/src/simulation/DRAMSys.h @@ -66,8 +66,8 @@ public: SC_HAS_PROCESS(DRAMSys); DRAMSys(sc_module_name name, - string simulationToRun, - string pathToResources); + std::string simulationToRun, + std::string pathToResources); ~DRAMSys(); @@ -100,12 +100,12 @@ private: std::vector tlmRecorders; void report(std::string message); - void setupTlmRecorders(const string &traceName, - const string &pathToResources); - void instantiateModules(const string &traceName, - const string &pathToResources); + void setupTlmRecorders(const std::string &traceName, + const std::string &pathToResources); + void instantiateModules(const std::string &traceName, + const std::string &pathToResources); void bindSockets(); - void setupDebugManager(const string &traceName); + void setupDebugManager(const std::string &traceName); }; #endif // DRAMSYS_H diff --git a/DRAMSys/library/src/simulation/ExampleInitiator.h b/DRAMSys/library/src/simulation/ExampleInitiator.h index 45233838..1e0bbcd5 100644 --- a/DRAMSys/library/src/simulation/ExampleInitiator.h +++ b/DRAMSys/library/src/simulation/ExampleInitiator.h @@ -8,8 +8,6 @@ #include "../common/dramExtensions.h" #include "TracePlayer.h" -using namespace std; - struct ExampleInitiator : sc_module { // TLM-2 socket, defaults to 32-bits wide, base protocol diff --git a/DRAMSys/library/src/simulation/IArbiter.h b/DRAMSys/library/src/simulation/IArbiter.h index 1ad91a0e..9666f0d4 100644 --- a/DRAMSys/library/src/simulation/IArbiter.h +++ b/DRAMSys/library/src/simulation/IArbiter.h @@ -46,7 +46,6 @@ #include #include "../configuration/ConfigurationLoader.h" -using namespace std; using namespace tlm; struct IArbiter : public sc_module diff --git a/DRAMSys/library/src/simulation/MemoryManager.cpp b/DRAMSys/library/src/simulation/MemoryManager.cpp index f5dee080..e000fc3e 100644 --- a/DRAMSys/library/src/simulation/MemoryManager.cpp +++ b/DRAMSys/library/src/simulation/MemoryManager.cpp @@ -39,12 +39,7 @@ #include "../configuration/Configuration.h" #include -using namespace std; - -MemoryManager::MemoryManager(): numberOfAllocations(0), numberOfFrees(0) -{ - -} +MemoryManager::MemoryManager(): numberOfAllocations(0), numberOfFrees(0) {} MemoryManager::~MemoryManager() { diff --git a/DRAMSys/library/src/simulation/ReorderBuffer.h b/DRAMSys/library/src/simulation/ReorderBuffer.h index 5b10544c..84818b33 100644 --- a/DRAMSys/library/src/simulation/ReorderBuffer.h +++ b/DRAMSys/library/src/simulation/ReorderBuffer.h @@ -42,7 +42,6 @@ #include #include -using namespace std; using namespace tlm; struct ReorderBuffer: public sc_module { @@ -61,7 +60,7 @@ public: private: tlm_utils::peq_with_cb_and_phase payloadEventQueue; deque pendingRequestsInOrder; - set receivedResponses; + std::set receivedResponses; bool responseIsPendingInInitator; diff --git a/DRAMSys/library/src/simulation/SimpleArbiter.h b/DRAMSys/library/src/simulation/SimpleArbiter.h index 5434576b..c12e7a2f 100644 --- a/DRAMSys/library/src/simulation/SimpleArbiter.h +++ b/DRAMSys/library/src/simulation/SimpleArbiter.h @@ -40,9 +40,7 @@ #include "IArbiter.h" #include "../common/XmlAddressDecoder.h" #include "../common/dramExtensions.h" -#include "../controller/core/timingCalculations.h" -using namespace std; using namespace tlm; // Annotated References [X,Y] --> Please refer to TLM AT Cheat Sheet on README diff --git a/DRAMSys/library/src/simulation/StlPlayer.h b/DRAMSys/library/src/simulation/StlPlayer.h index 3e228417..94bb2fae 100644 --- a/DRAMSys/library/src/simulation/StlPlayer.h +++ b/DRAMSys/library/src/simulation/StlPlayer.h @@ -43,7 +43,6 @@ #include "../common/XmlAddressDecoder.h" #include "TracePlayer.h" -using namespace std; using namespace tlm; template @@ -51,14 +50,14 @@ class StlPlayer : public TracePlayer { public: StlPlayer(sc_module_name name, - string pathToTrace, + std::string pathToTrace, sc_time playerClk, TracePlayerListener *listener) : TracePlayer(name, listener), file(pathToTrace) { if (!file.is_open()) - SC_REPORT_FATAL(0, (string("Could not open trace ") + pathToTrace).c_str()); + SC_REPORT_FATAL(0, (std::string("Could not open trace ") + pathToTrace).c_str()); this->playerClk = playerClk; this->burstlength = Configuration::getInstance().memSpec->BurstLength; @@ -93,10 +92,10 @@ public: // Trace files MUST provide timestamp, command and address for every // transaction. The data information depends on the storage mode // configuration. - string time; - string command; - string address; - string dataStr; + std::string time; + std::string command; + std::string address; + std::string dataStr; std::istringstream iss(line); @@ -104,7 +103,7 @@ public: iss >> time; if (time.empty()) SC_REPORT_FATAL("StlPlayer", - ("Malformed trace file. Timestamp could not be found (line " + to_string( + ("Malformed trace file. Timestamp could not be found (line " + std::to_string( lineCnt) + ").").c_str()); sc_time sendingTime = std::stoull(time.c_str()) * playerClk; @@ -112,7 +111,7 @@ public: iss >> command; if (command.empty()) SC_REPORT_FATAL("StlPlayer", - ("Malformed trace file. Command could not be found (line " + to_string( + ("Malformed trace file. Command could not be found (line " + std::to_string( lineCnt) + ").").c_str()); enum tlm_command cmd; if (command == "read") { @@ -121,15 +120,15 @@ public: cmd = TLM_WRITE_COMMAND; } else { SC_REPORT_FATAL("StlPlayer", - (string("Corrupted tracefile, command ") + command + - string(" unknown")).c_str()); + (std::string("Corrupted tracefile, command ") + command + + std::string(" unknown")).c_str()); } // Get the address. iss >> address; if (address.empty()) SC_REPORT_FATAL("StlPlayer", - ("Malformed trace file. Address could not be found (line " + to_string( + ("Malformed trace file. Address could not be found (line " + std::to_string( lineCnt) + ").").c_str()); unsigned long long addr = std::stoull(address.c_str(), 0, 16); @@ -140,13 +139,13 @@ public: iss >> dataStr; if (dataStr.empty()) SC_REPORT_FATAL("StlPlayer", - ("Malformed trace file. Data information could not be found (line " + to_string( + ("Malformed trace file. Data information could not be found (line " + std::to_string( lineCnt) + ").").c_str()); // Check if data length in the trace file is correct. We need two characters to represent 1 byte in hexadecimal. if (dataStr.length() != (dataLength * 2)) SC_REPORT_FATAL("StlPlayer", - ("Data in the trace file has an invalid length (line " + to_string( + ("Data in the trace file has an invalid length (line " + std::to_string( lineCnt) + ").").c_str()); // Set data @@ -178,7 +177,7 @@ public: } private: - ifstream file; + std::ifstream file; unsigned int lineCnt; unsigned int burstlength; diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/library/src/simulation/TraceGenerator.h index 47be2a16..3b9dec6b 100644 --- a/DRAMSys/library/src/simulation/TraceGenerator.h +++ b/DRAMSys/library/src/simulation/TraceGenerator.h @@ -40,7 +40,6 @@ #include "TracePlayer.h" -using namespace std; using namespace tlm; struct TraceGenerator : public TracePlayer diff --git a/DRAMSys/library/src/simulation/TracePlayer.cpp b/DRAMSys/library/src/simulation/TracePlayer.cpp index a47fbb3a..fd0a74d0 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.cpp +++ b/DRAMSys/library/src/simulation/TracePlayer.cpp @@ -112,7 +112,7 @@ void TracePlayer::setNumberOfTransactions(unsigned int n) numberOfTransactions = n; } -unsigned int TracePlayer::getNumberOfLines(string pathToTrace) +unsigned int TracePlayer::getNumberOfLines(std::string pathToTrace) { // Reference: http://stackoverflow.com/questions/3482064/counting-the-number-of-lines-in-a-text-file ifstream newFile; diff --git a/DRAMSys/library/src/simulation/TracePlayer.h b/DRAMSys/library/src/simulation/TracePlayer.h index 4d3f4f7c..b0f5e064 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.h +++ b/DRAMSys/library/src/simulation/TracePlayer.h @@ -52,7 +52,6 @@ #include "../common/XmlAddressDecoder.h" #include "TracePlayerListener.h" -using namespace std; using namespace tlm; struct TracePlayer : public sc_module @@ -61,7 +60,7 @@ public: tlm_utils::simple_initiator_socket iSocket; TracePlayer(sc_module_name name, TracePlayerListener *listener); virtual void nextPayload() = 0; - unsigned int getNumberOfLines(string pathToTrace); + unsigned int getNumberOfLines(std::string pathToTrace); protected: gp *allocatePayload(); diff --git a/DRAMSys/library/src/simulation/TraceSetup.cpp b/DRAMSys/library/src/simulation/TraceSetup.cpp index 18f9fdae..70d4507c 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.cpp +++ b/DRAMSys/library/src/simulation/TraceSetup.cpp @@ -79,7 +79,7 @@ traceSetup::traceSetup(std::string uri, std::string ext = name.substr(pos + 1); std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); - std::string stlFile = pathToResources + string("traces/") + name; + std::string stlFile = pathToResources + std::string("traces/") + name; std::string moduleName = name; // replace all '.' to '_' @@ -120,6 +120,6 @@ void traceSetup::transactionFinished() loadbar(totalTransactions - remainingTransactions, totalTransactions); if (remainingTransactions == 0) { - cout << endl; + std::cout << std::endl; } } diff --git a/DRAMSys/library/src/simulation/dram/Dram.h b/DRAMSys/library/src/simulation/dram/Dram.h index bab0ee3c..cd894435 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.h +++ b/DRAMSys/library/src/simulation/dram/Dram.h @@ -48,7 +48,6 @@ #include "../../configuration/memspec/MemSpec.h" #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" -using namespace std; using namespace tlm; using namespace DRAMPower; diff --git a/DRAMSys/simulator/main.cpp b/DRAMSys/simulator/main.cpp index 3598536b..f782faf4 100644 --- a/DRAMSys/simulator/main.cpp +++ b/DRAMSys/simulator/main.cpp @@ -44,11 +44,9 @@ #include "DRAMSys.h" #include "TraceSetup.h" -using namespace std; +std::string resources; -string resources; - -string pathOfFile(string file) +std::string pathOfFile(std::string file) { return file.substr(0, file.find_last_of('/')); } @@ -63,19 +61,19 @@ int sc_main(int argc, char **argv) sc_set_time_resolution(1, SC_PS); - string SimulationXML; + std::string SimulationXML; // Run only with default config (ddr-example.xml): if (argc == 1) { // Get path of resources: resources = pathOfFile(argv[0]) - + string("/../DRAMSys/library/resources/"); + + std::string("/../DRAMSys/library/resources/"); SimulationXML = resources + "simulations/ddr3-example.xml"; } // Run with specific config but default resource folders: else if (argc == 2) { // Get path of resources: resources = pathOfFile(argv[0]) - + string("/../DRAMSys/library/resources/"); + + std::string("/../DRAMSys/library/resources/"); SimulationXML = argv[1]; } // Run with spefific config and specific resource folder: @@ -96,7 +94,7 @@ int sc_main(int argc, char **argv) for (size_t i = 0; i < players.size(); i++) { if(Configuration::getInstance().checkTLM2Protocol) { - string str = "TLMCheckerPlayer" + std::to_string(i); + std::string str = "TLMCheckerPlayer" + std::to_string(i); tlm_utils::tlm2_base_protocol_checker<> *playerTlmChecker = new tlm_utils::tlm2_base_protocol_checker<>(str.c_str()); dramSys->playersTlmCheckers.push_back(playerTlmChecker); From 6c590a298f67beda7e912624ceb6d87d3bb43605 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Mon, 30 Mar 2020 15:34:28 +0200 Subject: [PATCH 11/23] Renaming and minor changes in the memspec. --- DRAMSys/library/src/common/TlmRecorder.cpp | 34 ++--- .../library/src/common/XmlAddressDecoder.cpp | 6 +- DRAMSys/library/src/common/dramExtensions.cpp | 2 +- .../src/configuration/Configuration.cpp | 16 +- .../src/configuration/ConfigurationLoader.cpp | 140 +++++++++--------- .../src/configuration/memspec/MemSpec.cpp | 12 +- .../src/configuration/memspec/MemSpec.h | 28 ++-- .../src/configuration/memspec/MemSpecDDR3.cpp | 12 +- .../src/configuration/memspec/MemSpecDDR4.cpp | 2 - .../src/configuration/memspec/MemSpecHBM2.cpp | 2 +- .../configuration/memspec/MemSpecLPDDR4.cpp | 22 +-- .../library/src/controller/BankMachine.cpp | 4 +- DRAMSys/library/src/controller/Controller.cpp | 48 +++--- DRAMSys/library/src/controller/ControllerIF.h | 6 +- .../src/controller/checker/CheckerDDR3.cpp | 8 +- .../src/controller/checker/CheckerDDR4.cpp | 10 +- .../src/controller/checker/CheckerGDDR5.cpp | 14 +- .../src/controller/checker/CheckerGDDR5X.cpp | 14 +- .../src/controller/checker/CheckerGDDR6.cpp | 12 +- .../src/controller/checker/CheckerHBM2.cpp | 16 +- .../src/controller/checker/CheckerLPDDR4.cpp | 8 +- .../src/controller/checker/CheckerWideIO.cpp | 8 +- .../src/controller/checker/CheckerWideIO2.cpp | 6 +- .../refresh/RefreshManagerBankwise.cpp | 10 +- .../controller/scheduler/SchedulerFifo.cpp | 2 +- .../controller/scheduler/SchedulerFrFcfs.cpp | 2 +- .../scheduler/SchedulerFrFcfsGrp.cpp | 2 +- DRAMSys/library/src/error/errormodel.cpp | 8 +- DRAMSys/library/src/simulation/DRAMSys.cpp | 2 +- DRAMSys/library/src/simulation/StlPlayer.h | 2 +- .../library/src/simulation/TraceGenerator.h | 2 +- .../src/simulation/TracePlayerListener.h | 2 +- DRAMSys/library/src/simulation/TraceSetup.cpp | 10 +- DRAMSys/library/src/simulation/TraceSetup.h | 8 +- .../library/src/simulation/dram/DramDDR3.cpp | 18 +-- .../library/src/simulation/dram/DramDDR4.cpp | 18 +-- .../src/simulation/dram/DramRecordable.cpp | 6 +- .../src/simulation/dram/DramWideIO.cpp | 28 ++-- DRAMSys/simulator/main.cpp | 2 +- 39 files changed, 275 insertions(+), 277 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 8fe6b343..829836b9 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -325,9 +325,9 @@ void TlmRecorder::insertGeneralInfo() sqlite3_bind_int64(insertGeneralInfoStatement, 2, simulationTimeCoveredByRecording.value()); sqlite3_bind_int(insertGeneralInfoStatement, 3, - Configuration::getInstance().memSpec->NumberOfRanks); + Configuration::getInstance().memSpec->numberOfRanks); sqlite3_bind_int(insertGeneralInfoStatement, 4, - Configuration::getInstance().memSpec->NumberOfBanks); + Configuration::getInstance().memSpec->numberOfBanks); sqlite3_bind_int(insertGeneralInfoStatement, 5, Configuration::getInstance().memSpec->clk.value()); sqlite3_bind_text(insertGeneralInfoStatement, 6, "PS", 2, NULL); @@ -361,21 +361,21 @@ void TlmRecorder::insertCommandLengths() { MemSpec *memSpec = Configuration::getInstance().memSpec; - sqlite3_bind_int(insertCommandLengthsStatement, 1, memSpec->commandLength[Command::ACT]); - sqlite3_bind_int(insertCommandLengthsStatement, 2, memSpec->commandLength[Command::PRE]); - sqlite3_bind_int(insertCommandLengthsStatement, 3, memSpec->commandLength[Command::PREA]); - sqlite3_bind_int(insertCommandLengthsStatement, 4, memSpec->commandLength[Command::RD]); - sqlite3_bind_int(insertCommandLengthsStatement, 5, memSpec->commandLength[Command::RDA]); - sqlite3_bind_int(insertCommandLengthsStatement, 6, memSpec->commandLength[Command::WR]); - sqlite3_bind_int(insertCommandLengthsStatement, 7, memSpec->commandLength[Command::WRA]); - sqlite3_bind_int(insertCommandLengthsStatement, 8, memSpec->commandLength[Command::REFA]); - sqlite3_bind_int(insertCommandLengthsStatement, 9, memSpec->commandLength[Command::REFB]); - sqlite3_bind_int(insertCommandLengthsStatement, 10, memSpec->commandLength[Command::PDEA]); - sqlite3_bind_int(insertCommandLengthsStatement, 11, memSpec->commandLength[Command::PDXA]); - sqlite3_bind_int(insertCommandLengthsStatement, 12, memSpec->commandLength[Command::PDEP]); - sqlite3_bind_int(insertCommandLengthsStatement, 13, memSpec->commandLength[Command::PDXP]); - sqlite3_bind_int(insertCommandLengthsStatement, 14, memSpec->commandLength[Command::SREFEN]); - sqlite3_bind_int(insertCommandLengthsStatement, 15, memSpec->commandLength[Command::SREFEX]); + sqlite3_bind_int(insertCommandLengthsStatement, 1, memSpec->commandLengthInCycles[Command::ACT]); + sqlite3_bind_int(insertCommandLengthsStatement, 2, memSpec->commandLengthInCycles[Command::PRE]); + sqlite3_bind_int(insertCommandLengthsStatement, 3, memSpec->commandLengthInCycles[Command::PREA]); + sqlite3_bind_int(insertCommandLengthsStatement, 4, memSpec->commandLengthInCycles[Command::RD]); + sqlite3_bind_int(insertCommandLengthsStatement, 5, memSpec->commandLengthInCycles[Command::RDA]); + sqlite3_bind_int(insertCommandLengthsStatement, 6, memSpec->commandLengthInCycles[Command::WR]); + sqlite3_bind_int(insertCommandLengthsStatement, 7, memSpec->commandLengthInCycles[Command::WRA]); + sqlite3_bind_int(insertCommandLengthsStatement, 8, memSpec->commandLengthInCycles[Command::REFA]); + sqlite3_bind_int(insertCommandLengthsStatement, 9, memSpec->commandLengthInCycles[Command::REFB]); + sqlite3_bind_int(insertCommandLengthsStatement, 10, memSpec->commandLengthInCycles[Command::PDEA]); + sqlite3_bind_int(insertCommandLengthsStatement, 11, memSpec->commandLengthInCycles[Command::PDXA]); + sqlite3_bind_int(insertCommandLengthsStatement, 12, memSpec->commandLengthInCycles[Command::PDEP]); + sqlite3_bind_int(insertCommandLengthsStatement, 13, memSpec->commandLengthInCycles[Command::PDXP]); + sqlite3_bind_int(insertCommandLengthsStatement, 14, memSpec->commandLengthInCycles[Command::SREFEN]); + sqlite3_bind_int(insertCommandLengthsStatement, 15, memSpec->commandLengthInCycles[Command::SREFEX]); executeSqlStatement(insertCommandLengthsStatement); } diff --git a/DRAMSys/library/src/common/XmlAddressDecoder.cpp b/DRAMSys/library/src/common/XmlAddressDecoder.cpp index d6e321d5..71a54039 100644 --- a/DRAMSys/library/src/common/XmlAddressDecoder.cpp +++ b/DRAMSys/library/src/common/XmlAddressDecoder.cpp @@ -124,9 +124,9 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI) Configuration &config = Configuration::getInstance(); MemSpec *memSpec = config.memSpec; - if (config.numberOfMemChannels != amount.channel || memSpec->NumberOfRanks != amount.rank - || memSpec->NumberOfBankGroups != amount.bankgroup || memSpec->NumberOfBanks != amount.bank - || memSpec->NumberOfRows != amount.row || memSpec->NumberOfColumns != amount.column + if (config.numberOfMemChannels != amount.channel || memSpec->numberOfRanks != amount.rank + || memSpec->numberOfBankGroups != amount.bankgroup || memSpec->numberOfBanks != amount.bank + || memSpec->numberOfRows != amount.row || memSpec->numberOfColumns != amount.column || config.numberOfDevicesOnDIMM * memSpec->bitWidth != amount.bytes * 8) SC_REPORT_FATAL("XmlAddressDecoder", "Memspec and addressmapping do not match"); } diff --git a/DRAMSys/library/src/common/dramExtensions.cpp b/DRAMSys/library/src/common/dramExtensions.cpp index d49666bf..2eedddd4 100644 --- a/DRAMSys/library/src/common/dramExtensions.cpp +++ b/DRAMSys/library/src/common/dramExtensions.cpp @@ -332,7 +332,7 @@ bool operator !=(const Row &lhs, const Row &rhs) const Row Row::operator ++() { - id = (id + 1) % Configuration::getInstance().memSpec->NumberOfRows; + id = (id + 1) % Configuration::getInstance().memSpec->numberOfRows; return *this; } diff --git a/DRAMSys/library/src/configuration/Configuration.cpp b/DRAMSys/library/src/configuration/Configuration.cpp index d9d2a711..67955ff0 100644 --- a/DRAMSys/library/src/configuration/Configuration.cpp +++ b/DRAMSys/library/src/configuration/Configuration.cpp @@ -191,12 +191,12 @@ void Configuration::setPathToResources(std::string path) std::uint64_t Configuration::getSimMemSizeInBytes() { // 1. Get number of banks, rows, columns and data width in bits for one die (or chip) - std::string type = memSpec->MemoryType; - std::uint64_t ranks = memSpec->NumberOfRanks; - std::uint64_t bankgroups = memSpec->NumberOfBankGroups; - std::uint64_t banks = memSpec->NumberOfBanks; - std::uint64_t rows = memSpec->NumberOfRows; - std::uint64_t columns = memSpec->NumberOfColumns; + std::string type = memSpec->memoryType; + std::uint64_t ranks = memSpec->numberOfRanks; + std::uint64_t bankgroups = memSpec->numberOfBankGroups; + std::uint64_t banks = memSpec->numberOfBanks; + std::uint64_t rows = memSpec->numberOfRows; + std::uint64_t columns = memSpec->numberOfColumns; std::uint64_t bitWidth = memSpec->bitWidth; // 2. Calculate size of one DRAM chip in bits std::uint64_t chipBitSize = banks * rows * columns * bitWidth; @@ -239,7 +239,7 @@ unsigned int Configuration::getDataBusWidth() unsigned int Configuration::getBytesPerBurst() { // First multiply to get the number of bits in a burst, then divide by 8 to get the value in bytes. The order is important. Think on a single x4 device. - unsigned int bytesPerBurst = (memSpec->BurstLength * getDataBusWidth()) / 8; + unsigned int bytesPerBurst = (memSpec->burstLength * getDataBusWidth()) / 8; assert(bytesPerBurst > 0); if (numberOfDevicesOnDIMM > 1) { @@ -248,7 +248,7 @@ unsigned int Configuration::getBytesPerBurst() // or burst element has N bytes. N = 2^(# bits for byte offset)). unsigned int burstElementSizeInBytes = AddressDecoder::getInstance().amount.bytes; - assert(bytesPerBurst == (burstElementSizeInBytes * memSpec->BurstLength)); + assert(bytesPerBurst == (burstElementSizeInBytes * memSpec->burstLength)); } return bytesPerBurst; diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index a1935765..df74db3e 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -209,15 +209,15 @@ void ConfigurationLoader::loadCommons(Configuration &config, XMLElement *xmlSpec { MemSpec *memSpec = config.memSpec; - memSpec->MemoryId = queryStringParameter(xmlSpec, "memoryId"); - memSpec->MemoryType = queryStringParameter(xmlSpec, "memoryType"); + memSpec->memoryId = queryStringParameter(xmlSpec, "memoryId"); + memSpec->memoryType = queryStringParameter(xmlSpec, "memoryType"); // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->BurstLength = queryUIntParameter(architecture, "burstLength"); - memSpec->DataRate = queryUIntParameter(architecture, "dataRate"); - memSpec->NumberOfRows = queryUIntParameter(architecture, "nbrOfRows"); - memSpec->NumberOfColumns = queryUIntParameter(architecture, "nbrOfColumns"); + memSpec->burstLength = queryUIntParameter(architecture, "burstLength"); + memSpec->dataRate = queryUIntParameter(architecture, "dataRate"); + memSpec->numberOfRows = queryUIntParameter(architecture, "nbrOfRows"); + memSpec->numberOfColumns = queryUIntParameter(architecture, "nbrOfColumns"); memSpec->bitWidth = queryUIntParameter(architecture, "width"); // Clock @@ -234,12 +234,12 @@ void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = 1; - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = 1; + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for DDR3 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -291,12 +291,12 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for DDR4 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -370,12 +370,12 @@ void ConfigurationLoader::loadLPDDR4(Configuration &config, XMLElement *xmlSpec) // MemArchitecture: XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = 1; - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = 1; + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for LPDDR4 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -421,12 +421,12 @@ void ConfigurationLoader::loadWideIO(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = 1; - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = 1; + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for WideIO XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -488,12 +488,12 @@ void ConfigurationLoader::loadWideIO2(Configuration &config, XMLElement *xmlSpec // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = 1; - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = 1; + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for WideIO XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -535,12 +535,12 @@ void ConfigurationLoader::loadHBM2(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for HBM2 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -570,14 +570,14 @@ void ConfigurationLoader::loadHBM2(Configuration &config, XMLElement *xmlSpec) memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); memSpec->tPD = memSpec->tCKE; memSpec->tRDPDE = memSpec->tRL + memSpec->tPL - + (memSpec->BurstLength / memSpec->DataRate + 1) * memSpec->clk; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk; memSpec->tWRPDE = memSpec->tWL + memSpec->tPL - + (memSpec->BurstLength / memSpec->DataRate + 1) * memSpec->clk + memSpec->tWR; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk + memSpec->tWR; memSpec->tWRAPDE = memSpec->tWL + memSpec->tPL - + (memSpec->BurstLength / memSpec->DataRate + 1) * memSpec->clk + memSpec->tWR; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk + memSpec->tWR; memSpec->tCKESR = memSpec->tCKE + memSpec->clk; memSpec->tRDSRE = memSpec->tRL + memSpec->tPL - + (memSpec->BurstLength / memSpec->DataRate + 1) * memSpec->clk; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk; memSpec->tXS = clk * queryUIntParameter(timings, "XS"); memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); memSpec->tRFCSB = clk * queryUIntParameter(timings, "RFCSB"); @@ -597,12 +597,12 @@ void ConfigurationLoader::loadGDDR5(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for GDDR5 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -639,9 +639,9 @@ void ConfigurationLoader::loadGDDR5(Configuration &config, XMLElement *xmlSpec) memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); memSpec->t32AW = clk * queryUIntParameter(timings, "32AW"); memSpec->tRDSRE = memSpec->tCL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); memSpec->tLK = clk * queryUIntParameter(timings, "LK"); @@ -657,12 +657,12 @@ void ConfigurationLoader::loadGDDR5X(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for GDDR5X XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -699,9 +699,9 @@ void ConfigurationLoader::loadGDDR5X(Configuration &config, XMLElement *xmlSpec) memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); memSpec->t32AW = clk * queryUIntParameter(timings, "32AW"); memSpec->tRDSRE = memSpec->tRL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); memSpec->tLK = clk * queryUIntParameter(timings, "LK"); @@ -717,12 +717,12 @@ void ConfigurationLoader::loadGDDR6(Configuration &config, XMLElement *xmlSpec) // MemArchitecture XMLElement *architecture = xmlSpec->FirstChildElement("memarchitecturespec"); - memSpec->NumberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); - memSpec->BanksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); - memSpec->GroupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); - memSpec->BanksPerGroup = memSpec->BanksPerRank / memSpec->GroupsPerRank; - memSpec->NumberOfBanks = memSpec->BanksPerRank * memSpec->NumberOfRanks; - memSpec->NumberOfBankGroups = memSpec->GroupsPerRank * memSpec->NumberOfRanks; + memSpec->numberOfRanks = queryUIntParameter(architecture, "nbrOfRanks"); + memSpec->banksPerRank = queryUIntParameter(architecture, "nbrOfBanks"); + memSpec->groupsPerRank = queryUIntParameter(architecture, "nbrOfBankGroups"); + memSpec->banksPerGroup = memSpec->banksPerRank / memSpec->groupsPerRank; + memSpec->numberOfBanks = memSpec->banksPerRank * memSpec->numberOfRanks; + memSpec->numberOfBankGroups = memSpec->groupsPerRank * memSpec->numberOfRanks; // MemTimings specific for GDDR6 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); @@ -759,9 +759,9 @@ void ConfigurationLoader::loadGDDR6(Configuration &config, XMLElement *xmlSpec) memSpec->tXS = clk * queryUIntParameter(timings, "XS"); memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); memSpec->tRDSRE = memSpec->tRL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->BurstLength / memSpec->DataRate * clk; + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); memSpec->tLK = clk * queryUIntParameter(timings, "LK"); memSpec->tACTPDE = clk * queryUIntParameter(timings, "ACTPDE"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp index 3632316b..03ac9b1b 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp @@ -44,14 +44,14 @@ using namespace tlm; MemSpec::MemSpec() { - commandLength = std::vector(numberOfCommands(), 1); + commandLengthInCycles = std::vector(numberOfCommands(), 1); } const std::vector &MemSpec::getBanks() const { static std::vector banks; if (banks.size() == 0) { - for (unsigned int i = 0; i < NumberOfBanks; i++) + for (unsigned int i = 0; i < numberOfBanks; i++) banks.push_back(Bank(i)); } return banks; @@ -59,15 +59,15 @@ const std::vector &MemSpec::getBanks() const sc_time MemSpec::getReadAccessTime() const { - return clk * (BurstLength / DataRate); + return clk * (burstLength / dataRate); } sc_time MemSpec::getWriteAccessTime() const { - return clk * (BurstLength / DataRate); + return clk * (burstLength / dataRate); } -unsigned MemSpec::getCommandLength(Command command) const +sc_time MemSpec::getCommandLength(Command command) const { - return commandLength[command]; + return clk * commandLengthInCycles[command]; } diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index 2dc5d628..f9f4350e 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -62,30 +62,30 @@ struct MemSpec virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const = 0; virtual TimeInterval getIntervalOnDataStrobe(Command) const = 0; - unsigned getCommandLength(Command) const; + sc_time getCommandLength(Command) const; - std::string MemoryId = "not defined."; - std::string MemoryType = "not defined."; + std::string memoryId = "not defined."; + std::string memoryType = "not defined."; - unsigned int NumberOfRanks; - unsigned int NumberOfBankGroups; - unsigned int NumberOfBanks; - unsigned int NumberOfRows; - unsigned int NumberOfColumns; - unsigned int BurstLength; - unsigned int DataRate; + unsigned int numberOfRanks; + unsigned int numberOfBankGroups; + unsigned int numberOfBanks; + unsigned int numberOfRows; + unsigned int numberOfColumns; + unsigned int burstLength; + unsigned int dataRate; unsigned int bitWidth; - unsigned int BanksPerRank; - unsigned int BanksPerGroup; - unsigned int GroupsPerRank; + unsigned int banksPerRank; + unsigned int banksPerGroup; + unsigned int groupsPerRank; // Clock double clkMHz; sc_time clk; // Command lengths on bus, usually one clock cycle - std::vector commandLength; + std::vector commandLengthInCycles; }; #endif // MEMSPEC_H diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp index 51b21916..26643e26 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp @@ -53,16 +53,16 @@ sc_time MemSpecDDR3::getExecutionTime(Command command, const tlm_generic_payload return tRP; else if (command == Command::ACT) return tRCD; - else if (command == Command::RD || command == Command::RDA) + else if (command == Command::RD) return tRL + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) + else if (command == Command::RDA) + return tRL + getReadAccessTime(); + else if (command == Command::WR) + return tWL + getWriteAccessTime(); + else if (command == Command::WRA) return tWL + getWriteAccessTime(); else if (command == Command::REFA) return tRFC; - else if (command == Command::REFB) - return tRFC; - else if (command == Command::PDXA || command == Command::PDXP || command == Command::SREFEX) - return clk; else { SC_REPORT_FATAL("getExecutionTime", diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp index 0fd8bfb9..ec53fd9a 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp @@ -59,8 +59,6 @@ sc_time MemSpecDDR4::getExecutionTime(Command command, const tlm_generic_payload return tWL + getWriteAccessTime(); else if (command == Command::REFA) return tRFC; - else if (command == Command::REFB) - return tRFC; else { SC_REPORT_FATAL("getExecutionTime", diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp index 7fa61d1b..6c8065c4 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp @@ -37,7 +37,7 @@ MemSpecHBM2::MemSpecHBM2() { - commandLength[Command::ACT] = 2; + commandLengthInCycles[Command::ACT] = 2; } sc_time MemSpecHBM2::getRefreshIntervalAB() const diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp index 106d3c13..d24a9908 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp @@ -37,17 +37,17 @@ MemSpecLPDDR4::MemSpecLPDDR4() { - commandLength[Command::ACT] = 4; - commandLength[Command::PRE] = 2; - commandLength[Command::PREA] = 2; - commandLength[Command::RD] = 4; - commandLength[Command::RDA] = 4; - commandLength[Command::WR] = 4; - commandLength[Command::WRA] = 4; - commandLength[Command::REFA] = 2; - commandLength[Command::REFB] = 2; - commandLength[Command::SREFEN] = 2; - commandLength[Command::SREFEX] = 2; + commandLengthInCycles[Command::ACT] = 4; + commandLengthInCycles[Command::PRE] = 2; + commandLengthInCycles[Command::PREA] = 2; + commandLengthInCycles[Command::RD] = 4; + commandLengthInCycles[Command::RDA] = 4; + commandLengthInCycles[Command::WR] = 4; + commandLengthInCycles[Command::WRA] = 4; + commandLengthInCycles[Command::REFA] = 2; + commandLengthInCycles[Command::REFB] = 2; + commandLengthInCycles[Command::SREFEN] = 2; + commandLengthInCycles[Command::SREFEX] = 2; } sc_time MemSpecLPDDR4::getRefreshIntervalAB() const diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index 3bb27498..5061cc36 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -38,8 +38,8 @@ BankMachine::BankMachine(SchedulerIF *scheduler, CheckerIF *checker, Bank bank) : scheduler(scheduler), checker(checker), bank(bank) { MemSpec *memSpec = Configuration::getInstance().memSpec; - rank = Rank(bank.ID() / memSpec->BanksPerRank); - bankgroup = BankGroup(bank.ID() / memSpec->BanksPerGroup); + rank = Rank(bank.ID() / memSpec->banksPerRank); + bankgroup = BankGroup(bank.ID() / memSpec->banksPerGroup); } std::pair BankMachine::getNextCommand() diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 2831a030..316117b2 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -68,26 +68,26 @@ Controller::Controller(sc_module_name name) : Configuration &config = Configuration::getInstance(); memSpec = config.memSpec; - ranksNumberOfPayloads = std::vector(memSpec->NumberOfRanks); + ranksNumberOfPayloads = std::vector(memSpec->numberOfRanks); // instantiate timing checker - if (memSpec->MemoryType == "DDR3") + if (memSpec->memoryType == "DDR3") checker = new CheckerDDR3(); - else if (memSpec->MemoryType == "DDR4") + else if (memSpec->memoryType == "DDR4") checker = new CheckerDDR4(); - else if (memSpec->MemoryType == "WIDEIO_SDR") + else if (memSpec->memoryType == "WIDEIO_SDR") checker = new CheckerWideIO(); - else if (memSpec->MemoryType == "LPDDR4") + else if (memSpec->memoryType == "LPDDR4") checker = new CheckerLPDDR4(); - else if (memSpec->MemoryType == "WIDEIO2") + else if (memSpec->memoryType == "WIDEIO2") checker = new CheckerWideIO2(); - else if (memSpec->MemoryType == "HBM2") + else if (memSpec->memoryType == "HBM2") checker = new CheckerHBM2(); - else if (memSpec->MemoryType == "GDDR5") + else if (memSpec->memoryType == "GDDR5") checker = new CheckerGDDR5(); - else if (memSpec->MemoryType == "GDDR5X") + else if (memSpec->memoryType == "GDDR5X") checker = new CheckerGDDR5X(); - else if (memSpec->MemoryType == "GDDR6") + else if (memSpec->memoryType == "GDDR6") checker = new CheckerGDDR6(); else SC_REPORT_FATAL("Controller", "Unsupported DRAM type!"); @@ -119,37 +119,37 @@ Controller::Controller(sc_module_name name) : // instantiate bank machines (one per bank) if (config.pagePolicy == "Open") { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + for (unsigned bankID = 0; bankID < memSpec->numberOfBanks; bankID++) bankMachines.push_back(new BankMachineOpen(scheduler, checker, Bank(bankID))); } else if (config.pagePolicy == "OpenAdaptive") { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + for (unsigned bankID = 0; bankID < memSpec->numberOfBanks; bankID++) bankMachines.push_back(new BankMachineOpenAdaptive(scheduler, checker, Bank(bankID))); } else if (config.pagePolicy == "Closed") { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + for (unsigned bankID = 0; bankID < memSpec->numberOfBanks; bankID++) bankMachines.push_back(new BankMachineClosed(scheduler, checker, Bank(bankID))); } else if (config.pagePolicy == "ClosedAdaptive") { - for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + for (unsigned bankID = 0; bankID < memSpec->numberOfBanks; bankID++) bankMachines.push_back(new BankMachineClosedAdaptive(scheduler, checker, Bank(bankID))); } else SC_REPORT_FATAL("Controller", "Selected page policy not supported!"); - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { - bankMachinesOnRank.push_back(std::vector(bankMachines.begin() + rankID * memSpec->BanksPerRank, - bankMachines.begin() + (rankID + 1) * memSpec->BanksPerRank)); + bankMachinesOnRank.push_back(std::vector(bankMachines.begin() + rankID * memSpec->banksPerRank, + bankMachines.begin() + (rankID + 1) * memSpec->banksPerRank)); } // instantiate power-down managers (one per rank) if (config.powerDownPolicy == "NoPowerDown") { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { PowerDownManagerIF *manager = new PowerDownManagerDummy(); powerDownManagers.push_back(manager); @@ -157,7 +157,7 @@ Controller::Controller(sc_module_name name) : } else if (config.powerDownPolicy == "Staggered") { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { PowerDownManagerIF *manager = new PowerDownManagerStaggered(Rank(rankID), checker); powerDownManagers.push_back(manager); @@ -171,12 +171,12 @@ Controller::Controller(sc_module_name name) : // instantiate refresh managers (one per rank) if (config.refreshPolicy == "NoRefresh") { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) refreshManagers.push_back(new RefreshManagerDummy()); } else if (config.refreshPolicy == "Rankwise") { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { RefreshManagerIF *manager = new RefreshManagerRankwise (bankMachinesOnRank[rankID], powerDownManagers[rankID], Rank(rankID), checker); @@ -186,7 +186,7 @@ Controller::Controller(sc_module_name name) : } else if (config.refreshPolicy == "Bankwise") { - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { // TODO: remove bankMachines in constructor RefreshManagerIF *manager = new RefreshManagerBankwise @@ -264,7 +264,7 @@ void Controller::controllerMethod() std::pair commandPair; std::vector> readyCommands; // (5.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX) - for (unsigned rankID = 0; rankID < memSpec->NumberOfRanks; rankID++) + for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++) { commandPair = powerDownManagers[rankID]->getNextCommand(); if (commandPair.second != nullptr) @@ -333,7 +333,7 @@ void Controller::controllerMethod() readyCmdBlocked = true; } - // (6) Restart bank machines and refresh managers to issue new requests for the future + // (6) Restart bank machines, refresh managers and power-down managers to issue new requests for the future // TODO: check if all calls are necessary sc_time timeForNextTrigger = sc_max_time(); for (auto it : bankMachines) diff --git a/DRAMSys/library/src/controller/ControllerIF.h b/DRAMSys/library/src/controller/ControllerIF.h index 6abe4569..e07e1780 100644 --- a/DRAMSys/library/src/controller/ControllerIF.h +++ b/DRAMSys/library/src/controller/ControllerIF.h @@ -22,8 +22,8 @@ public: virtual ~ControllerIF() { sc_time activeTime = numberOfTransactionsServed - * Configuration::getInstance().memSpec->BurstLength - / Configuration::getInstance().memSpec->DataRate + * Configuration::getInstance().memSpec->burstLength + / Configuration::getInstance().memSpec->dataRate * Configuration::getInstance().memSpec->clk; double bandwidth = (activeTime / sc_time_stamp() * 100); @@ -33,7 +33,7 @@ public: // clk in Mhz e.g. 800 [MHz]: (1000000 / Configuration::getInstance().memSpec->clk.to_double()) // DataRate e.g. 2 - * Configuration::getInstance().memSpec->DataRate + * Configuration::getInstance().memSpec->dataRate // BusWidth e.g. 8 or 64 * Configuration::getInstance().memSpec->bitWidth // Number of devices on a DIMM e.g. 8 diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp index 0c7ecb6a..3b9462a9 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp @@ -42,14 +42,14 @@ CheckerDDR3::CheckerDDR3() SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; + burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp index e4ca5462..6272c328 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp @@ -42,16 +42,16 @@ CheckerDDR4::CheckerDDR4() SC_REPORT_FATAL("CheckerDDR4", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndBankGroup = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBankGroups)); + (numberOfCommands(), std::vector(memSpec->numberOfBankGroups)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; + burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp index 9ea840bf..a67ed71a 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp @@ -42,17 +42,17 @@ CheckerGDDR5::CheckerGDDR5() SC_REPORT_FATAL("CheckerGDDR5", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndBankGroup = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBankGroups)); + (numberOfCommands(), std::vector(memSpec->numberOfBankGroups)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - last4Activates = std::vector>(memSpec->NumberOfRanks); - last32Activates = std::vector>(memSpec->NumberOfRanks); + last4Activates = std::vector>(memSpec->numberOfRanks); + last32Activates = std::vector>(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; + burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -338,5 +338,5 @@ void CheckerGDDR5::insert(Command command, Rank rank, BankGroup bankgroup, Bank } if (command == Command::REFB) - bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->BanksPerRank; + bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->banksPerRank; } diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp index 06cbddfe..d84c715f 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp @@ -42,17 +42,17 @@ CheckerGDDR5X::CheckerGDDR5X() SC_REPORT_FATAL("CheckerGDDR5X", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndBankGroup = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBankGroups)); + (numberOfCommands(), std::vector(memSpec->numberOfBankGroups)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - last4Activates = std::vector>(memSpec->NumberOfRanks); - last32Activates = std::vector>(memSpec->NumberOfRanks); + last4Activates = std::vector>(memSpec->numberOfRanks); + last32Activates = std::vector>(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; + burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -338,5 +338,5 @@ void CheckerGDDR5X::insert(Command command, Rank rank, BankGroup bankgroup, Bank } if (command == Command::REFB) - bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->BanksPerRank; + bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->banksPerRank; } diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp index b9313dd5..d93c0b71 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp @@ -42,16 +42,16 @@ CheckerGDDR6::CheckerGDDR6() SC_REPORT_FATAL("CheckerGDDR6", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndBankGroup = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBankGroups)); + (numberOfCommands(), std::vector(memSpec->numberOfBankGroups)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / memSpec->DataRate) * memSpec->clk; + burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -327,5 +327,5 @@ void CheckerGDDR6::insert(Command command, Rank rank, BankGroup bankgroup, Bank } if (command == Command::REFB) - bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->BanksPerRank; + bankwiseRefreshCounter = (bankwiseRefreshCounter + 1) % memSpec->banksPerRank; } diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp index 1b7de13f..c1b45e3d 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp @@ -42,17 +42,17 @@ CheckerHBM2::CheckerHBM2() SC_REPORT_FATAL("CheckerHBM2", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndBankGroup = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBankGroups)); + (numberOfCommands(), std::vector(memSpec->numberOfBankGroups)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); - bankwiseRefreshCounter = std::vector(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); + bankwiseRefreshCounter = std::vector(memSpec->numberOfRanks); - burstClocks = (memSpec->BurstLength / 2) * memSpec->clk; + burstClocks = (memSpec->burstLength / 2) * memSpec->clk; } sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -325,7 +325,7 @@ void CheckerHBM2::insert(Command command, Rank rank, BankGroup bankgroup, Bank b lastScheduledByCommandAndRank[command][rank.ID()] = sc_time_stamp(); lastScheduledByCommand[command] = sc_time_stamp(); - if (command == Command::RD || command == Command::RDA || command == Command::WR || command == Command::WRA) + if (isCasCommand(command)) lastCommandOnCASBus = sc_time_stamp(); else if (command == Command::ACT) lastCommandOnRASBus = sc_time_stamp() + memSpec->clk; @@ -340,5 +340,5 @@ void CheckerHBM2::insert(Command command, Rank rank, BankGroup bankgroup, Bank b } if (command == Command::REFB) - bankwiseRefreshCounter[rank.ID()] = (bankwiseRefreshCounter[rank.ID()] + 1) % memSpec->BanksPerRank; + bankwiseRefreshCounter[rank.ID()] = (bankwiseRefreshCounter[rank.ID()] + 1) % memSpec->banksPerRank; } diff --git a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp index 5f7da450..de447df5 100644 --- a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp @@ -42,12 +42,12 @@ CheckerLPDDR4::CheckerLPDDR4() SC_REPORT_FATAL("CheckerLPDDR4", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); } sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const @@ -280,7 +280,7 @@ void CheckerLPDDR4::insert(Command command, Rank rank, BankGroup, Bank bank) lastScheduledByCommandAndBank[command][bank.ID()] = sc_time_stamp(); lastScheduledByCommandAndRank[command][rank.ID()] = sc_time_stamp(); lastScheduledByCommand[command] = sc_time_stamp(); - lastCommandOnBus = sc_time_stamp() + (memSpec->getCommandLength(command) - 1) * memSpec->clk; + lastCommandOnBus = sc_time_stamp() + memSpec->getCommandLength(command) - memSpec->clk; if (command == Command::ACT || command == Command::REFB) { diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp index 7250f4bd..ee1b6552 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp @@ -42,14 +42,14 @@ CheckerWideIO::CheckerWideIO() SC_REPORT_FATAL("CheckerWideIO", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); - burstClocks = memSpec->BurstLength * memSpec->clk; + burstClocks = memSpec->burstLength * memSpec->clk; } sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp index 5230dfa7..4ca29658 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp @@ -42,12 +42,12 @@ CheckerWideIO2::CheckerWideIO2() SC_REPORT_FATAL("CheckerWideIO2", "Wrong MemSpec chosen"); lastScheduledByCommandAndBank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfBanks)); + (numberOfCommands(), std::vector(memSpec->numberOfBanks)); lastScheduledByCommandAndRank = std::vector> - (numberOfCommands(), std::vector(memSpec->NumberOfRanks)); + (numberOfCommands(), std::vector(memSpec->numberOfRanks)); lastScheduledByCommand = std::vector(numberOfCommands()); - lastActivates = std::vector>(memSpec->NumberOfRanks); + lastActivates = std::vector>(memSpec->numberOfRanks); } sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 899d93e3..7c87a9b9 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -45,23 +45,23 @@ RefreshManagerBankwise::RefreshManagerBankwise(std::vector &bankM memSpec = config.memSpec; timeForNextTrigger = memSpec->getRefreshIntervalPB(); - refreshPayloads = std::vector(memSpec->BanksPerRank); - for (unsigned bankID = 0; bankID < memSpec->BanksPerRank; bankID++) + refreshPayloads = std::vector(memSpec->banksPerRank); + for (unsigned bankID = 0; bankID < memSpec->banksPerRank; bankID++) { setUpDummy(refreshPayloads[bankID], rank, bankMachines[bankID]->getBank()); allBankMachines.push_back(bankMachines[bankID]); } remainingBankMachines = allBankMachines; - maxPostponed = config.refreshMaxPostponed * memSpec->BanksPerRank; - maxPulledin = -(config.refreshMaxPulledin * memSpec->BanksPerRank); + maxPostponed = config.refreshMaxPostponed * memSpec->banksPerRank; + maxPulledin = -(config.refreshMaxPulledin * memSpec->banksPerRank); } std::pair RefreshManagerBankwise::getNextCommand() { if (sc_time_stamp() == timeToSchedule) return std::pair - (nextCommand, &refreshPayloads[currentBankMachine->getBank().ID() % memSpec->BanksPerRank]); + (nextCommand, &refreshPayloads[currentBankMachine->getBank().ID() % memSpec->banksPerRank]); else return std::pair(Command::NOP, nullptr); } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index 47b67b86..d90d8dd6 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -37,7 +37,7 @@ SchedulerFifo::SchedulerFifo() { buffer = std::vector> - (Configuration::getInstance().memSpec->NumberOfBanks); + (Configuration::getInstance().memSpec->numberOfBanks); requestBufferSize = Configuration::getInstance().requestBufferSize; } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 667430d7..0262e009 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -39,7 +39,7 @@ SchedulerFrFcfs::SchedulerFrFcfs() { buffer = std::vector> - (Configuration::getInstance().memSpec->NumberOfBanks); + (Configuration::getInstance().memSpec->numberOfBanks); requestBufferSize = Configuration::getInstance().requestBufferSize; } diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp index 109fd78d..077c6f9d 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp @@ -37,7 +37,7 @@ SchedulerFrFcfsGrp::SchedulerFrFcfsGrp() { buffer = std::vector> - (Configuration::getInstance().memSpec->NumberOfBanks); + (Configuration::getInstance().memSpec->numberOfBanks); requestBufferSize = Configuration::getInstance().requestBufferSize; } diff --git a/DRAMSys/library/src/error/errormodel.cpp b/DRAMSys/library/src/error/errormodel.cpp index 6a14a16f..5cc06fe3 100644 --- a/DRAMSys/library/src/error/errormodel.cpp +++ b/DRAMSys/library/src/error/errormodel.cpp @@ -46,15 +46,15 @@ void errorModel::init() powerAnalysis = Configuration::getInstance().powerAnalysis; thermalSim = Configuration::getInstance().thermalSimulation; // Get Configuration parameters: - burstLenght = Configuration::getInstance().memSpec->BurstLength; - numberOfColumns = Configuration::getInstance().memSpec->NumberOfColumns; + burstLenght = Configuration::getInstance().memSpec->burstLength; + numberOfColumns = Configuration::getInstance().memSpec->numberOfColumns; bytesPerColumn = AddressDecoder::getInstance().amount.bytes; // Adjust number of bytes per column dynamically to the selected ecc controller bytesPerColumn = Configuration::getInstance().adjustNumBytesAfterECC( bytesPerColumn); - numberOfRows = Configuration::getInstance().memSpec->NumberOfRows; + numberOfRows = Configuration::getInstance().memSpec->numberOfRows; numberOfBitErrorEvents = 0; @@ -253,7 +253,7 @@ void errorModel::markBitFlips() { double temp = getTemperature(); for (unsigned int row = 0; - row < Configuration::getInstance().memSpec->NumberOfRows; row++) { + row < Configuration::getInstance().memSpec->numberOfRows; row++) { // If the row has never been accessed ignore it and go to the next one if (lastRowAccess[row] != SC_ZERO_TIME) { // Get the time interval between now and the last acivate/refresh diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index 1cb1719c..7eabae3e 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -246,7 +246,7 @@ void DRAMSys::instantiateModules(const std::string &traceName, arbiter = new Arbiter("arbiter"); // Create DRAM - std::string memoryType = Configuration::getInstance().memSpec->MemoryType; + std::string memoryType = Configuration::getInstance().memSpec->memoryType; for (size_t i = 0; i < Configuration::getInstance().numberOfMemChannels; i++) { std::string str = "controller" + std::to_string(i); diff --git a/DRAMSys/library/src/simulation/StlPlayer.h b/DRAMSys/library/src/simulation/StlPlayer.h index 94bb2fae..76ca8562 100644 --- a/DRAMSys/library/src/simulation/StlPlayer.h +++ b/DRAMSys/library/src/simulation/StlPlayer.h @@ -60,7 +60,7 @@ public: SC_REPORT_FATAL(0, (std::string("Could not open trace ") + pathToTrace).c_str()); this->playerClk = playerClk; - this->burstlength = Configuration::getInstance().memSpec->BurstLength; + this->burstlength = Configuration::getInstance().memSpec->burstLength; this->dataLength = Configuration::getInstance().getBytesPerBurst(); this->lineCnt = 0; } diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/library/src/simulation/TraceGenerator.h index 3b9dec6b..56a9877e 100644 --- a/DRAMSys/library/src/simulation/TraceGenerator.h +++ b/DRAMSys/library/src/simulation/TraceGenerator.h @@ -53,7 +53,7 @@ public: else clk = sc_time(1.0 / clkMhz, SC_US); - this->burstlenght = Configuration::getInstance().memSpec->BurstLength; + this->burstlenght = Configuration::getInstance().memSpec->burstLength; } virtual void nextPayload() override diff --git a/DRAMSys/library/src/simulation/TracePlayerListener.h b/DRAMSys/library/src/simulation/TracePlayerListener.h index 430c10a0..b05ccd74 100644 --- a/DRAMSys/library/src/simulation/TracePlayerListener.h +++ b/DRAMSys/library/src/simulation/TracePlayerListener.h @@ -43,7 +43,7 @@ class TracePlayerListener public: virtual void tracePlayerTerminates() = 0; virtual void transactionFinished() = 0; - virtual ~TracePlayerListener() {}; + virtual ~TracePlayerListener() {} }; #endif // TRACEPLAYERLISTENER_H diff --git a/DRAMSys/library/src/simulation/TraceSetup.cpp b/DRAMSys/library/src/simulation/TraceSetup.cpp index 70d4507c..778b25ac 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.cpp +++ b/DRAMSys/library/src/simulation/TraceSetup.cpp @@ -35,7 +35,7 @@ #include "TraceSetup.h" -traceSetup::traceSetup(std::string uri, +TraceSetup::TraceSetup(std::string uri, std::string pathToResources, std::vector *devices) { @@ -102,18 +102,18 @@ traceSetup::traceSetup(std::string uri, } remainingTransactions = totalTransactions; - NumberOfTracePlayers = devices->size(); + numberOfTracePlayers = devices->size(); } -void traceSetup::tracePlayerTerminates() +void TraceSetup::tracePlayerTerminates() { finishedTracePlayers++; - if (finishedTracePlayers == NumberOfTracePlayers) { + if (finishedTracePlayers == numberOfTracePlayers) { sc_stop(); } } -void traceSetup::transactionFinished() +void TraceSetup::transactionFinished() { remainingTransactions--; diff --git a/DRAMSys/library/src/simulation/TraceSetup.h b/DRAMSys/library/src/simulation/TraceSetup.h index 49f91049..a65ae1f2 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.h +++ b/DRAMSys/library/src/simulation/TraceSetup.h @@ -44,19 +44,19 @@ #include "StlPlayer.h" -class traceSetup : public TracePlayerListener +class TraceSetup : public TracePlayerListener { public: - traceSetup(std::string uri, + TraceSetup(std::string uri, std::string pathToResources, std::vector *devices); virtual void tracePlayerTerminates() override; virtual void transactionFinished() override; - virtual ~traceSetup() {}; + virtual ~TraceSetup() {} private: - unsigned int NumberOfTracePlayers; + unsigned int numberOfTracePlayers; unsigned int totalTransactions = 0; unsigned int remainingTransactions; unsigned int finishedTracePlayers = 0; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index 736dad5d..76335e4f 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -55,14 +55,14 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) sc_time clk = memSpec->clk; MemArchitectureSpec memArchSpec; - memArchSpec.burstLength = memSpec->BurstLength; - memArchSpec.dataRate = memSpec->DataRate; - memArchSpec.nbrOfRows = memSpec->NumberOfRows; - memArchSpec.nbrOfBanks = memSpec->NumberOfBanks; - memArchSpec.nbrOfColumns = memSpec->NumberOfColumns; - memArchSpec.nbrOfRanks = memSpec->NumberOfRanks; + memArchSpec.burstLength = memSpec->burstLength; + memArchSpec.dataRate = memSpec->dataRate; + memArchSpec.nbrOfRows = memSpec->numberOfRows; + memArchSpec.nbrOfBanks = memSpec->numberOfBanks; + memArchSpec.nbrOfColumns = memSpec->numberOfColumns; + memArchSpec.nbrOfRanks = memSpec->numberOfRanks; memArchSpec.width = memSpec->bitWidth; - memArchSpec.nbrOfBankGroups = memSpec->NumberOfBankGroups; + memArchSpec.nbrOfBankGroups = memSpec->numberOfBankGroups; memArchSpec.twoVoltageDomains = false; memArchSpec.dll = true; @@ -134,8 +134,8 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) memPowerSpec.vdd2 = 0; MemorySpecification powerSpec; - powerSpec.id = memSpec->MemoryId; - powerSpec.memoryType = memSpec->MemoryType; + powerSpec.id = memSpec->memoryId; + powerSpec.memoryType = memSpec->memoryType; powerSpec.memTimingSpec = memTimingSpec; powerSpec.memPowerSpec = memPowerSpec; powerSpec.memArchSpec = memArchSpec; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index 5082b2f7..b924435a 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -55,14 +55,14 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) sc_time clk = memSpec->clk; MemArchitectureSpec memArchSpec; - memArchSpec.burstLength = memSpec->BurstLength; - memArchSpec.dataRate = memSpec->DataRate; - memArchSpec.nbrOfRows = memSpec->NumberOfRows; - memArchSpec.nbrOfBanks = memSpec->NumberOfBanks; - memArchSpec.nbrOfColumns = memSpec->NumberOfColumns; - memArchSpec.nbrOfRanks = memSpec->NumberOfRanks; + memArchSpec.burstLength = memSpec->burstLength; + memArchSpec.dataRate = memSpec->dataRate; + memArchSpec.nbrOfRows = memSpec->numberOfRows; + memArchSpec.nbrOfBanks = memSpec->numberOfBanks; + memArchSpec.nbrOfColumns = memSpec->numberOfColumns; + memArchSpec.nbrOfRanks = memSpec->numberOfRanks; memArchSpec.width = memSpec->bitWidth; - memArchSpec.nbrOfBankGroups = memSpec->NumberOfBankGroups; + memArchSpec.nbrOfBankGroups = memSpec->numberOfBankGroups; memArchSpec.twoVoltageDomains = true; memArchSpec.dll = true; @@ -134,8 +134,8 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) memPowerSpec.vdd2 = memSpec->vDD2; MemorySpecification powerSpec; - powerSpec.id = memSpec->MemoryId; - powerSpec.memoryType = memSpec->MemoryType; + powerSpec.id = memSpec->memoryId; + powerSpec.memoryType = memSpec->memoryType; powerSpec.memTimingSpec = memTimingSpec; powerSpec.memPowerSpec = memPowerSpec; powerSpec.memArchSpec = memArchSpec; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index e08c764b..fa14377c 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -89,11 +89,11 @@ tlm_sync_enum DramRecordable::nb_transport_fw(tlm_generic_payload &pay // These are terminating phases recorded by the DRAM. The execution // time of the related command must be taken into consideration. if (phase == END_PDNA || phase == END_PDNAB) - recTime += this->memSpec->getExecutionTime(Command::PDXA, payload); + recTime += this->memSpec->getCommandLength(Command::PDXA); else if (phase == END_PDNP || phase == END_PDNPB) - recTime += this->memSpec->getExecutionTime(Command::PDXP, payload); + recTime += this->memSpec->getCommandLength(Command::PDXP); else if (phase == END_SREF || phase == END_SREFB) - recTime += this->memSpec->getExecutionTime(Command::SREFEX, payload); + recTime += this->memSpec->getCommandLength(Command::SREFEX); unsigned int thr __attribute__((unused)) = DramExtension::getExtension(payload).getThread().ID(); unsigned int ch __attribute__((unused)) = DramExtension::getExtension(payload).getChannel().ID(); diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index c6733ddb..4c8ba3c9 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -57,14 +57,14 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) sc_time clk = memSpec->clk; MemArchitectureSpec memArchSpec; - memArchSpec.burstLength = memSpec->BurstLength; - memArchSpec.dataRate = memSpec->DataRate; - memArchSpec.nbrOfRows = memSpec->NumberOfRows; - memArchSpec.nbrOfBanks = memSpec->NumberOfBanks; - memArchSpec.nbrOfColumns = memSpec->NumberOfColumns; - memArchSpec.nbrOfRanks = memSpec->NumberOfRanks; + memArchSpec.burstLength = memSpec->burstLength; + memArchSpec.dataRate = memSpec->dataRate; + memArchSpec.nbrOfRows = memSpec->numberOfRows; + memArchSpec.nbrOfBanks = memSpec->numberOfBanks; + memArchSpec.nbrOfColumns = memSpec->numberOfColumns; + memArchSpec.nbrOfRanks = memSpec->numberOfRanks; memArchSpec.width = memSpec->bitWidth; - memArchSpec.nbrOfBankGroups = memSpec->NumberOfBankGroups; + memArchSpec.nbrOfBankGroups = memSpec->numberOfBankGroups; memArchSpec.twoVoltageDomains = true; memArchSpec.dll = false; @@ -77,9 +77,9 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD / clk; //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD / clk; memTimingSpec.AL = 0; - memTimingSpec.CCD = memSpec->BurstLength; - memTimingSpec.CCD_L = memSpec->BurstLength; - memTimingSpec.CCD_S = memSpec->BurstLength; + memTimingSpec.CCD = memSpec->burstLength; + memTimingSpec.CCD_L = memSpec->burstLength; + memTimingSpec.CCD_S = memSpec->burstLength; memTimingSpec.CKE = memSpec->tCKE / clk; memTimingSpec.CKESR = memSpec->tCKESR / clk; memTimingSpec.clkMhz = memSpec->clkMHz; @@ -97,7 +97,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) memTimingSpec.RRD = memSpec->tRRD / clk; memTimingSpec.RRD_L = memSpec->tRRD / clk; memTimingSpec.RRD_S = memSpec->tRRD / clk; - memTimingSpec.RTP = memSpec->BurstLength; + memTimingSpec.RTP = memSpec->burstLength; memTimingSpec.TAW = memSpec->tTAW / clk; memTimingSpec.WL = memSpec->tWL / clk; memTimingSpec.WR = memSpec->tWR / clk; @@ -136,8 +136,8 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) memPowerSpec.vdd2 = memSpec->vDD2; MemorySpecification powerSpec; - powerSpec.id = memSpec->MemoryId; - powerSpec.memoryType = memSpec->MemoryType; + powerSpec.id = memSpec->memoryId; + powerSpec.memoryType = memSpec->memoryType; powerSpec.memTimingSpec = memTimingSpec; powerSpec.memPowerSpec = memPowerSpec; powerSpec.memArchSpec = memArchSpec; @@ -147,7 +147,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) // For each bank in a channel a error Model is created: if (storeMode == StorageMode::ErrorModel) { - for (unsigned i = 0; i < memSpec->NumberOfBanks; i++) + for (unsigned i = 0; i < memSpec->numberOfBanks; i++) { errorModel *em; std::string errorModelStr = "errorModel_bank" + std::to_string(i); diff --git a/DRAMSys/simulator/main.cpp b/DRAMSys/simulator/main.cpp index f782faf4..cf231c5f 100644 --- a/DRAMSys/simulator/main.cpp +++ b/DRAMSys/simulator/main.cpp @@ -88,7 +88,7 @@ int sc_main(int argc, char **argv) DRAMSys *dramSys = new DRAMSys("DRAMSys", SimulationXML, resources); // Instantiate STL Players: - traceSetup *ts = new traceSetup(SimulationXML, resources, &players); + TraceSetup *ts = new TraceSetup(SimulationXML, resources, &players); // Bind STL Players with DRAMSys: for (size_t i = 0; i < players.size(); i++) { From 42f38b5789996aa4503742bf66cabfb196197bc4 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 31 Mar 2020 10:19:57 +0200 Subject: [PATCH 12/23] Changed RDA/WRA command execution times to correct values. --- .../src/configuration/ConfigurationLoader.cpp | 2 + .../src/configuration/memspec/MemSpec.cpp | 10 ---- .../src/configuration/memspec/MemSpec.h | 5 +- .../src/configuration/memspec/MemSpecDDR3.cpp | 12 ++--- .../src/configuration/memspec/MemSpecDDR4.cpp | 16 ++++--- .../configuration/memspec/MemSpecGDDR5.cpp | 20 ++++---- .../configuration/memspec/MemSpecGDDR5X.cpp | 20 ++++---- .../configuration/memspec/MemSpecGDDR6.cpp | 16 ++++--- .../src/configuration/memspec/MemSpecHBM2.cpp | 16 ++++--- .../configuration/memspec/MemSpecLPDDR4.cpp | 16 ++++--- .../configuration/memspec/MemSpecWideIO.cpp | 16 ++++--- .../configuration/memspec/MemSpecWideIO2.cpp | 16 ++++--- .../src/controller/checker/CheckerDDR3.cpp | 24 +++++----- .../src/controller/checker/CheckerDDR3.h | 2 - .../src/controller/checker/CheckerDDR4.cpp | 26 +++++------ .../src/controller/checker/CheckerDDR4.h | 2 - .../src/controller/checker/CheckerGDDR5.cpp | 24 +++++----- .../src/controller/checker/CheckerGDDR5.h | 2 - .../src/controller/checker/CheckerGDDR5X.cpp | 24 +++++----- .../src/controller/checker/CheckerGDDR5X.h | 2 - .../src/controller/checker/CheckerGDDR6.cpp | 24 +++++----- .../src/controller/checker/CheckerGDDR6.h | 2 - .../src/controller/checker/CheckerHBM2.cpp | 46 +++++++++---------- .../src/controller/checker/CheckerHBM2.h | 6 +-- .../src/controller/checker/CheckerLPDDR4.cpp | 28 +++++------ .../src/controller/checker/CheckerWideIO.cpp | 38 ++++++++------- .../src/controller/checker/CheckerWideIO.h | 2 - .../src/controller/checker/CheckerWideIO2.cpp | 34 +++++++------- 28 files changed, 223 insertions(+), 228 deletions(-) diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index df74db3e..70bb2e2f 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -224,6 +224,8 @@ void ConfigurationLoader::loadCommons(Configuration &config, XMLElement *xmlSpec XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); memSpec->clkMHz = queryDoubleParameter(timings, "clkMhz"); memSpec->clk = sc_time(1.0 / memSpec->clkMHz, SC_US); + + memSpec->burstDuration = memSpec->clk * (memSpec->burstLength / memSpec->dataRate); } void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp index 03ac9b1b..ade57e7b 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp @@ -57,16 +57,6 @@ const std::vector &MemSpec::getBanks() const return banks; } -sc_time MemSpec::getReadAccessTime() const -{ - return clk * (burstLength / dataRate); -} - -sc_time MemSpec::getWriteAccessTime() const -{ - return clk * (burstLength / dataRate); -} - sc_time MemSpec::getCommandLength(Command command) const { return clk * commandLengthInCycles[command]; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index f9f4350e..9363c318 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -53,9 +53,6 @@ struct MemSpec const std::vector &getBanks() const; - sc_time getWriteAccessTime() const; - sc_time getReadAccessTime() const; - virtual sc_time getRefreshIntervalAB() const = 0; virtual sc_time getRefreshIntervalPB() const = 0; @@ -84,6 +81,8 @@ struct MemSpec double clkMHz; sc_time clk; + sc_time burstDuration; + // Command lengths on bus, usually one clock cycle std::vector commandLengthInCycles; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp index 26643e26..53fe1db8 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp @@ -54,13 +54,13 @@ sc_time MemSpecDDR3::getExecutionTime(Command command, const tlm_generic_payload else if (command == Command::ACT) return tRCD; else if (command == Command::RD) - return tRL + getReadAccessTime(); + return tRL + burstDuration; else if (command == Command::RDA) - return tRL + getReadAccessTime(); + return tRTP + tRP; else if (command == Command::WR) - return tWL + getWriteAccessTime(); + return tWL + burstDuration; else if (command == Command::WRA) - return tWL + getWriteAccessTime(); + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else @@ -74,9 +74,9 @@ sc_time MemSpecDDR3::getExecutionTime(Command command, const tlm_generic_payload TimeInterval MemSpecDDR3::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) - return TimeInterval(sc_time_stamp() + tRL, sc_time_stamp() + tRL + getReadAccessTime()); + return TimeInterval(sc_time_stamp() + tRL, sc_time_stamp() + tRL + burstDuration); else if (command == Command::WR || command == Command::WRA) - return TimeInterval(sc_time_stamp() + tWL, sc_time_stamp() + tWL + getWriteAccessTime()); + return TimeInterval(sc_time_stamp() + tWL, sc_time_stamp() + tWL + burstDuration); else { SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp index ec53fd9a..f7e87256 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp @@ -53,10 +53,14 @@ sc_time MemSpecDDR4::getExecutionTime(Command command, const tlm_generic_payload return tRP; else if (command == Command::ACT) return tRCD; - else if (command == Command::RD || command == Command::RDA) - return tRL + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + burstDuration; + else if (command == Command::RDA) + return tRTP + tRP; + else if (command == Command::WR) + return tWL + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else @@ -70,9 +74,9 @@ sc_time MemSpecDDR4::getExecutionTime(Command command, const tlm_generic_payload TimeInterval MemSpecDDR4::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) - return TimeInterval(sc_time_stamp() + tRL, sc_time_stamp() + tRL + getReadAccessTime()); + return TimeInterval(sc_time_stamp() + tRL, sc_time_stamp() + tRL + burstDuration); else if (command == Command::WR || command == Command::WRA) - return TimeInterval(sc_time_stamp() + tWL, sc_time_stamp() + tWL + getWriteAccessTime()); + return TimeInterval(sc_time_stamp() + tWL, sc_time_stamp() + tWL + burstDuration); else { SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp index 5bcbcbc6..5c19c5c4 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp @@ -52,14 +52,18 @@ sc_time MemSpecGDDR5::getExecutionTime(Command command, const tlm_generic_payloa else if (command == Command::ACT) { if (payload.get_command() == TLM_READ_COMMAND) - return tRCDRD + clk; + return tRCDRD; else - return tRCDWR + clk; + return tRCDWR; } - else if (command == Command::RD || command == Command::RDA) - return tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime(); + else if (command == Command::RD) + return tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration; + else if (command == Command::RDA) + return tRTP + tRP; + else if (command == Command::WR) + return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else if (command == Command::REFB) @@ -76,10 +80,10 @@ TimeInterval MemSpecGDDR5::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, - sc_time_stamp() + tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime()); + sc_time_stamp() + tCL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, - sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime()); + sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration); else { SC_REPORT_FATAL("MemSpecGDDR5", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp index d7e148f6..a42b6b93 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp @@ -52,14 +52,18 @@ sc_time MemSpecGDDR5X::getExecutionTime(Command command, const tlm_generic_paylo else if (command == Command::ACT) { if (payload.get_command() == TLM_READ_COMMAND) - return tRCDRD + clk; + return tRCDRD; else - return tRCDWR + clk; + return tRCDWR; } - else if (command == Command::RD || command == Command::RDA) - return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration; + else if (command == Command::RDA) + return tRTP + tRP; + else if (command == Command::WR) + return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else if (command == Command::REFB) @@ -76,10 +80,10 @@ TimeInterval MemSpecGDDR5X::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, - sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime()); + sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, - sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime()); + sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration); else { SC_REPORT_FATAL("MemSpecGDDR5X", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp index 9be62f01..14befb19 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp @@ -56,10 +56,14 @@ sc_time MemSpecGDDR6::getExecutionTime(Command command, const tlm_generic_payloa else return tRCDWR + clk; } - else if (command == Command::RD || command == Command::RDA) - return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration; + else if (command == Command::RDA) + return tRTP + tRP; + else if (command == Command::WR) + return tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else if (command == Command::REFB) @@ -76,10 +80,10 @@ TimeInterval MemSpecGDDR6::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO, - sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + getReadAccessTime()); + sc_time_stamp() + tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI, - sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + getWriteAccessTime()); + sc_time_stamp() + tWL + tWCK2CKPIN + tWCK2CK + tWCK2DQI + burstDuration); else { SC_REPORT_FATAL("MemSpecGDDR6", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp index 6c8065c4..2b661eea 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp @@ -61,10 +61,14 @@ sc_time MemSpecHBM2::getExecutionTime(Command command, const tlm_generic_payload else return tRCDWR + clk; } - else if (command == Command::RD || command == Command::RDA) - return tRL + tDQSCK + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + tDQSCK + burstDuration; + else if (command == Command::RDA) + return tRTP + tRP; + else if (command == Command::WR) + return tWL + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + tWR + tRP; else if (command == Command::REFA) return tRFC; else if (command == Command::REFB) @@ -81,10 +85,10 @@ TimeInterval MemSpecHBM2::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tDQSCK, - sc_time_stamp() + tRL + tDQSCK + getReadAccessTime()); + sc_time_stamp() + tRL + tDQSCK + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL, - sc_time_stamp() + tWL + getWriteAccessTime()); + sc_time_stamp() + tWL + burstDuration); else { SC_REPORT_FATAL("MemSpecHBM2", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp index d24a9908..6fa0fe2d 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp @@ -68,10 +68,14 @@ sc_time MemSpecLPDDR4::getExecutionTime(Command command, const tlm_generic_paylo return tRPab + clk; else if (command == Command::ACT) return tRCD + 3 * clk; - else if (command == Command::RD || command == Command::RDA) - return tRL + tDQSCK + getReadAccessTime() + 3 * clk; - else if (command == Command::WR || command == Command::WRA) - return tWL + tDQSS + tDQS2DQ + getWriteAccessTime() + 3 * clk; + else if (command == Command::RD) + return tRL + tDQSCK + burstDuration + 3 * clk; + else if (command == Command::RDA) + return burstDuration + tRTP - 5 * clk + tRPpb; + else if (command == Command::WR) + return tWL + tDQSS + tDQS2DQ + burstDuration + 3 * clk; + else if (command == Command::WRA) + return tWL + 4 * clk + burstDuration + tWR + tRPpb; else if (command == Command::REFA) return tRFCab + clk; else if (command == Command::REFB) @@ -88,10 +92,10 @@ TimeInterval MemSpecLPDDR4::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tDQSCK + 3 * clk, - sc_time_stamp() + tRL + tDQSCK + getReadAccessTime() + 3 * clk); + sc_time_stamp() + tRL + tDQSCK + burstDuration + 3 * clk); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL + tDQSS + tDQS2DQ + 3 * clk, - sc_time_stamp() + tWL + tDQSS + tDQS2DQ + getWriteAccessTime() + 3 * clk); + sc_time_stamp() + tWL + tDQSS + tDQS2DQ + burstDuration + 3 * clk); else { SC_REPORT_FATAL("MemSpecLPDDR4", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp index af3af2b4..6b6200ab 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp @@ -53,10 +53,14 @@ sc_time MemSpecWideIO::getExecutionTime(Command command, const tlm_generic_paylo return tRP; else if (command == Command::ACT) return tRCD; - else if (command == Command::RD || command == Command::RDA) - return tRL + tAC + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + tAC + burstDuration; + else if (command == Command::RDA) + return burstDuration + tRP; + else if (command == Command::WR) + return tWL + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration - clk + tWR + tRP; else if (command == Command::REFA) return tRFC; else @@ -71,10 +75,10 @@ TimeInterval MemSpecWideIO::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tAC, - sc_time_stamp() + tRL + tAC + getReadAccessTime()); + sc_time_stamp() + tRL + tAC + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL, - sc_time_stamp() + tWL + getWriteAccessTime()); + sc_time_stamp() + tWL + burstDuration); else { SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp index 7d122e17..409ffadd 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp @@ -54,10 +54,14 @@ sc_time MemSpecWideIO2::getExecutionTime(Command command, const tlm_generic_payl return tRPab; else if (command == Command::ACT) return tRCD; - else if (command == Command::RD || command == Command::RDA) - return tRL + tDQSCK + getReadAccessTime(); - else if (command == Command::WR || command == Command::WRA) - return tWL + tDQSS + getWriteAccessTime(); + else if (command == Command::RD) + return tRL + tDQSCK + burstDuration; + else if (command == Command::RDA) + return burstDuration - 2 * clk + tRTP + tRPpb; + else if (command == Command::WR) + return tWL + tDQSS + burstDuration; + else if (command == Command::WRA) + return tWL + burstDuration + clk + tWR + tRPpb; else if (command == Command::REFA) return tRFCab; else if (command == Command::REFB) @@ -74,10 +78,10 @@ TimeInterval MemSpecWideIO2::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) return TimeInterval(sc_time_stamp() + tRL + tDQSCK, - sc_time_stamp() + tRL + tDQSCK + getReadAccessTime()); + sc_time_stamp() + tRL + tDQSCK + burstDuration); else if (command == Command::WR || command == Command::WRA) return TimeInterval(sc_time_stamp() + tWL + tDQSS, - sc_time_stamp() + tWL + tDQSS + getWriteAccessTime()); + sc_time_stamp() + tWL + tDQSS + burstDuration); else { SC_REPORT_FATAL("MemSpec", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp index 3b9462a9..7fe0dae9 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp @@ -48,8 +48,6 @@ CheckerDDR3::CheckerDDR3() lastScheduledByCommand = std::vector(numberOfCommands()); lastActivates = std::vector>(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const @@ -66,7 +64,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -123,20 +121,20 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTR); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -154,12 +152,12 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + burstClocks + 2 * memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + burstClocks + 2 * memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -189,7 +187,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -211,12 +209,12 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -235,7 +233,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -330,7 +328,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + std::max(memSpec->tWL + 5 * memSpec->clk + memSpec->tWR, memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP)); + + std::max(memSpec->tWL + 5 * memSpec->clk + memSpec->tWR, memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.h b/DRAMSys/library/src/controller/checker/CheckerDDR3.h index 022902e4..bf86b726 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.h +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.h @@ -58,8 +58,6 @@ private: // Four activate window std::vector> lastActivates; - - sc_time burstClocks; }; #endif // CHECKERDDR3_H diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp index 6272c328..adb156b3 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp @@ -50,8 +50,6 @@ CheckerDDR4::CheckerDDR4() lastScheduledByCommand = std::vector(numberOfCommands()); lastActivates = std::vector>(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -68,7 +66,7 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -121,30 +119,30 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWTR_L); + + memSpec->burstDuration + memSpec->tWTR_L); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWTR_S); + + memSpec->burstDuration + memSpec->tWTR_S); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWTR_L); + + memSpec->burstDuration + memSpec->tWTR_L); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWTR_S); + + memSpec->burstDuration + memSpec->tWTR_S); } else if (command == Command::WR || command == Command::WRA) { @@ -154,12 +152,12 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL - + burstClocks + 2 * memSpec->clk - memSpec->tWL); + + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL - + burstClocks + 2 * memSpec->clk - memSpec->tWL); + + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -189,7 +187,7 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWR); + + memSpec->burstDuration + memSpec->tWR); } else if (command == Command::PREA) { @@ -207,12 +205,12 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWR); + + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWR); + + memSpec->burstDuration + memSpec->tWR); } else if (command == Command::REFA) { @@ -227,7 +225,7 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.h b/DRAMSys/library/src/controller/checker/CheckerDDR4.h index b3c86a99..3f14d754 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.h +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.h @@ -59,8 +59,6 @@ private: // Four activate window std::vector> lastActivates; - - sc_time burstClocks; }; #endif // CHECKERDDR4_H diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp index a67ed71a..9db728d2 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp @@ -51,8 +51,6 @@ CheckerGDDR5::CheckerGDDR5() last4Activates = std::vector>(memSpec->numberOfRanks); last32Activates = std::vector>(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -81,7 +79,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -133,30 +131,30 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); } else if (command == Command::WR || command == Command::WRA) { @@ -199,7 +197,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -221,12 +219,12 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -245,7 +243,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -280,7 +278,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.h b/DRAMSys/library/src/controller/checker/CheckerGDDR5.h index 1ce6a54d..937fd853 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.h @@ -61,8 +61,6 @@ private: std::vector> last4Activates; std::vector> last32Activates; - sc_time burstClocks; - unsigned bankwiseRefreshCounter = 0; }; diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp index d84c715f..4796866b 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp @@ -51,8 +51,6 @@ CheckerGDDR5X::CheckerGDDR5X() last4Activates = std::vector>(memSpec->numberOfRanks); last32Activates = std::vector>(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -81,7 +79,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -133,30 +131,30 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); } else if (command == Command::WR || command == Command::WRA) { @@ -199,7 +197,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -221,12 +219,12 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -245,7 +243,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -280,7 +278,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h index d77b9e5c..8f838914 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.h @@ -61,8 +61,6 @@ private: std::vector> last4Activates; std::vector> last32Activates; - sc_time burstClocks; - unsigned bankwiseRefreshCounter = 0; }; diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp index d93c0b71..9ac73b89 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp @@ -50,8 +50,6 @@ CheckerGDDR6::CheckerGDDR6() lastScheduledByCommand = std::vector(numberOfCommands()); lastActivates = std::vector>(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / memSpec->dataRate) * memSpec->clk; } sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -80,7 +78,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -129,30 +127,30 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); } else if (command == Command::WR || command == Command::WRA) { @@ -195,7 +193,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -217,12 +215,12 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -241,7 +239,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -276,7 +274,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.h b/DRAMSys/library/src/controller/checker/CheckerGDDR6.h index a0fdd8bf..501c0da6 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.h +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.h @@ -60,8 +60,6 @@ private: // four activate window std::vector> lastActivates; - sc_time burstClocks; - unsigned bankwiseRefreshCounter = 0; }; diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp index c1b45e3d..097233d3 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp @@ -51,8 +51,6 @@ CheckerHBM2::CheckerHBM2() lastActivates = std::vector>(memSpec->numberOfRanks); bankwiseRefreshCounter = std::vector(memSpec->numberOfRanks); - - burstClocks = (memSpec->burstLength / 2) * memSpec->clk; } sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGroup bankgroup, Bank bank) const @@ -82,7 +80,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP - memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP - memSpec->clk); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -108,7 +106,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW - memSpec->clk); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); } else if (command == Command::RD || command == Command::RDA) { @@ -134,32 +132,32 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WRA][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRL); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRL); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWTRS); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->clk); } else if (command == Command::WR || command == Command::WRA) { @@ -190,7 +188,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->clk); } else if (command == Command::PRE) { @@ -204,9 +202,9 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); } else if (command == Command::PREA) { @@ -224,14 +222,14 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); } else if (command == Command::REFA) { @@ -246,7 +244,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -260,7 +258,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); } else if (command == Command::REFB) { @@ -283,7 +281,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -305,7 +303,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastActivates[rank.ID()].size() == 4) earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRASBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); } else { @@ -326,17 +324,17 @@ void CheckerHBM2::insert(Command command, Rank rank, BankGroup bankgroup, Bank b lastScheduledByCommand[command] = sc_time_stamp(); if (isCasCommand(command)) - lastCommandOnCASBus = sc_time_stamp(); + lastCommandOnCasBus = sc_time_stamp(); else if (command == Command::ACT) - lastCommandOnRASBus = sc_time_stamp() + memSpec->clk; + lastCommandOnRasBus = sc_time_stamp() + memSpec->clk; else - lastCommandOnRASBus = sc_time_stamp(); + lastCommandOnRasBus = sc_time_stamp(); if (command == Command::ACT || command == Command::REFB) { if (lastActivates[rank.ID()].size() == 4) lastActivates[rank.ID()].pop(); - lastActivates[rank.ID()].push(lastCommandOnRASBus); + lastActivates[rank.ID()].push(lastCommandOnRasBus); } if (command == Command::REFB) diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.h b/DRAMSys/library/src/controller/checker/CheckerHBM2.h index 6ba92816..77b27f64 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.h +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.h @@ -55,14 +55,12 @@ private: std::vector> lastScheduledByCommandAndBankGroup; std::vector> lastScheduledByCommandAndRank; std::vector lastScheduledByCommand; - sc_time lastCommandOnRASBus; - sc_time lastCommandOnCASBus; + sc_time lastCommandOnRasBus; + sc_time lastCommandOnCasBus; // Four activate window std::vector> lastActivates; std::vector bankwiseRefreshCounter; - - sc_time burstClocks; }; #endif // CHECKERHBM2_H diff --git a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp index de447df5..4313861b 100644 --- a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp @@ -63,7 +63,7 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; @@ -112,19 +112,19 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWTR); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWTR); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -133,11 +133,11 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL + memSpec->tDQSCK + memSpec->tCCD - memSpec->tWL + memSpec->tWPRE + memSpec->tRPST); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration - memSpec->tWL + memSpec->tWPRE + memSpec->tRPST); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL + memSpec->tDQSCK + memSpec->tCCD - memSpec->tWL + memSpec->tWPRE + memSpec->tRPST); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration - memSpec->tWL + memSpec->tWPRE + memSpec->tRPST); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -154,11 +154,11 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -171,19 +171,19 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCD + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); // lastCommandStart = lastScheduledByCommandAndRank[Command::REFB][rank.ID()]; // if (lastCommandStart != SC_ZERO_TIME) @@ -205,7 +205,7 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; @@ -240,7 +240,7 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCCD + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp index ee1b6552..16aa444e 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp @@ -48,8 +48,6 @@ CheckerWideIO::CheckerWideIO() lastScheduledByCommand = std::vector(numberOfCommands()); lastActivates = std::vector>(memSpec->numberOfRanks); - - burstClocks = memSpec->burstLength * memSpec->clk; } sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, BankGroup, Bank bank) const @@ -61,12 +59,12 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank { lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks + memSpec->tRP); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + burstClocks - memSpec->clk + memSpec->tWR + memSpec->tRP); + + memSpec->burstDuration - memSpec->clk + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -98,16 +96,16 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWTR); if (command == Command::RDA) { @@ -120,7 +118,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -130,20 +128,20 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + burstClocks + memSpec->clk); + + memSpec->tRL + memSpec->burstDuration + memSpec->clk); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + burstClocks + memSpec->clk); + + memSpec->tRL + memSpec->burstDuration + memSpec->clk); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); } else if (command == Command::PRE) { @@ -152,12 +150,12 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); } else if (command == Command::PREA) { @@ -166,21 +164,21 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); } else if (command == Command::REFA) { @@ -190,12 +188,12 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + burstClocks + memSpec->tRP); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + burstClocks - memSpec->clk + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.h b/DRAMSys/library/src/controller/checker/CheckerWideIO.h index 105078d0..65a8adee 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.h +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.h @@ -58,8 +58,6 @@ private: // Four activate window std::vector> lastActivates; - - sc_time burstClocks; }; #endif // CHECKERWIDEIO_H diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp index 4ca29658..22fb6c70 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp @@ -68,12 +68,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -114,20 +114,20 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWTR); + + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->tCCD + memSpec->tWTR); + + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -137,12 +137,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->tDQSCK + memSpec->tCCD + memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->tDQSCK + memSpec->tCCD + memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->clk - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -160,12 +160,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); } else if (command == Command::PREA) { @@ -175,22 +175,22 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -205,12 +205,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -237,12 +237,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tCCD + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->tCCD + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) From b75126f207fcebe34f6f023f3a3a2e026bce57b7 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 31 Mar 2020 11:33:31 +0200 Subject: [PATCH 13/23] clk to tCK. --- DRAMSys/library/src/common/TlmRecorder.cpp | 4 +- .../src/configuration/ConfigurationLoader.cpp | 539 +++++++++--------- .../src/configuration/memspec/MemSpec.cpp | 2 +- .../src/configuration/memspec/MemSpec.h | 4 +- .../configuration/memspec/MemSpecGDDR6.cpp | 4 +- .../src/configuration/memspec/MemSpecHBM2.cpp | 4 +- .../src/configuration/memspec/MemSpecHBM2.h | 10 +- .../configuration/memspec/MemSpecLPDDR4.cpp | 26 +- .../configuration/memspec/MemSpecWideIO.cpp | 2 +- .../configuration/memspec/MemSpecWideIO2.cpp | 4 +- DRAMSys/library/src/controller/Controller.cpp | 4 +- DRAMSys/library/src/controller/ControllerIF.h | 6 +- .../src/controller/checker/CheckerDDR3.cpp | 24 +- .../src/controller/checker/CheckerDDR4.cpp | 6 +- .../src/controller/checker/CheckerGDDR5.cpp | 2 +- .../src/controller/checker/CheckerGDDR5X.cpp | 2 +- .../src/controller/checker/CheckerGDDR6.cpp | 2 +- .../src/controller/checker/CheckerHBM2.cpp | 48 +- .../src/controller/checker/CheckerLPDDR4.cpp | 56 +- .../src/controller/checker/CheckerWideIO.cpp | 22 +- .../src/controller/checker/CheckerWideIO2.cpp | 38 +- DRAMSys/library/src/error/errormodel.cpp | 4 +- DRAMSys/library/src/simulation/Arbiter.cpp | 6 +- .../library/src/simulation/TraceGenerator.h | 10 +- DRAMSys/library/src/simulation/dram/Dram.cpp | 2 +- .../library/src/simulation/dram/DramDDR3.cpp | 78 ++- .../library/src/simulation/dram/DramDDR4.cpp | 78 ++- .../src/simulation/dram/DramRecordable.cpp | 7 +- .../src/simulation/dram/DramRecordable.h | 2 +- .../src/simulation/dram/DramWideIO.cpp | 70 ++- 30 files changed, 525 insertions(+), 541 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 829836b9..f4c23c03 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -329,7 +329,7 @@ void TlmRecorder::insertGeneralInfo() sqlite3_bind_int(insertGeneralInfoStatement, 4, Configuration::getInstance().memSpec->numberOfBanks); sqlite3_bind_int(insertGeneralInfoStatement, 5, - Configuration::getInstance().memSpec->clk.value()); + Configuration::getInstance().memSpec->tCK.value()); sqlite3_bind_text(insertGeneralInfoStatement, 6, "PS", 2, NULL); sqlite3_bind_text(insertGeneralInfoStatement, 7, mcconfig.c_str(), mcconfig.length(), NULL); @@ -341,7 +341,7 @@ void TlmRecorder::insertGeneralInfo() sqlite3_bind_int64(insertGeneralInfoStatement, 10, 0); else sqlite3_bind_int64(insertGeneralInfoStatement, 10, - (Configuration::getInstance().memSpec->clk * + (Configuration::getInstance().memSpec->tCK * Configuration::getInstance().windowSize).value()); if ((Configuration::getInstance().refreshMaxPostponed > 0) || (Configuration::getInstance().refreshMaxPulledin > 0)) { diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index 70bb2e2f..7a8e9579 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -222,10 +222,10 @@ void ConfigurationLoader::loadCommons(Configuration &config, XMLElement *xmlSpec // Clock XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - memSpec->clkMHz = queryDoubleParameter(timings, "clkMhz"); - memSpec->clk = sc_time(1.0 / memSpec->clkMHz, SC_US); + memSpec->fCKMHz = queryDoubleParameter(timings, "clkMhz"); + memSpec->tCK = sc_time(1.0 / memSpec->fCKMHz, SC_US); - memSpec->burstDuration = memSpec->clk * (memSpec->burstLength / memSpec->dataRate); + memSpec->burstDuration = memSpec->tCK * (memSpec->burstLength / memSpec->dataRate); } void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) @@ -245,29 +245,28 @@ void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for DDR3 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); - memSpec->tCKESR = clk * queryUIntParameter(timings, "CKESR"); - //memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCD = clk * queryUIntParameter(timings, "RCD"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tCCD = clk * queryUIntParameter(timings, "CCD"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRRD = clk * queryUIntParameter(timings, "RRD"); - memSpec->tWTR = clk * queryUIntParameter(timings, "WTR"); - memSpec->tAL = clk * queryUIntParameter(timings, "AL"); - memSpec->tXPDLL = clk * queryUIntParameter(timings, "XPDLL"); - memSpec->tXSDLL = clk * queryUIntParameter(timings, "XSDLL"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); + memSpec->tCKESR = memSpec->tCK * queryUIntParameter(timings, "CKESR"); + //memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCD = memSpec->tCK * queryUIntParameter(timings, "RCD"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tCCD = memSpec->tCK * queryUIntParameter(timings, "CCD"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRRD = memSpec->tCK * queryUIntParameter(timings, "RRD"); + memSpec->tWTR = memSpec->tCK * queryUIntParameter(timings, "WTR"); + memSpec->tAL = memSpec->tCK * queryUIntParameter(timings, "AL"); + memSpec->tXPDLL = memSpec->tCK * queryUIntParameter(timings, "XPDLL"); + memSpec->tXSDLL = memSpec->tCK * queryUIntParameter(timings, "XSDLL"); // Currents and voltages XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -302,48 +301,47 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for DDR4 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); - memSpec->tCKESR = clk * queryUIntParameter(timings, "CKESR"); - //memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCD = clk * queryUIntParameter(timings, "RCD"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tCCD_S = clk * queryUIntParameter(timings, "CCD_S"); - memSpec->tCCD_L = clk * queryUIntParameter(timings, "CCD_L"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); + memSpec->tCKESR = memSpec->tCK * queryUIntParameter(timings, "CKESR"); + //memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCD = memSpec->tCK * queryUIntParameter(timings, "RCD"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tCCD_S = memSpec->tCK * queryUIntParameter(timings, "CCD_S"); + memSpec->tCCD_L = memSpec->tCK * queryUIntParameter(timings, "CCD_L"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); unsigned refreshMode = Configuration::getInstance().refreshMode; if (refreshMode == 1) { - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); } else if (refreshMode == 2) { - memSpec->tREFI = clk * (queryUIntParameter(timings, "REFI") / 2); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC2"); + memSpec->tREFI = memSpec->tCK * (queryUIntParameter(timings, "REFI") / 2); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC2"); } else if (refreshMode == 4) { - memSpec->tREFI = clk * (queryUIntParameter(timings, "REFI") / 2); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC4"); + memSpec->tREFI = memSpec->tCK * (queryUIntParameter(timings, "REFI") / 2); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC4"); } else SC_REPORT_FATAL("ConfigurationLoader", "Refresh Mode not supported"); - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRRD_S = clk * queryUIntParameter(timings, "RRD_S"); - memSpec->tRRD_L = clk * queryUIntParameter(timings, "RRD_L"); - memSpec->tWTR_S = clk * queryUIntParameter(timings, "WTR_S"); - memSpec->tWTR_L = clk * queryUIntParameter(timings, "WTR_L"); - memSpec->tAL = clk * queryUIntParameter(timings, "AL"); - memSpec->tXPDLL = clk * queryUIntParameter(timings, "XPDLL"); - memSpec->tXSDLL = clk * queryUIntParameter(timings, "XSDLL"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRRD_S = memSpec->tCK * queryUIntParameter(timings, "RRD_S"); + memSpec->tRRD_L = memSpec->tCK * queryUIntParameter(timings, "RRD_L"); + memSpec->tWTR_S = memSpec->tCK * queryUIntParameter(timings, "WTR_S"); + memSpec->tWTR_L = memSpec->tCK * queryUIntParameter(timings, "WTR_L"); + memSpec->tAL = memSpec->tCK * queryUIntParameter(timings, "AL"); + memSpec->tXPDLL = memSpec->tCK * queryUIntParameter(timings, "XPDLL"); + memSpec->tXSDLL = memSpec->tCK * queryUIntParameter(timings, "XSDLL"); // Currents and voltages XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -381,35 +379,34 @@ void ConfigurationLoader::loadLPDDR4(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for LPDDR4 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFIpb = clk * queryUIntParameter(timings, "REFIPB"); - memSpec->tRFCab = clk * queryUIntParameter(timings, "RFCAB"); - memSpec->tRFCpb = clk * queryUIntParameter(timings, "RFCPB"); - memSpec->tRPab = clk * queryUIntParameter(timings, "RPAB"); - memSpec->tRPpb = clk * queryUIntParameter(timings, "RPPB"); - memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRCD = clk * queryUIntParameter(timings, "RCD"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->tRRD = clk * queryUIntParameter(timings, "RRD"); - memSpec->tCCD = clk * queryUIntParameter(timings, "CCD"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tRPST = clk * queryUIntParameter(timings, "RPST"); - memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tDQSS = clk * queryUIntParameter(timings, "DQSS"); - memSpec->tDQS2DQ = clk * queryUIntParameter(timings, "DQS2DQ"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tWPRE = clk * queryUIntParameter(timings, "WPRE"); - memSpec->tWTR = clk * queryUIntParameter(timings, "WTR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tSR = clk * queryUIntParameter(timings, "SR"); - memSpec->tXSR = clk * queryUIntParameter(timings, "XSR"); - memSpec->tESCKE = clk * queryUIntParameter(timings, "ESCKE"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); - memSpec->tCMDCKE = clk * queryUIntParameter(timings, "CMDCKE"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFIpb = memSpec->tCK * queryUIntParameter(timings, "REFIPB"); + memSpec->tRFCab = memSpec->tCK * queryUIntParameter(timings, "RFCAB"); + memSpec->tRFCpb = memSpec->tCK * queryUIntParameter(timings, "RFCPB"); + memSpec->tRPab = memSpec->tCK * queryUIntParameter(timings, "RPAB"); + memSpec->tRPpb = memSpec->tCK * queryUIntParameter(timings, "RPPB"); + memSpec->tPPD = memSpec->tCK * queryUIntParameter(timings, "PPD"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRCD = memSpec->tCK * queryUIntParameter(timings, "RCD"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->tRRD = memSpec->tCK * queryUIntParameter(timings, "RRD"); + memSpec->tCCD = memSpec->tCK * queryUIntParameter(timings, "CCD"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tRPST = memSpec->tCK * queryUIntParameter(timings, "RPST"); + memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tDQSS = memSpec->tCK * queryUIntParameter(timings, "DQSS"); + memSpec->tDQS2DQ = memSpec->tCK * queryUIntParameter(timings, "DQS2DQ"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tWPRE = memSpec->tCK * queryUIntParameter(timings, "WPRE"); + memSpec->tWTR = memSpec->tCK * queryUIntParameter(timings, "WTR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tSR = memSpec->tCK * queryUIntParameter(timings, "SR"); + memSpec->tXSR = memSpec->tCK * queryUIntParameter(timings, "XSR"); + memSpec->tESCKE = memSpec->tCK * queryUIntParameter(timings, "ESCKE"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); + memSpec->tCMDCKE = memSpec->tCK * queryUIntParameter(timings, "CMDCKE"); // Currents and voltages // TODO: to be completed @@ -432,27 +429,26 @@ void ConfigurationLoader::loadWideIO(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for WideIO XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); - memSpec->tCKESR = clk * queryUIntParameter(timings, "CKESR"); - memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); - memSpec->tAC = clk * queryUIntParameter(timings, "AC"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCD = clk * queryUIntParameter(timings, "RCD"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tCCD_R = clk * queryUIntParameter(timings, "CCD_R"); - memSpec->tCCD_W = clk * queryUIntParameter(timings, "CCD_W"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRRD = clk * queryUIntParameter(timings, "RRD"); - memSpec->tTAW = clk * queryUIntParameter(timings, "TAW"); - memSpec->tWTR = clk * queryUIntParameter(timings, "WTR"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); + memSpec->tCKESR = memSpec->tCK * queryUIntParameter(timings, "CKESR"); + memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); + memSpec->tAC = memSpec->tCK * queryUIntParameter(timings, "AC"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCD = memSpec->tCK * queryUIntParameter(timings, "RCD"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tCCD_R = memSpec->tCK * queryUIntParameter(timings, "CCD_R"); + memSpec->tCCD_W = memSpec->tCK * queryUIntParameter(timings, "CCD_W"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRRD = memSpec->tCK * queryUIntParameter(timings, "RRD"); + memSpec->tTAW = memSpec->tCK * queryUIntParameter(timings, "TAW"); + memSpec->tWTR = memSpec->tCK * queryUIntParameter(timings, "WTR"); // Currents and voltages XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -499,31 +495,30 @@ void ConfigurationLoader::loadWideIO2(Configuration &config, XMLElement *xmlSpec // MemTimings specific for WideIO XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); - memSpec->tDQSS = clk * queryUIntParameter(timings, "DQSS"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tRCpb = clk * queryUIntParameter(timings, "RCPB"); - memSpec->tRCab = clk * queryUIntParameter(timings, "RCAB"); - memSpec->tCKESR = clk * queryUIntParameter(timings, "CKESR"); - memSpec->tXSR = clk * queryUIntParameter(timings, "XSR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tCCD = clk * queryUIntParameter(timings, "CCD"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tRCD = clk * queryUIntParameter(timings, "RCD"); - memSpec->tRPpb = clk * queryUIntParameter(timings, "RPPB"); - memSpec->tRPab = clk * queryUIntParameter(timings, "RPAB"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tWTR = clk * queryUIntParameter(timings, "WTR"); - memSpec->tRRD = clk * queryUIntParameter(timings, "RRD"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFIpb = clk * queryUIntParameter(timings, "REFIPB"); - memSpec->tRFCab = clk * queryUIntParameter(timings, "RFCAB"); - memSpec->tRFCpb = clk * queryUIntParameter(timings, "RFCPB"); + memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); + memSpec->tDQSS = memSpec->tCK * queryUIntParameter(timings, "DQSS"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tRCpb = memSpec->tCK * queryUIntParameter(timings, "RCPB"); + memSpec->tRCab = memSpec->tCK * queryUIntParameter(timings, "RCAB"); + memSpec->tCKESR = memSpec->tCK * queryUIntParameter(timings, "CKESR"); + memSpec->tXSR = memSpec->tCK * queryUIntParameter(timings, "XSR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tCCD = memSpec->tCK * queryUIntParameter(timings, "CCD"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tRCD = memSpec->tCK * queryUIntParameter(timings, "RCD"); + memSpec->tRPpb = memSpec->tCK * queryUIntParameter(timings, "RPPB"); + memSpec->tRPab = memSpec->tCK * queryUIntParameter(timings, "RPAB"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tWTR = memSpec->tCK * queryUIntParameter(timings, "WTR"); + memSpec->tRRD = memSpec->tCK * queryUIntParameter(timings, "RRD"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFIpb = memSpec->tCK * queryUIntParameter(timings, "REFIPB"); + memSpec->tRFCab = memSpec->tCK * queryUIntParameter(timings, "RFCAB"); + memSpec->tRFCpb = memSpec->tCK * queryUIntParameter(timings, "RFCPB"); // Currents and voltages // TODO: to be completed @@ -546,46 +541,45 @@ void ConfigurationLoader::loadHBM2(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for HBM2 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tDQSCK = clk * queryUIntParameter(timings, "DQSCK"); -// memSpec->tDQSQ = clk * queryUIntParameter(timings, "DQSQ"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRCDRD = clk * queryUIntParameter(timings, "RCDRD"); - memSpec->tRCDWR = clk * queryUIntParameter(timings, "RCDWR"); - memSpec->tRRDL = clk * queryUIntParameter(timings, "RRDL"); - memSpec->tRRDS = clk * queryUIntParameter(timings, "RRDS"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tPL = clk * queryUIntParameter(timings, "PL"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tCCDL = clk * queryUIntParameter(timings, "CCDL"); - memSpec->tCCDS = clk * queryUIntParameter(timings, "CCDS"); -// memSpec->tCCDR = clk * queryUIntParameter(timings, "CCDR"); - memSpec->tWTRL = clk * queryUIntParameter(timings, "WTRL"); - memSpec->tWTRS = clk * queryUIntParameter(timings, "WTRS"); - memSpec->tRTW = clk * queryUIntParameter(timings, "RTW"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); + memSpec->tDQSCK = memSpec->tCK * queryUIntParameter(timings, "DQSCK"); +// memSpec->tDQSQ = memSpec->tCK * queryUIntParameter(timings, "DQSQ"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRCDRD = memSpec->tCK * queryUIntParameter(timings, "RCDRD"); + memSpec->tRCDWR = memSpec->tCK * queryUIntParameter(timings, "RCDWR"); + memSpec->tRRDL = memSpec->tCK * queryUIntParameter(timings, "RRDL"); + memSpec->tRRDS = memSpec->tCK * queryUIntParameter(timings, "RRDS"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tPL = memSpec->tCK * queryUIntParameter(timings, "PL"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tCCDL = memSpec->tCK * queryUIntParameter(timings, "CCDL"); + memSpec->tCCDS = memSpec->tCK * queryUIntParameter(timings, "CCDS"); +// memSpec->tCCDR = memSpec->tCK * queryUIntParameter(timings, "CCDR"); + memSpec->tWTRL = memSpec->tCK * queryUIntParameter(timings, "WTRL"); + memSpec->tWTRS = memSpec->tCK * queryUIntParameter(timings, "WTRS"); + memSpec->tRTW = memSpec->tCK * queryUIntParameter(timings, "RTW"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); memSpec->tPD = memSpec->tCKE; memSpec->tRDPDE = memSpec->tRL + memSpec->tPL - + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->tCK; memSpec->tWRPDE = memSpec->tWL + memSpec->tPL - + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk + memSpec->tWR; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->tCK + memSpec->tWR; memSpec->tWRAPDE = memSpec->tWL + memSpec->tPL - + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk + memSpec->tWR; - memSpec->tCKESR = memSpec->tCKE + memSpec->clk; + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->tCK + memSpec->tWR; + memSpec->tCKESR = memSpec->tCKE + memSpec->tCK; memSpec->tRDSRE = memSpec->tRL + memSpec->tPL - + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->clk; - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRFCSB = clk * queryUIntParameter(timings, "RFCSB"); - memSpec->tRREFD = clk * queryUIntParameter(timings, "RREFD"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFISB = clk * queryUIntParameter(timings, "REFISB"); + + (memSpec->burstLength / memSpec->dataRate + 1) * memSpec->tCK; + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRFCSB = memSpec->tCK * queryUIntParameter(timings, "RFCSB"); + memSpec->tRREFD = memSpec->tCK * queryUIntParameter(timings, "RREFD"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFISB = memSpec->tCK * queryUIntParameter(timings, "REFISB"); // Currents and voltages // TODO: to be completed @@ -608,44 +602,43 @@ void ConfigurationLoader::loadGDDR5(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for GDDR5 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCDRD = clk * queryUIntParameter(timings, "RCDRD"); - memSpec->tRCDWR = clk * queryUIntParameter(timings, "RCDWR"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tRRDS = clk * queryUIntParameter(timings, "RRDS"); - memSpec->tRRDL = clk * queryUIntParameter(timings, "RRDL"); - memSpec->tCCDS = clk * queryUIntParameter(timings, "CCDS"); - memSpec->tCCDL = clk * queryUIntParameter(timings, "CCDL"); - memSpec->tCL = clk * queryUIntParameter(timings, "CL"); - memSpec->tWCK2CKPIN = clk * queryUIntParameter(timings, "WCK2CKPIN"); - memSpec->tWCK2CK = clk * queryUIntParameter(timings, "WCK2CK"); - memSpec->tWCK2DQO = clk * queryUIntParameter(timings, "WCK2DQO"); - memSpec->tRTW = clk * queryUIntParameter(timings, "RTW"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWCK2DQI = clk * queryUIntParameter(timings, "WCK2DQI"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tWTRS = clk * queryUIntParameter(timings, "WTRS"); - memSpec->tWTRL = clk * queryUIntParameter(timings, "WTRL"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCDRD = memSpec->tCK * queryUIntParameter(timings, "RCDRD"); + memSpec->tRCDWR = memSpec->tCK * queryUIntParameter(timings, "RCDWR"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tRRDS = memSpec->tCK * queryUIntParameter(timings, "RRDS"); + memSpec->tRRDL = memSpec->tCK * queryUIntParameter(timings, "RRDL"); + memSpec->tCCDS = memSpec->tCK * queryUIntParameter(timings, "CCDS"); + memSpec->tCCDL = memSpec->tCK * queryUIntParameter(timings, "CCDL"); + memSpec->tCL = memSpec->tCK * queryUIntParameter(timings, "CL"); + memSpec->tWCK2CKPIN = memSpec->tCK * queryUIntParameter(timings, "WCK2CKPIN"); + memSpec->tWCK2CK = memSpec->tCK * queryUIntParameter(timings, "WCK2CK"); + memSpec->tWCK2DQO = memSpec->tCK * queryUIntParameter(timings, "WCK2DQO"); + memSpec->tRTW = memSpec->tCK * queryUIntParameter(timings, "RTW"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWCK2DQI = memSpec->tCK * queryUIntParameter(timings, "WCK2DQI"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tWTRS = memSpec->tCK * queryUIntParameter(timings, "WTRS"); + memSpec->tWTRL = memSpec->tCK * queryUIntParameter(timings, "WTRL"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); memSpec->tPD = memSpec->tCKE; - memSpec->tXPN = clk * queryUIntParameter(timings, "XPN"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFIPB = clk * queryUIntParameter(timings, "REFIPB"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRFCPB = clk * queryUIntParameter(timings, "RFCPB"); - memSpec->tRREFD = clk * queryUIntParameter(timings, "RREFD"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->t32AW = clk * queryUIntParameter(timings, "32AW"); + memSpec->tXPN = memSpec->tCK * queryUIntParameter(timings, "XPN"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFIPB = memSpec->tCK * queryUIntParameter(timings, "REFIPB"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRFCPB = memSpec->tCK * queryUIntParameter(timings, "RFCPB"); + memSpec->tRREFD = memSpec->tCK * queryUIntParameter(timings, "RREFD"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->t32AW = memSpec->tCK * queryUIntParameter(timings, "32AW"); memSpec->tRDSRE = memSpec->tCL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; - memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); - memSpec->tLK = clk * queryUIntParameter(timings, "LK"); + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; + memSpec->tPPD = memSpec->tCK * queryUIntParameter(timings, "PPD"); + memSpec->tLK = memSpec->tCK * queryUIntParameter(timings, "LK"); // Currents and voltages // TODO: to be completed @@ -668,44 +661,43 @@ void ConfigurationLoader::loadGDDR5X(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for GDDR5X XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCDRD = clk * queryUIntParameter(timings, "RCDRD"); - memSpec->tRCDWR = clk * queryUIntParameter(timings, "RCDWR"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tRRDS = clk * queryUIntParameter(timings, "RRDS"); - memSpec->tRRDL = clk * queryUIntParameter(timings, "RRDL"); - memSpec->tCCDS = clk * queryUIntParameter(timings, "CCDS"); - memSpec->tCCDL = clk * queryUIntParameter(timings, "CCDL"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tWCK2CKPIN = clk * queryUIntParameter(timings, "WCK2CKPIN"); - memSpec->tWCK2CK = clk * queryUIntParameter(timings, "WCK2CK"); - memSpec->tWCK2DQO = clk * queryUIntParameter(timings, "WCK2DQO"); - memSpec->tRTW = clk * queryUIntParameter(timings, "RTW"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWCK2DQI = clk * queryUIntParameter(timings, "WCK2DQI"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tWTRS = clk * queryUIntParameter(timings, "WTRS"); - memSpec->tWTRL = clk * queryUIntParameter(timings, "WTRL"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCDRD = memSpec->tCK * queryUIntParameter(timings, "RCDRD"); + memSpec->tRCDWR = memSpec->tCK * queryUIntParameter(timings, "RCDWR"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tRRDS = memSpec->tCK * queryUIntParameter(timings, "RRDS"); + memSpec->tRRDL = memSpec->tCK * queryUIntParameter(timings, "RRDL"); + memSpec->tCCDS = memSpec->tCK * queryUIntParameter(timings, "CCDS"); + memSpec->tCCDL = memSpec->tCK * queryUIntParameter(timings, "CCDL"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tWCK2CKPIN = memSpec->tCK * queryUIntParameter(timings, "WCK2CKPIN"); + memSpec->tWCK2CK = memSpec->tCK * queryUIntParameter(timings, "WCK2CK"); + memSpec->tWCK2DQO = memSpec->tCK * queryUIntParameter(timings, "WCK2DQO"); + memSpec->tRTW = memSpec->tCK * queryUIntParameter(timings, "RTW"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWCK2DQI = memSpec->tCK * queryUIntParameter(timings, "WCK2DQI"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tWTRS = memSpec->tCK * queryUIntParameter(timings, "WTRS"); + memSpec->tWTRL = memSpec->tCK * queryUIntParameter(timings, "WTRL"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); memSpec->tPD = memSpec->tCKE; - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFIPB = clk * queryUIntParameter(timings, "REFIPB"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRFCPB = clk * queryUIntParameter(timings, "RFCPB"); - memSpec->tRREFD = clk * queryUIntParameter(timings, "RREFD"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); - memSpec->t32AW = clk * queryUIntParameter(timings, "32AW"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFIPB = memSpec->tCK * queryUIntParameter(timings, "REFIPB"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRFCPB = memSpec->tCK * queryUIntParameter(timings, "RFCPB"); + memSpec->tRREFD = memSpec->tCK * queryUIntParameter(timings, "RREFD"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); + memSpec->t32AW = memSpec->tCK * queryUIntParameter(timings, "32AW"); memSpec->tRDSRE = memSpec->tRL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; - memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); - memSpec->tLK = clk * queryUIntParameter(timings, "LK"); + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; + memSpec->tPPD = memSpec->tCK * queryUIntParameter(timings, "PPD"); + memSpec->tLK = memSpec->tCK * queryUIntParameter(timings, "LK"); // Currents and voltages // TODO: to be completed @@ -728,47 +720,46 @@ void ConfigurationLoader::loadGDDR6(Configuration &config, XMLElement *xmlSpec) // MemTimings specific for GDDR6 XMLElement *timings = xmlSpec->FirstChildElement("memtimingspec"); - sc_time clk = memSpec->clk; - memSpec->tRP = clk * queryUIntParameter(timings, "RP"); - memSpec->tRAS = clk * queryUIntParameter(timings, "RAS"); - memSpec->tRC = clk * queryUIntParameter(timings, "RC"); - memSpec->tRCDRD = clk * queryUIntParameter(timings, "RCDRD"); - memSpec->tRCDWR = clk * queryUIntParameter(timings, "RCDWR"); - memSpec->tRTP = clk * queryUIntParameter(timings, "RTP"); - memSpec->tRRDS = clk * queryUIntParameter(timings, "RRDS"); - memSpec->tRRDL = clk * queryUIntParameter(timings, "RRDL"); - memSpec->tCCDS = clk * queryUIntParameter(timings, "CCDS"); - memSpec->tCCDL = clk * queryUIntParameter(timings, "CCDL"); - memSpec->tRL = clk * queryUIntParameter(timings, "RL"); - memSpec->tWCK2CKPIN = clk * queryUIntParameter(timings, "WCK2CKPIN"); - memSpec->tWCK2CK = clk * queryUIntParameter(timings, "WCK2CK"); - memSpec->tWCK2DQO = clk * queryUIntParameter(timings, "WCK2DQO"); - memSpec->tRTW = clk * queryUIntParameter(timings, "RTW"); - memSpec->tWL = clk * queryUIntParameter(timings, "WL"); - memSpec->tWCK2DQI = clk * queryUIntParameter(timings, "WCK2DQI"); - memSpec->tWR = clk * queryUIntParameter(timings, "WR"); - memSpec->tWTRS = clk * queryUIntParameter(timings, "WTRS"); - memSpec->tWTRL = clk * queryUIntParameter(timings, "WTRL"); - memSpec->tCKE = clk * queryUIntParameter(timings, "CKE"); + memSpec->tRP = memSpec->tCK * queryUIntParameter(timings, "RP"); + memSpec->tRAS = memSpec->tCK * queryUIntParameter(timings, "RAS"); + memSpec->tRC = memSpec->tCK * queryUIntParameter(timings, "RC"); + memSpec->tRCDRD = memSpec->tCK * queryUIntParameter(timings, "RCDRD"); + memSpec->tRCDWR = memSpec->tCK * queryUIntParameter(timings, "RCDWR"); + memSpec->tRTP = memSpec->tCK * queryUIntParameter(timings, "RTP"); + memSpec->tRRDS = memSpec->tCK * queryUIntParameter(timings, "RRDS"); + memSpec->tRRDL = memSpec->tCK * queryUIntParameter(timings, "RRDL"); + memSpec->tCCDS = memSpec->tCK * queryUIntParameter(timings, "CCDS"); + memSpec->tCCDL = memSpec->tCK * queryUIntParameter(timings, "CCDL"); + memSpec->tRL = memSpec->tCK * queryUIntParameter(timings, "RL"); + memSpec->tWCK2CKPIN = memSpec->tCK * queryUIntParameter(timings, "WCK2CKPIN"); + memSpec->tWCK2CK = memSpec->tCK * queryUIntParameter(timings, "WCK2CK"); + memSpec->tWCK2DQO = memSpec->tCK * queryUIntParameter(timings, "WCK2DQO"); + memSpec->tRTW = memSpec->tCK * queryUIntParameter(timings, "RTW"); + memSpec->tWL = memSpec->tCK * queryUIntParameter(timings, "WL"); + memSpec->tWCK2DQI = memSpec->tCK * queryUIntParameter(timings, "WCK2DQI"); + memSpec->tWR = memSpec->tCK * queryUIntParameter(timings, "WR"); + memSpec->tWTRS = memSpec->tCK * queryUIntParameter(timings, "WTRS"); + memSpec->tWTRL = memSpec->tCK * queryUIntParameter(timings, "WTRL"); + memSpec->tCKE = memSpec->tCK * queryUIntParameter(timings, "CKE"); memSpec->tPD = memSpec->tCKE; - memSpec->tCKESR = clk * queryUIntParameter(timings, "CKESR"); - memSpec->tXP = clk * queryUIntParameter(timings, "XP"); - memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tREFIPB = clk * queryUIntParameter(timings, "REFIPB"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); - memSpec->tRFCPB = clk * queryUIntParameter(timings, "RFCPB"); - memSpec->tRREFD = clk * queryUIntParameter(timings, "RREFD"); - memSpec->tXS = clk * queryUIntParameter(timings, "XS"); - memSpec->tFAW = clk * queryUIntParameter(timings, "FAW"); + memSpec->tCKESR = memSpec->tCK * queryUIntParameter(timings, "CKESR"); + memSpec->tXP = memSpec->tCK * queryUIntParameter(timings, "XP"); + memSpec->tREFI = memSpec->tCK * queryUIntParameter(timings, "REFI"); + memSpec->tREFIPB = memSpec->tCK * queryUIntParameter(timings, "REFIPB"); + memSpec->tRFC = memSpec->tCK * queryUIntParameter(timings, "RFC"); + memSpec->tRFCPB = memSpec->tCK * queryUIntParameter(timings, "RFCPB"); + memSpec->tRREFD = memSpec->tCK * queryUIntParameter(timings, "RREFD"); + memSpec->tXS = memSpec->tCK * queryUIntParameter(timings, "XS"); + memSpec->tFAW = memSpec->tCK * queryUIntParameter(timings, "FAW"); memSpec->tRDSRE = memSpec->tRL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * clk; + + memSpec->tWCK2DQO + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; memSpec->tWRSRE = memSpec->tWL + memSpec->tWCK2CKPIN + memSpec->tWCK2CK - + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * clk; - memSpec->tPPD = clk * queryUIntParameter(timings, "PPD"); - memSpec->tLK = clk * queryUIntParameter(timings, "LK"); - memSpec->tACTPDE = clk * queryUIntParameter(timings, "ACTPDE"); - memSpec->tPREPDE = clk * queryUIntParameter(timings, "PREPDE"); - memSpec->tREFPDE = clk * queryUIntParameter(timings, "REFPDE"); + + memSpec->tWCK2DQI + memSpec->burstLength / memSpec->dataRate * memSpec->tCK; + memSpec->tPPD = memSpec->tCK * queryUIntParameter(timings, "PPD"); + memSpec->tLK = memSpec->tCK * queryUIntParameter(timings, "LK"); + memSpec->tACTPDE = memSpec->tCK * queryUIntParameter(timings, "ACTPDE"); + memSpec->tPREPDE = memSpec->tCK * queryUIntParameter(timings, "PREPDE"); + memSpec->tREFPDE = memSpec->tCK * queryUIntParameter(timings, "REFPDE"); // Currents and voltages // TODO: to be completed diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp index ade57e7b..b6f74ddd 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp @@ -59,5 +59,5 @@ const std::vector &MemSpec::getBanks() const sc_time MemSpec::getCommandLength(Command command) const { - return clk * commandLengthInCycles[command]; + return tCK * commandLengthInCycles[command]; } diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index 9363c318..5589a767 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -78,8 +78,8 @@ struct MemSpec unsigned int groupsPerRank; // Clock - double clkMHz; - sc_time clk; + double fCKMHz; + sc_time tCK; sc_time burstDuration; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp index 14befb19..f002b501 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp @@ -52,9 +52,9 @@ sc_time MemSpecGDDR6::getExecutionTime(Command command, const tlm_generic_payloa else if (command == Command::ACT) { if (payload.get_command() == TLM_READ_COMMAND) - return tRCDRD + clk; + return tRCDRD + tCK; else - return tRCDWR + clk; + return tRCDWR + tCK; } else if (command == Command::RD) return tRL + tWCK2CKPIN + tWCK2CK + tWCK2DQO + burstDuration; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp index 2b661eea..22e4e686 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp @@ -57,9 +57,9 @@ sc_time MemSpecHBM2::getExecutionTime(Command command, const tlm_generic_payload else if (command == Command::ACT) { if (payload.get_command() == TLM_READ_COMMAND) - return tRCDRD + clk; + return tRCDRD + tCK; else - return tRCDWR + clk; + return tRCDWR + tCK; } else if (command == Command::RD) return tRL + tDQSCK + burstDuration; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h index 72b96781..4930c070 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h @@ -67,11 +67,11 @@ struct MemSpecHBM2 final : public MemSpec sc_time tXP; sc_time tCKE; sc_time tPD; // = tCKE; - sc_time tRDPDE; // = tRL + tPL + (BurstLength / DataRate) * clk + clk; - sc_time tWRPDE; // = tWL + tPL + (BurstLength / DataRate) * clk + clk + tWR; - sc_time tWRAPDE; // = tWL + tPL + (BurstLength / DataRate) * clk + clk + tWR; - sc_time tCKESR; // = tCKE + clk; - sc_time tRDSRE; // = tRL + tPL + (BurstLength / DataRate) * clk + clk; + sc_time tRDPDE; // = tRL + tPL + (BurstLength / DataRate) * tCK + tCK; + sc_time tWRPDE; // = tWL + tPL + (BurstLength / DataRate) * tCK + tCK + tWR; + sc_time tWRAPDE; // = tWL + tPL + (BurstLength / DataRate) * tCK + tCK + tWR; + sc_time tCKESR; // = tCKE + tCK; + sc_time tRDSRE; // = tRL + tPL + (BurstLength / DataRate) * tCK + tCK; sc_time tXS; sc_time tRFC; sc_time tRFCSB; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp index 6fa0fe2d..c01615ee 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp @@ -63,23 +63,23 @@ sc_time MemSpecLPDDR4::getRefreshIntervalPB() const sc_time MemSpecLPDDR4::getExecutionTime(Command command, const tlm_generic_payload &) const { if (command == Command::PRE) - return tRPpb + clk; + return tRPpb + tCK; else if (command == Command::PREA) - return tRPab + clk; + return tRPab + tCK; else if (command == Command::ACT) - return tRCD + 3 * clk; + return tRCD + 3 * tCK; else if (command == Command::RD) - return tRL + tDQSCK + burstDuration + 3 * clk; + return tRL + tDQSCK + burstDuration + 3 * tCK; else if (command == Command::RDA) - return burstDuration + tRTP - 5 * clk + tRPpb; + return burstDuration + tRTP - 5 * tCK + tRPpb; else if (command == Command::WR) - return tWL + tDQSS + tDQS2DQ + burstDuration + 3 * clk; + return tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK; else if (command == Command::WRA) - return tWL + 4 * clk + burstDuration + tWR + tRPpb; + return tWL + 4 * tCK + burstDuration + tWR + tRPpb; else if (command == Command::REFA) - return tRFCab + clk; + return tRFCab + tCK; else if (command == Command::REFB) - return tRFCpb + clk; + return tRFCpb + tCK; else { SC_REPORT_FATAL("getExecutionTime", @@ -91,11 +91,11 @@ sc_time MemSpecLPDDR4::getExecutionTime(Command command, const tlm_generic_paylo TimeInterval MemSpecLPDDR4::getIntervalOnDataStrobe(Command command) const { if (command == Command::RD || command == Command::RDA) - return TimeInterval(sc_time_stamp() + tRL + tDQSCK + 3 * clk, - sc_time_stamp() + tRL + tDQSCK + burstDuration + 3 * clk); + return TimeInterval(sc_time_stamp() + tRL + tDQSCK + 3 * tCK, + sc_time_stamp() + tRL + tDQSCK + burstDuration + 3 * tCK); else if (command == Command::WR || command == Command::WRA) - return TimeInterval(sc_time_stamp() + tWL + tDQSS + tDQS2DQ + 3 * clk, - sc_time_stamp() + tWL + tDQSS + tDQS2DQ + burstDuration + 3 * clk); + return TimeInterval(sc_time_stamp() + tWL + tDQSS + tDQS2DQ + 3 * tCK, + sc_time_stamp() + tWL + tDQSS + tDQS2DQ + burstDuration + 3 * tCK); else { SC_REPORT_FATAL("MemSpecLPDDR4", "Method was called with invalid argument"); diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp index 6b6200ab..99c93232 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp @@ -60,7 +60,7 @@ sc_time MemSpecWideIO::getExecutionTime(Command command, const tlm_generic_paylo else if (command == Command::WR) return tWL + burstDuration; else if (command == Command::WRA) - return tWL + burstDuration - clk + tWR + tRP; + return tWL + burstDuration - tCK + tWR + tRP; else if (command == Command::REFA) return tRFC; else diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp index 409ffadd..e115e300 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp @@ -57,11 +57,11 @@ sc_time MemSpecWideIO2::getExecutionTime(Command command, const tlm_generic_payl else if (command == Command::RD) return tRL + tDQSCK + burstDuration; else if (command == Command::RDA) - return burstDuration - 2 * clk + tRTP + tRPpb; + return burstDuration - 2 * tCK + tRTP + tRPpb; else if (command == Command::WR) return tWL + tDQSS + burstDuration; else if (command == Command::WRA) - return tWL + burstDuration + clk + tWR + tRPpb; + return tWL + burstDuration + tCK + tWR + tRPpb; else if (command == Command::REFA) return tRFCab; else if (command == Command::REFB) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 316117b2..6aeecb1a 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -360,14 +360,14 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, if (phase == BEGIN_REQ) { - notificationDelay += Configuration::getInstance().memSpec->clk; + notificationDelay += Configuration::getInstance().memSpec->tCK; payloadToAcquire = &trans; timeToAcquire = sc_time_stamp() + notificationDelay; beginReqEvent.notify(notificationDelay); } else if (phase = END_RESP) { - notificationDelay += Configuration::getInstance().memSpec->clk; + notificationDelay += Configuration::getInstance().memSpec->tCK; timeToRelease = sc_time_stamp() + notificationDelay; endRespEvent.notify(notificationDelay); } diff --git a/DRAMSys/library/src/controller/ControllerIF.h b/DRAMSys/library/src/controller/ControllerIF.h index e07e1780..cb40432f 100644 --- a/DRAMSys/library/src/controller/ControllerIF.h +++ b/DRAMSys/library/src/controller/ControllerIF.h @@ -24,14 +24,14 @@ public: sc_time activeTime = numberOfTransactionsServed * Configuration::getInstance().memSpec->burstLength / Configuration::getInstance().memSpec->dataRate - * Configuration::getInstance().memSpec->clk; + * Configuration::getInstance().memSpec->tCK; double bandwidth = (activeTime / sc_time_stamp() * 100); double bandwidth_IDLE = ((activeTime) / (sc_time_stamp() - idleTime) * 100); double maxBandwidth = ( - // clk in Mhz e.g. 800 [MHz]: - (1000000 / Configuration::getInstance().memSpec->clk.to_double()) + // fCK in Mhz e.g. 800 [MHz]: + (1000000 / Configuration::getInstance().memSpec->tCK.to_double()) // DataRate e.g. 2 * Configuration::getInstance().memSpec->dataRate // BusWidth e.g. 8 or 64 diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp index 7fe0dae9..1daf2dee 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR3.cpp @@ -152,12 +152,12 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->burstDuration + 2 * memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -260,22 +260,22 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + 5 * memSpec->clk); + + memSpec->tRL + 5 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + 5 * memSpec->clk); + + memSpec->tRL + 5 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + 4 * memSpec->clk + memSpec->tWR); + + memSpec->tWL + 4 * memSpec->tCK + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + 5 * memSpec->clk + memSpec->tWR); + + memSpec->tWL + 5 * memSpec->tCK + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -292,17 +292,17 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + 5 * memSpec->clk); + + memSpec->tRL + 5 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + 5 * memSpec->clk); + + memSpec->tRL + 5 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + 5 * memSpec->clk + memSpec->tWR); + + memSpec->tWL + 5 * memSpec->tCK + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::PDXP][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -323,12 +323,12 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + std::max(memSpec->tRL + 5 * memSpec->clk, memSpec->tAL + memSpec->tRTP + memSpec->tRP)); + + std::max(memSpec->tRL + 5 * memSpec->tCK, memSpec->tAL + memSpec->tRTP + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + std::max(memSpec->tWL + 5 * memSpec->clk + memSpec->tWR, memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP)); + + std::max(memSpec->tWL + 5 * memSpec->tCK + memSpec->tWR, memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP)); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -360,7 +360,7 @@ sc_time CheckerDDR3::timeToSatisfyConstraints(Command command, Rank rank, BankGr reportFatal("CheckerDDR3", "Unknown command!"); // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp index adb156b3..143d5b90 100644 --- a/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerDDR4.cpp @@ -152,12 +152,12 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL - + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); + + memSpec->burstDuration + 2 * memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRL - + memSpec->burstDuration + 2 * memSpec->clk - memSpec->tWL); + + memSpec->burstDuration + 2 * memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::WR][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -243,7 +243,7 @@ sc_time CheckerDDR4::timeToSatisfyConstraints(Command command, Rank rank, BankGr reportFatal("CheckerDDR4", "Unknown command!"); // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp index 9db728d2..d8b3c522 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5.cpp @@ -308,7 +308,7 @@ sc_time CheckerGDDR5::timeToSatisfyConstraints(Command command, Rank rank, BankG reportFatal("CheckerGDDR5", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp index 4796866b..7c7d51aa 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR5X.cpp @@ -308,7 +308,7 @@ sc_time CheckerGDDR5X::timeToSatisfyConstraints(Command command, Rank rank, Bank reportFatal("CheckerGDDR5X", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp index 9ac73b89..74abbf99 100644 --- a/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerGDDR6.cpp @@ -301,7 +301,7 @@ sc_time CheckerGDDR6::timeToSatisfyConstraints(Command command, Rank rank, BankG reportFatal("CheckerGDDR6", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp index 097233d3..e2c92f9e 100644 --- a/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerHBM2.cpp @@ -75,43 +75,43 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRTP + memSpec->tRP - memSpec->clk); + + memSpec->tRTP + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP - memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRP - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFB][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCSB - memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFB][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRREFD - memSpec->tCK); if (lastActivates[rank.ID()].size() == 4) earliestTimeToStart = std::max(earliestTimeToStart, - lastActivates[rank.ID()].front() + memSpec->tFAW - memSpec->clk); + lastActivates[rank.ID()].front() + memSpec->tFAW - memSpec->tCK); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else if (command == Command::RD || command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDRD + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::RD][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -157,12 +157,12 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWTRS); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); } else if (command == Command::WR || command == Command::WRA) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRCDWR + memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) @@ -188,12 +188,12 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tCCDS); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnCasBus + memSpec->tCK); } else if (command == Command::PRE) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -204,12 +204,12 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else if (command == Command::PREA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -229,13 +229,13 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else if (command == Command::REFA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -258,21 +258,21 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFC); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else if (command == Command::REFB) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRC + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBankGroup[Command::ACT][bankgroup.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDL + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRDS + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -303,7 +303,7 @@ sc_time CheckerHBM2::timeToSatisfyConstraints(Command command, Rank rank, BankGr if (lastActivates[rank.ID()].size() == 4) earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW); - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnRasBus + memSpec->tCK); } else { @@ -326,7 +326,7 @@ void CheckerHBM2::insert(Command command, Rank rank, BankGroup bankgroup, Bank b if (isCasCommand(command)) lastCommandOnCasBus = sc_time_stamp(); else if (command == Command::ACT) - lastCommandOnRasBus = sc_time_stamp() + memSpec->clk; + lastCommandOnRasBus = sc_time_stamp() + memSpec->tCK; else lastCommandOnRasBus = sc_time_stamp(); diff --git a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp index 4313861b..943298db 100644 --- a/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerLPDDR4.cpp @@ -64,15 +64,15 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration - + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWR + memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb - 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPpb - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PREA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab - 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRPab - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -84,18 +84,18 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::REFA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab - 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCab - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::REFB][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb - 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::REFB][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD - 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD - 2 * memSpec->tCK); if (lastActivates[rank.ID()].size() == 4) - earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW - 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW - 3 * memSpec->tCK); } else if (command == Command::RD || command == Command::RDA) { @@ -112,19 +112,19 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -150,15 +150,15 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank else if (command == Command::PRE) { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -167,23 +167,23 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank else if (command == Command::PREA) { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->burstDuration + memSpec->tRTP - 6 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + 3 * memSpec->tCK); // lastCommandStart = lastScheduledByCommandAndRank[Command::REFB][rank.ID()]; // if (lastCommandStart != SC_ZERO_TIME) @@ -197,16 +197,16 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank { lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tRPpb + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tRPpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRPpb + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRPpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration - + memSpec->tWR + 3 * memSpec->clk + memSpec->tRPpb); + + memSpec->tWR + 3 * memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -228,20 +228,20 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank { lastCommandStart = lastScheduledByCommandAndBank[Command::ACT][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tRPpb + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRAS + memSpec->tRPpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::ACT][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRRD + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRPpb + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRTP + memSpec->tRPpb + 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL + memSpec->burstDuration - + memSpec->tWR + 3 * memSpec->clk + memSpec->tRPpb); + + memSpec->tWR + 3 * memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -260,14 +260,14 @@ sc_time CheckerLPDDR4::timeToSatisfyConstraints(Command command, Rank rank, Bank earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tRFCpb); if (lastActivates[rank.ID()].size() == 4) - earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW - memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastActivates[rank.ID()].front() + memSpec->tFAW - memSpec->tCK); } else { reportFatal("CheckerLPDDR4", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } @@ -280,7 +280,7 @@ void CheckerLPDDR4::insert(Command command, Rank rank, BankGroup, Bank bank) lastScheduledByCommandAndBank[command][bank.ID()] = sc_time_stamp(); lastScheduledByCommandAndRank[command][rank.ID()] = sc_time_stamp(); lastScheduledByCommand[command] = sc_time_stamp(); - lastCommandOnBus = sc_time_stamp() + memSpec->getCommandLength(command) - memSpec->clk; + lastCommandOnBus = sc_time_stamp() + memSpec->getCommandLength(command) - memSpec->tCK; if (command == Command::ACT || command == Command::REFB) { diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp index 16aa444e..c0236fee 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO.cpp @@ -64,7 +64,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec->tWL - + memSpec->burstDuration - memSpec->clk + memSpec->tWR + memSpec->tRP); + + memSpec->burstDuration - memSpec->tCK + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -105,20 +105,20 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->tCK + memSpec->tWR); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWTR); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -128,12 +128,12 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->burstDuration + memSpec->clk); + + memSpec->tRL + memSpec->burstDuration + memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->burstDuration + memSpec->clk); + + memSpec->tRL + memSpec->burstDuration + memSpec->tCK); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -155,7 +155,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWR); } else if (command == Command::PREA) { @@ -173,12 +173,12 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWR); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWR); } else if (command == Command::REFA) { @@ -193,7 +193,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration - memSpec->clk + memSpec->tWR + memSpec->tRP); + + memSpec->tWL + memSpec->burstDuration - memSpec->tCK + memSpec->tWR + memSpec->tRP); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -212,7 +212,7 @@ sc_time CheckerWideIO::timeToSatisfyConstraints(Command command, Rank rank, Bank reportFatal("CheckerWideIO", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastScheduled + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastScheduled + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp index 22fb6c70..8a2a73fb 100644 --- a/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp +++ b/DRAMSys/library/src/controller/checker/CheckerWideIO2.cpp @@ -68,12 +68,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -114,20 +114,20 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); + + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWTR); if (command == Command::RDA) { lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); + + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWR - memSpec->tRTP); } lastCommandStart = lastScheduledByCommand[Command::WRA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->clk + memSpec->burstDuration + memSpec->tWTR); + + memSpec->tWL + memSpec->tCK + memSpec->burstDuration + memSpec->tWTR); } else if (command == Command::WR || command == Command::WRA) { @@ -137,12 +137,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommand[Command::RD]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::RDA]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->clk - memSpec->tWL); + + memSpec->tRL + memSpec->tDQSCK + memSpec->burstDuration + memSpec->tCK - memSpec->tWL); lastCommandStart = lastScheduledByCommand[Command::WR]; if (lastCommandStart != SC_ZERO_TIME) @@ -160,12 +160,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RD][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndBank[Command::WR][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK); } else if (command == Command::PREA) { @@ -175,26 +175,26 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::RD][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WR][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + 2 * memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + 2 * memSpec->tCK); } else if (command == Command::REFA) { @@ -205,12 +205,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndRank[Command::RDA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::WRA][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndRank[Command::PRE][rank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -237,12 +237,12 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban lastCommandStart = lastScheduledByCommandAndBank[Command::RDA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->clk + memSpec->tRPpb); + + memSpec->burstDuration + memSpec->tRTP - 2 * memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart - + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->clk + memSpec->tRPpb); + + memSpec->tWL + memSpec->burstDuration + memSpec->tWR + memSpec->tCK + memSpec->tRPpb); lastCommandStart = lastScheduledByCommandAndBank[Command::PRE][bank.ID()]; if (lastCommandStart != SC_ZERO_TIME) @@ -260,7 +260,7 @@ sc_time CheckerWideIO2::timeToSatisfyConstraints(Command command, Rank rank, Ban reportFatal("CheckerWideIO2", "Unknown command!"); } // Check if command bus is free - earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->clk); + earliestTimeToStart = std::max(earliestTimeToStart, lastCommandOnBus + memSpec->tCK); return earliestTimeToStart; } diff --git a/DRAMSys/library/src/error/errormodel.cpp b/DRAMSys/library/src/error/errormodel.cpp index 5cc06fe3..9b20c68b 100644 --- a/DRAMSys/library/src/error/errormodel.cpp +++ b/DRAMSys/library/src/error/errormodel.cpp @@ -497,8 +497,8 @@ double errorModel::getTemperature() if (thermalSim == true && powerAnalysis == true) { // TODO // check if this is best way to request information to DRAMPower. - unsigned long long clk_cycles = sc_time_stamp().value() / - Configuration::getInstance().memSpec->clk.value(); + unsigned long long clk_cycles = sc_time_stamp() / + Configuration::getInstance().memSpec->tCK; DRAMPower->calcWindowEnergy(clk_cycles); float average_power = (float)DRAMPower->getPower().average_power; temperature = TemperatureController::getInstance().getTemperature( diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index 199d6a34..7f80a9ff 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -67,8 +67,8 @@ Arbiter::Arbiter(sc_module_name name) : tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, tlm_phase &phase, sc_time &fwDelay) { - sc_time notDelay = std::ceil((sc_time_stamp() + fwDelay) / Configuration::getInstance().memSpec->clk) - * Configuration::getInstance().memSpec->clk - sc_time_stamp(); + sc_time notDelay = std::ceil((sc_time_stamp() + fwDelay) / Configuration::getInstance().memSpec->tCK) + * Configuration::getInstance().memSpec->tCK - sc_time_stamp(); if (phase == BEGIN_REQ) { @@ -83,7 +83,7 @@ tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, } else if (phase == END_RESP) { - notDelay += Configuration::getInstance().memSpec->clk; + notDelay += Configuration::getInstance().memSpec->tCK; payload.release(); } diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/library/src/simulation/TraceGenerator.h index 56a9877e..2d8f7bc9 100644 --- a/DRAMSys/library/src/simulation/TraceGenerator.h +++ b/DRAMSys/library/src/simulation/TraceGenerator.h @@ -45,13 +45,13 @@ using namespace tlm; struct TraceGenerator : public TracePlayer { public: - TraceGenerator(sc_module_name name, unsigned int clkMhz, TracePlayerListener *listener) + TraceGenerator(sc_module_name name, unsigned int fCKMhz, TracePlayerListener *listener) : TracePlayer(name, listener), transCounter(0) { - if (clkMhz == 0) - clk = Configuration::getInstance().memSpec->clk; + if (fCKMhz == 0) + tCK = Configuration::getInstance().memSpec->tCK; else - clk = sc_time(1.0 / clkMhz, SC_US); + tCK = sc_time(1.0 / fCKMhz, SC_US); this->burstlenght = Configuration::getInstance().memSpec->burstLength; } @@ -81,7 +81,7 @@ public: private: unsigned int burstlenght; - sc_time clk; + sc_time tCK; unsigned int transCounter; }; diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index 7c0f9369..cf881f03 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -141,7 +141,7 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp().value() / memSpec->clk.value(); + unsigned long long cycle = sc_time_stamp() / memSpec->tCK; if (phase == BEGIN_PRE) { diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index 76335e4f..9b2910ab 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -52,8 +52,6 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) if (Configuration::getInstance().powerAnalysis) { - sc_time clk = memSpec->clk; - MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -67,45 +65,45 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) memArchSpec.dll = true; MemTimingSpec memTimingSpec; - //FIXME: memTimingSpec.FAWB = memSpec->tFAW / clk; - //FIXME: memTimingSpec.RASB = memSpec->tRAS / clk; - //FIXME: memTimingSpec.RCB = memSpec->tRC / clk; - //FIXME: memTimingSpec.RPB = memSpec->tRP / clk; - //FIXME: memTimingSpec.RRDB = memSpec->tRRD / clk; - //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD / clk; - //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD / clk; - memTimingSpec.AL = memSpec->tAL / clk; - memTimingSpec.CCD = memSpec->tCCD / clk; - memTimingSpec.CCD_L = memSpec->tCCD / clk; - memTimingSpec.CCD_S = memSpec->tCCD / clk; - memTimingSpec.CKE = memSpec->tCKE / clk; - memTimingSpec.CKESR = memSpec->tCKESR / clk; - memTimingSpec.clkMhz = memSpec->clkMHz; + //FIXME: memTimingSpec.FAWB = memSpec->tFAW / memSpec->tCK; + //FIXME: memTimingSpec.RASB = memSpec->tRAS / memSpec->tCK; + //FIXME: memTimingSpec.RCB = memSpec->tRC / memSpec->tCK; + //FIXME: memTimingSpec.RPB = memSpec->tRP / memSpec->tCK; + //FIXME: memTimingSpec.RRDB = memSpec->tRRD / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD / memSpec->tCK; + memTimingSpec.AL = memSpec->tAL / memSpec->tCK; + memTimingSpec.CCD = memSpec->tCCD / memSpec->tCK; + memTimingSpec.CCD_L = memSpec->tCCD / memSpec->tCK; + memTimingSpec.CCD_S = memSpec->tCCD / memSpec->tCK; + memTimingSpec.CKE = memSpec->tCKE / memSpec->tCK; + memTimingSpec.CKESR = memSpec->tCKESR / memSpec->tCK; + memTimingSpec.clkMhz = memSpec->fCKMHz; // See also MemTimingSpec.cc in DRAMPower - memTimingSpec.clkPeriod = 1000.0 / memSpec->clkMHz; - memTimingSpec.DQSCK = memSpec->tDQSCK / clk; - memTimingSpec.FAW = memSpec->tFAW / clk; - memTimingSpec.RAS = memSpec->tRAS / clk; - memTimingSpec.RC = memSpec->tRC / clk; - memTimingSpec.RCD = memSpec->tRCD / clk; - memTimingSpec.REFI = memSpec->tREFI / clk; - memTimingSpec.RFC = memSpec->tRFC / clk; - memTimingSpec.RL = memSpec->tRL / clk; - memTimingSpec.RP = memSpec->tRP / clk; - memTimingSpec.RRD = memSpec->tRRD / clk; - memTimingSpec.RRD_L = memSpec->tRRD / clk; - memTimingSpec.RRD_S = memSpec->tRRD / clk; - memTimingSpec.RTP = memSpec->tRTP / clk; - memTimingSpec.TAW = memSpec->tFAW / clk; - memTimingSpec.WL = memSpec->tWL / clk; - memTimingSpec.WR = memSpec->tWR / clk; - memTimingSpec.WTR = memSpec->tWTR / clk; - memTimingSpec.WTR_L = memSpec->tWTR / clk; - memTimingSpec.WTR_S = memSpec->tWTR / clk; - memTimingSpec.XP = memSpec->tXP / clk; - memTimingSpec.XPDLL = memSpec->tXPDLL / clk; - memTimingSpec.XS = memSpec->tXS / clk; - memTimingSpec.XSDLL = memSpec->tXSDLL / clk; + memTimingSpec.clkPeriod = 1000.0 / memSpec->fCKMHz; + memTimingSpec.DQSCK = memSpec->tDQSCK / memSpec->tCK; + memTimingSpec.FAW = memSpec->tFAW / memSpec->tCK; + memTimingSpec.RAS = memSpec->tRAS / memSpec->tCK; + memTimingSpec.RC = memSpec->tRC / memSpec->tCK; + memTimingSpec.RCD = memSpec->tRCD / memSpec->tCK; + memTimingSpec.REFI = memSpec->tREFI / memSpec->tCK; + memTimingSpec.RFC = memSpec->tRFC / memSpec->tCK; + memTimingSpec.RL = memSpec->tRL / memSpec->tCK; + memTimingSpec.RP = memSpec->tRP / memSpec->tCK; + memTimingSpec.RRD = memSpec->tRRD / memSpec->tCK; + memTimingSpec.RRD_L = memSpec->tRRD / memSpec->tCK; + memTimingSpec.RRD_S = memSpec->tRRD / memSpec->tCK; + memTimingSpec.RTP = memSpec->tRTP / memSpec->tCK; + memTimingSpec.TAW = memSpec->tFAW / memSpec->tCK; + memTimingSpec.WL = memSpec->tWL / memSpec->tCK; + memTimingSpec.WR = memSpec->tWR / memSpec->tCK; + memTimingSpec.WTR = memSpec->tWTR / memSpec->tCK; + memTimingSpec.WTR_L = memSpec->tWTR / memSpec->tCK; + memTimingSpec.WTR_S = memSpec->tWTR / memSpec->tCK; + memTimingSpec.XP = memSpec->tXP / memSpec->tCK; + memTimingSpec.XPDLL = memSpec->tXPDLL / memSpec->tCK; + memTimingSpec.XS = memSpec->tXS / memSpec->tCK; + memTimingSpec.XSDLL = memSpec->tXSDLL / memSpec->tCK; MemPowerSpec memPowerSpec; memPowerSpec.idd0 = memSpec->iDD0; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index b924435a..9bc518f1 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -52,8 +52,6 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) if (Configuration::getInstance().powerAnalysis) { - sc_time clk = memSpec->clk; - MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -67,45 +65,45 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) memArchSpec.dll = true; MemTimingSpec memTimingSpec; - //FIXME: memTimingSpec.FAWB = memSpec->tFAW / clk; - //FIXME: memTimingSpec.RASB = memSpec->tRAS / clk; - //FIXME: memTimingSpec.RCB = memSpec->tRC / clk; - //FIXME: memTimingSpec.RPB = memSpec->tRP / clk; - //FIXME: memTimingSpec.RRDB = memSpec->tRRD_S / clk; - //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD_L / clk; - //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD_S / clk; - memTimingSpec.AL = memSpec->tAL / clk; - memTimingSpec.CCD = memSpec->tCCD_S / clk; - memTimingSpec.CCD_L = memSpec->tCCD_L / clk; - memTimingSpec.CCD_S = memSpec->tCCD_S / clk; - memTimingSpec.CKE = memSpec->tCKE / clk; - memTimingSpec.CKESR = memSpec->tCKESR / clk; - memTimingSpec.clkMhz = memSpec->clkMHz; + //FIXME: memTimingSpec.FAWB = memSpec->tFAW / memSpec->tCK; + //FIXME: memTimingSpec.RASB = memSpec->tRAS / memSpec->tCK; + //FIXME: memTimingSpec.RCB = memSpec->tRC / memSpec->tCK; + //FIXME: memTimingSpec.RPB = memSpec->tRP / memSpec->tCK; + //FIXME: memTimingSpec.RRDB = memSpec->tRRD_S / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD_L / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD_S / memSpec->tCK; + memTimingSpec.AL = memSpec->tAL / memSpec->tCK; + memTimingSpec.CCD = memSpec->tCCD_S / memSpec->tCK; + memTimingSpec.CCD_L = memSpec->tCCD_L / memSpec->tCK; + memTimingSpec.CCD_S = memSpec->tCCD_S / memSpec->tCK; + memTimingSpec.CKE = memSpec->tCKE / memSpec->tCK; + memTimingSpec.CKESR = memSpec->tCKESR / memSpec->tCK; + memTimingSpec.clkMhz = memSpec->fCKMHz; // See also MemTimingSpec.cc in DRAMPower - memTimingSpec.clkPeriod = 1000.0 / memSpec->clkMHz; - memTimingSpec.DQSCK = memSpec->tDQSCK / clk; - memTimingSpec.FAW = memSpec->tFAW / clk; - memTimingSpec.RAS = memSpec->tRAS / clk; - memTimingSpec.RC = memSpec->tRC / clk; - memTimingSpec.RCD = memSpec->tRCD / clk; - memTimingSpec.REFI = memSpec->tREFI / clk; - memTimingSpec.RFC = memSpec->tRFC / clk; - memTimingSpec.RL = memSpec->tRL / clk; - memTimingSpec.RP = memSpec->tRP / clk; - memTimingSpec.RRD = memSpec->tRRD_S / clk; - memTimingSpec.RRD_L = memSpec->tRRD_L / clk; - memTimingSpec.RRD_S = memSpec->tRRD_S / clk; - memTimingSpec.RTP = memSpec->tRTP / clk; - memTimingSpec.TAW = memSpec->tFAW / clk; - memTimingSpec.WL = memSpec->tWL / clk; - memTimingSpec.WR = memSpec->tWR / clk; - memTimingSpec.WTR = memSpec->tWTR_S / clk; - memTimingSpec.WTR_L = memSpec->tWTR_L / clk; - memTimingSpec.WTR_S = memSpec->tWTR_S / clk; - memTimingSpec.XP = memSpec->tXP / clk; - memTimingSpec.XPDLL = memSpec->tXPDLL / clk; - memTimingSpec.XS = memSpec->tXS / clk; - memTimingSpec.XSDLL = memSpec->tXSDLL / clk; + memTimingSpec.clkPeriod = 1000.0 / memSpec->fCKMHz; + memTimingSpec.DQSCK = memSpec->tDQSCK / memSpec->tCK; + memTimingSpec.FAW = memSpec->tFAW / memSpec->tCK; + memTimingSpec.RAS = memSpec->tRAS / memSpec->tCK; + memTimingSpec.RC = memSpec->tRC / memSpec->tCK; + memTimingSpec.RCD = memSpec->tRCD / memSpec->tCK; + memTimingSpec.REFI = memSpec->tREFI / memSpec->tCK; + memTimingSpec.RFC = memSpec->tRFC / memSpec->tCK; + memTimingSpec.RL = memSpec->tRL / memSpec->tCK; + memTimingSpec.RP = memSpec->tRP / memSpec->tCK; + memTimingSpec.RRD = memSpec->tRRD_S / memSpec->tCK; + memTimingSpec.RRD_L = memSpec->tRRD_L / memSpec->tCK; + memTimingSpec.RRD_S = memSpec->tRRD_S / memSpec->tCK; + memTimingSpec.RTP = memSpec->tRTP / memSpec->tCK; + memTimingSpec.TAW = memSpec->tFAW / memSpec->tCK; + memTimingSpec.WL = memSpec->tWL / memSpec->tCK; + memTimingSpec.WR = memSpec->tWR / memSpec->tCK; + memTimingSpec.WTR = memSpec->tWTR_S / memSpec->tCK; + memTimingSpec.WTR_L = memSpec->tWTR_L / memSpec->tCK; + memTimingSpec.WTR_S = memSpec->tWTR_S / memSpec->tCK; + memTimingSpec.XP = memSpec->tXP / memSpec->tCK; + memTimingSpec.XPDLL = memSpec->tXPDLL / memSpec->tCK; + memTimingSpec.XS = memSpec->tXS / memSpec->tCK; + memTimingSpec.XSDLL = memSpec->tXSDLL / memSpec->tCK; MemPowerSpec memPowerSpec; memPowerSpec.idd0 = memSpec->iDD0; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index fa14377c..b3474777 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -123,7 +123,7 @@ void DramRecordable::powerWindow() // At the very beginning (zero clock cycles) the energy is 0, so we wait first wait(powerWindowSize); - clkCycles = sc_time_stamp().value() / this->memSpec->clk.value(); + clkCycles = sc_time_stamp() / this->memSpec->tCK; DRAMPower->calcWindowEnergy(clkCycles); @@ -148,11 +148,10 @@ void DramRecordable::powerWindow() template class DramRecordable; template class DramRecordable; -template class DramRecordable; template class DramRecordable; +template class DramRecordable; template class DramRecordable; -template class DramRecordable; template class DramRecordable; template class DramRecordable; template class DramRecordable; - +template class DramRecordable; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.h b/DRAMSys/library/src/simulation/dram/DramRecordable.h index bb83826b..51832e84 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.h +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.h @@ -58,7 +58,7 @@ private: TlmRecorder *tlmRecorder; libDRAMPower *DRAMPower; - sc_time powerWindowSize = Configuration::getInstance().memSpec->clk * + sc_time powerWindowSize = Configuration::getInstance().memSpec->tCK * Configuration::getInstance().windowSize; // When working with floats, we have to decide ourselves what is an diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index 4c8ba3c9..b0339631 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -54,8 +54,6 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) if (Configuration::getInstance().powerAnalysis) { - sc_time clk = memSpec->clk; - MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -69,45 +67,45 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) memArchSpec.dll = false; MemTimingSpec memTimingSpec; - //FIXME: memTimingSpec.FAWB = memSpec->tTAW / clk; - //FIXME: memTimingSpec.RASB = memSpec->tRAS / clk; - //FIXME: memTimingSpec.RCB = memSpec->tRC / clk; - //FIXME: memTimingSpec.RPB = memSpec->tRP / clk; - //FIXME: memTimingSpec.RRDB = memSpec->tRRD / clk; - //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD / clk; - //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD / clk; + //FIXME: memTimingSpec.FAWB = memSpec->tTAW / memSpec->tCK; + //FIXME: memTimingSpec.RASB = memSpec->tRAS / memSpec->tCK; + //FIXME: memTimingSpec.RCB = memSpec->tRC / memSpec->tCK; + //FIXME: memTimingSpec.RPB = memSpec->tRP / memSpec->tCK; + //FIXME: memTimingSpec.RRDB = memSpec->tRRD / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_L = memSpec->tRRD / memSpec->tCK; + //FIXME: memTimingSpec.RRDB_S = memSpec->tRRD / memSpec->tCK; memTimingSpec.AL = 0; memTimingSpec.CCD = memSpec->burstLength; memTimingSpec.CCD_L = memSpec->burstLength; memTimingSpec.CCD_S = memSpec->burstLength; - memTimingSpec.CKE = memSpec->tCKE / clk; - memTimingSpec.CKESR = memSpec->tCKESR / clk; - memTimingSpec.clkMhz = memSpec->clkMHz; + memTimingSpec.CKE = memSpec->tCKE / memSpec->tCK; + memTimingSpec.CKESR = memSpec->tCKESR / memSpec->tCK; + memTimingSpec.clkMhz = memSpec->fCKMHz; // See also MemTimingSpec.cc in DRAMPower - memTimingSpec.clkPeriod = 1000.0 / memSpec->clkMHz; - memTimingSpec.DQSCK = memSpec->tDQSCK / clk; - memTimingSpec.FAW = memSpec->tTAW / clk; - memTimingSpec.RAS = memSpec->tRAS / clk; - memTimingSpec.RC = memSpec->tRC / clk; - memTimingSpec.RCD = memSpec->tRCD / clk; - memTimingSpec.REFI = memSpec->tREFI / clk; - memTimingSpec.RFC = memSpec->tRFC / clk; - memTimingSpec.RL = memSpec->tRL / clk; - memTimingSpec.RP = memSpec->tRP / clk; - memTimingSpec.RRD = memSpec->tRRD / clk; - memTimingSpec.RRD_L = memSpec->tRRD / clk; - memTimingSpec.RRD_S = memSpec->tRRD / clk; + memTimingSpec.clkPeriod = 1000.0 / memSpec->fCKMHz; + memTimingSpec.DQSCK = memSpec->tDQSCK / memSpec->tCK; + memTimingSpec.FAW = memSpec->tTAW / memSpec->tCK; + memTimingSpec.RAS = memSpec->tRAS / memSpec->tCK; + memTimingSpec.RC = memSpec->tRC / memSpec->tCK; + memTimingSpec.RCD = memSpec->tRCD / memSpec->tCK; + memTimingSpec.REFI = memSpec->tREFI / memSpec->tCK; + memTimingSpec.RFC = memSpec->tRFC / memSpec->tCK; + memTimingSpec.RL = memSpec->tRL / memSpec->tCK; + memTimingSpec.RP = memSpec->tRP / memSpec->tCK; + memTimingSpec.RRD = memSpec->tRRD / memSpec->tCK; + memTimingSpec.RRD_L = memSpec->tRRD / memSpec->tCK; + memTimingSpec.RRD_S = memSpec->tRRD / memSpec->tCK; memTimingSpec.RTP = memSpec->burstLength; - memTimingSpec.TAW = memSpec->tTAW / clk; - memTimingSpec.WL = memSpec->tWL / clk; - memTimingSpec.WR = memSpec->tWR / clk; - memTimingSpec.WTR = memSpec->tWTR / clk; - memTimingSpec.WTR_L = memSpec->tWTR / clk; - memTimingSpec.WTR_S = memSpec->tWTR / clk; - memTimingSpec.XP = memSpec->tXP / clk; - memTimingSpec.XPDLL = memSpec->tXP / clk; - memTimingSpec.XS = memSpec->tXS / clk; - memTimingSpec.XSDLL = memSpec->tXS / clk; + memTimingSpec.TAW = memSpec->tTAW / memSpec->tCK; + memTimingSpec.WL = memSpec->tWL / memSpec->tCK; + memTimingSpec.WR = memSpec->tWR / memSpec->tCK; + memTimingSpec.WTR = memSpec->tWTR / memSpec->tCK; + memTimingSpec.WTR_L = memSpec->tWTR / memSpec->tCK; + memTimingSpec.WTR_S = memSpec->tWTR / memSpec->tCK; + memTimingSpec.XP = memSpec->tXP / memSpec->tCK; + memTimingSpec.XPDLL = memSpec->tXP / memSpec->tCK; + memTimingSpec.XS = memSpec->tXS / memSpec->tCK; + memTimingSpec.XSDLL = memSpec->tXS / memSpec->tCK; MemPowerSpec memPowerSpec; memPowerSpec.idd0 = memSpec->iDD0; @@ -178,7 +176,7 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp().value() / memSpec->clk.value(); + unsigned long long cycle = sc_time_stamp().value() / memSpec->tCK.value(); if (phase == BEGIN_PRE) { From e17a1b416e0613fd7ae1acdcb691424e190a2e66 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 31 Mar 2020 15:13:19 +0200 Subject: [PATCH 14/23] Command cleanup. --- DRAMSys/library/src/common/TlmRecorder.cpp | 8 - DRAMSys/library/src/common/protocol.h | 60 +++---- .../src/configuration/memspec/MemSpec.cpp | 10 -- .../src/configuration/memspec/MemSpec.h | 2 - DRAMSys/library/src/controller/Command.cpp | 147 ++++++------------ DRAMSys/library/src/controller/Command.h | 15 +- DRAMSys/library/src/controller/Controller.cpp | 3 +- .../src/controller/ControllerRecordable.cpp | 2 +- .../src/simulation/dram/DramRecordable.cpp | 6 +- .../src/simulation/dram/DramWideIO.cpp | 2 +- 10 files changed, 76 insertions(+), 179 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index f4c23c03..4357843a 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -259,14 +259,6 @@ void TlmRecorder::setUpTransactionTerminatingPhases() (END_PDNP)); transactionTerminatingPhases.push_back(static_cast (END_SREF)); - - // Phases for Power Down Bankwise - transactionTerminatingPhases.push_back(static_cast - (END_PDNAB)); - transactionTerminatingPhases.push_back(static_cast - (END_PDNPB)); - transactionTerminatingPhases.push_back(static_cast - (END_SREFB)); } void TlmRecorder::prepareSqlStatements() diff --git a/DRAMSys/library/src/common/protocol.h b/DRAMSys/library/src/common/protocol.h index 986ef847..e8851b88 100644 --- a/DRAMSys/library/src/common/protocol.h +++ b/DRAMSys/library/src/common/protocol.h @@ -38,54 +38,32 @@ #ifndef PROTOCOL_H #define PROTOCOL_H -// DRAM Control Phases -DECLARE_EXTENDED_PHASE(BEGIN_PRE); -DECLARE_EXTENDED_PHASE(END_PRE); - -DECLARE_EXTENDED_PHASE(BEGIN_PREA); -DECLARE_EXTENDED_PHASE(END_PREA); - -DECLARE_EXTENDED_PHASE(BEGIN_ACT); -DECLARE_EXTENDED_PHASE(END_ACT); - -DECLARE_EXTENDED_PHASE(BEGIN_REFA); -DECLARE_EXTENDED_PHASE(END_REFA); - -DECLARE_EXTENDED_PHASE(BEGIN_REFB); -DECLARE_EXTENDED_PHASE(END_REFB); - -// Phases for Read and Write -DECLARE_EXTENDED_PHASE(BEGIN_WR); -DECLARE_EXTENDED_PHASE(END_WR); - +// DO NOT CHANGE THE ORDER! DECLARE_EXTENDED_PHASE(BEGIN_RD); -DECLARE_EXTENDED_PHASE(END_RD); - -DECLARE_EXTENDED_PHASE(BEGIN_WRA); -DECLARE_EXTENDED_PHASE(END_WRA); - +DECLARE_EXTENDED_PHASE(BEGIN_WR); DECLARE_EXTENDED_PHASE(BEGIN_RDA); -DECLARE_EXTENDED_PHASE(END_RDA); - -// Phases for Power Down -DECLARE_EXTENDED_PHASE(BEGIN_PDNP); -DECLARE_EXTENDED_PHASE(END_PDNP); - +DECLARE_EXTENDED_PHASE(BEGIN_WRA); +DECLARE_EXTENDED_PHASE(BEGIN_PRE); +DECLARE_EXTENDED_PHASE(BEGIN_ACT); +DECLARE_EXTENDED_PHASE(BEGIN_REFB); +DECLARE_EXTENDED_PHASE(BEGIN_PREA); +DECLARE_EXTENDED_PHASE(BEGIN_REFA); DECLARE_EXTENDED_PHASE(BEGIN_PDNA); DECLARE_EXTENDED_PHASE(END_PDNA); - +DECLARE_EXTENDED_PHASE(BEGIN_PDNP); +DECLARE_EXTENDED_PHASE(END_PDNP); DECLARE_EXTENDED_PHASE(BEGIN_SREF); DECLARE_EXTENDED_PHASE(END_SREF); -// Phases for Power Down Bankwise -DECLARE_EXTENDED_PHASE(BEGIN_PDNPB); -DECLARE_EXTENDED_PHASE(END_PDNPB); - -DECLARE_EXTENDED_PHASE(BEGIN_PDNAB); -DECLARE_EXTENDED_PHASE(END_PDNAB); - -DECLARE_EXTENDED_PHASE(BEGIN_SREFB); -DECLARE_EXTENDED_PHASE(END_SREFB); +DECLARE_EXTENDED_PHASE(END_RD); +DECLARE_EXTENDED_PHASE(END_WR); +DECLARE_EXTENDED_PHASE(END_RDA); +DECLARE_EXTENDED_PHASE(END_WRA); +DECLARE_EXTENDED_PHASE(END_PRE); +DECLARE_EXTENDED_PHASE(END_ACT); +DECLARE_EXTENDED_PHASE(END_REFB); +DECLARE_EXTENDED_PHASE(END_PREA); +DECLARE_EXTENDED_PHASE(END_REFA); #endif // PROTOCOL_H diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp index b6f74ddd..b0396643 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.cpp @@ -47,16 +47,6 @@ MemSpec::MemSpec() commandLengthInCycles = std::vector(numberOfCommands(), 1); } -const std::vector &MemSpec::getBanks() const -{ - static std::vector banks; - if (banks.size() == 0) { - for (unsigned int i = 0; i < numberOfBanks; i++) - banks.push_back(Bank(i)); - } - return banks; -} - sc_time MemSpec::getCommandLength(Command command) const { return tCK * commandLengthInCycles[command]; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index 5589a767..b56a03fb 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -51,8 +51,6 @@ struct MemSpec MemSpec(); virtual ~MemSpec() {} - const std::vector &getBanks() const; - virtual sc_time getRefreshIntervalAB() const = 0; virtual sc_time getRefreshIntervalPB() const = 0; diff --git a/DRAMSys/library/src/controller/Command.cpp b/DRAMSys/library/src/controller/Command.cpp index 290f7c44..1a534ccb 100644 --- a/DRAMSys/library/src/controller/Command.cpp +++ b/DRAMSys/library/src/controller/Command.cpp @@ -40,86 +40,26 @@ std::string commandToString(Command command) -{ - switch (command) { - case Command::RD: - return "RD"; - break; - case Command::RDA: - return "RDA"; - break; - case Command::WR: - return "WR"; - break; - case Command::WRA: - return "WRA"; - break; - case Command::PRE: - return "PRE"; - break; - case Command::ACT: - return "ACT"; - break; - case Command::PREA: - return "PREA"; - break; - case Command::REFA: - return "REFA"; - break; - case Command::REFB: - return "REFB"; - break; - case Command::PDEA: - return "PDEA"; - break; - case Command::PDXA: - return "PDXA"; - break; - case Command::PDEP: - return "PDEP"; - break; - case Command::PDXP: - return "PDXP"; - break; - case Command::SREFEN: - return "SREFEN"; - break; - case Command::SREFEX: - return "SREFEX"; - break; - - case Command::NOP: - return "NOP"; - break; - - default: - SC_REPORT_FATAL("command", "commandToString was called with unknown command"); - break; - } - - return ""; -} - -const std::vector &getAllCommands() -{ - static std::vector allCommands( { Command::NOP, - Command::RD, - Command::WR, - Command::RDA, - Command::WRA, - Command::PRE, - Command::ACT, - Command::REFB, - Command::PREA, - Command::REFA, - Command::PDEA, - Command::PDXA, - Command::PDEP, - Command::PDXP, - Command::SREFEN, - Command::SREFEX - }); - return allCommands; +{ + assert(command >= 0 && command <= 15); + static std::array stringOfCommand = + {"NOP", + "RD", + "WR", + "RDA", + "WRA", + "PRE", + "ACT", + "REFB", + "PREA", + "REFA", + "PDEA", + "PDXA", + "PDEP", + "PDXP", + "SREFEN", + "SREFEX"}; + return stringOfCommand[command]; } unsigned numberOfCommands() @@ -127,48 +67,49 @@ unsigned numberOfCommands() return 16; } -bool commandIsIn(Command command, std::vector commands) +tlm_phase commandToPhase(Command command) { - for (Command c : commands) { - if (c == command) - return true; - } - return false; + assert(command >= 0 && command <= 15); + static std::array phaseOfCommand = + {UNINITIALIZED_PHASE, + BEGIN_RD, + BEGIN_WR, + BEGIN_RDA, + BEGIN_WRA, + BEGIN_PRE, + BEGIN_ACT, + BEGIN_REFB, + BEGIN_PREA, + BEGIN_REFA, + BEGIN_PDNA, + END_PDNA, + BEGIN_PDNP, + END_PDNP, + BEGIN_SREF, + END_SREF}; + return phaseOfCommand[command]; } -std::array phaseOfCommand = {UNINITIALIZED_PHASE, - BEGIN_RD, - BEGIN_WR, - BEGIN_RDA, - BEGIN_WRA, - BEGIN_PRE, - BEGIN_ACT, - BEGIN_REFB, - BEGIN_PREA, - BEGIN_REFA, - BEGIN_PDNA, - END_PDNA, - BEGIN_PDNP, - END_PDNP, - BEGIN_SREF, - END_SREF}; - bool isBankCommand(Command command) { + assert(command >= 0 && command <= 15); return (command <= 7); } bool isRankCommand(Command command) { + assert(command >= 0 && command <= 15); return (command >= 8); } bool isCasCommand(Command command) { + assert(command >= 0 && command <= 15); return (command <= 4); } bool isRasCommand(Command command) { + assert(command >= 0 && command <= 15); return (command >= 5); } diff --git a/DRAMSys/library/src/controller/Command.h b/DRAMSys/library/src/controller/Command.h index 8365ef4d..f0902670 100644 --- a/DRAMSys/library/src/controller/Command.h +++ b/DRAMSys/library/src/controller/Command.h @@ -64,15 +64,12 @@ enum Command SREFEX }; -std::string commandToString(Command command); -const std::vector &getAllCommands(); +std::string commandToString(Command); +tlm_phase commandToPhase(Command); unsigned numberOfCommands(); -bool commandIsIn(Command command, std::vector commands); -bool isBankCommand(Command command); -bool isRankCommand(Command command); -bool isCasCommand(Command command); -bool isRasCommand(Command command); - -extern std::array phaseOfCommand; +bool isBankCommand(Command); +bool isRankCommand(Command); +bool isCasCommand(Command); +bool isRasCommand(Command); #endif // COMMAND_H diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 6aeecb1a..f533cd5f 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -37,6 +37,7 @@ #include "../configuration/Configuration.h" #include "../common/dramExtensions.h" #include "../common/protocol.h" +#include "Command.h" #include "checker/CheckerDDR3.h" #include "checker/CheckerDDR4.h" #include "checker/CheckerWideIO.h" @@ -445,7 +446,7 @@ void Controller::sendToFrontend(tlm_generic_payload *payload, tlm_phase phase) void Controller::sendToDram(Command command, tlm_generic_payload *payload) { sc_time delay = SC_ZERO_TIME; - tlm_phase phase = phaseOfCommand[command]; + tlm_phase phase = commandToPhase(command); iSocket->nb_transport_fw(*payload, phase, delay); } diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index aa2c7722..97b1a542 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -60,7 +60,7 @@ void ControllerRecordable::sendToFrontend(tlm_generic_payload *payload, tlm_phas void ControllerRecordable::sendToDram(Command command, tlm_generic_payload *payload) { - if (commandIsIn(command, {Command::RD, Command::RDA, Command::WR, Command::WRA})) + if (isCasCommand(command)) { TimeInterval dataStrobe = Configuration::getInstance().memSpec->getIntervalOnDataStrobe(command); tlmRecorder->updateDataStrobe(dataStrobe.start, dataStrobe.end, *payload); diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index b3474777..8aa14629 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -88,11 +88,11 @@ tlm_sync_enum DramRecordable::nb_transport_fw(tlm_generic_payload &pay // These are terminating phases recorded by the DRAM. The execution // time of the related command must be taken into consideration. - if (phase == END_PDNA || phase == END_PDNAB) + if (phase == END_PDNA) recTime += this->memSpec->getCommandLength(Command::PDXA); - else if (phase == END_PDNP || phase == END_PDNPB) + else if (phase == END_PDNP) recTime += this->memSpec->getCommandLength(Command::PDXP); - else if (phase == END_SREF || phase == END_SREFB) + else if (phase == END_SREF) recTime += this->memSpec->getCommandLength(Command::SREFEX); unsigned int thr __attribute__((unused)) = DramExtension::getExtension(payload).getThread().ID(); diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index b0339631..fb3c1731 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -176,7 +176,7 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp().value() / memSpec->tCK.value(); + unsigned long long cycle = sc_time_stamp() / memSpec->tCK; if (phase == BEGIN_PRE) { From 1b10c9ae0224ed0aea991bef4294ea55b6bb3b9d Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 31 Mar 2020 16:50:18 +0200 Subject: [PATCH 15/23] Removed sending of END_CMD phases in DRAM. --- DRAMSys/library/src/common/protocol.h | 48 +++++++++---------- DRAMSys/library/src/controller/Command.cpp | 33 +++++++++++++ DRAMSys/library/src/controller/Command.h | 3 ++ DRAMSys/library/src/controller/Controller.cpp | 8 ++-- DRAMSys/library/src/simulation/dram/Dram.cpp | 47 +----------------- DRAMSys/library/src/simulation/dram/Dram.h | 3 -- .../src/simulation/dram/DramRecordable.cpp | 38 +++++++++------ .../src/simulation/dram/DramRecordable.h | 3 ++ .../src/simulation/dram/DramWideIO.cpp | 41 ++-------------- 9 files changed, 93 insertions(+), 131 deletions(-) diff --git a/DRAMSys/library/src/common/protocol.h b/DRAMSys/library/src/common/protocol.h index e8851b88..9f7be6be 100644 --- a/DRAMSys/library/src/common/protocol.h +++ b/DRAMSys/library/src/common/protocol.h @@ -39,31 +39,31 @@ #define PROTOCOL_H // DO NOT CHANGE THE ORDER! -DECLARE_EXTENDED_PHASE(BEGIN_RD); -DECLARE_EXTENDED_PHASE(BEGIN_WR); -DECLARE_EXTENDED_PHASE(BEGIN_RDA); -DECLARE_EXTENDED_PHASE(BEGIN_WRA); -DECLARE_EXTENDED_PHASE(BEGIN_PRE); -DECLARE_EXTENDED_PHASE(BEGIN_ACT); -DECLARE_EXTENDED_PHASE(BEGIN_REFB); -DECLARE_EXTENDED_PHASE(BEGIN_PREA); -DECLARE_EXTENDED_PHASE(BEGIN_REFA); -DECLARE_EXTENDED_PHASE(BEGIN_PDNA); -DECLARE_EXTENDED_PHASE(END_PDNA); -DECLARE_EXTENDED_PHASE(BEGIN_PDNP); -DECLARE_EXTENDED_PHASE(END_PDNP); -DECLARE_EXTENDED_PHASE(BEGIN_SREF); -DECLARE_EXTENDED_PHASE(END_SREF); +DECLARE_EXTENDED_PHASE(BEGIN_RD); // 5 +DECLARE_EXTENDED_PHASE(BEGIN_WR); // 6 +DECLARE_EXTENDED_PHASE(BEGIN_RDA); // 7 +DECLARE_EXTENDED_PHASE(BEGIN_WRA); // 8 +DECLARE_EXTENDED_PHASE(BEGIN_PRE); // 9 +DECLARE_EXTENDED_PHASE(BEGIN_ACT); // 10 +DECLARE_EXTENDED_PHASE(BEGIN_REFB); // 11 +DECLARE_EXTENDED_PHASE(BEGIN_PREA); // 12 +DECLARE_EXTENDED_PHASE(BEGIN_REFA); // 13 +DECLARE_EXTENDED_PHASE(BEGIN_PDNA); // 14 +DECLARE_EXTENDED_PHASE(END_PDNA); // 15 +DECLARE_EXTENDED_PHASE(BEGIN_PDNP); // 16 +DECLARE_EXTENDED_PHASE(END_PDNP); // 17 +DECLARE_EXTENDED_PHASE(BEGIN_SREF); // 18 +DECLARE_EXTENDED_PHASE(END_SREF); // 19 -DECLARE_EXTENDED_PHASE(END_RD); -DECLARE_EXTENDED_PHASE(END_WR); -DECLARE_EXTENDED_PHASE(END_RDA); -DECLARE_EXTENDED_PHASE(END_WRA); -DECLARE_EXTENDED_PHASE(END_PRE); -DECLARE_EXTENDED_PHASE(END_ACT); -DECLARE_EXTENDED_PHASE(END_REFB); -DECLARE_EXTENDED_PHASE(END_PREA); -DECLARE_EXTENDED_PHASE(END_REFA); +DECLARE_EXTENDED_PHASE(END_RD); // 20 +DECLARE_EXTENDED_PHASE(END_WR); // 21 +DECLARE_EXTENDED_PHASE(END_RDA); // 22 +DECLARE_EXTENDED_PHASE(END_WRA); // 23 +DECLARE_EXTENDED_PHASE(END_PRE); // 24 +DECLARE_EXTENDED_PHASE(END_ACT); // 25 +DECLARE_EXTENDED_PHASE(END_REFB); // 26 +DECLARE_EXTENDED_PHASE(END_PREA); // 27 +DECLARE_EXTENDED_PHASE(END_REFA); // 28 #endif // PROTOCOL_H diff --git a/DRAMSys/library/src/controller/Command.cpp b/DRAMSys/library/src/controller/Command.cpp index 1a534ccb..7c15c931 100644 --- a/DRAMSys/library/src/controller/Command.cpp +++ b/DRAMSys/library/src/controller/Command.cpp @@ -90,6 +90,39 @@ tlm_phase commandToPhase(Command command) return phaseOfCommand[command]; } +Command phaseToCommand(tlm_phase phase) +{ + assert(phase >= 5 && phase <= 19); + static std::array commandOfPhase = + {Command::RD, + Command::WR, + Command::RDA, + Command::WRA, + Command::PRE, + Command::ACT, + Command::REFB, + Command::PREA, + Command::REFA, + Command::PDEA, + Command::PDXA, + Command::PDEP, + Command::PDXP, + Command::SREFEN, + Command::SREFEX}; + return commandOfPhase[phase - 5]; +} + +bool phaseNeedsEnd(tlm_phase phase) +{ + return (phase >= 5 && phase <= 13); +} + +tlm_phase getEndPhase(tlm_phase phase) +{ + assert(phase >= 5 && phase <= 13); + return (phase + 15); +} + bool isBankCommand(Command command) { assert(command >= 0 && command <= 15); diff --git a/DRAMSys/library/src/controller/Command.h b/DRAMSys/library/src/controller/Command.h index f0902670..b9be24b1 100644 --- a/DRAMSys/library/src/controller/Command.h +++ b/DRAMSys/library/src/controller/Command.h @@ -66,6 +66,9 @@ enum Command std::string commandToString(Command); tlm_phase commandToPhase(Command); +Command phaseToCommand(tlm_phase); +bool phaseNeedsEnd(tlm_phase); +tlm_phase getEndPhase(tlm_phase); unsigned numberOfCommands(); bool isBankCommand(Command); bool isRankCommand(Command); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index f533cd5f..db03bd37 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -373,7 +373,7 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, endRespEvent.notify(notificationDelay); } else - SC_REPORT_FATAL(0, "nb_transport_fw in controller was triggered with unknown phase"); + SC_REPORT_FATAL("Controller", "nb_transport_fw in controller was triggered with unknown phase"); PRINTDEBUGMESSAGE(name(), "[fw] " + phaseNameToString(phase) + " notification in " + notificationDelay.to_string()); @@ -382,11 +382,9 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, } tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &, - tlm_phase &phase, sc_time &delay) + tlm_phase &, sc_time &) { - PRINTDEBUGMESSAGE(name(), "[bw] " + phaseNameToString(phase) + " notification in " + - delay.to_string()); - + SC_REPORT_FATAL("Controller", "nb_transport_bw of controller must not be called"); return TLM_ACCEPTED; } diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index cf881f03..5eee8b93 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -136,7 +136,7 @@ Dram::~Dram() } tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, - tlm_phase &phase, sc_time &delay) + tlm_phase &phase, sc_time &) { unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); @@ -144,21 +144,11 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned long long cycle = sc_time_stamp() / memSpec->tCK; if (phase == BEGIN_PRE) - { DRAMPower->doCommand(MemCommand::PRE, bank, cycle); - sendToController(payload, END_PRE, delay + memSpec->getExecutionTime(Command::PRE, payload)); - } else if (phase == BEGIN_PREA) - { DRAMPower->doCommand(MemCommand::PREA, bank, cycle); - sendToController(payload, END_PREA, - delay + memSpec->getExecutionTime(Command::PREA, payload)); - } else if (phase == BEGIN_ACT) - { DRAMPower->doCommand(MemCommand::ACT, bank, cycle); - sendToController(payload, END_ACT, delay + memSpec->getExecutionTime(Command::ACT, payload)); - } else if (phase == BEGIN_WR) { DRAMPower->doCommand(MemCommand::WR, bank, cycle); @@ -168,7 +158,6 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); } - sendToController(payload, END_WR, delay + memSpec->getExecutionTime(Command::WR, payload)); } else if (phase == BEGIN_RD) { @@ -179,7 +168,6 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); } - sendToController(payload, END_RD, delay + memSpec->getExecutionTime(Command::RD, payload)); } else if (phase == BEGIN_WRA) { @@ -190,7 +178,6 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); } - sendToController(payload, END_WRA, delay + memSpec->getExecutionTime(Command::WRA, payload)); } else if (phase == BEGIN_RDA) { @@ -201,49 +188,25 @@ tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, unsigned char *phyAddr = memory + payload.get_address(); memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); } - sendToController(payload, END_RDA, delay + memSpec->getExecutionTime(Command::RDA, payload)); } else if (phase == BEGIN_REFA) - { DRAMPower->doCommand(MemCommand::REF, bank, cycle); - sendToController(payload, END_REFA, - delay + memSpec->getExecutionTime(Command::REFA, payload)); - } else if (phase == BEGIN_REFB) - { DRAMPower->doCommand(MemCommand::REFB, bank, cycle); - sendToController(payload, END_REFB, - delay + memSpec->getExecutionTime(Command::REFB, payload)); - } - // Powerdown phases have to be started and ended by the controller, because they do not have a fixed length else if (phase == BEGIN_PDNA) - { DRAMPower->doCommand(MemCommand::PDN_S_ACT, bank, cycle); - } else if (phase == END_PDNA) - { DRAMPower->doCommand(MemCommand::PUP_ACT, bank, cycle); - } else if (phase == BEGIN_PDNP) - { DRAMPower->doCommand(MemCommand::PDN_S_PRE, bank, cycle); - } else if (phase == END_PDNP) - { DRAMPower->doCommand(MemCommand::PUP_PRE, bank, cycle); - } else if (phase == BEGIN_SREF) - { DRAMPower->doCommand(MemCommand::SREN, bank, cycle); - } else if (phase == END_SREF) - { DRAMPower->doCommand(MemCommand::SREX, bank, cycle); - } else - { SC_REPORT_FATAL("DRAM", "DRAM PEQ was called with unknown phase"); - } return TLM_ACCEPTED; } @@ -298,11 +261,3 @@ unsigned int Dram::transport_dbg(tlm_generic_payload &trans) } return 0; } - -void Dram::sendToController(tlm_generic_payload &payload, const tlm_phase &phase, - const sc_time &delay) -{ - tlm_phase TPhase = phase; - sc_time TDelay = delay; - tSocket->nb_transport_bw(payload, TPhase, TDelay); -} diff --git a/DRAMSys/library/src/simulation/dram/Dram.h b/DRAMSys/library/src/simulation/dram/Dram.h index cd894435..2386ab35 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.h +++ b/DRAMSys/library/src/simulation/dram/Dram.h @@ -74,9 +74,6 @@ protected: virtual unsigned int transport_dbg(tlm_generic_payload &trans); - void sendToController(tlm_generic_payload &payload, const tlm_phase &phase, - const sc_time &delay); - public: tlm_utils::simple_target_socket tSocket; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index 8aa14629..8c090b50 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -83,35 +83,43 @@ template tlm_sync_enum DramRecordable::nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &delay) { - // Recording time used by the traceAnalyzer + recordPhase(payload, phase, delay); + return BaseDram::nb_transport_fw(payload, phase, delay); +} + +template +void DramRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase phase, sc_time delay) +{ sc_time recTime = sc_time_stamp() + delay; // These are terminating phases recorded by the DRAM. The execution // time of the related command must be taken into consideration. - if (phase == END_PDNA) - recTime += this->memSpec->getCommandLength(Command::PDXA); - else if (phase == END_PDNP) - recTime += this->memSpec->getCommandLength(Command::PDXP); - else if (phase == END_SREF) - recTime += this->memSpec->getCommandLength(Command::SREFEX); + if (phase == END_PDNA || phase == END_PDNP || phase == END_SREF) + recTime += this->memSpec->getCommandLength(phaseToCommand(phase)); - unsigned int thr __attribute__((unused)) = DramExtension::getExtension(payload).getThread().ID(); - unsigned int ch __attribute__((unused)) = DramExtension::getExtension(payload).getChannel().ID(); - unsigned int bg __attribute__((unused)) = DramExtension::getExtension(payload).getBankGroup().ID(); - unsigned int bank __attribute__((unused)) = DramExtension::getExtension(payload).getBank().ID(); - unsigned int row __attribute__((unused)) = DramExtension::getExtension(payload).getRow().ID(); - unsigned int col __attribute__((unused)) = DramExtension::getExtension(payload).getColumn().ID(); + unsigned int thr __attribute__((unused)) = DramExtension::getExtension(trans).getThread().ID(); + unsigned int ch __attribute__((unused)) = DramExtension::getExtension(trans).getChannel().ID(); + unsigned int bg __attribute__((unused)) = DramExtension::getExtension(trans).getBankGroup().ID(); + unsigned int bank __attribute__((unused)) = DramExtension::getExtension(trans).getBank().ID(); + unsigned int row __attribute__((unused)) = DramExtension::getExtension(trans).getRow().ID(); + unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID(); PRINTDEBUGMESSAGE(this->name(), "Recording " + phaseNameToString(phase) + " thread " + to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string( bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " + to_string(col) + " at " + recTime.to_string()); - tlmRecorder->recordPhase(payload, phase, recTime); + tlmRecorder->recordPhase(trans, phase, recTime); + + if (phaseNeedsEnd(phase)) + { + recTime += this->memSpec->getExecutionTime(phaseToCommand(phase), trans); + tlmRecorder->recordPhase(trans, getEndPhase(phase), recTime); + } - return BaseDram::nb_transport_fw(payload, phase, delay); } + // This Thread is only triggered when Power Simulation is enabled. // It estimates the current average power which will be stored in the trace database for visualization purposes. template diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.h b/DRAMSys/library/src/simulation/dram/DramRecordable.h index 51832e84..507ce270 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.h +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.h @@ -55,6 +55,9 @@ public: private: virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &delay) override; + + void recordPhase(tlm_generic_payload &trans, tlm_phase phase, sc_time delay); + TlmRecorder *tlmRecorder; libDRAMPower *DRAMPower; diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index fb3c1731..e3008c27 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -171,7 +171,7 @@ DramWideIO::~DramWideIO() } tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, - tlm_phase &phase, sc_time &delay) + tlm_phase &phase, sc_time &) { unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); @@ -179,24 +179,15 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, unsigned long long cycle = sc_time_stamp() / memSpec->tCK; if (phase == BEGIN_PRE) - { DRAMPower->doCommand(MemCommand::PRE, bank, cycle); - sendToController(payload, END_PRE, delay + memSpec->getExecutionTime(Command::PRE, payload)); - } else if (phase == BEGIN_PREA) - { DRAMPower->doCommand(MemCommand::PREA, bank, cycle); - sendToController(payload, END_PREA, - delay + memSpec->getExecutionTime(Command::PREA, payload)); - } else if (phase == BEGIN_ACT) { DRAMPower->doCommand(MemCommand::ACT, bank, cycle); - sendToController(payload, END_ACT, delay + memSpec->getExecutionTime(Command::ACT, payload)); - unsigned int row = DramExtension::getExtension(payload).getRow().ID(); if (storeMode == StorageMode::ErrorModel) - ememory[bank]->activate(row); + ememory[bank]->activate(DramExtension::getExtension(payload).getRow().ID()); } else if (phase == BEGIN_WR) { @@ -211,7 +202,6 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { ememory[bank]->store(payload); } - sendToController(payload, END_WR, delay + memSpec->getExecutionTime(Command::WR, payload)); } else if (phase == BEGIN_RD) { @@ -226,7 +216,6 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { ememory[bank]->load(payload); } - sendToController(payload, END_RD, delay + memSpec->getExecutionTime(Command::RD, payload)); } else if (phase == BEGIN_WRA) { @@ -241,7 +230,6 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { ememory[bank]->store(payload); } - sendToController(payload, END_WRA, delay + memSpec->getExecutionTime(Command::WRA, payload)); } else if (phase == BEGIN_RDA) { @@ -256,53 +244,30 @@ tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, { ememory[bank]->load(payload); } - sendToController(payload, END_RDA, delay + memSpec->getExecutionTime(Command::RDA, payload)); } else if (phase == BEGIN_REFA) { DRAMPower->doCommand(MemCommand::REF, bank, cycle); - sendToController(payload, END_REFA, - delay + memSpec->getExecutionTime(Command::REFA, payload)); - unsigned int row = DramExtension::getExtension(payload).getRow().ID(); if (storeMode == StorageMode::ErrorModel) - ememory[bank]->refresh(row); + ememory[bank]->refresh(DramExtension::getExtension(payload).getRow().ID()); } else if (phase == BEGIN_REFB) - { DRAMPower->doCommand(MemCommand::REFB, bank, cycle); - sendToController(payload, END_REFB, - delay + memSpec->getExecutionTime(Command::REFA, payload)); - } - // Powerdown phases have to be started and ended by the controller, because they do not have a fixed length else if (phase == BEGIN_PDNA) - { DRAMPower->doCommand(MemCommand::PDN_S_ACT, bank, cycle); - } else if (phase == END_PDNA) - { DRAMPower->doCommand(MemCommand::PUP_ACT, bank, cycle); - } else if (phase == BEGIN_PDNP) - { DRAMPower->doCommand(MemCommand::PDN_S_PRE, bank, cycle); - } else if (phase == END_PDNP) - { DRAMPower->doCommand(MemCommand::PUP_PRE, bank, cycle); - } else if (phase == BEGIN_SREF) - { DRAMPower->doCommand(MemCommand::SREN, bank, cycle); - } else if (phase == END_SREF) - { DRAMPower->doCommand(MemCommand::SREX, bank, cycle); - } else - { SC_REPORT_FATAL("DRAM", "DRAM PEQ was called with unknown phase"); - } return TLM_ACCEPTED; } From f428d57dfad497518a589b700fd72ab56f1cd4a3 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 1 Apr 2020 10:49:37 +0200 Subject: [PATCH 16/23] Separated idle time collector. --- DRAMSys/library/src/controller/Controller.cpp | 30 +++----------- DRAMSys/library/src/controller/Controller.h | 16 +++----- DRAMSys/library/src/controller/ControllerIF.h | 41 +++++++++++++++++-- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index db03bd37..9256cb81 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -199,20 +199,20 @@ Controller::Controller(sc_module_name name) : else SC_REPORT_FATAL("Controller", "Selected refresh mode not supported!"); - startBandwidthIdleCollector(); + idleTimeCollector.start(); } Controller::~Controller() { - endBandwithIdleCollector(); + idleTimeCollector.end(); - delete respQueue; for (auto it : refreshManagers) delete it; for (auto it : powerDownManagers) delete it; for (auto it : bankMachines) delete it; + delete respQueue; delete cmdMux; delete scheduler; delete checker; @@ -406,7 +406,7 @@ void Controller::releasePayload() totalNumberOfPayloads--; if (totalNumberOfPayloads == 0) - startBandwidthIdleCollector(); + idleTimeCollector.start(); } void Controller::acquirePayload() @@ -417,7 +417,7 @@ void Controller::acquirePayload() Rank rank = DramExtension::getRank(payloadToAcquire); if (totalNumberOfPayloads == 0) - endBandwithIdleCollector(); + idleTimeCollector.end(); totalNumberOfPayloads++; if(ranksNumberOfPayloads[rank.ID()] == 0) @@ -448,23 +448,3 @@ void Controller::sendToDram(Command command, tlm_generic_payload *payload) iSocket->nb_transport_fw(*payload, phase, delay); } - -void Controller::startBandwidthIdleCollector() -{ - if (!isIdle) - { - PRINTDEBUGMESSAGE(name(), "IDLE start"); - idleStart = sc_time_stamp(); - isIdle = true; - } -} - -void Controller::endBandwithIdleCollector() -{ - if (isIdle) - { - PRINTDEBUGMESSAGE(name(), "IDLE end"); - idleTime += sc_time_stamp() - idleStart; - isIdle = false; - } -} diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index 53ba66cf..e94a2262 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -77,11 +77,6 @@ protected: private: unsigned totalNumberOfPayloads = 0; std::vector ranksNumberOfPayloads; - tlm_generic_payload *payloadToAcquire = nullptr; - sc_time timeToAcquire = sc_max_time(); - tlm_generic_payload *payloadToRelease = nullptr; - sc_time timeToRelease = sc_max_time(); - std::queue> responseQueue; MemSpec *memSpec; @@ -94,17 +89,16 @@ private: std::vector refreshManagers; std::vector powerDownManagers; + tlm_generic_payload *payloadToAcquire = nullptr; + sc_time timeToAcquire = sc_max_time(); + tlm_generic_payload *payloadToRelease = nullptr; + sc_time timeToRelease = sc_max_time(); + void releasePayload(); void acquirePayload(); void controllerMethod(); sc_event beginReqEvent, endRespEvent, controllerEvent, dataResponseEvent; - - // Bandwidth related - sc_time idleStart; - bool isIdle = false; - void startBandwidthIdleCollector(); - void endBandwithIdleCollector(); }; #endif // CONTROLLER_H diff --git a/DRAMSys/library/src/controller/ControllerIF.h b/DRAMSys/library/src/controller/ControllerIF.h index cb40432f..50114311 100644 --- a/DRAMSys/library/src/controller/ControllerIF.h +++ b/DRAMSys/library/src/controller/ControllerIF.h @@ -27,7 +27,7 @@ public: * Configuration::getInstance().memSpec->tCK; double bandwidth = (activeTime / sc_time_stamp() * 100); - double bandwidth_IDLE = ((activeTime) / (sc_time_stamp() - idleTime) * 100); + double bandwidthWoIdle = ((activeTime) / (sc_time_stamp() - idleTimeCollector.getIdleTime()) * 100); double maxBandwidth = ( // fCK in Mhz e.g. 800 [MHz]: @@ -49,8 +49,8 @@ public: << std::endl; std::cout << name() << std::string(" AVG BW\\IDLE: ") << std::fixed << std::setprecision(2) - << ((bandwidth_IDLE / 100) * maxBandwidth) - << " Gibit/s (" << bandwidth_IDLE << " %)" + << ((bandwidthWoIdle / 100) * maxBandwidth) + << " Gibit/s (" << bandwidthWoIdle << " %)" << endl; std::cout << name() << std::string(" MAX BW: ") << std::fixed << std::setprecision(2) @@ -75,7 +75,40 @@ protected: virtual tlm_sync_enum nb_transport_bw(tlm_generic_payload &, tlm_phase &, sc_time &) = 0; // Bandwidth related - sc_time idleTime = SC_ZERO_TIME; + class IdleTimeCollector + { + public: + void start() + { + if (!isIdle) + { + PRINTDEBUGMESSAGE("IdleTimeCollector", "IDLE start"); + idleStart = sc_time_stamp(); + isIdle = true; + } + } + + void end() + { + if (isIdle) + { + PRINTDEBUGMESSAGE("IdleTimeCollector", "IDLE end"); + idleTime += sc_time_stamp() - idleStart; + isIdle = false; + } + } + + sc_time getIdleTime() + { + return idleTime; + } + + private: + bool isIdle = false; + sc_time idleTime = SC_ZERO_TIME; + sc_time idleStart; + } idleTimeCollector; + uint64_t numberOfTransactionsServed = 0; }; From fbbe306ee50f513c742ede3a21d146e2f6eec215 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 1 Apr 2020 16:01:07 +0200 Subject: [PATCH 17/23] New hardware-equivalent backpressure implementation. --- DRAMSys/library/src/controller/Controller.cpp | 127 +++++++++--------- DRAMSys/library/src/controller/Controller.h | 6 +- .../powerdown/PowerDownManagerStaggered.h | 2 +- .../controller/scheduler/SchedulerFifo.cpp | 7 +- .../src/controller/scheduler/SchedulerFifo.h | 3 +- .../controller/scheduler/SchedulerFrFcfs.cpp | 7 +- .../controller/scheduler/SchedulerFrFcfs.h | 3 +- .../scheduler/SchedulerFrFcfsGrp.cpp | 7 +- .../controller/scheduler/SchedulerFrFcfsGrp.h | 3 +- .../src/controller/scheduler/SchedulerIF.h | 2 +- 10 files changed, 88 insertions(+), 79 deletions(-) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 9256cb81..8da97ddc 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -65,7 +65,6 @@ Controller::Controller(sc_module_name name) : { SC_METHOD(controllerMethod); sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEvent; - dont_initialize(); Configuration &config = Configuration::getInstance(); memSpec = config.memSpec; @@ -162,8 +161,6 @@ Controller::Controller(sc_module_name name) : { PowerDownManagerIF *manager = new PowerDownManagerStaggered(Rank(rankID), checker); powerDownManagers.push_back(manager); - manager->triggerEntry(TriggerSource::Controller); - controllerEvent.notify(manager->start()); } } else @@ -182,7 +179,6 @@ Controller::Controller(sc_module_name name) : RefreshManagerIF *manager = new RefreshManagerRankwise (bankMachinesOnRank[rankID], powerDownManagers[rankID], Rank(rankID), checker); refreshManagers.push_back(manager); - controllerEvent.notify(manager->start()); } } else if (config.refreshPolicy == "Bankwise") @@ -193,7 +189,6 @@ Controller::Controller(sc_module_name name) : RefreshManagerIF *manager = new RefreshManagerBankwise (bankMachinesOnRank[rankID], powerDownManagers[rankID], Rank(rankID), checker); refreshManagers.push_back(manager); - controllerEvent.notify(manager->start()); } } else @@ -220,38 +215,20 @@ Controller::~Controller() void Controller::controllerMethod() { - // (1) Release payload if arbiter has accepted the result - if (sc_time_stamp() == timeToRelease && payloadToRelease != nullptr) - releasePayload(); + // (1) Release payload if arbiter has accepted the result (finish END_RESP) + if (payloadToRelease != nullptr && timeToRelease <= sc_time_stamp()) + finishEndResp(); - // (2) Send next result to arbiter + // (2) Send next result to arbiter (start BEGIN_RESP) if (payloadToRelease == nullptr) - { - payloadToRelease = respQueue->nextPayload(); + startBeginResp(); - if (payloadToRelease != nullptr) - sendToFrontend(payloadToRelease, BEGIN_RESP); - else - { - sc_time triggerTime = respQueue->getTriggerTime(); - if (triggerTime != sc_max_time()) - dataResponseEvent.notify(triggerTime - sc_time_stamp()); - } - } - - // (3) Accept new request from arbiter and start appropriate BM if necessary - if (sc_time_stamp() >= timeToAcquire && payloadToAcquire != nullptr) + // (3) Insert new request from arbiter into scheduler and restart appropriate BM (finish BEGIN_REQ) + if (payloadToAcquire != nullptr && timeToAcquire <= sc_time_stamp()) { - if (scheduler->hasBufferSpace(payloadToAcquire)) - { - Bank bank = DramExtension::getBank(payloadToAcquire); - acquirePayload(); - - if (bankMachines[bank.ID()]->isIdle()) - bankMachines[bank.ID()]->start(); - } - else - PRINTDEBUGMESSAGE(name(), "Total number of payloads exceeded, backpressure!"); + unsigned bankID = DramExtension::getBank(payloadToAcquire).ID(); + finishBeginReq(); + bankMachines[bankID]->start(); } // (4) Start refresh and power-down managers to issue requests for the current time @@ -334,7 +311,11 @@ void Controller::controllerMethod() readyCmdBlocked = true; } - // (6) Restart bank machines, refresh managers and power-down managers to issue new requests for the future + // (6) Accept request from arbiter if scheduler is not full, otherwise backpressure (start END_REQ) + if (payloadToAcquire != nullptr && timeToAcquire == sc_max_time()) + startEndReq(); + + // (7) Restart bank machines, refresh managers and power-down managers to issue new requests for the future // TODO: check if all calls are necessary sc_time timeForNextTrigger = sc_max_time(); for (auto it : bankMachines) @@ -343,8 +324,6 @@ void Controller::controllerMethod() if (!(localTime == sc_time_stamp() && readyCmdBlocked)) timeForNextTrigger = std::min(timeForNextTrigger, localTime); } - if (payloadToAcquire != nullptr && sc_time_stamp() >= timeToAcquire && scheduler->hasBufferSpace(payloadToAcquire)) - acquirePayload(); for (auto it : refreshManagers) timeForNextTrigger = std::min(timeForNextTrigger, it->start()); for (auto it : powerDownManagers) @@ -394,7 +373,55 @@ unsigned int Controller::transport_dbg(tlm_generic_payload &) return 0; } -void Controller::releasePayload() +void Controller::finishBeginReq() +{ + uint64_t id __attribute__((unused)) = DramExtension::getPayloadID(payloadToAcquire); + PRINTDEBUGMESSAGE(name(), "Payload " + std::to_string(id) + " entered system."); + + if (totalNumberOfPayloads == 0) + idleTimeCollector.end(); + totalNumberOfPayloads++; + + Rank rank = DramExtension::getRank(payloadToAcquire); + if (ranksNumberOfPayloads[rank.ID()] == 0) + { + refreshManagers[rank.ID()]->notifyActive(); + powerDownManagers[rank.ID()]->triggerExit(TriggerSource::Controller); + } + ranksNumberOfPayloads[rank.ID()]++; + + scheduler->storeRequest(payloadToAcquire); + payloadToAcquire->acquire(); + timeToAcquire = sc_max_time(); +} + +void Controller::startEndReq() +{ + if (scheduler->hasBufferSpace()) + { + payloadToAcquire->set_response_status(TLM_OK_RESPONSE); + sendToFrontend(payloadToAcquire, END_REQ); + payloadToAcquire = nullptr; + } + else + PRINTDEBUGMESSAGE(name(), "Total number of payloads exceeded, backpressure!"); +} + +void Controller::startBeginResp() +{ + payloadToRelease = respQueue->nextPayload(); + + if (payloadToRelease != nullptr) + sendToFrontend(payloadToRelease, BEGIN_RESP); + else + { + sc_time triggerTime = respQueue->getTriggerTime(); + if (triggerTime != sc_max_time()) + dataResponseEvent.notify(triggerTime - sc_time_stamp()); + } +} + +void Controller::finishEndResp() { uint64_t id __attribute__((unused)) = DramExtension::getPayloadID(payloadToRelease); PRINTDEBUGMESSAGE(name(), "Payload " + std::to_string(id) + " left system."); @@ -409,32 +436,6 @@ void Controller::releasePayload() idleTimeCollector.start(); } -void Controller::acquirePayload() -{ - uint64_t id __attribute__((unused)) = DramExtension::getPayloadID(payloadToAcquire); - PRINTDEBUGMESSAGE(name(), "Payload " + std::to_string(id) + " entered system."); - - Rank rank = DramExtension::getRank(payloadToAcquire); - - if (totalNumberOfPayloads == 0) - idleTimeCollector.end(); - totalNumberOfPayloads++; - - if(ranksNumberOfPayloads[rank.ID()] == 0) - { - refreshManagers[rank.ID()]->notifyActive(); - powerDownManagers[rank.ID()]->triggerExit(TriggerSource::Controller); - } - ranksNumberOfPayloads[rank.ID()]++; - - scheduler->storeRequest(payloadToAcquire); - payloadToAcquire->acquire(); - payloadToAcquire->set_response_status(TLM_OK_RESPONSE); - sendToFrontend(payloadToAcquire, END_REQ); - payloadToAcquire = nullptr; - timeToAcquire = sc_max_time(); -} - void Controller::sendToFrontend(tlm_generic_payload *payload, tlm_phase phase) { sc_time delay = SC_ZERO_TIME; diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index e94a2262..4f0ce5f2 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -94,8 +94,10 @@ private: tlm_generic_payload *payloadToRelease = nullptr; sc_time timeToRelease = sc_max_time(); - void releasePayload(); - void acquirePayload(); + void finishBeginReq(); + void startEndReq(); + void startBeginResp(); + void finishEndResp(); void controllerMethod(); sc_event beginReqEvent, endRespEvent, controllerEvent, dataResponseEvent; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h index 350e38b5..3ae9a7f1 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h @@ -62,7 +62,7 @@ private: sc_time timeToSchedule; Command nextCommand; - bool triggered = false; + bool triggered = true; bool enterSelfRefresh = false; bool controllerIdle = true; unsigned activatedBanks = 0; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index d90d8dd6..6c4050ed 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -41,9 +41,9 @@ SchedulerFifo::SchedulerFifo() requestBufferSize = Configuration::getInstance().requestBufferSize; } -bool SchedulerFifo::hasBufferSpace(tlm_generic_payload *payload) +bool SchedulerFifo::hasBufferSpace() { - if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) + if (buffer[lastBankID].size() < requestBufferSize) return true; else return false; @@ -51,7 +51,8 @@ bool SchedulerFifo::hasBufferSpace(tlm_generic_payload *payload) void SchedulerFifo::storeRequest(tlm_generic_payload *payload) { - buffer[DramExtension::getBank(payload).ID()].push_back(payload); + lastBankID = DramExtension::getBank(payload).ID(); + buffer[lastBankID].push_back(payload); } void SchedulerFifo::removeRequest(tlm_generic_payload *payload) diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h index 3acee039..51955c48 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h @@ -48,7 +48,7 @@ class SchedulerFifo : public SchedulerIF { public: SchedulerFifo(); - virtual bool hasBufferSpace(tlm_generic_payload *) override; + virtual bool hasBufferSpace() override; virtual void storeRequest(tlm_generic_payload *) override; virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; @@ -57,6 +57,7 @@ public: private: std::vector> buffer; unsigned requestBufferSize; + unsigned lastBankID; }; #endif // SCHEDULERFIFO_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 0262e009..4e87354c 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -43,9 +43,9 @@ SchedulerFrFcfs::SchedulerFrFcfs() requestBufferSize = Configuration::getInstance().requestBufferSize; } -bool SchedulerFrFcfs::hasBufferSpace(tlm_generic_payload *payload) +bool SchedulerFrFcfs::hasBufferSpace() { - if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) + if (buffer[lastBankID].size() < requestBufferSize) return true; else return false; @@ -53,7 +53,8 @@ bool SchedulerFrFcfs::hasBufferSpace(tlm_generic_payload *payload) void SchedulerFrFcfs::storeRequest(tlm_generic_payload *payload) { - buffer[DramExtension::getBank(payload).ID()].push_back(payload); + lastBankID = DramExtension::getBank(payload).ID(); + buffer[lastBankID].push_back(payload); } void SchedulerFrFcfs::removeRequest(tlm_generic_payload *payload) diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h index c0250513..5470ff68 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h @@ -48,7 +48,7 @@ class SchedulerFrFcfs : public SchedulerIF { public: SchedulerFrFcfs(); - virtual bool hasBufferSpace(tlm_generic_payload *) override; + virtual bool hasBufferSpace() override; virtual void storeRequest(tlm_generic_payload *) override; virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; @@ -57,6 +57,7 @@ public: private: std::vector> buffer; unsigned requestBufferSize; + unsigned lastBankID; }; #endif // SCHEDULERFRFCFS_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp index 077c6f9d..d62705ad 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp @@ -41,9 +41,9 @@ SchedulerFrFcfsGrp::SchedulerFrFcfsGrp() requestBufferSize = Configuration::getInstance().requestBufferSize; } -bool SchedulerFrFcfsGrp::hasBufferSpace(tlm_generic_payload *payload) +bool SchedulerFrFcfsGrp::hasBufferSpace() { - if (buffer[DramExtension::getBank(payload).ID()].size() < requestBufferSize) + if (buffer[lastBankID].size() < requestBufferSize) return true; else return false; @@ -51,7 +51,8 @@ bool SchedulerFrFcfsGrp::hasBufferSpace(tlm_generic_payload *payload) void SchedulerFrFcfsGrp::storeRequest(tlm_generic_payload *payload) { - buffer[DramExtension::getBank(payload).ID()].push_back(payload); + lastBankID = DramExtension::getBank(payload).ID(); + buffer[lastBankID].push_back(payload); } void SchedulerFrFcfsGrp::removeRequest(tlm_generic_payload *payload) diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h index 0b7418df..fbc5e92c 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h @@ -49,7 +49,7 @@ class SchedulerFrFcfsGrp : public SchedulerIF { public: SchedulerFrFcfsGrp(); - virtual bool hasBufferSpace(tlm_generic_payload *) override; + virtual bool hasBufferSpace() override; virtual void storeRequest(tlm_generic_payload *) override; virtual void removeRequest(tlm_generic_payload *) override; virtual tlm_generic_payload *getNextRequest(BankMachine *) override; @@ -59,6 +59,7 @@ private: std::vector> buffer; unsigned requestBufferSize; tlm_command lastCommand = TLM_READ_COMMAND; + unsigned lastBankID; }; #endif // SCHEDULERFRFCFSGRP_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h index d7504bbb..9ab2bc71 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h @@ -49,7 +49,7 @@ class SchedulerIF { public: virtual ~SchedulerIF() {} - virtual bool hasBufferSpace(tlm_generic_payload *) = 0; + virtual bool hasBufferSpace() = 0; virtual void storeRequest(tlm_generic_payload *) = 0; virtual void removeRequest(tlm_generic_payload *) = 0; virtual tlm_generic_payload *getNextRequest(BankMachine *) = 0; From b0418f711fede9d48973dc681e8403875542b1d8 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 1 Apr 2020 17:34:56 +0200 Subject: [PATCH 18/23] Removed notifyActive() and notifyIdle() of refresh managers. --- DRAMSys/library/src/controller/Controller.cpp | 8 +-- .../refresh/RefreshManagerBankwise.cpp | 2 +- .../refresh/RefreshManagerBankwise.h | 5 +- .../controller/refresh/RefreshManagerDummy.h | 3 - .../src/controller/refresh/RefreshManagerIF.h | 3 - .../refresh/RefreshManagerRankwise.cpp | 61 +++++++++++-------- .../refresh/RefreshManagerRankwise.h | 6 +- 7 files changed, 39 insertions(+), 49 deletions(-) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 8da97ddc..6ab312c4 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -232,7 +232,6 @@ void Controller::controllerMethod() } // (4) Start refresh and power-down managers to issue requests for the current time - // TODO: check if the order of start() matters, do I always need to start them at this point? No, only if something happened in steps 1-3!!! for (auto it : refreshManagers) it->start(); for (auto it : powerDownManagers) @@ -299,10 +298,7 @@ void Controller::controllerMethod() ranksNumberOfPayloads[rank.ID()]--; if (ranksNumberOfPayloads[rank.ID()] == 0) - { - refreshManagers[rank.ID()]->notifyIdle(); powerDownManagers[rank.ID()]->triggerEntry(TriggerSource::Controller); - } } sendToDram(commandPair.first, commandPair.second); @@ -384,10 +380,8 @@ void Controller::finishBeginReq() Rank rank = DramExtension::getRank(payloadToAcquire); if (ranksNumberOfPayloads[rank.ID()] == 0) - { - refreshManagers[rank.ID()]->notifyActive(); powerDownManagers[rank.ID()]->triggerExit(TriggerSource::Controller); - } + ranksNumberOfPayloads[rank.ID()]++; scheduler->storeRequest(payloadToAcquire); diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 7c87a9b9..fa9c147d 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -39,7 +39,7 @@ RefreshManagerBankwise::RefreshManagerBankwise(std::vector &bankMachines, PowerDownManagerIF *powerDownManager, Rank rank, CheckerIF *checker) - : bankMachines(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) + : bankMachinesOnRank(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) { Configuration &config = Configuration::getInstance(); memSpec = config.memSpec; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h index e92cc08f..a94c435e 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h @@ -54,13 +54,10 @@ public: virtual sc_time start() override; virtual void updateState(Command, tlm_generic_payload *) override; - virtual void notifyActive() override {} - virtual void notifyIdle() override {} - private: enum class RmState {Regular, Pulledin} state = RmState::Regular; const MemSpec *memSpec; - std::vector &bankMachines; + std::vector &bankMachinesOnRank; PowerDownManagerIF *powerDownManager; std::vector refreshPayloads; sc_time timeForNextTrigger = sc_max_time(); diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h index e9c2cabe..3a62916a 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h @@ -49,9 +49,6 @@ public: virtual std::pair getNextCommand() override; virtual sc_time start() override; virtual void updateState(Command, tlm_generic_payload *) override {} - - virtual void notifyActive() override {} - virtual void notifyIdle() override {} }; #endif // REFRESHMANAGERDUMMY_H diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h b/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h index cedf94c9..d1e589ca 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h @@ -50,9 +50,6 @@ public: virtual std::pair getNextCommand() = 0; virtual sc_time start() = 0; virtual void updateState(Command, tlm_generic_payload *) = 0; - - virtual void notifyIdle() = 0; - virtual void notifyActive() = 0; }; #endif // REFRESHMANAGERIF_H diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index 68a20b61..7ce3e2a3 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -39,7 +39,7 @@ RefreshManagerRankwise::RefreshManagerRankwise(std::vector &bankMachines, PowerDownManagerIF *powerDownManager, Rank rank, CheckerIF *checker) - : bankMachines(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) + : bankMachinesOnRank(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) { Configuration &config = Configuration::getInstance(); memSpec = config.memSpec; @@ -50,16 +50,6 @@ RefreshManagerRankwise::RefreshManagerRankwise(std::vector &bankM maxPulledin = -config.refreshMaxPulledin; } -void RefreshManagerRankwise::notifyActive() -{ - controllerIdle = false; -} - -void RefreshManagerRankwise::notifyIdle() -{ - controllerIdle = true; -} - std::pair RefreshManagerRankwise::getNextCommand() { if (sc_time_stamp() == timeToSchedule) @@ -86,32 +76,51 @@ sc_time RefreshManagerRankwise::start() if (state == RmState::Regular) { - bool forcedRefresh = (flexibilityCounter == maxPostponed); - if (!forcedRefresh && !controllerIdle) // no forced refresh & controller is busy -> postpone + if (flexibilityCounter == maxPostponed) // forced refresh { - flexibilityCounter++; - timeForNextTrigger += memSpec->getRefreshIntervalAB(); - return timeForNextTrigger; + for (auto it : bankMachinesOnRank) + it->block(); } else { - if (forcedRefresh) + bool controllerBusy = false; + for (auto it : bankMachinesOnRank) { - for (auto it : bankMachines) - it->block(); + if (!it->isIdle()) + { + controllerBusy = true; + break; + } } - if (activatedBanks > 0) - nextCommand = Command::PREA; - else - nextCommand = Command::REFA; - timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); - return timeToSchedule; + if (controllerBusy) + { + flexibilityCounter++; + timeForNextTrigger += memSpec->getRefreshIntervalAB(); + return timeForNextTrigger; + } } + + if (activatedBanks > 0) + nextCommand = Command::PREA; + else + nextCommand = Command::REFA; + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); + return timeToSchedule; } else // if (state == RmState::Pulledin) { - if (!controllerIdle) + bool controllerBusy = false; + for (auto it : bankMachinesOnRank) + { + if (!it->isIdle()) + { + controllerBusy = true; + break; + } + } + + if (controllerBusy) { state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalAB(); diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h index c6e6786d..a85d15c4 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h @@ -52,13 +52,10 @@ public: virtual sc_time start() override; virtual void updateState(Command, tlm_generic_payload *) override; - virtual void notifyActive() override; - virtual void notifyIdle() override; - private: enum class RmState {Regular, Pulledin} state = RmState::Regular; const MemSpec *memSpec; - std::vector &bankMachines; + std::vector &bankMachinesOnRank; PowerDownManagerIF *powerDownManager; tlm_generic_payload refreshPayload; sc_time timeForNextTrigger = sc_max_time(); @@ -67,7 +64,6 @@ private: CheckerIF *checker; Command nextCommand; - bool controllerIdle = true; unsigned activatedBanks = 0; int flexibilityCounter = 0; From a5343a9da28fa2a942a2cd96cd2c99f010fdc1c0 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Thu, 2 Apr 2020 10:47:12 +0200 Subject: [PATCH 19/23] Simplified PDM. --- DRAMSys/library/src/controller/Controller.cpp | 4 ++-- .../src/controller/powerdown/PowerDownManagerDummy.h | 2 +- .../library/src/controller/powerdown/PowerDownManagerIF.h | 2 +- .../controller/powerdown/PowerDownManagerStaggered.cpp | 8 ++------ .../src/controller/powerdown/PowerDownManagerStaggered.h | 2 +- .../src/controller/refresh/RefreshManagerBankwise.cpp | 1 - .../src/controller/refresh/RefreshManagerRankwise.cpp | 1 - 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 6ab312c4..1498c688 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -297,9 +297,9 @@ void Controller::controllerMethod() dataResponseEvent.notify(triggerTime - sc_time_stamp()); ranksNumberOfPayloads[rank.ID()]--; - if (ranksNumberOfPayloads[rank.ID()] == 0) - powerDownManagers[rank.ID()]->triggerEntry(TriggerSource::Controller); } + if (ranksNumberOfPayloads[rank.ID()] == 0) + powerDownManagers[rank.ID()]->triggerEntry(); sendToDram(commandPair.first, commandPair.second); } diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h index 8aef3f54..d5fa9ef3 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h @@ -44,7 +44,7 @@ class PowerDownManagerDummy final : public PowerDownManagerIF public: PowerDownManagerDummy() {} - virtual void triggerEntry(TriggerSource) override {} + virtual void triggerEntry() override {} virtual void triggerExit(TriggerSource) override {} virtual std::pair getNextCommand() override; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h index d6a12ac4..05e3ca6b 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h @@ -49,7 +49,7 @@ class PowerDownManagerIF public: virtual ~PowerDownManagerIF() {} - virtual void triggerEntry(TriggerSource) = 0; + virtual void triggerEntry() = 0; virtual void triggerExit(TriggerSource) = 0; virtual std::pair getNextCommand() = 0; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp index bc8d676f..b0ebea5c 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp @@ -41,13 +41,9 @@ PowerDownManagerStaggered::PowerDownManagerStaggered(Rank rank, CheckerIF *check setUpDummy(powerDownPayload, rank); } -void PowerDownManagerStaggered::triggerEntry(TriggerSource source) +void PowerDownManagerStaggered::triggerEntry() { - if (source == TriggerSource::Controller) - controllerIdle = true; - - // TODO: check if state is always idle here - if (state == PdmState::Idle && controllerIdle) + if (state == PdmState::Idle) triggered = true; } diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h index 3ae9a7f1..7d12961d 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h @@ -46,7 +46,7 @@ class PowerDownManagerStaggered final : public PowerDownManagerIF public: PowerDownManagerStaggered(Rank, CheckerIF *); - virtual void triggerEntry(TriggerSource) override; + virtual void triggerEntry() override; virtual void triggerExit(TriggerSource) override; virtual std::pair getNextCommand() override; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index fa9c147d..3e4271d0 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -171,7 +171,6 @@ void RefreshManagerBankwise::updateState(Command command, tlm_generic_payload *p { state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalPB(); - powerDownManager->triggerEntry(TriggerSource::RefreshManager); } } else if (command == Command::REFA) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index 7ce3e2a3..a5f704d0 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -166,7 +166,6 @@ void RefreshManagerRankwise::updateState(Command command, tlm_generic_payload *) { state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalAB(); - powerDownManager->triggerEntry(TriggerSource::RefreshManager); } } } From a57d91acd314867c2e9f7b519abdb5fbbb2824ee Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Thu, 2 Apr 2020 22:31:08 +0200 Subject: [PATCH 20/23] Improved and simplified version of PDM. --- DRAMSys/library/src/controller/Controller.cpp | 2 +- .../powerdown/PowerDownManagerDummy.h | 3 +- .../controller/powerdown/PowerDownManagerIF.h | 5 +- .../powerdown/PowerDownManagerStaggered.cpp | 107 ++++++++++-------- .../powerdown/PowerDownManagerStaggered.h | 10 +- .../refresh/RefreshManagerBankwise.cpp | 2 +- .../refresh/RefreshManagerRankwise.cpp | 2 +- 7 files changed, 72 insertions(+), 59 deletions(-) diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 1498c688..7d5037f3 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -380,7 +380,7 @@ void Controller::finishBeginReq() Rank rank = DramExtension::getRank(payloadToAcquire); if (ranksNumberOfPayloads[rank.ID()] == 0) - powerDownManagers[rank.ID()]->triggerExit(TriggerSource::Controller); + powerDownManagers[rank.ID()]->triggerExit(); ranksNumberOfPayloads[rank.ID()]++; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h index d5fa9ef3..55af81e9 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h @@ -45,7 +45,8 @@ public: PowerDownManagerDummy() {} virtual void triggerEntry() override {} - virtual void triggerExit(TriggerSource) override {} + virtual void triggerExit() override {} + virtual void triggerInterruption() override {} virtual std::pair getNextCommand() override; virtual void updateState(Command) override {} diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h index 05e3ca6b..c5bfdf4d 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h @@ -42,15 +42,14 @@ using namespace tlm; -enum class TriggerSource {Controller, RefreshManager}; - class PowerDownManagerIF { public: virtual ~PowerDownManagerIF() {} virtual void triggerEntry() = 0; - virtual void triggerExit(TriggerSource) = 0; + virtual void triggerExit() = 0; + virtual void triggerInterruption() = 0; virtual std::pair getNextCommand() = 0; virtual void updateState(Command) = 0; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp index b0ebea5c..b1ca8298 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp @@ -43,34 +43,28 @@ PowerDownManagerStaggered::PowerDownManagerStaggered(Rank rank, CheckerIF *check void PowerDownManagerStaggered::triggerEntry() { + controllerIdle = true; + if (state == PdmState::Idle) - triggered = true; + entryTriggered = true; } -void PowerDownManagerStaggered::triggerExit(TriggerSource source) +void PowerDownManagerStaggered::triggerExit() { - if (source == TriggerSource::Controller) - { - controllerIdle = false; - enterSelfRefresh = false; + controllerIdle = false; + enterSelfRefresh = false; + entryTriggered = false; - if (state == PdmState::Idle) - triggered = false; - else - triggered = true; - } - else // if (source == TriggerSource::RefreshManager) - { - if (state == PdmState::Idle && !enterSelfRefresh) - triggered = false; - else if (state == PdmState::PrechargePd && !triggered) - { - triggered = true; - enterSelfRefresh = true; - } - else if (state == PdmState::ActivePd) // TODO: check if normal else is also ok here - triggered = true; - } + if (state != PdmState::Idle) + exitTriggered = true; +} + +void PowerDownManagerStaggered::triggerInterruption() +{ + entryTriggered = false; + + if (state != PdmState::Idle) + exitTriggered = true; } std::pair PowerDownManagerStaggered::getNextCommand() @@ -85,28 +79,33 @@ sc_time PowerDownManagerStaggered::start() { timeToSchedule = sc_max_time(); - if (triggered) + if (exitTriggered) { - if (state == PdmState::Idle) - { - if (enterSelfRefresh) - nextCommand = Command::SREFEN; - else if (activatedBanks == 0) - nextCommand = Command::PDEP; - else - nextCommand = Command::PDEA; - } - else if (state == PdmState::ActivePd) + if (state == PdmState::ActivePdn) nextCommand = Command::PDXA; - else if (state == PdmState::PrechargePd) + else if (state == PdmState::PrechargePdn) nextCommand = Command::PDXP; else if (state == PdmState::SelfRefresh) nextCommand = Command::SREFEX; - else // if (state == PdmState::Refresh) + else if (state == PdmState::ExtraRefresh) nextCommand = Command::REFA; timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); } + else if (entryTriggered) + { + if (activatedBanks != 0) + nextCommand = Command::PDEA; + else + nextCommand = Command::PDEP; + + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); + } + else if (enterSelfRefresh) + { + nextCommand = Command::SREFEN; + timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0)); + } return timeToSchedule; } @@ -121,36 +120,48 @@ void PowerDownManagerStaggered::updateState(Command command) activatedBanks = 0; else if (command == Command::PDEA) { - state = PdmState::ActivePd; - triggered = false; + state = PdmState::ActivePdn; + entryTriggered = false; } else if (command == Command::PDEP) { - state = PdmState::PrechargePd; - triggered = false; + state = PdmState::PrechargePdn; + entryTriggered = false; } else if (command == Command::SREFEN) { state = PdmState::SelfRefresh; - triggered = false; + entryTriggered = false; enterSelfRefresh = false; } else if (command == Command::PDXA) { state = PdmState::Idle; - triggered = false; + exitTriggered = false; } else if (command == Command::PDXP) { state = PdmState::Idle; - if (!enterSelfRefresh) - triggered = false; + exitTriggered = false; + + if (controllerIdle) + enterSelfRefresh = true; } else if (command == Command::SREFEX) - state = PdmState::Refresh; - else if (command == Command::REFA && state == PdmState::Refresh) + state = PdmState::ExtraRefresh; + else if (command == Command::REFA) { - state = PdmState::Idle; - triggered = false; + if (state == PdmState::ExtraRefresh) + { + state = PdmState::Idle; + exitTriggered = false; + } + else if (controllerIdle) + entryTriggered = true; + } + else if (command == Command::REFB) + { + if (controllerIdle) + entryTriggered = true; } } diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h index 7d12961d..c11f086f 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h @@ -47,14 +47,15 @@ public: PowerDownManagerStaggered(Rank, CheckerIF *); virtual void triggerEntry() override; - virtual void triggerExit(TriggerSource) override; + virtual void triggerExit() override; + virtual void triggerInterruption() override; virtual std::pair getNextCommand() override; virtual void updateState(Command) override; virtual sc_time start() override; private: - enum class PdmState {Idle, ActivePd, PrechargePd, SelfRefresh, Refresh} state = PdmState::Idle; + enum class PdmState {Idle, ActivePdn, PrechargePdn, SelfRefresh, ExtraRefresh} state = PdmState::Idle; tlm_generic_payload powerDownPayload; Rank rank; CheckerIF *checker; @@ -62,9 +63,10 @@ private: sc_time timeToSchedule; Command nextCommand; - bool triggered = true; - bool enterSelfRefresh = false; bool controllerIdle = true; + bool entryTriggered = true; + bool exitTriggered = false; + bool enterSelfRefresh = false; unsigned activatedBanks = 0; }; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 3e4271d0..55de87b7 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -72,7 +72,7 @@ sc_time RefreshManagerBankwise::start() if (sc_time_stamp() >= timeForNextTrigger) { - powerDownManager->triggerExit(TriggerSource::RefreshManager); + powerDownManager->triggerInterruption(); if (sleeping) return timeToSchedule; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index a5f704d0..c14f30fc 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -64,7 +64,7 @@ sc_time RefreshManagerRankwise::start() if (sc_time_stamp() >= timeForNextTrigger) { - powerDownManager->triggerExit(TriggerSource::RefreshManager); + powerDownManager->triggerInterruption(); if (sleeping) return timeToSchedule; From 6c0ebb0e880ca21f919bec574c4c1c906ff1afbd Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 3 Apr 2020 15:00:51 +0200 Subject: [PATCH 21/23] Minor changes in DRAM and controller. --- DRAMSys/library/CMakeLists.txt | 1 - DRAMSys/library/src/common/TlmRecorder.cpp | 2 +- DRAMSys/library/src/common/protocol.h | 69 ---------- .../library/src/controller/BankMachine.cpp | 28 ++-- DRAMSys/library/src/controller/Command.cpp | 23 ++++ DRAMSys/library/src/controller/Command.h | 30 ++++- DRAMSys/library/src/controller/Controller.cpp | 1 - .../src/controller/ControllerRecordable.cpp | 1 - .../powerdown/PowerDownManagerStaggered.cpp | 53 ++++---- .../powerdown/PowerDownManagerStaggered.h | 2 +- .../refresh/RefreshManagerBankwise.cpp | 22 +-- .../refresh/RefreshManagerRankwise.cpp | 32 +++-- DRAMSys/library/src/simulation/dram/Dram.cpp | 86 +++--------- DRAMSys/library/src/simulation/dram/Dram.h | 3 +- .../library/src/simulation/dram/DramDDR3.cpp | 11 +- .../library/src/simulation/dram/DramDDR4.cpp | 11 +- .../library/src/simulation/dram/DramGDDR5.cpp | 9 +- .../src/simulation/dram/DramGDDR5X.cpp | 9 +- .../library/src/simulation/dram/DramGDDR6.cpp | 9 +- .../library/src/simulation/dram/DramHBM2.cpp | 9 +- .../src/simulation/dram/DramLPDDR4.cpp | 9 +- .../src/simulation/dram/DramRecordable.cpp | 15 +-- .../src/simulation/dram/DramRecordable.h | 1 - .../src/simulation/dram/DramWideIO.cpp | 127 +++++------------- .../src/simulation/dram/DramWideIO2.cpp | 9 +- 25 files changed, 197 insertions(+), 375 deletions(-) delete mode 100644 DRAMSys/library/src/common/protocol.h diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index f0b04c92..31729d23 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -69,7 +69,6 @@ add_library(DRAMSysLibrary src/common/CongenAddressDecoder.cpp src/common/DebugManager.cpp src/common/dramExtensions.cpp - src/common/protocol.h src/common/tlm2_base_protocol_checker.h src/common/TlmRecorder.cpp src/common/utils.cpp diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 4357843a..0258da37 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -40,10 +40,10 @@ #include #include "TlmRecorder.h" -#include "protocol.h" #include "dramExtensions.h" #include "XmlAddressDecoder.h" #include "../configuration/Configuration.h" +#include "../controller/Command.h" using namespace tlm; diff --git a/DRAMSys/library/src/common/protocol.h b/DRAMSys/library/src/common/protocol.h deleted file mode 100644 index 9f7be6be..00000000 --- a/DRAMSys/library/src/common/protocol.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2015, University of Kaiserslautern - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: - * Janik Schlemminger - * Robert Gernhardt - * Matthias Jung - */ - -#ifndef PROTOCOL_H -#define PROTOCOL_H - -// DO NOT CHANGE THE ORDER! -DECLARE_EXTENDED_PHASE(BEGIN_RD); // 5 -DECLARE_EXTENDED_PHASE(BEGIN_WR); // 6 -DECLARE_EXTENDED_PHASE(BEGIN_RDA); // 7 -DECLARE_EXTENDED_PHASE(BEGIN_WRA); // 8 -DECLARE_EXTENDED_PHASE(BEGIN_PRE); // 9 -DECLARE_EXTENDED_PHASE(BEGIN_ACT); // 10 -DECLARE_EXTENDED_PHASE(BEGIN_REFB); // 11 -DECLARE_EXTENDED_PHASE(BEGIN_PREA); // 12 -DECLARE_EXTENDED_PHASE(BEGIN_REFA); // 13 -DECLARE_EXTENDED_PHASE(BEGIN_PDNA); // 14 -DECLARE_EXTENDED_PHASE(END_PDNA); // 15 -DECLARE_EXTENDED_PHASE(BEGIN_PDNP); // 16 -DECLARE_EXTENDED_PHASE(END_PDNP); // 17 -DECLARE_EXTENDED_PHASE(BEGIN_SREF); // 18 -DECLARE_EXTENDED_PHASE(END_SREF); // 19 - -DECLARE_EXTENDED_PHASE(END_RD); // 20 -DECLARE_EXTENDED_PHASE(END_WR); // 21 -DECLARE_EXTENDED_PHASE(END_RDA); // 22 -DECLARE_EXTENDED_PHASE(END_WRA); // 23 -DECLARE_EXTENDED_PHASE(END_PRE); // 24 -DECLARE_EXTENDED_PHASE(END_ACT); // 25 -DECLARE_EXTENDED_PHASE(END_REFB); // 26 -DECLARE_EXTENDED_PHASE(END_PREA); // 27 -DECLARE_EXTENDED_PHASE(END_REFA); // 28 - -#endif // PROTOCOL_H - diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index 5061cc36..4c20a76a 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -52,29 +52,33 @@ std::pair BankMachine::getNextCommand() void BankMachine::updateState(Command command) { - if (command == Command::ACT) + switch (command) { + case Command::ACT: currentState = BmState::Activated; currentRow = DramExtension::getRow(currentPayload); - } - else if (command == Command::PRE || command == Command::PREA) + break; + case Command::PRE: case Command::PREA: currentState = BmState::Precharged; - else if (command == Command::RD || command == Command::WR) + break; + case Command::RD: case Command::WR: currentPayload = nullptr; - else if (command == Command::RDA || command == Command::WRA) - { + break; + case Command::RDA: case Command::WRA: currentState = BmState::Precharged; currentPayload = nullptr; - } - else if (command == Command::PDEA || command == Command::PDEP || command == Command::SREFEN) + break; + case Command::PDEA: case Command::PDEP: case Command::SREFEN: sleeping = true; - else if (command == Command::REFA || command == Command::REFB) - { + break; + case Command::REFA: case Command::REFB: sleeping = false; blocked = false; - } - else if (command == Command::PDXA || command == Command::PDXP) + break; + case Command::PDXA: case Command::PDXP: sleeping = false; + break; + } } void BankMachine::block() diff --git a/DRAMSys/library/src/controller/Command.cpp b/DRAMSys/library/src/controller/Command.cpp index 7c15c931..9fd3e0c7 100644 --- a/DRAMSys/library/src/controller/Command.cpp +++ b/DRAMSys/library/src/controller/Command.cpp @@ -38,6 +38,7 @@ #include "Command.h" #include +using namespace DRAMPower; std::string commandToString(Command command) { @@ -112,6 +113,28 @@ Command phaseToCommand(tlm_phase phase) return commandOfPhase[phase - 5]; } +MemCommand::cmds phaseToDRAMPowerCommand(tlm_phase phase) +{ + assert(phase >= 5 && phase <= 19); + static std::array phaseOfCommand = + {MemCommand::RD, + MemCommand::WR, + MemCommand::RDA, + MemCommand::WRA, + MemCommand::PRE, + MemCommand::ACT, + MemCommand::REFB, + MemCommand::PREA, + MemCommand::REF, + MemCommand::PDN_S_ACT, + MemCommand::PUP_ACT, + MemCommand::PDN_S_PRE, + MemCommand::PUP_PRE, + MemCommand::SREN, + MemCommand::SREX}; + return phaseOfCommand[phase - 5]; +} + bool phaseNeedsEnd(tlm_phase phase) { return (phase >= 5 && phase <= 13); diff --git a/DRAMSys/library/src/controller/Command.h b/DRAMSys/library/src/controller/Command.h index b9be24b1..9f49ea2b 100644 --- a/DRAMSys/library/src/controller/Command.h +++ b/DRAMSys/library/src/controller/Command.h @@ -40,10 +40,37 @@ #include #include #include -#include "../common/protocol.h" +#include "../common/third_party/DRAMPower/src/MemCommand.h" using namespace tlm; +// DO NOT CHANGE THE ORDER! +DECLARE_EXTENDED_PHASE(BEGIN_RD); // 5 +DECLARE_EXTENDED_PHASE(BEGIN_WR); // 6 +DECLARE_EXTENDED_PHASE(BEGIN_RDA); // 7 +DECLARE_EXTENDED_PHASE(BEGIN_WRA); // 8 +DECLARE_EXTENDED_PHASE(BEGIN_PRE); // 9 +DECLARE_EXTENDED_PHASE(BEGIN_ACT); // 10 +DECLARE_EXTENDED_PHASE(BEGIN_REFB); // 11 +DECLARE_EXTENDED_PHASE(BEGIN_PREA); // 12 +DECLARE_EXTENDED_PHASE(BEGIN_REFA); // 13 +DECLARE_EXTENDED_PHASE(BEGIN_PDNA); // 14 +DECLARE_EXTENDED_PHASE(END_PDNA); // 15 +DECLARE_EXTENDED_PHASE(BEGIN_PDNP); // 16 +DECLARE_EXTENDED_PHASE(END_PDNP); // 17 +DECLARE_EXTENDED_PHASE(BEGIN_SREF); // 18 +DECLARE_EXTENDED_PHASE(END_SREF); // 19 + +DECLARE_EXTENDED_PHASE(END_RD); // 20 +DECLARE_EXTENDED_PHASE(END_WR); // 21 +DECLARE_EXTENDED_PHASE(END_RDA); // 22 +DECLARE_EXTENDED_PHASE(END_WRA); // 23 +DECLARE_EXTENDED_PHASE(END_PRE); // 24 +DECLARE_EXTENDED_PHASE(END_ACT); // 25 +DECLARE_EXTENDED_PHASE(END_REFB); // 26 +DECLARE_EXTENDED_PHASE(END_PREA); // 27 +DECLARE_EXTENDED_PHASE(END_REFA); // 28 + enum Command { NOP, @@ -67,6 +94,7 @@ enum Command std::string commandToString(Command); tlm_phase commandToPhase(Command); Command phaseToCommand(tlm_phase); +DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm_phase); bool phaseNeedsEnd(tlm_phase); tlm_phase getEndPhase(tlm_phase); unsigned numberOfCommands(); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 7d5037f3..ee32349e 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -36,7 +36,6 @@ #include "../configuration/Configuration.h" #include "../common/dramExtensions.h" -#include "../common/protocol.h" #include "Command.h" #include "checker/CheckerDDR3.h" #include "checker/CheckerDDR4.h" diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index 97b1a542..c0e90278 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -34,7 +34,6 @@ #include "ControllerRecordable.h" -#include "../common/protocol.h" #include "../configuration/Configuration.h" tlm_sync_enum ControllerRecordable::nb_transport_fw(tlm_generic_payload &trans, diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp index b1ca8298..098f5c51 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp @@ -112,45 +112,44 @@ sc_time PowerDownManagerStaggered::start() void PowerDownManagerStaggered::updateState(Command command) { - if (command == Command::ACT) - activatedBanks++; - else if (command == Command::PRE) - activatedBanks--; - else if (command == Command::PREA) - activatedBanks = 0; - else if (command == Command::PDEA) + switch (command) { + case Command::ACT: + activatedBanks++; + break; + case Command::PRE: + activatedBanks--; + break; + case Command::PREA: + activatedBanks = 0; + break; + case Command::PDEA: state = PdmState::ActivePdn; entryTriggered = false; - } - else if (command == Command::PDEP) - { + break; + case Command::PDEP: state = PdmState::PrechargePdn; entryTriggered = false; - } - else if (command == Command::SREFEN) - { + break; + case Command::SREFEN: state = PdmState::SelfRefresh; entryTriggered = false; enterSelfRefresh = false; - } - else if (command == Command::PDXA) - { + break; + case Command::PDXA: state = PdmState::Idle; exitTriggered = false; - } - else if (command == Command::PDXP) - { + break; + case Command::PDXP: state = PdmState::Idle; exitTriggered = false; - if (controllerIdle) enterSelfRefresh = true; - } - else if (command == Command::SREFEX) + break; + case Command::SREFEX: state = PdmState::ExtraRefresh; - else if (command == Command::REFA) - { + break; + case Command::REFA: if (state == PdmState::ExtraRefresh) { state = PdmState::Idle; @@ -158,10 +157,10 @@ void PowerDownManagerStaggered::updateState(Command command) } else if (controllerIdle) entryTriggered = true; - } - else if (command == Command::REFB) - { + break; + case Command::REFB: if (controllerIdle) entryTriggered = true; + break; } } diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h index c11f086f..83048ca8 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h @@ -60,7 +60,7 @@ private: Rank rank; CheckerIF *checker; - sc_time timeToSchedule; + sc_time timeToSchedule = sc_max_time(); Command nextCommand; bool controllerIdle = true; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 55de87b7..5e534b6b 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -156,8 +156,9 @@ sc_time RefreshManagerBankwise::start() void RefreshManagerBankwise::updateState(Command command, tlm_generic_payload *payload) { - if (command == Command::REFB) + switch (command) { + case Command::REFB: remainingBankMachines.erase(currentIterator); if (remainingBankMachines.empty()) remainingBankMachines = allBankMachines; @@ -172,21 +173,22 @@ void RefreshManagerBankwise::updateState(Command command, tlm_generic_payload *p state = RmState::Regular; timeForNextTrigger += memSpec->getRefreshIntervalPB(); } - } - else if (command == Command::REFA) - { + break; + case Command::REFA: // Refresh command after SREFEX state = RmState::Regular; // TODO: check if this assignment is necessary timeForNextTrigger = sc_time_stamp() + memSpec->getRefreshIntervalPB(); sleeping = false; - } - else if (command == Command::PDEA || command == Command::PDEP) + break; + case Command::PDEA: case Command::PDEP: sleeping = true; - else if (command == Command::SREFEN) - { + break; + case Command::SREFEN: sleeping = true; timeForNextTrigger = sc_max_time(); - } - else if (command == Command::PDXA || command == Command::PDXP) + break; + case Command::PDXA: case Command::PDXP: sleeping = false; + break; + } } diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index c14f30fc..9af8bde4 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -140,14 +140,18 @@ sc_time RefreshManagerRankwise::start() void RefreshManagerRankwise::updateState(Command command, tlm_generic_payload *) { - if (command == Command::ACT) - activatedBanks++; - else if (command == Command::PRE) - activatedBanks--; - else if (command == Command::PREA) - activatedBanks = 0; - else if (command == Command::REFA) + switch (command) { + case Command::ACT: + activatedBanks++; + break; + case Command::PRE: + activatedBanks--; + break; + case Command::PREA: + activatedBanks = 0; + break; + case Command::REFA: if (sleeping) { // Refresh command after SREFEX @@ -168,14 +172,16 @@ void RefreshManagerRankwise::updateState(Command command, tlm_generic_payload *) timeForNextTrigger += memSpec->getRefreshIntervalAB(); } } - } - else if (command == Command::PDEA || command == Command::PDEP) + break; + case Command::PDEA: case Command::PDEP: sleeping = true; - else if (command == Command::SREFEN) - { + break; + case Command::SREFEN: sleeping = true; timeForNextTrigger = sc_max_time(); - } - else if (command == Command::PDXA || command == Command::PDXP) + break; + case Command::PDXA: case Command::PDXP: sleeping = false; + break; + } } diff --git a/DRAMSys/library/src/simulation/dram/Dram.cpp b/DRAMSys/library/src/simulation/dram/Dram.cpp index 5eee8b93..feaea294 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.cpp +++ b/DRAMSys/library/src/simulation/dram/Dram.cpp @@ -55,10 +55,10 @@ #include "../../common/DebugManager.h" #include "../../common/dramExtensions.h" #include "../../configuration/Configuration.h" -#include "../../common/protocol.h" #include "../../common/utils.h" #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" #include "../../common/third_party/DRAMPower/src/MemCommand.h" +#include "../../controller/Command.h" using namespace tlm; using namespace DRAMPower; @@ -107,10 +107,6 @@ Dram::~Dram() { if (Configuration::getInstance().powerAnalysis) { - libDRAMPower *DRAMPower = dynamic_cast(this->DRAMPower); - if (DRAMPower == nullptr) - SC_REPORT_FATAL("Dram", "Power Analysis active but libDRAMPowerIF instantiated"); - if (!Configuration::getInstance().databaseRecording) DRAMPower->calcEnergy(); @@ -128,8 +124,9 @@ Dram::~Dram() << DRAMPower->getPower().average_power * Configuration::getInstance().numberOfDevicesOnDIMM << std::string(" mW") << std::endl; + + delete DRAMPower; } - delete DRAMPower; if (Configuration::getInstance().useMalloc) free(memory); @@ -138,75 +135,28 @@ Dram::~Dram() tlm_sync_enum Dram::nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &) { - unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); + assert(phase >= 5 && phase <= 19); - // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp() / memSpec->tCK; - - if (phase == BEGIN_PRE) - DRAMPower->doCommand(MemCommand::PRE, bank, cycle); - else if (phase == BEGIN_PREA) - DRAMPower->doCommand(MemCommand::PREA, bank, cycle); - else if (phase == BEGIN_ACT) - DRAMPower->doCommand(MemCommand::ACT, bank, cycle); - else if (phase == BEGIN_WR) + if (Configuration::getInstance().powerAnalysis) { - DRAMPower->doCommand(MemCommand::WR, bank, cycle); - // save data: - if (storeMode == StorageMode::Store) // Use Storage + unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); + unsigned long long cycle = sc_time_stamp() / memSpec->tCK; + DRAMPower->doCommand(phaseToDRAMPowerCommand(phase), bank, cycle); + } + + if (storeMode == StorageMode::Store) + { + if (phase == BEGIN_RD || phase == BEGIN_RDA) + { + unsigned char *phyAddr = memory + payload.get_address(); + memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); + } + else if (phase == BEGIN_WR || phase == BEGIN_WRA) { unsigned char *phyAddr = memory + payload.get_address(); memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); } } - else if (phase == BEGIN_RD) - { - DRAMPower->doCommand(MemCommand::RD, bank, cycle); - // load data: - if (storeMode == StorageMode::Store) // use StorageMode - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); - } - } - else if (phase == BEGIN_WRA) - { - DRAMPower->doCommand(MemCommand::WRA, bank, cycle); - // save data: - if (storeMode == StorageMode::Store) // Use Storage - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); - } - } - else if (phase == BEGIN_RDA) - { - DRAMPower->doCommand(MemCommand::RDA, bank, cycle); - // Load data: - if (storeMode == StorageMode::Store) // use StorageMode - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); - } - } - else if (phase == BEGIN_REFA) - DRAMPower->doCommand(MemCommand::REF, bank, cycle); - else if (phase == BEGIN_REFB) - DRAMPower->doCommand(MemCommand::REFB, bank, cycle); - else if (phase == BEGIN_PDNA) - DRAMPower->doCommand(MemCommand::PDN_S_ACT, bank, cycle); - else if (phase == END_PDNA) - DRAMPower->doCommand(MemCommand::PUP_ACT, bank, cycle); - else if (phase == BEGIN_PDNP) - DRAMPower->doCommand(MemCommand::PDN_S_PRE, bank, cycle); - else if (phase == END_PDNP) - DRAMPower->doCommand(MemCommand::PUP_PRE, bank, cycle); - else if (phase == BEGIN_SREF) - DRAMPower->doCommand(MemCommand::SREN, bank, cycle); - else if (phase == END_SREF) - DRAMPower->doCommand(MemCommand::SREX, bank, cycle); - else - SC_REPORT_FATAL("DRAM", "DRAM PEQ was called with unknown phase"); return TLM_ACCEPTED; } diff --git a/DRAMSys/library/src/simulation/dram/Dram.h b/DRAMSys/library/src/simulation/dram/Dram.h index 2386ab35..3995ac99 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.h +++ b/DRAMSys/library/src/simulation/dram/Dram.h @@ -43,7 +43,6 @@ #include #include #include -#include "../../common/protocol.h" #include "../../configuration/Configuration.h" #include "../../configuration/memspec/MemSpec.h" #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" @@ -67,7 +66,7 @@ protected: unsigned char *memory; - libDRAMPowerDummy *DRAMPower; + libDRAMPower *DRAMPower; virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &delay); diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index 9b2910ab..5f30ad02 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -45,13 +45,12 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramDDR3", "Error Model not supported for DDR3"); - // Parameters for DRAMPower - MemSpecDDR3 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramDDR3", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) { + MemSpecDDR3 *memSpec = dynamic_cast(this->memSpec); + if (memSpec == nullptr) + SC_REPORT_FATAL("DramDDR3", "Wrong MemSpec chosen"); + MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -140,6 +139,4 @@ DramDDR3::DramDDR3(sc_module_name name) : Dram(name) DRAMPower = new libDRAMPower(powerSpec, 0); } - else - DRAMPower = new libDRAMPowerDummy(); } diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index 9bc518f1..39a21935 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -45,13 +45,12 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramDDR4", "Error Model not supported for DDR4"); - // Parameters for DRAMPower - MemSpecDDR4 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramDDR4", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) { + MemSpecDDR4 *memSpec = dynamic_cast(this->memSpec); + if (memSpec == nullptr) + SC_REPORT_FATAL("DramDDR4", "Wrong MemSpec chosen"); + MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -140,6 +139,4 @@ DramDDR4::DramDDR4(sc_module_name name) : Dram(name) DRAMPower = new libDRAMPower(powerSpec, 0); } - else - DRAMPower = new libDRAMPowerDummy(); } diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp index 773aa690..3d5f2e48 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5.cpp @@ -45,13 +45,6 @@ DramGDDR5::DramGDDR5(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR5", "Error Model not supported for GDDR5"); - // Parameters for DRAMPower - MemSpecGDDR5 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramGDDR5", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramGDDR5", "DRAMPower not supported for GDDR5"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramGDDR5", "DRAMPower does not support GDDR5"); } diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp index 5342a5e5..48105864 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR5X.cpp @@ -45,13 +45,6 @@ DramGDDR5X::DramGDDR5X(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR5X", "Error Model not supported for GDDR5X"); - // Parameters for DRAMPower - MemSpecGDDR5X *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramGDDR5X", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramGDDR5X", "DRAMPower not supported for GDDR5X"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramGDDR5X", "DRAMPower does not support GDDR5X"); } diff --git a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp index 029d000d..9ff895ee 100644 --- a/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp +++ b/DRAMSys/library/src/simulation/dram/DramGDDR6.cpp @@ -45,13 +45,6 @@ DramGDDR6::DramGDDR6(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramGDDR6", "Error Model not supported for GDDR6"); - // Parameters for DRAMPower - MemSpecGDDR6 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramGDDR6", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramGDDR6", "DRAMPower not supported for GDDR6"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramGDDR6", "DRAMPower does not support GDDR6"); } diff --git a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp index 735e5256..395ca2da 100644 --- a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp @@ -45,13 +45,6 @@ DramHBM2::DramHBM2(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramHBM2", "Error Model not supported for HBM2"); - // Parameters for DRAMPower - MemSpecHBM2 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramHBM2", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramHBM2", "DRAMPower not supported for HBM2"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramHBM2", "DRAMPower does not support HBM2"); } diff --git a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp index c09c5d5b..3587606c 100644 --- a/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramLPDDR4.cpp @@ -45,13 +45,6 @@ DramLPDDR4::DramLPDDR4(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramLPDDR4", "Error Model not supported for LPDDR4"); - // Parameters for DRAMPower - MemSpecLPDDR4 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramLPDDR4", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramLPDDR4", "DRAMPower not supported for LPDDR4"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramLPDDR4", "DRAMPower does not support LPDDR4"); } diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index 8c090b50..ecf88f5b 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -58,12 +58,7 @@ DramRecordable::DramRecordable(sc_module_name name, TlmRecorder *tlmRe // Create a thread that is triggered every $powerWindowSize // to generate a Power over Time plot in the Trace analyzer: if (Configuration::getInstance().powerAnalysis) - { - DRAMPower = dynamic_cast(Dram::DRAMPower); - if (DRAMPower == nullptr) - SC_REPORT_FATAL("DramRecordable", "Power Analysis active but libDRAMPowerIF instantiated"); SC_THREAD(powerWindow); - } } template @@ -71,9 +66,9 @@ DramRecordable::~DramRecordable() { if (Configuration::getInstance().powerAnalysis) { - DRAMPower->calcEnergy(); + this->DRAMPower->calcEnergy(); tlmRecorder->recordPower(sc_time_stamp().to_seconds(), - DRAMPower->getPower().window_average_power + this->DRAMPower->getPower().window_average_power * Configuration::getInstance().numberOfDevicesOnDIMM); } tlmRecorder->closeConnection(); @@ -133,14 +128,14 @@ void DramRecordable::powerWindow() clkCycles = sc_time_stamp() / this->memSpec->tCK; - DRAMPower->calcWindowEnergy(clkCycles); + this->DRAMPower->calcWindowEnergy(clkCycles); // During operation the energy should never be zero since the device is always consuming - assert(!isEqual(DRAMPower->getEnergy().window_energy, 0.0)); + assert(!isEqual(this->DRAMPower->getEnergy().window_energy, 0.0)); // Store the time (in seconds) and the current average power (in mW) into the database tlmRecorder->recordPower(sc_time_stamp().to_seconds(), - DRAMPower->getPower().window_average_power + this->DRAMPower->getPower().window_average_power * Configuration::getInstance().numberOfDevicesOnDIMM); // Here considering that DRAMPower provides the energy in pJ and the power in mW diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.h b/DRAMSys/library/src/simulation/dram/DramRecordable.h index 507ce270..f0091c21 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.h +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.h @@ -60,7 +60,6 @@ private: TlmRecorder *tlmRecorder; - libDRAMPower *DRAMPower; sc_time powerWindowSize = Configuration::getInstance().memSpec->tCK * Configuration::getInstance().windowSize; diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index e3008c27..2aff7fdd 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -47,13 +47,12 @@ using namespace tlm; DramWideIO::DramWideIO(sc_module_name name) : Dram(name) { - // Parameters for DRAMPower - MemSpecWideIO *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramWideIO", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) { + MemSpecWideIO *memSpec = dynamic_cast(this->memSpec); + if (memSpec == nullptr) + SC_REPORT_FATAL("DramWideIO", "Wrong MemSpec chosen"); + MemArchitectureSpec memArchSpec; memArchSpec.burstLength = memSpec->burstLength; memArchSpec.dataRate = memSpec->dataRate; @@ -140,7 +139,7 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) powerSpec.memPowerSpec = memPowerSpec; powerSpec.memArchSpec = memArchSpec; - libDRAMPower *DRAMPower = new libDRAMPower(powerSpec, 0); + DRAMPower = new libDRAMPower(powerSpec, 0); // For each bank in a channel a error Model is created: if (storeMode == StorageMode::ErrorModel) @@ -153,13 +152,11 @@ DramWideIO::DramWideIO(sc_module_name name) : Dram(name) ememory.push_back(em); } } - this->DRAMPower = DRAMPower; } else { if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramWideIO", "Error modeling without power analysis is not supported"); - DRAMPower = new libDRAMPowerDummy(); } } @@ -173,101 +170,41 @@ DramWideIO::~DramWideIO() tlm_sync_enum DramWideIO::nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &) { - unsigned int bank = DramExtension::getExtension(payload).getBank().ID(); + assert(phase >= 5 && phase <= 19); - // This is only needed for power simulation: - unsigned long long cycle = sc_time_stamp() / memSpec->tCK; - - if (phase == BEGIN_PRE) - DRAMPower->doCommand(MemCommand::PRE, bank, cycle); - else if (phase == BEGIN_PREA) - DRAMPower->doCommand(MemCommand::PREA, bank, cycle); - else if (phase == BEGIN_ACT) + if (Configuration::getInstance().powerAnalysis) { - DRAMPower->doCommand(MemCommand::ACT, bank, cycle); + unsigned bank = DramExtension::getExtension(payload).getBank().ID(); + unsigned long long cycle = sc_time_stamp() / memSpec->tCK; + DRAMPower->doCommand(phaseToDRAMPowerCommand(phase), bank, cycle); + } - if (storeMode == StorageMode::ErrorModel) + if (storeMode == StorageMode::Store) + { + if (phase == BEGIN_RD || phase == BEGIN_RDA) + { + unsigned char *phyAddr = memory + payload.get_address(); + memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); + } + else if (phase == BEGIN_WR || phase == BEGIN_WRA) + { + unsigned char *phyAddr = memory + payload.get_address(); + memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); + } + } + else if (storeMode == StorageMode::ErrorModel) + { + unsigned bank = DramExtension::getExtension(payload).getBank().ID(); + + if (phase == BEGIN_ACT) ememory[bank]->activate(DramExtension::getExtension(payload).getRow().ID()); - } - else if (phase == BEGIN_WR) - { - DRAMPower->doCommand(MemCommand::WR, bank, cycle); - // save data: - if (storeMode == StorageMode::Store) // Use Storage - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); - } - else if (storeMode == StorageMode::ErrorModel) // Use Storage with Error Model - { - ememory[bank]->store(payload); - } - } - else if (phase == BEGIN_RD) - { - DRAMPower->doCommand(MemCommand::RD, bank, cycle); - // load data: - if (storeMode == StorageMode::Store) // use StorageMode - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); - } - else if (storeMode == StorageMode::ErrorModel) // use StorageMode with errormodel - { + else if (phase == BEGIN_RD || phase == BEGIN_RDA) ememory[bank]->load(payload); - } - } - else if (phase == BEGIN_WRA) - { - DRAMPower->doCommand(MemCommand::WRA, bank, cycle); - // save data: - if (storeMode == StorageMode::Store) // Use Storage - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(phyAddr, payload.get_data_ptr(), payload.get_data_length()); - } - else if (storeMode == StorageMode::ErrorModel) // Use Storage with Error Model - { + else if (phase == BEGIN_WR || phase == BEGIN_WRA) ememory[bank]->store(payload); - } - } - else if (phase == BEGIN_RDA) - { - DRAMPower->doCommand(MemCommand::RDA, bank, cycle); - // Load data: - if (storeMode == StorageMode::Store) // use StorageMode - { - unsigned char *phyAddr = memory + payload.get_address(); - memcpy(payload.get_data_ptr(), phyAddr, payload.get_data_length()); - } - else if (storeMode == StorageMode::ErrorModel) // use StorageMode with errormodel - { - ememory[bank]->load(payload); - } - } - else if (phase == BEGIN_REFA) - { - DRAMPower->doCommand(MemCommand::REF, bank, cycle); - - if (storeMode == StorageMode::ErrorModel) + else if (phase == BEGIN_REFA) ememory[bank]->refresh(DramExtension::getExtension(payload).getRow().ID()); } - else if (phase == BEGIN_REFB) - DRAMPower->doCommand(MemCommand::REFB, bank, cycle); - else if (phase == BEGIN_PDNA) - DRAMPower->doCommand(MemCommand::PDN_S_ACT, bank, cycle); - else if (phase == END_PDNA) - DRAMPower->doCommand(MemCommand::PUP_ACT, bank, cycle); - else if (phase == BEGIN_PDNP) - DRAMPower->doCommand(MemCommand::PDN_S_PRE, bank, cycle); - else if (phase == END_PDNP) - DRAMPower->doCommand(MemCommand::PUP_PRE, bank, cycle); - else if (phase == BEGIN_SREF) - DRAMPower->doCommand(MemCommand::SREN, bank, cycle); - else if (phase == END_SREF) - DRAMPower->doCommand(MemCommand::SREX, bank, cycle); - else - SC_REPORT_FATAL("DRAM", "DRAM PEQ was called with unknown phase"); return TLM_ACCEPTED; } diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp index 127bee12..8d2ac226 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO2.cpp @@ -45,13 +45,6 @@ DramWideIO2::DramWideIO2(sc_module_name name) : Dram(name) if (storeMode == StorageMode::ErrorModel) SC_REPORT_FATAL("DramWideIO2", "Error Model not supported for WideIO2"); - // Parameters for DRAMPower - MemSpecWideIO2 *memSpec = dynamic_cast(this->memSpec); - if (memSpec == nullptr) - SC_REPORT_FATAL("DramWideIO2", "Wrong MemSpec chosen"); - if (Configuration::getInstance().powerAnalysis) - SC_REPORT_FATAL("DramWideIO2", "DRAMPower not supported for WideIO2"); - else - DRAMPower = new libDRAMPowerDummy(); + SC_REPORT_FATAL("DramWideIO2", "DRAMPower does not support WideIO2"); } From 2e255217e25b328973c2e388d2bdfde3fe87f1bc Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 3 Apr 2020 16:30:30 +0200 Subject: [PATCH 22/23] Removed namespace tlm in header files. --- DRAMSys/library/src/common/TlmRecorder.h | 12 ++-- DRAMSys/library/src/common/dramExtensions.h | 56 +++++++++---------- .../src/configuration/memspec/MemSpec.h | 4 +- .../src/configuration/memspec/MemSpecDDR3.cpp | 2 + .../src/configuration/memspec/MemSpecDDR3.h | 2 +- .../src/configuration/memspec/MemSpecDDR4.cpp | 2 + .../src/configuration/memspec/MemSpecDDR4.h | 2 +- .../configuration/memspec/MemSpecGDDR5.cpp | 2 + .../src/configuration/memspec/MemSpecGDDR5.h | 2 +- .../configuration/memspec/MemSpecGDDR5X.cpp | 2 + .../src/configuration/memspec/MemSpecGDDR5X.h | 2 +- .../configuration/memspec/MemSpecGDDR6.cpp | 2 + .../src/configuration/memspec/MemSpecGDDR6.h | 2 +- .../src/configuration/memspec/MemSpecHBM2.cpp | 2 + .../src/configuration/memspec/MemSpecHBM2.h | 2 +- .../configuration/memspec/MemSpecLPDDR4.cpp | 2 + .../src/configuration/memspec/MemSpecLPDDR4.h | 2 +- .../configuration/memspec/MemSpecWideIO.cpp | 2 + .../src/configuration/memspec/MemSpecWideIO.h | 2 +- .../configuration/memspec/MemSpecWideIO2.cpp | 2 + .../configuration/memspec/MemSpecWideIO2.h | 2 +- .../library/src/controller/BankMachine.cpp | 2 + DRAMSys/library/src/controller/BankMachine.h | 6 +- DRAMSys/library/src/controller/Command.cpp | 1 + DRAMSys/library/src/controller/Command.h | 12 ++-- DRAMSys/library/src/controller/Controller.cpp | 2 + DRAMSys/library/src/controller/Controller.h | 16 +++--- DRAMSys/library/src/controller/ControllerIF.h | 8 +-- .../src/controller/ControllerRecordable.cpp | 3 +- .../src/controller/ControllerRecordable.h | 14 ++--- .../library/src/controller/cmdmux/CmdMuxIF.h | 6 +- .../src/controller/cmdmux/CmdMuxOldest.cpp | 2 + .../src/controller/cmdmux/CmdMuxOldest.h | 4 +- .../src/controller/cmdmux/CmdMuxStrict.cpp | 2 + .../src/controller/cmdmux/CmdMuxStrict.h | 4 +- .../powerdown/PowerDownManagerDummy.cpp | 2 + .../powerdown/PowerDownManagerDummy.h | 4 +- .../controller/powerdown/PowerDownManagerIF.h | 4 +- .../powerdown/PowerDownManagerStaggered.cpp | 2 + .../powerdown/PowerDownManagerStaggered.h | 6 +- .../refresh/RefreshManagerBankwise.cpp | 2 + .../refresh/RefreshManagerBankwise.h | 8 +-- .../refresh/RefreshManagerDummy.cpp | 2 + .../controller/refresh/RefreshManagerDummy.h | 6 +- .../src/controller/refresh/RefreshManagerIF.h | 6 +- .../refresh/RefreshManagerRankwise.cpp | 2 + .../refresh/RefreshManagerRankwise.h | 8 +-- .../controller/respqueue/RespQueueFifo.cpp | 2 + .../src/controller/respqueue/RespQueueFifo.h | 8 +-- .../src/controller/respqueue/RespQueueIF.h | 6 +- .../controller/respqueue/RespQueueReorder.cpp | 2 + .../controller/respqueue/RespQueueReorder.h | 8 +-- .../controller/scheduler/SchedulerFifo.cpp | 2 + .../src/controller/scheduler/SchedulerFifo.h | 10 ++-- .../controller/scheduler/SchedulerFrFcfs.cpp | 2 + .../controller/scheduler/SchedulerFrFcfs.h | 10 ++-- .../scheduler/SchedulerFrFcfsGrp.cpp | 2 + .../controller/scheduler/SchedulerFrFcfsGrp.h | 12 ++-- .../src/controller/scheduler/SchedulerIF.h | 8 +-- DRAMSys/library/src/error/eccbaseclass.cpp | 2 + DRAMSys/library/src/error/eccbaseclass.h | 2 - DRAMSys/library/src/simulation/Arbiter.h | 28 +++++----- DRAMSys/library/src/simulation/IArbiter.h | 12 ++-- .../library/src/simulation/ReorderBuffer.h | 43 +++++++------- .../library/src/simulation/SimpleArbiter.h | 18 +++--- DRAMSys/library/src/simulation/StlPlayer.h | 18 +++--- .../library/src/simulation/TraceGenerator.h | 8 +-- .../library/src/simulation/TracePlayer.cpp | 2 + DRAMSys/library/src/simulation/TracePlayer.h | 8 +-- DRAMSys/library/src/simulation/dram/Dram.h | 9 +-- .../library/src/simulation/dram/DramDDR3.cpp | 2 + .../library/src/simulation/dram/DramDDR4.cpp | 2 + .../src/simulation/dram/DramRecordable.h | 8 +-- .../src/simulation/dram/DramWideIO.cpp | 1 + .../library/src/simulation/dram/DramWideIO.h | 6 +- 75 files changed, 237 insertions(+), 246 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.h b/DRAMSys/library/src/common/TlmRecorder.h index 9c6e75e3..6da4608c 100644 --- a/DRAMSys/library/src/common/TlmRecorder.h +++ b/DRAMSys/library/src/common/TlmRecorder.h @@ -53,8 +53,6 @@ #include "DebugManager.h" #include "utils.h" -using namespace tlm; - class TlmRecorder { public: @@ -77,12 +75,12 @@ public: this->traces = traces; } - void recordPhase(tlm_generic_payload &trans, tlm_phase phase, + void recordPhase(tlm::tlm_generic_payload &trans, tlm::tlm_phase phase, sc_time time); void recordPower(double timeInSeconds, double averagePower); void recordDebugMessage(std::string message, sc_time time); void updateDataStrobe(const sc_time &begin, const sc_time &end, - tlm_generic_payload &trans); + tlm::tlm_generic_payload &trans); void closeConnection(); private: @@ -121,8 +119,8 @@ private: void createTables(std::string pathToURI); void setUpTransactionTerminatingPhases(); - void introduceTransactionSystem(tlm_generic_payload &trans); - void removeTransactionFromSystem(tlm_generic_payload &trans); + void introduceTransactionSystem(tlm::tlm_generic_payload &trans); + void removeTransactionFromSystem(tlm::tlm_generic_payload &trans); void commitRecordedDataToDB(); void insertGeneralInfo(); @@ -140,7 +138,7 @@ private: unsigned int totalNumTransactions; sc_time simulationTimeCoveredByRecording; - std::vector transactionTerminatingPhases; + std::vector transactionTerminatingPhases; sqlite3 *db = NULL; sqlite3_stmt *insertTransactionStatement, *insertRangeStatement, *updateRangeStatement, *insertPhaseStatement, *updatePhaseStatement, diff --git a/DRAMSys/library/src/common/dramExtensions.h b/DRAMSys/library/src/common/dramExtensions.h index 0bb74af1..27aac730 100644 --- a/DRAMSys/library/src/common/dramExtensions.h +++ b/DRAMSys/library/src/common/dramExtensions.h @@ -41,8 +41,6 @@ #include #include -using namespace tlm; - class Thread { public: @@ -161,7 +159,7 @@ private: }; -class DramExtension : public tlm_extension +class DramExtension : public tlm::tlm_extension { public: DramExtension(); @@ -172,29 +170,29 @@ public: const BankGroup &bankgroup, const Bank &bank, const Row &row, const Column &column, unsigned int burstlength, uint64_t payloadID); - virtual tlm_extension_base *clone() const; - virtual void copy_from(const tlm_extension_base &ext); + virtual tlm::tlm_extension_base *clone() const; + virtual void copy_from(const tlm::tlm_extension_base &ext); - static DramExtension &getExtension(const tlm_generic_payload *payload); - static DramExtension &getExtension(const tlm_generic_payload &payload); + static DramExtension &getExtension(const tlm::tlm_generic_payload *payload); + static DramExtension &getExtension(const tlm::tlm_generic_payload &payload); // Used for convience, caller could also use getExtension(..) to access these field - static Thread getThread(const tlm_generic_payload *payload); - static Thread getThread(const tlm_generic_payload &payload); - static Channel getChannel(const tlm_generic_payload *payload); - static Channel getChannel(const tlm_generic_payload &payload); - static Rank getRank(const tlm_generic_payload *payload); - static Rank getRank(const tlm_generic_payload &payload); - static BankGroup getBankGroup(const tlm_generic_payload *payload); - static BankGroup getBankGroup(const tlm_generic_payload &payload); - static Bank getBank(const tlm_generic_payload *payload); - static Bank getBank(const tlm_generic_payload &payload); - static Row getRow(const tlm_generic_payload *payload); - static Row getRow(const tlm_generic_payload &payload); - static Column getColumn(const tlm_generic_payload *payload); - static Column getColumn(const tlm_generic_payload &payload); - static uint64_t getPayloadID(const tlm_generic_payload *payload); - static uint64_t getPayloadID(const tlm_generic_payload &payload); + static Thread getThread(const tlm::tlm_generic_payload *payload); + static Thread getThread(const tlm::tlm_generic_payload &payload); + static Channel getChannel(const tlm::tlm_generic_payload *payload); + static Channel getChannel(const tlm::tlm_generic_payload &payload); + static Rank getRank(const tlm::tlm_generic_payload *payload); + static Rank getRank(const tlm::tlm_generic_payload &payload); + static BankGroup getBankGroup(const tlm::tlm_generic_payload *payload); + static BankGroup getBankGroup(const tlm::tlm_generic_payload &payload); + static Bank getBank(const tlm::tlm_generic_payload *payload); + static Bank getBank(const tlm::tlm_generic_payload &payload); + static Row getRow(const tlm::tlm_generic_payload *payload); + static Row getRow(const tlm::tlm_generic_payload &payload); + static Column getColumn(const tlm::tlm_generic_payload *payload); + static Column getColumn(const tlm::tlm_generic_payload &payload); + static uint64_t getPayloadID(const tlm::tlm_generic_payload *payload); + static uint64_t getPayloadID(const tlm::tlm_generic_payload &payload); Thread getThread() const; Channel getChannel() const; @@ -224,21 +222,21 @@ private: // Used to indicate the time when a payload is created (in a traceplayer or in a core) // Note that this time can be different from the time the payload enters the DRAM system //(at that time the phase BEGIN_REQ is recorded), so timeOfGeneration =< time(BEGIN_REQ) -class GenerationExtension : public tlm_extension +class GenerationExtension : public tlm::tlm_extension { public: GenerationExtension(sc_time timeOfGeneration) : timeOfGeneration(timeOfGeneration) {} - virtual tlm_extension_base *clone() const; - virtual void copy_from(const tlm_extension_base &ext); + virtual tlm::tlm_extension_base *clone() const; + virtual void copy_from(const tlm::tlm_extension_base &ext); static GenerationExtension - &getExtension(const tlm_generic_payload *payload); + &getExtension(const tlm::tlm_generic_payload *payload); sc_time TimeOfGeneration() const { return timeOfGeneration; } - static sc_time getTimeOfGeneration(const tlm_generic_payload *payload); - static sc_time getTimeOfGeneration(const tlm_generic_payload &payload); + static sc_time getTimeOfGeneration(const tlm::tlm_generic_payload *payload); + static sc_time getTimeOfGeneration(const tlm::tlm_generic_payload &payload); private: sc_time timeOfGeneration; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpec.h b/DRAMSys/library/src/configuration/memspec/MemSpec.h index b56a03fb..ff401235 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpec.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpec.h @@ -44,8 +44,6 @@ #include "../../controller/Command.h" #include "../../common/utils.h" -using namespace tlm; - struct MemSpec { MemSpec(); @@ -54,7 +52,7 @@ struct MemSpec virtual sc_time getRefreshIntervalAB() const = 0; virtual sc_time getRefreshIntervalPB() const = 0; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const = 0; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const = 0; virtual TimeInterval getIntervalOnDataStrobe(Command) const = 0; sc_time getCommandLength(Command) const; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp index 53fe1db8..fdf88bd5 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.cpp @@ -35,6 +35,8 @@ #include "MemSpecDDR3.h" +using namespace tlm; + sc_time MemSpecDDR3::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.h b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.h index c8c7beac..35f861c6 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR3.h @@ -81,7 +81,7 @@ struct MemSpecDDR3 final : public MemSpec virtual sc_time getRefreshIntervalAB() const override; virtual sc_time getRefreshIntervalPB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp index f7e87256..91d4762c 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.cpp @@ -35,6 +35,8 @@ #include "MemSpecDDR4.h" +using namespace tlm; + sc_time MemSpecDDR4::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.h b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.h index ecadfc18..b37ff5a6 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecDDR4.h @@ -87,7 +87,7 @@ struct MemSpecDDR4 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp index 5c19c5c4..6c10ec1a 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.cpp @@ -35,6 +35,8 @@ #include "MemSpecGDDR5.h" +using namespace tlm; + sc_time MemSpecGDDR5::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.h b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.h index c04bbfd2..22fb4e38 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5.h @@ -83,7 +83,7 @@ struct MemSpecGDDR5 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp index a42b6b93..779d4107 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.cpp @@ -35,6 +35,8 @@ #include "MemSpecGDDR5X.h" +using namespace tlm; + sc_time MemSpecGDDR5X::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.h b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.h index a69d76ce..bfa2ece1 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR5X.h @@ -83,7 +83,7 @@ struct MemSpecGDDR5X final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp index f002b501..c3365722 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.cpp @@ -35,6 +35,8 @@ #include "MemSpecGDDR6.h" +using namespace tlm; + sc_time MemSpecGDDR6::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.h b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.h index 43924408..88b0e491 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecGDDR6.h @@ -86,7 +86,7 @@ struct MemSpecGDDR6 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp index 22e4e686..f7898d5c 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp @@ -35,6 +35,8 @@ #include "MemSpecHBM2.h" +using namespace tlm; + MemSpecHBM2::MemSpecHBM2() { commandLengthInCycles[Command::ACT] = 2; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h index 4930c070..13217183 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h @@ -85,7 +85,7 @@ struct MemSpecHBM2 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp index c01615ee..b0b6ee34 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.cpp @@ -35,6 +35,8 @@ #include "MemSpecLPDDR4.h" +using namespace tlm; + MemSpecLPDDR4::MemSpecLPDDR4() { commandLengthInCycles[Command::ACT] = 4; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.h b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.h index 67738e4e..5b05150a 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecLPDDR4.h @@ -78,7 +78,7 @@ struct MemSpecLPDDR4 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp index 99c93232..314a4df1 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.cpp @@ -35,6 +35,8 @@ #include "MemSpecWideIO.h" +using namespace tlm; + sc_time MemSpecWideIO::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.h b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.h index e504c63b..0886ef17 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO.h @@ -91,7 +91,7 @@ struct MemSpecWideIO final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp index e115e300..b19e6f96 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.cpp @@ -35,6 +35,8 @@ #include "MemSpecWideIO2.h" +using namespace tlm; + sc_time MemSpecWideIO2::getRefreshIntervalAB() const { return tREFI; diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.h b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.h index 4caff1e4..bd432a8f 100644 --- a/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.h +++ b/DRAMSys/library/src/configuration/memspec/MemSpecWideIO2.h @@ -72,7 +72,7 @@ struct MemSpecWideIO2 final : public MemSpec virtual sc_time getRefreshIntervalPB() const override; virtual sc_time getRefreshIntervalAB() const override; - virtual sc_time getExecutionTime(Command, const tlm_generic_payload &) const override; + virtual sc_time getExecutionTime(Command, const tlm::tlm_generic_payload &) const override; virtual TimeInterval getIntervalOnDataStrobe(Command) const override; }; diff --git a/DRAMSys/library/src/controller/BankMachine.cpp b/DRAMSys/library/src/controller/BankMachine.cpp index 4c20a76a..47fc5d24 100644 --- a/DRAMSys/library/src/controller/BankMachine.cpp +++ b/DRAMSys/library/src/controller/BankMachine.cpp @@ -34,6 +34,8 @@ #include "BankMachine.h" +using namespace tlm; + BankMachine::BankMachine(SchedulerIF *scheduler, CheckerIF *checker, Bank bank) : scheduler(scheduler), checker(checker), bank(bank) { diff --git a/DRAMSys/library/src/controller/BankMachine.h b/DRAMSys/library/src/controller/BankMachine.h index 49fce270..ade2cf07 100644 --- a/DRAMSys/library/src/controller/BankMachine.h +++ b/DRAMSys/library/src/controller/BankMachine.h @@ -44,8 +44,6 @@ #include "scheduler/SchedulerIF.h" #include "checker/CheckerIF.h" -using namespace tlm; - class SchedulerIF; class CheckerIF; @@ -60,7 +58,7 @@ class BankMachine public: virtual ~BankMachine() {} virtual sc_time start() = 0; - std::pair getNextCommand(); + std::pair getNextCommand(); void updateState(Command); void block(); @@ -73,7 +71,7 @@ public: protected: BankMachine(SchedulerIF *, CheckerIF *, Bank); - tlm_generic_payload *currentPayload = nullptr; + tlm::tlm_generic_payload *currentPayload = nullptr; SchedulerIF *scheduler; CheckerIF *checker; Command nextCommand; diff --git a/DRAMSys/library/src/controller/Command.cpp b/DRAMSys/library/src/controller/Command.cpp index 9fd3e0c7..88e64544 100644 --- a/DRAMSys/library/src/controller/Command.cpp +++ b/DRAMSys/library/src/controller/Command.cpp @@ -38,6 +38,7 @@ #include "Command.h" #include +using namespace tlm; using namespace DRAMPower; std::string commandToString(Command command) diff --git a/DRAMSys/library/src/controller/Command.h b/DRAMSys/library/src/controller/Command.h index 9f49ea2b..64d32cc2 100644 --- a/DRAMSys/library/src/controller/Command.h +++ b/DRAMSys/library/src/controller/Command.h @@ -42,8 +42,6 @@ #include #include "../common/third_party/DRAMPower/src/MemCommand.h" -using namespace tlm; - // DO NOT CHANGE THE ORDER! DECLARE_EXTENDED_PHASE(BEGIN_RD); // 5 DECLARE_EXTENDED_PHASE(BEGIN_WR); // 6 @@ -92,11 +90,11 @@ enum Command }; std::string commandToString(Command); -tlm_phase commandToPhase(Command); -Command phaseToCommand(tlm_phase); -DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm_phase); -bool phaseNeedsEnd(tlm_phase); -tlm_phase getEndPhase(tlm_phase); +tlm::tlm_phase commandToPhase(Command); +Command phaseToCommand(tlm::tlm_phase); +DRAMPower::MemCommand::cmds phaseToDRAMPowerCommand(tlm::tlm_phase); +bool phaseNeedsEnd(tlm::tlm_phase); +tlm::tlm_phase getEndPhase(tlm::tlm_phase); unsigned numberOfCommands(); bool isBankCommand(Command); bool isRankCommand(Command); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index ee32349e..e0190723 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -59,6 +59,8 @@ #include "powerdown/PowerDownManagerStaggered.h" #include "powerdown/PowerDownManagerDummy.h" +using namespace tlm; + Controller::Controller(sc_module_name name) : ControllerIF(name) { diff --git a/DRAMSys/library/src/controller/Controller.h b/DRAMSys/library/src/controller/Controller.h index 4f0ce5f2..53c116ab 100644 --- a/DRAMSys/library/src/controller/Controller.h +++ b/DRAMSys/library/src/controller/Controller.h @@ -53,8 +53,6 @@ #include "powerdown/PowerDownManagerIF.h" #include "respqueue/RespQueueIF.h" -using namespace tlm; - class BankMachine; class SchedulerIF; class PowerDownManagerStaggered; @@ -67,12 +65,12 @@ public: virtual ~Controller(); protected: - virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &, tlm_phase &, sc_time &); - virtual tlm_sync_enum nb_transport_bw(tlm_generic_payload &, tlm_phase &, sc_time &); - virtual unsigned int transport_dbg(tlm_generic_payload &); + virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &, tlm::tlm_phase &, sc_time &); + virtual tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &, tlm::tlm_phase &, sc_time &); + virtual unsigned int transport_dbg(tlm::tlm_generic_payload &); - virtual void sendToFrontend(tlm_generic_payload *, tlm_phase); - virtual void sendToDram(Command, tlm_generic_payload *); + virtual void sendToFrontend(tlm::tlm_generic_payload *, tlm::tlm_phase); + virtual void sendToDram(Command, tlm::tlm_generic_payload *); private: unsigned totalNumberOfPayloads = 0; @@ -89,9 +87,9 @@ private: std::vector refreshManagers; std::vector powerDownManagers; - tlm_generic_payload *payloadToAcquire = nullptr; + tlm::tlm_generic_payload *payloadToAcquire = nullptr; sc_time timeToAcquire = sc_max_time(); - tlm_generic_payload *payloadToRelease = nullptr; + tlm::tlm_generic_payload *payloadToRelease = nullptr; sc_time timeToRelease = sc_max_time(); void finishBeginReq(); diff --git a/DRAMSys/library/src/controller/ControllerIF.h b/DRAMSys/library/src/controller/ControllerIF.h index 50114311..fbcf969f 100644 --- a/DRAMSys/library/src/controller/ControllerIF.h +++ b/DRAMSys/library/src/controller/ControllerIF.h @@ -7,8 +7,6 @@ #include #include "../configuration/Configuration.h" -using namespace tlm; - // Utiliy class to pass around the DRAMSys, without having to propagate the template defintions // throughout all classes class ControllerIF : public sc_module @@ -70,9 +68,9 @@ protected: SC_HAS_PROCESS(ControllerIF); // Virtual transport functions - virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &, tlm_phase &, sc_time &) = 0; - virtual unsigned int transport_dbg(tlm_generic_payload &) = 0; - virtual tlm_sync_enum nb_transport_bw(tlm_generic_payload &, tlm_phase &, sc_time &) = 0; + virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &, tlm::tlm_phase &, sc_time &) = 0; + virtual unsigned int transport_dbg(tlm::tlm_generic_payload &) = 0; + virtual tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &, tlm::tlm_phase &, sc_time &) = 0; // Bandwidth related class IdleTimeCollector diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index c0e90278..7478d6fb 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -33,9 +33,10 @@ */ #include "ControllerRecordable.h" - #include "../configuration/Configuration.h" +using namespace tlm; + tlm_sync_enum ControllerRecordable::nb_transport_fw(tlm_generic_payload &trans, tlm_phase &phase, sc_time &delay) { diff --git a/DRAMSys/library/src/controller/ControllerRecordable.h b/DRAMSys/library/src/controller/ControllerRecordable.h index 60a70edd..752466b2 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.h +++ b/DRAMSys/library/src/controller/ControllerRecordable.h @@ -45,15 +45,15 @@ public: Controller(name), tlmRecorder(tlmRecorder) {} private: - tlm_sync_enum nb_transport_fw(tlm_generic_payload &trans, - tlm_phase &phase, sc_time &delay) override; - tlm_sync_enum nb_transport_bw(tlm_generic_payload &trans, - tlm_phase &phase, sc_time &delay) override; + tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &trans, + tlm::tlm_phase &phase, sc_time &delay) override; + tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &trans, + tlm::tlm_phase &phase, sc_time &delay) override; - void sendToFrontend(tlm_generic_payload *, tlm_phase) override; - void sendToDram(Command, tlm_generic_payload *) override; + void sendToFrontend(tlm::tlm_generic_payload *, tlm::tlm_phase) override; + void sendToDram(Command, tlm::tlm_generic_payload *) override; - void recordPhase(tlm_generic_payload &trans, tlm_phase phase, sc_time delay); + void recordPhase(tlm::tlm_generic_payload &trans, tlm::tlm_phase phase, sc_time delay); TlmRecorder *tlmRecorder; }; diff --git a/DRAMSys/library/src/controller/cmdmux/CmdMuxIF.h b/DRAMSys/library/src/controller/cmdmux/CmdMuxIF.h index 2e599656..1ec6b817 100644 --- a/DRAMSys/library/src/controller/cmdmux/CmdMuxIF.h +++ b/DRAMSys/library/src/controller/cmdmux/CmdMuxIF.h @@ -40,14 +40,12 @@ #include #include "../Command.h" -using namespace tlm; - class CmdMuxIF { public: virtual ~CmdMuxIF() {} - virtual std::pair - selectCommand(std::vector> &) = 0; + virtual std::pair + selectCommand(std::vector> &) = 0; }; #endif // CMDMUXIF_H diff --git a/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.cpp b/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.cpp index 6414c3ce..3ff4abe5 100644 --- a/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.cpp +++ b/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.cpp @@ -36,6 +36,8 @@ #include "../../common/dramExtensions.h" +using namespace tlm; + std::pair CmdMuxOldest::selectCommand(std::vector> &readyCommands) { diff --git a/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.h b/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.h index 124d056c..9198501a 100644 --- a/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.h +++ b/DRAMSys/library/src/controller/cmdmux/CmdMuxOldest.h @@ -40,8 +40,8 @@ class CmdMuxOldest : public CmdMuxIF { public: - std::pair - selectCommand(std::vector> &); + std::pair + selectCommand(std::vector> &); }; #endif // CMDMUXOLDEST_H diff --git a/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.cpp b/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.cpp index 6e2d623e..3b37d837 100644 --- a/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.cpp +++ b/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.cpp @@ -36,6 +36,8 @@ #include "../../common/dramExtensions.h" +using namespace tlm; + std::pair CmdMuxStrict::selectCommand(std::vector> &readyCommands) { diff --git a/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.h b/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.h index 8c98b8c6..1517eeda 100644 --- a/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.h +++ b/DRAMSys/library/src/controller/cmdmux/CmdMuxStrict.h @@ -40,8 +40,8 @@ class CmdMuxStrict : public CmdMuxIF { public: - std::pair - selectCommand(std::vector> &); + std::pair + selectCommand(std::vector> &); private: uint64_t nextPayloadID = 0; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp index 91f666b3..37013c81 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.cpp @@ -34,6 +34,8 @@ #include "PowerDownManagerDummy.h" +using namespace tlm; + std::pair PowerDownManagerDummy::getNextCommand() { return std::pair(Command::NOP, nullptr); diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h index 55af81e9..bc934dd5 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerDummy.h @@ -37,8 +37,6 @@ #include "PowerDownManagerIF.h" -using namespace tlm; - class PowerDownManagerDummy final : public PowerDownManagerIF { public: @@ -48,7 +46,7 @@ public: virtual void triggerExit() override {} virtual void triggerInterruption() override {} - virtual std::pair getNextCommand() override; + virtual std::pair getNextCommand() override; virtual void updateState(Command) override {} virtual sc_time start() override; }; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h index c5bfdf4d..2fa72a17 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerIF.h @@ -40,8 +40,6 @@ #include #include "../Command.h" -using namespace tlm; - class PowerDownManagerIF { public: @@ -51,7 +49,7 @@ public: virtual void triggerExit() = 0; virtual void triggerInterruption() = 0; - virtual std::pair getNextCommand() = 0; + virtual std::pair getNextCommand() = 0; virtual void updateState(Command) = 0; virtual sc_time start() = 0; }; diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp index 098f5c51..09610719 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.cpp @@ -35,6 +35,8 @@ #include "PowerDownManagerStaggered.h" #include "../../common/utils.h" +using namespace tlm; + PowerDownManagerStaggered::PowerDownManagerStaggered(Rank rank, CheckerIF *checker) : rank(rank), checker(checker) { diff --git a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h index 83048ca8..fee58fb3 100644 --- a/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h +++ b/DRAMSys/library/src/controller/powerdown/PowerDownManagerStaggered.h @@ -39,8 +39,6 @@ #include "../BankMachine.h" #include "../checker/CheckerIF.h" -using namespace tlm; - class PowerDownManagerStaggered final : public PowerDownManagerIF { public: @@ -50,13 +48,13 @@ public: virtual void triggerExit() override; virtual void triggerInterruption() override; - virtual std::pair getNextCommand() override; + virtual std::pair getNextCommand() override; virtual void updateState(Command) override; virtual sc_time start() override; private: enum class PdmState {Idle, ActivePdn, PrechargePdn, SelfRefresh, ExtraRefresh} state = PdmState::Idle; - tlm_generic_payload powerDownPayload; + tlm::tlm_generic_payload powerDownPayload; Rank rank; CheckerIF *checker; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 5e534b6b..349bef14 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -37,6 +37,8 @@ #include "../../common/utils.h" #include "../../common/dramExtensions.h" +using namespace tlm; + RefreshManagerBankwise::RefreshManagerBankwise(std::vector &bankMachines, PowerDownManagerIF *powerDownManager, Rank rank, CheckerIF *checker) : bankMachinesOnRank(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h index a94c435e..285329b5 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h @@ -43,23 +43,21 @@ #include #include -using namespace tlm; - class RefreshManagerBankwise final : public RefreshManagerIF { public: RefreshManagerBankwise(std::vector &, PowerDownManagerIF *, Rank, CheckerIF *); - virtual std::pair getNextCommand() override; + virtual std::pair getNextCommand() override; virtual sc_time start() override; - virtual void updateState(Command, tlm_generic_payload *) override; + virtual void updateState(Command, tlm::tlm_generic_payload *) override; private: enum class RmState {Regular, Pulledin} state = RmState::Regular; const MemSpec *memSpec; std::vector &bankMachinesOnRank; PowerDownManagerIF *powerDownManager; - std::vector refreshPayloads; + std::vector refreshPayloads; sc_time timeForNextTrigger = sc_max_time(); sc_time timeToSchedule = sc_max_time(); Rank rank; diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp index 92cc8cf2..1f4c1d9e 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.cpp @@ -34,6 +34,8 @@ #include "RefreshManagerDummy.h" +using namespace tlm; + std::pair RefreshManagerDummy::getNextCommand() { return std::pair(Command::NOP, nullptr); diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h index 3a62916a..58ea2a59 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerDummy.h @@ -41,14 +41,12 @@ #include "RefreshManagerIF.h" #include "../Command.h" -using namespace tlm; - class RefreshManagerDummy final : public RefreshManagerIF { public: - virtual std::pair getNextCommand() override; + virtual std::pair getNextCommand() override; virtual sc_time start() override; - virtual void updateState(Command, tlm_generic_payload *) override {} + virtual void updateState(Command, tlm::tlm_generic_payload *) override {} }; #endif // REFRESHMANAGERDUMMY_H diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h b/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h index d1e589ca..89283183 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerIF.h @@ -40,16 +40,14 @@ #include #include "../Command.h" -using namespace tlm; - class RefreshManagerIF { public: virtual ~RefreshManagerIF() {} - virtual std::pair getNextCommand() = 0; + virtual std::pair getNextCommand() = 0; virtual sc_time start() = 0; - virtual void updateState(Command, tlm_generic_payload *) = 0; + virtual void updateState(Command, tlm::tlm_generic_payload *) = 0; }; #endif // REFRESHMANAGERIF_H diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp index 9af8bde4..90c56855 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.cpp @@ -37,6 +37,8 @@ #include "../../configuration/Configuration.h" #include "../../common/utils.h" +using namespace tlm; + RefreshManagerRankwise::RefreshManagerRankwise(std::vector &bankMachines, PowerDownManagerIF *powerDownManager, Rank rank, CheckerIF *checker) : bankMachinesOnRank(bankMachines), powerDownManager(powerDownManager), rank(rank), checker(checker) diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h index a85d15c4..3dd93385 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerRankwise.h @@ -41,23 +41,21 @@ #include "../powerdown/PowerDownManagerIF.h" #include "../checker/CheckerIF.h" -using namespace tlm; - class RefreshManagerRankwise final : public RefreshManagerIF { public: RefreshManagerRankwise(std::vector &, PowerDownManagerIF *, Rank, CheckerIF *); - virtual std::pair getNextCommand() override; + virtual std::pair getNextCommand() override; virtual sc_time start() override; - virtual void updateState(Command, tlm_generic_payload *) override; + virtual void updateState(Command, tlm::tlm_generic_payload *) override; private: enum class RmState {Regular, Pulledin} state = RmState::Regular; const MemSpec *memSpec; std::vector &bankMachinesOnRank; PowerDownManagerIF *powerDownManager; - tlm_generic_payload refreshPayload; + tlm::tlm_generic_payload refreshPayload; sc_time timeForNextTrigger = sc_max_time(); sc_time timeToSchedule = sc_max_time(); Rank rank; diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp index df839a3c..5374b48d 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp +++ b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp @@ -34,6 +34,8 @@ #include "RespQueueFifo.h" +using namespace tlm; + void RespQueueFifo::insertPayload(tlm_generic_payload *payload, sc_time strobeEnd) { buffer.push({payload, strobeEnd}); diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h index d68c3393..8a5e0dd2 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h +++ b/DRAMSys/library/src/controller/respqueue/RespQueueFifo.h @@ -41,17 +41,15 @@ #include #include -using namespace tlm; - class RespQueueFifo final : public RespQueueIF { public: - virtual void insertPayload(tlm_generic_payload *, sc_time) override; - virtual tlm_generic_payload *nextPayload() override; + virtual void insertPayload(tlm::tlm_generic_payload *, sc_time) override; + virtual tlm::tlm_generic_payload *nextPayload() override; virtual sc_time getTriggerTime() const override; private: - std::queue> buffer; + std::queue> buffer; }; #endif // RESPQUEUEFIFO_H diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueIF.h b/DRAMSys/library/src/controller/respqueue/RespQueueIF.h index 2e882f47..078ddb93 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueIF.h +++ b/DRAMSys/library/src/controller/respqueue/RespQueueIF.h @@ -38,13 +38,11 @@ #include #include -using namespace tlm; - class RespQueueIF { public: - virtual void insertPayload(tlm_generic_payload *, sc_time) = 0; - virtual tlm_generic_payload *nextPayload() = 0; + virtual void insertPayload(tlm::tlm_generic_payload *, sc_time) = 0; + virtual tlm::tlm_generic_payload *nextPayload() = 0; virtual sc_time getTriggerTime() const = 0; }; diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp index eadcbcc7..5ee814f9 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp +++ b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.cpp @@ -35,6 +35,8 @@ #include "RespQueueReorder.h" #include "../../common/dramExtensions.h" +using namespace tlm; + void RespQueueReorder::insertPayload(tlm_generic_payload *payload, sc_time strobeEnd) { buffer[DramExtension::getPayloadID(payload)] = {payload, strobeEnd}; diff --git a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h index 3b2b3c9f..242b9d8d 100644 --- a/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h +++ b/DRAMSys/library/src/controller/respqueue/RespQueueReorder.h @@ -40,19 +40,17 @@ #include "RespQueueIF.h" #include -using namespace tlm; - class RespQueueReorder final : public RespQueueIF { public: - virtual void insertPayload(tlm_generic_payload *, sc_time) override; - virtual tlm_generic_payload *nextPayload() override; + virtual void insertPayload(tlm::tlm_generic_payload *, sc_time) override; + virtual tlm::tlm_generic_payload *nextPayload() override; virtual sc_time getTriggerTime() const override; private: uint64_t currentPayloadID = 0; // Muss die Zeit aller Payloads gespeichert werden? - std::map> buffer; + std::map> buffer; }; #endif // RESPQUEUEREORDER_H diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp index 6c4050ed..87cdc55e 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.cpp @@ -34,6 +34,8 @@ #include "SchedulerFifo.h" +using namespace tlm; + SchedulerFifo::SchedulerFifo() { buffer = std::vector> diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h index 51955c48..dc9359bc 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFifo.h @@ -42,20 +42,18 @@ #include "../../common/dramExtensions.h" #include "../BankMachine.h" -using namespace tlm; - class SchedulerFifo : public SchedulerIF { public: SchedulerFifo(); virtual bool hasBufferSpace() override; - virtual void storeRequest(tlm_generic_payload *) override; - virtual void removeRequest(tlm_generic_payload *) override; - virtual tlm_generic_payload *getNextRequest(BankMachine *) override; + virtual void storeRequest(tlm::tlm_generic_payload *) override; + virtual void removeRequest(tlm::tlm_generic_payload *) override; + virtual tlm::tlm_generic_payload *getNextRequest(BankMachine *) override; virtual bool hasFurtherRowHit(Bank, Row) override; virtual bool hasFurtherRequest(Bank) override; private: - std::vector> buffer; + std::vector> buffer; unsigned requestBufferSize; unsigned lastBankID; }; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp index 4e87354c..f730eac5 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.cpp @@ -36,6 +36,8 @@ #include +using namespace tlm; + SchedulerFrFcfs::SchedulerFrFcfs() { buffer = std::vector> diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h index 5470ff68..7cce4050 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfs.h @@ -42,20 +42,18 @@ #include "../../common/dramExtensions.h" #include "../BankMachine.h" -using namespace tlm; - class SchedulerFrFcfs : public SchedulerIF { public: SchedulerFrFcfs(); virtual bool hasBufferSpace() override; - virtual void storeRequest(tlm_generic_payload *) override; - virtual void removeRequest(tlm_generic_payload *) override; - virtual tlm_generic_payload *getNextRequest(BankMachine *) override; + virtual void storeRequest(tlm::tlm_generic_payload *) override; + virtual void removeRequest(tlm::tlm_generic_payload *) override; + virtual tlm::tlm_generic_payload *getNextRequest(BankMachine *) override; virtual bool hasFurtherRowHit(Bank, Row) override; virtual bool hasFurtherRequest(Bank) override; private: - std::vector> buffer; + std::vector> buffer; unsigned requestBufferSize; unsigned lastBankID; }; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp index d62705ad..c2df4082 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.cpp @@ -34,6 +34,8 @@ #include "SchedulerFrFcfsGrp.h" +using namespace tlm; + SchedulerFrFcfsGrp::SchedulerFrFcfsGrp() { buffer = std::vector> diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h index fbc5e92c..8c7ed9bc 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerFrFcfsGrp.h @@ -43,22 +43,20 @@ #include "../../common/dramExtensions.h" #include "../BankMachine.h" -using namespace tlm; - class SchedulerFrFcfsGrp : public SchedulerIF { public: SchedulerFrFcfsGrp(); virtual bool hasBufferSpace() override; - virtual void storeRequest(tlm_generic_payload *) override; - virtual void removeRequest(tlm_generic_payload *) override; - virtual tlm_generic_payload *getNextRequest(BankMachine *) override; + virtual void storeRequest(tlm::tlm_generic_payload *) override; + virtual void removeRequest(tlm::tlm_generic_payload *) override; + virtual tlm::tlm_generic_payload *getNextRequest(BankMachine *) override; virtual bool hasFurtherRowHit(Bank, Row) override; virtual bool hasFurtherRequest(Bank) override; private: - std::vector> buffer; + std::vector> buffer; unsigned requestBufferSize; - tlm_command lastCommand = TLM_READ_COMMAND; + tlm::tlm_command lastCommand = tlm::TLM_READ_COMMAND; unsigned lastBankID; }; diff --git a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h index 9ab2bc71..2c2723a6 100644 --- a/DRAMSys/library/src/controller/scheduler/SchedulerIF.h +++ b/DRAMSys/library/src/controller/scheduler/SchedulerIF.h @@ -40,8 +40,6 @@ #include "../../common/DebugManager.h" #include "../BankMachine.h" -using namespace tlm; - enum class BmState; class BankMachine; @@ -50,9 +48,9 @@ class SchedulerIF public: virtual ~SchedulerIF() {} virtual bool hasBufferSpace() = 0; - virtual void storeRequest(tlm_generic_payload *) = 0; - virtual void removeRequest(tlm_generic_payload *) = 0; - virtual tlm_generic_payload *getNextRequest(BankMachine *) = 0; + virtual void storeRequest(tlm::tlm_generic_payload *) = 0; + virtual void removeRequest(tlm::tlm_generic_payload *) = 0; + virtual tlm::tlm_generic_payload *getNextRequest(BankMachine *) = 0; virtual bool hasFurtherRowHit(Bank, Row) = 0; virtual bool hasFurtherRequest(Bank) = 0; }; diff --git a/DRAMSys/library/src/error/eccbaseclass.cpp b/DRAMSys/library/src/error/eccbaseclass.cpp index 6c41e6d1..0f2fc4e1 100644 --- a/DRAMSys/library/src/error/eccbaseclass.cpp +++ b/DRAMSys/library/src/error/eccbaseclass.cpp @@ -1,5 +1,7 @@ #include "eccbaseclass.h" +using namespace tlm; + tlm::tlm_sync_enum ECCBaseClass::nb_transport_fw( int id, tlm::tlm_generic_payload &trans, tlm::tlm_phase &phase, sc_time &delay ) { diff --git a/DRAMSys/library/src/error/eccbaseclass.h b/DRAMSys/library/src/error/eccbaseclass.h index a3889307..57f20aa7 100644 --- a/DRAMSys/library/src/error/eccbaseclass.h +++ b/DRAMSys/library/src/error/eccbaseclass.h @@ -11,8 +11,6 @@ #include "../common/XmlAddressDecoder.h" #include "../common/DebugManager.h" -using namespace tlm; - class ECCBaseClass : sc_module { public: diff --git a/DRAMSys/library/src/simulation/Arbiter.h b/DRAMSys/library/src/simulation/Arbiter.h index 0d0f399d..907a8fcf 100644 --- a/DRAMSys/library/src/simulation/Arbiter.h +++ b/DRAMSys/library/src/simulation/Arbiter.h @@ -50,8 +50,6 @@ #include "../common/dramExtensions.h" #include "../configuration/ConfigurationLoader.h" -using namespace tlm; - class Arbiter : public sc_module { public: @@ -68,32 +66,32 @@ private: // used to account for the request_accept_delay in the dram controllers // This is a queue of new transactions. The phase of a new request is BEGIN_REQ. - std::vector> pendingRequests; + std::vector> pendingRequests; // used to account for the response_accept_delay in the initiators (traceplayer, core etc.) // This is a queue of responses comming from the memory side. The phase of these transactions is BEGIN_RESP. - std::map> receivedResponses; + std::map> receivedResponses; // Initiated by initiator side // This function is called when an arbiter's target socket receives a transaction from a device - tlm_sync_enum nb_transport_fw(int id, tlm_generic_payload &payload, - tlm_phase &phase, sc_time &fwDelay); + tlm::tlm_sync_enum nb_transport_fw(int id, tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &fwDelay); // Initiated by dram side // This function is called when an arbiter's initiator socket receives a transaction from a memory controller - tlm_sync_enum nb_transport_bw(int channelId, tlm_generic_payload &payload, - tlm_phase &phase, sc_time &bwDelay); + tlm::tlm_sync_enum nb_transport_bw(int channelId, tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &bwDelay); - virtual unsigned int transport_dbg(int /*id*/, tlm_generic_payload &trans); + virtual unsigned int transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans); - void peqCallback(tlm_generic_payload &payload, const tlm_phase &phase); + void peqCallback(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase); - void sendToChannel(unsigned int channelId, tlm_generic_payload &payload, - const tlm_phase &phase, const sc_time &delay); + void sendToChannel(unsigned int channelId, tlm::tlm_generic_payload &payload, + const tlm::tlm_phase &phase, const sc_time &delay); - void sendToInitiator(unsigned int id, tlm_generic_payload &payload, - const tlm_phase &phase, const sc_time &delay); + void sendToInitiator(unsigned int id, tlm::tlm_generic_payload &payload, + const tlm::tlm_phase &phase, const sc_time &delay); - void appendDramExtension(int socketId, tlm_generic_payload &payload); + void appendDramExtension(int socketId, tlm::tlm_generic_payload &payload); std::vector nextPayloadID; bool addressIsValid(DecodedAddress &decodedAddress); diff --git a/DRAMSys/library/src/simulation/IArbiter.h b/DRAMSys/library/src/simulation/IArbiter.h index 9666f0d4..3747a1b0 100644 --- a/DRAMSys/library/src/simulation/IArbiter.h +++ b/DRAMSys/library/src/simulation/IArbiter.h @@ -46,8 +46,6 @@ #include #include "../configuration/ConfigurationLoader.h" -using namespace tlm; - struct IArbiter : public sc_module { public: @@ -77,18 +75,18 @@ public: protected: // Initiated by initiator side // This function is called when an arbiter's target socket receives a transaction from a device - virtual tlm_sync_enum nb_transport_fw(int id, tlm_generic_payload &payload, - tlm_phase &phase, sc_time &fwDelay) = 0; + virtual tlm::tlm_sync_enum nb_transport_fw(int id, tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &fwDelay) = 0; // Initiated by dram side // This function is called when an arbiter's initiator socket receives a transaction from a memory controller - virtual tlm_sync_enum nb_transport_bw(int channelId, - tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay) = 0; + virtual tlm::tlm_sync_enum nb_transport_bw(int channelId, + tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_time &bwDelay) = 0; virtual unsigned int transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans) = 0; - void appendDramExtension(int socketId, tlm_generic_payload &payload) + void appendDramExtension(int socketId, tlm::tlm_generic_payload &payload) { // Append Generation Extension GenerationExtension *genExtension = new GenerationExtension(clkAlign( diff --git a/DRAMSys/library/src/simulation/ReorderBuffer.h b/DRAMSys/library/src/simulation/ReorderBuffer.h index 84818b33..ab751054 100644 --- a/DRAMSys/library/src/simulation/ReorderBuffer.h +++ b/DRAMSys/library/src/simulation/ReorderBuffer.h @@ -40,10 +40,9 @@ #include #include +#include #include -using namespace tlm; - struct ReorderBuffer: public sc_module { public: tlm_utils::simple_initiator_socket iSocket; @@ -59,43 +58,43 @@ public: private: tlm_utils::peq_with_cb_and_phase payloadEventQueue; - deque pendingRequestsInOrder; - std::set receivedResponses; + deque pendingRequestsInOrder; + std::set receivedResponses; bool responseIsPendingInInitator; // Initiated by dram side - tlm_sync_enum nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, + tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_time &bwDelay) { payloadEventQueue.notify(payload, phase, bwDelay); - return TLM_ACCEPTED; + return tlm::TLM_ACCEPTED; } // Initiated by initator side (players) - tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, + tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_time &fwDelay) { - if (phase == BEGIN_REQ) { + if (phase == tlm::BEGIN_REQ) { payload.acquire(); - } else if (phase == END_RESP) { + } else if (phase == tlm::END_RESP) { payload.release(); } payloadEventQueue.notify(payload, phase, fwDelay); - return TLM_ACCEPTED; + return tlm::TLM_ACCEPTED; } - void peqCallback(tlm_generic_payload &payload, const tlm_phase &phase) + void peqCallback(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase) { //Phases initiated by initiator side - if (phase == BEGIN_REQ) { + if (phase == tlm::BEGIN_REQ) { pendingRequestsInOrder.push_back(&payload); sendToTarget(payload, phase, SC_ZERO_TIME ); } - else if (phase == END_RESP) { + else if (phase == tlm::END_RESP) { responseIsPendingInInitator = false; pendingRequestsInOrder.pop_front(); receivedResponses.erase(&payload); @@ -103,10 +102,10 @@ private: } //Phases initiated by dram side - else if (phase == END_REQ) { + else if (phase == tlm::END_REQ) { sendToInitiator(payload, phase, SC_ZERO_TIME); - } else if (phase == BEGIN_RESP) { - sendToTarget(payload, END_RESP, SC_ZERO_TIME); + } else if (phase == tlm::BEGIN_RESP) { + sendToTarget(payload, tlm::END_RESP, SC_ZERO_TIME); receivedResponses.emplace(&payload); sendNextResponse(); } @@ -118,15 +117,15 @@ private: } } - void sendToTarget(tlm_generic_payload &payload, const tlm_phase &phase, + void sendToTarget(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase, const sc_time &delay) { - tlm_phase TPhase = phase; + tlm::tlm_phase TPhase = phase; sc_time TDelay = delay; iSocket->nb_transport_fw(payload, TPhase, TDelay); } - void sendToInitiator(tlm_generic_payload &payload, const tlm_phase &phase, + void sendToInitiator(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase, const sc_time &delay) { @@ -135,7 +134,7 @@ private: (phase == BEGIN_RESP && pendingRequestsInOrder.front() == &payload && receivedResponses.count(&payload))); - tlm_phase TPhase = phase; + tlm::tlm_phase TPhase = phase; sc_time TDelay = delay; tSocket->nb_transport_bw(payload, TPhase, TDelay); } @@ -146,9 +145,9 @@ private: //has been received if (!responseIsPendingInInitator && receivedResponses.count(pendingRequestsInOrder.front())) { - tlm_generic_payload *payloadToSend = pendingRequestsInOrder.front(); + tlm::tlm_generic_payload *payloadToSend = pendingRequestsInOrder.front(); responseIsPendingInInitator = true; - sendToInitiator(*payloadToSend, BEGIN_RESP, SC_ZERO_TIME); + sendToInitiator(*payloadToSend, tlm::BEGIN_RESP, SC_ZERO_TIME); } // else if(!responseIsPendingInInitator && receivedResponses.size()>0 && !receivedResponses.count(pendingRequestsInOrder.front())>0) // { diff --git a/DRAMSys/library/src/simulation/SimpleArbiter.h b/DRAMSys/library/src/simulation/SimpleArbiter.h index c12e7a2f..a61b9a66 100644 --- a/DRAMSys/library/src/simulation/SimpleArbiter.h +++ b/DRAMSys/library/src/simulation/SimpleArbiter.h @@ -41,8 +41,6 @@ #include "../common/XmlAddressDecoder.h" #include "../common/dramExtensions.h" -using namespace tlm; - // Annotated References [X,Y] --> Please refer to TLM AT Cheat Sheet on README struct SimpleArbiter: public IArbiter { @@ -70,8 +68,8 @@ protected: TlmRecorder *tlmRecorder; // Initiated by initiator side // This function is called when an arbiter's target socket receives a transaction from a device - virtual tlm_sync_enum nb_transport_fw(int id, tlm_generic_payload &payload, - tlm_phase &phase, sc_time &fwDelay) + virtual tlm::tlm_sync_enum nb_transport_fw(int id, tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &fwDelay) { if (phase == BEGIN_REQ) { payload.acquire(); @@ -98,13 +96,13 @@ protected: // 4-Phase Handshake [1.1] // 4-Phase Handshake [1.7] - return TLM_ACCEPTED; + return tlm::TLM_ACCEPTED; } // Initiated by dram side // This function is called when an arbiter's initiator socket receives a transaction from a memory controller - virtual tlm_sync_enum nb_transport_bw(int /*channelId*/, - tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay) + virtual tlm::tlm_sync_enum nb_transport_bw(int /*channelId*/, + tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_time &bwDelay) { tlmRecorder->recordPhase(payload, phase, bwDelay + sc_time_stamp()); @@ -115,10 +113,10 @@ protected: // Early Completion [3.1] tlmRecorder->recordPhase(payload, END_RESP, bwDelay + sc_time_stamp()); tlmRecorder->recordArbiterPhase(payload, BEGIN_RESP, sc_time_stamp() + bwDelay); - return TLM_COMPLETED; + return tlm::TLM_COMPLETED; } // 4-Phase Handshake [1.3] - return TLM_ACCEPTED; + return tlm::TLM_ACCEPTED; } virtual unsigned int transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans) @@ -130,7 +128,7 @@ protected: return iSocket[getISocketIndex(trans)]->transport_dbg(trans); } - virtual unsigned int getISocketIndex(tlm_generic_payload &payload) + virtual unsigned int getISocketIndex(tlm::tlm_generic_payload &payload) { return DramExtension::getBank(payload).ID(); } diff --git a/DRAMSys/library/src/simulation/StlPlayer.h b/DRAMSys/library/src/simulation/StlPlayer.h index 76ca8562..2ae960b7 100644 --- a/DRAMSys/library/src/simulation/StlPlayer.h +++ b/DRAMSys/library/src/simulation/StlPlayer.h @@ -43,8 +43,6 @@ #include "../common/XmlAddressDecoder.h" #include "TracePlayer.h" -using namespace tlm; - template class StlPlayer : public TracePlayer { @@ -113,11 +111,11 @@ public: SC_REPORT_FATAL("StlPlayer", ("Malformed trace file. Command could not be found (line " + std::to_string( lineCnt) + ").").c_str()); - enum tlm_command cmd; + enum tlm::tlm_command cmd; if (command == "read") { - cmd = TLM_READ_COMMAND; + cmd = tlm::TLM_READ_COMMAND; } else if (command == "write") { - cmd = TLM_WRITE_COMMAND; + cmd = tlm::TLM_WRITE_COMMAND; } else { SC_REPORT_FATAL("StlPlayer", (std::string("Corrupted tracefile, command ") + command + @@ -133,7 +131,7 @@ public: unsigned long long addr = std::stoull(address.c_str(), 0, 16); // Get the data if necessary. - if (storageEnabled && cmd == TLM_WRITE_COMMAND) + if (storageEnabled && cmd == tlm::TLM_WRITE_COMMAND) { // The input trace file must provide the data to be stored into the memory. iss >> dataStr; @@ -155,7 +153,7 @@ public: // Fill up the payload. payload->set_address(addr); - payload->set_response_status(TLM_INCOMPLETE_RESPONSE); + payload->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); payload->set_dmi_allowed(false); payload->set_byte_enable_length(0); payload->set_streaming_width(burstlength); @@ -167,13 +165,13 @@ public: { // Send the transaction directly or schedule it to be sent in the future. if (sendingTime <= sc_time_stamp()) - this->payloadEventQueue.notify(*payload, BEGIN_REQ, SC_ZERO_TIME); + this->payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, SC_ZERO_TIME); else - this->payloadEventQueue.notify(*payload, BEGIN_REQ, + this->payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, sendingTime - sc_time_stamp()); } else - payloadEventQueue.notify(*payload, BEGIN_REQ, sendingTime); + payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, sendingTime); } private: diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/library/src/simulation/TraceGenerator.h index 2d8f7bc9..29eaf26e 100644 --- a/DRAMSys/library/src/simulation/TraceGenerator.h +++ b/DRAMSys/library/src/simulation/TraceGenerator.h @@ -40,8 +40,6 @@ #include "TracePlayer.h" -using namespace tlm; - struct TraceGenerator : public TracePlayer { public: @@ -68,15 +66,15 @@ public: char[16]; // TODO: column / burst breite payload->set_address(0x0); - payload->set_response_status(TLM_INCOMPLETE_RESPONSE); + payload->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); payload->set_dmi_allowed(false); payload->set_byte_enable_length(0); payload->set_streaming_width(this->burstlenght); payload->set_data_ptr(dataElement); payload->set_data_length(16); - payload->set_command(TLM_READ_COMMAND); + payload->set_command(tlm::TLM_READ_COMMAND); transCounter++; - this->payloadEventQueue.notify(*payload, BEGIN_REQ, SC_ZERO_TIME); + this->payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, SC_ZERO_TIME); } private: diff --git a/DRAMSys/library/src/simulation/TracePlayer.cpp b/DRAMSys/library/src/simulation/TracePlayer.cpp index fd0a74d0..025221d7 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.cpp +++ b/DRAMSys/library/src/simulation/TracePlayer.cpp @@ -38,6 +38,8 @@ #include "TracePlayer.h" +using namespace tlm; + TracePlayer::TracePlayer(sc_module_name name, TracePlayerListener *listener) : sc_module(name), payloadEventQueue(this, &TracePlayer::peqCallback), diff --git a/DRAMSys/library/src/simulation/TracePlayer.h b/DRAMSys/library/src/simulation/TracePlayer.h index b0f5e064..6eabd60c 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.h +++ b/DRAMSys/library/src/simulation/TracePlayer.h @@ -52,8 +52,6 @@ #include "../common/XmlAddressDecoder.h" #include "TracePlayerListener.h" -using namespace tlm; - struct TracePlayer : public sc_module { public: @@ -72,10 +70,10 @@ protected: bool storageEnabled; private: - tlm_sync_enum nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, + tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_time &bwDelay); - void peqCallback(tlm_generic_payload &payload, const tlm_phase &phase); - void sendToTarget(tlm_generic_payload &payload, const tlm_phase &phase, + void peqCallback(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase); + void sendToTarget(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase, const sc_time &delay); MemoryManager memoryManager; unsigned int transactionsSent = 0; diff --git a/DRAMSys/library/src/simulation/dram/Dram.h b/DRAMSys/library/src/simulation/dram/Dram.h index 3995ac99..04a286f9 100644 --- a/DRAMSys/library/src/simulation/dram/Dram.h +++ b/DRAMSys/library/src/simulation/dram/Dram.h @@ -47,9 +47,6 @@ #include "../../configuration/memspec/MemSpec.h" #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" -using namespace tlm; -using namespace DRAMPower; - class Dram : public sc_module { private: @@ -68,10 +65,10 @@ protected: libDRAMPower *DRAMPower; - virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, - tlm_phase &phase, sc_time &delay); + virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &delay); - virtual unsigned int transport_dbg(tlm_generic_payload &trans); + virtual unsigned int transport_dbg(tlm::tlm_generic_payload &trans); public: tlm_utils::simple_target_socket tSocket; diff --git a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp index 5f30ad02..0e785ae2 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR3.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR3.cpp @@ -40,6 +40,8 @@ #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" #include "../../configuration/memspec/MemSpecDDR3.h" +using namespace DRAMPower; + DramDDR3::DramDDR3(sc_module_name name) : Dram(name) { if (storeMode == StorageMode::ErrorModel) diff --git a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp index 39a21935..0ed29672 100644 --- a/DRAMSys/library/src/simulation/dram/DramDDR4.cpp +++ b/DRAMSys/library/src/simulation/dram/DramDDR4.cpp @@ -40,6 +40,8 @@ #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" #include "../../configuration/memspec/MemSpecDDR4.h" +using namespace DRAMPower; + DramDDR4::DramDDR4(sc_module_name name) : Dram(name) { if (storeMode == StorageMode::ErrorModel) diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.h b/DRAMSys/library/src/simulation/dram/DramRecordable.h index f0091c21..fe835bf1 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.h +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.h @@ -42,8 +42,6 @@ #include "../../configuration/Configuration.h" #include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" -using namespace tlm; - template class DramRecordable final : public BaseDram { @@ -53,10 +51,10 @@ public: ~DramRecordable(); private: - virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, - tlm_phase &phase, sc_time &delay) override; + virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &delay) override; - void recordPhase(tlm_generic_payload &trans, tlm_phase phase, sc_time delay); + void recordPhase(tlm::tlm_generic_payload &trans, tlm::tlm_phase phase, sc_time delay); TlmRecorder *tlmRecorder; diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp index 2aff7fdd..71ccca31 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.cpp +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.cpp @@ -44,6 +44,7 @@ #include "../../configuration/memspec/MemSpecWideIO.h" using namespace tlm; +using namespace DRAMPower; DramWideIO::DramWideIO(sc_module_name name) : Dram(name) { diff --git a/DRAMSys/library/src/simulation/dram/DramWideIO.h b/DRAMSys/library/src/simulation/dram/DramWideIO.h index 10aeb629..8f0ae6d5 100644 --- a/DRAMSys/library/src/simulation/dram/DramWideIO.h +++ b/DRAMSys/library/src/simulation/dram/DramWideIO.h @@ -41,8 +41,6 @@ #include "Dram.h" #include "../../error/errormodel.h" -using namespace tlm; - class DramWideIO : public Dram { public: @@ -51,8 +49,8 @@ public: virtual ~DramWideIO(); protected: - virtual tlm_sync_enum nb_transport_fw(tlm_generic_payload &payload, - tlm_phase &phase, sc_time &delay) override; + virtual tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &payload, + tlm::tlm_phase &phase, sc_time &delay) override; private: std::vector ememory; From 658e3fb1ca069a55191406cbd033cc4201a61c65 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Mon, 6 Apr 2020 11:44:33 +0200 Subject: [PATCH 23/23] Included cmake debug flag into debug manager. --- .../src/common/CongenAddressDecoder.cpp | 7 ++++--- .../library/src/common/CongenAddressDecoder.h | 12 ++++-------- DRAMSys/library/src/common/DebugManager.cpp | 4 ++-- DRAMSys/library/src/common/DebugManager.h | 4 +--- DRAMSys/library/src/common/TlmRecorder.cpp | 6 +++--- .../src/controller/ControllerRecordable.cpp | 6 +++--- DRAMSys/library/src/error/ECC/Word.cpp | 1 + DRAMSys/library/src/error/ECC/Word.h | 5 +---- DRAMSys/library/src/simulation/ReorderBuffer.h | 6 +++--- .../src/simulation/dram/DramRecordable.cpp | 18 +++++++++--------- 10 files changed, 31 insertions(+), 38 deletions(-) diff --git a/DRAMSys/library/src/common/CongenAddressDecoder.cpp b/DRAMSys/library/src/common/CongenAddressDecoder.cpp index fca1ea3b..46613007 100644 --- a/DRAMSys/library/src/common/CongenAddressDecoder.cpp +++ b/DRAMSys/library/src/common/CongenAddressDecoder.cpp @@ -37,14 +37,15 @@ #include "utils.h" #include +#include using std::ifstream; using std::cout; using std::endl; - -#include - using std::set; +using std::pair; +using std::map; +using std::deque; tinyxml2::XMLElement *CongenAddressDecoder::GetXMLNode(tinyxml2::XMLElement *pRoot, std::string strName) diff --git a/DRAMSys/library/src/common/CongenAddressDecoder.h b/DRAMSys/library/src/common/CongenAddressDecoder.h index ed523d9d..85829d9d 100644 --- a/DRAMSys/library/src/common/CongenAddressDecoder.h +++ b/DRAMSys/library/src/common/CongenAddressDecoder.h @@ -43,10 +43,6 @@ #include #include -using std::vector; -using std::pair; -using std::map; - class CongenAddressDecoder : private AddressDecoder { // Friendship needed so that the AddressDecoder can access the @@ -80,13 +76,13 @@ private: m_nByteBits; // Number of Byte bits used by this mapping - vector + std::vector m_vXor; // This container stores for each used xor gate a pair which consists of "First/Number of an address bit which corresponds to a bank" and "Second/Number of an address bit which corresponds to a row" - vector> + std::vector> m_vBankBits; // This container stores for each bank bit a pair which consists of "First/Number of the bank bit" and "Second/Number of the address bit" - vector> + std::vector> m_vRowBits; // This container stores for each row bit a pair which consists of "First/Number of the row bit" and "Second/Number of the address bit" - vector> + std::vector> m_vColumnBits; // This container stores for each column bit a pair which consists of "First/Number of the column bit" and "Second/Number of the address bit" //Methods diff --git a/DRAMSys/library/src/common/DebugManager.cpp b/DRAMSys/library/src/common/DebugManager.cpp index 02c1da73..19d6d6df 100644 --- a/DRAMSys/library/src/common/DebugManager.cpp +++ b/DRAMSys/library/src/common/DebugManager.cpp @@ -36,13 +36,13 @@ #include "DebugManager.h" -#ifdef DEBUGGING +#ifndef NDEBUG #include "../configuration/Configuration.h" void DebugManager::printDebugMessage(std::string sender, std::string message) { - if (Configuration::getInstance().Debug) { + if (Configuration::getInstance().debug) { if (writeToConsole) std::cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << std::endl; diff --git a/DRAMSys/library/src/common/DebugManager.h b/DRAMSys/library/src/common/DebugManager.h index ca3b1fec..83219115 100644 --- a/DRAMSys/library/src/common/DebugManager.h +++ b/DRAMSys/library/src/common/DebugManager.h @@ -37,9 +37,7 @@ #ifndef DEBUGMANAGER_H #define DEBUGMANAGER_H -//#define DEBUGGING - -#ifndef DEBUGGING +#ifdef NDEBUG #define PRINTDEBUGMESSAGE(sender, message) {} #else #define PRINTDEBUGMESSAGE(sender, message) DebugManager::getInstance().printDebugMessage(sender, message) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 0258da37..0571eb98 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -153,12 +153,12 @@ void TlmRecorder::introduceTransactionSystem(tlm_generic_payload &trans) currentTransactionsInSystem[&trans].timeOfGeneration = GenerationExtension::getExtension(&trans).TimeOfGeneration(); - PRINTDEBUGMESSAGE(name, "New transaction #" + to_string(id) + " generation time " + + PRINTDEBUGMESSAGE(name, "New transaction #" + std::to_string(id) + " generation time " + currentTransactionsInSystem[&trans].timeOfGeneration.to_string()); if (id % transactionCommitRate == 0) { PRINTDEBUGMESSAGE(name, "Committing transactions " + - to_string(id - transactionCommitRate + 1) + " - " + to_string(id)); + std::to_string(id - transactionCommitRate + 1) + " - " + std::to_string(id)); commitRecordedDataToDB(); } } @@ -168,7 +168,7 @@ void TlmRecorder::removeTransactionFromSystem(tlm_generic_payload &trans) assert(currentTransactionsInSystem.count(&trans) != 0); PRINTDEBUGMESSAGE(name, "Removing transaction #" + - to_string(currentTransactionsInSystem[&trans].id)); + std::to_string(currentTransactionsInSystem[&trans].id)); Transaction &recordingData = currentTransactionsInSystem[&trans]; recordedData.push_back(recordingData); diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index 7478d6fb..bcfbc836 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -81,9 +81,9 @@ void ControllerRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase pha uint64_t id __attribute__((unused)) = DramExtension::getExtension(trans).getPayloadID(); PRINTDEBUGMESSAGE(name(), "Recording " + phaseNameToString(phase) + " thread " + - to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string( - bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " + - to_string(col) + " id " + to_string(id) + " at " + recTime.to_string()); + std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string( + bg) + " bank " + std::to_string(bank) + " row " + std::to_string(row) + " column " + + std::to_string(col) + " id " + std::to_string(id) + " at " + recTime.to_string()); tlmRecorder->recordPhase(trans, phase, recTime); } diff --git a/DRAMSys/library/src/error/ECC/Word.cpp b/DRAMSys/library/src/error/ECC/Word.cpp index 47794ea0..a59c38e3 100644 --- a/DRAMSys/library/src/error/ECC/Word.cpp +++ b/DRAMSys/library/src/error/ECC/Word.cpp @@ -5,6 +5,7 @@ #include using std::cout; +using std::deque; CWord::CWord(unsigned nBitLength) : m_nBitLength(nBitLength) diff --git a/DRAMSys/library/src/error/ECC/Word.h b/DRAMSys/library/src/error/ECC/Word.h index c3edb1ae..743d7cfe 100644 --- a/DRAMSys/library/src/error/ECC/Word.h +++ b/DRAMSys/library/src/error/ECC/Word.h @@ -3,15 +3,12 @@ #include #include "Bit.h" -using std::deque; - - class CWord { protected: unsigned m_nBitLength; - deque m_word; + std::deque m_word; public: diff --git a/DRAMSys/library/src/simulation/ReorderBuffer.h b/DRAMSys/library/src/simulation/ReorderBuffer.h index ab751054..d2d84077 100644 --- a/DRAMSys/library/src/simulation/ReorderBuffer.h +++ b/DRAMSys/library/src/simulation/ReorderBuffer.h @@ -58,7 +58,7 @@ public: private: tlm_utils::peq_with_cb_and_phase payloadEventQueue; - deque pendingRequestsInOrder; + std::deque pendingRequestsInOrder; std::set receivedResponses; bool responseIsPendingInInitator; @@ -130,8 +130,8 @@ private: { - sc_assert(phase == END_REQ || - (phase == BEGIN_RESP && pendingRequestsInOrder.front() == &payload + sc_assert(phase == tlm::END_REQ || + (phase == tlm::BEGIN_RESP && pendingRequestsInOrder.front() == &payload && receivedResponses.count(&payload))); tlm::tlm_phase TPhase = phase; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index ecf88f5b..d1a8df14 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -100,9 +100,9 @@ void DramRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID(); PRINTDEBUGMESSAGE(this->name(), "Recording " + phaseNameToString(phase) + " thread " + - to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string( - bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " + - to_string(col) + " at " + recTime.to_string()); + std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string( + bg) + " bank " + std::to_string(bank) + " row " + std::to_string(row) + " column " + + std::to_string(col) + " at " + recTime.to_string()); tlmRecorder->recordPhase(trans, phase, recTime); @@ -139,12 +139,12 @@ void DramRecordable::powerWindow() * Configuration::getInstance().numberOfDevicesOnDIMM); // Here considering that DRAMPower provides the energy in pJ and the power in mW - PRINTDEBUGMESSAGE(this->name(), string("\tWindow Energy: \t") + to_string( - DRAMPower->getEnergy().window_energy * - Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[pJ]")); - PRINTDEBUGMESSAGE(this->name(), string("\tWindow Average Power: \t") + to_string( - DRAMPower->getPower().window_average_power * - Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[mW]")); + PRINTDEBUGMESSAGE(this->name(), std::string("\tWindow Energy: \t") + std::to_string( + this->DRAMPower->getEnergy().window_energy * + Configuration::getInstance().numberOfDevicesOnDIMM) + std::string("\t[pJ]")); + PRINTDEBUGMESSAGE(this->name(), std::string("\tWindow Average Power: \t") + std::to_string( + this->DRAMPower->getPower().window_average_power * + Configuration::getInstance().numberOfDevicesOnDIMM) + std::string("\t[mW]")); } while (true); }