diff --git a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp b/DRAMSys/library/src/controller/refresh/RefreshManager.cpp index ff790e09..67c987d4 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManager.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManager.cpp @@ -39,11 +39,12 @@ RefreshManager::RefreshManager(std::map &bankMachines) : bankMachines(bankMachines) { - setUpDummy(refreshPayload); memSpec = dynamic_cast(Configuration::getInstance().memSpec); if (memSpec == nullptr) SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen"); + setUpDummy(refreshPayload); + timeForNextTrigger = memSpec->tREFI - memSpec->tRP; } diff --git a/DRAMSys/library/src/controller/refresh/RefreshManager.h b/DRAMSys/library/src/controller/refresh/RefreshManager.h index 58d8f05c..801ee5df 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManager.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManager.h @@ -35,11 +35,7 @@ #ifndef REFRESHMANAGER_H #define REFRESHMANAGER_H -#include -#include -#include #include "RefreshManagerIF.h" -#include "../Command.h" #include "../core/configuration/MemSpec.h" #include "../BankMachine.h" diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp index 5738683a..93dbe4b6 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.cpp @@ -1,6 +1,67 @@ +/* + * 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 "RefreshManagerBankwise.h" +#include "../core/configuration/Configuration.h" +#include "../../common/utils.h" +#include "../../common/dramExtensions.h" -//RefreshManagerBankwise::RefreshManagerBankwise() -//{ +RefreshManagerBankwise::RefreshManagerBankwise(std::map &bankMachines) + : bankMachines(bankMachines) +{ + memSpec = dynamic_cast(Configuration::getInstance().memSpec); + if (memSpec == nullptr) + SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen"); -//} + sc_time currentREFB = memSpec->tREFI - memSpec->clk * memSpec->NumberOfBanks; + sc_time currentPRE = currentREFB - std::max(memSpec->clk * memSpec->NumberOfBanks, memSpec->tRP); + for (unsigned bankID = 0; bankID < memSpec->NumberOfBanks; bankID++) + { + setUpDummy(refreshPayloads[Bank(bankID)], Bank(bankID)); + triggerTimes.insert(std::pair(currentREFB, Bank(bankID))); + triggerTimes.insert(std::pair(currentPRE, Bank(bankID))); + currentREFB += memSpec->clk; + currentPRE += memSpec->clk; + } +} + +std::pair RefreshManagerBankwise::getNextCommand() +{ + +} + +sc_time RefreshManagerBankwise::getTriggerDelay() +{ + +} diff --git a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h index 7ef388a3..08758631 100644 --- a/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h +++ b/DRAMSys/library/src/controller/refresh/RefreshManagerBankwise.h @@ -1,19 +1,61 @@ +/* + * 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 REFRESHMANAGERBANKWISE_H #define REFRESHMANAGERBANKWISE_H #include "RefreshManagerIF.h" +#include "../core/configuration/MemSpec.h" +#include "../BankMachine.h" +#include +#include -//class RefreshManagerBankwise : public RefreshManagerIF -//{ -//public: -// RefreshManagerBankwise(); +class RefreshManagerBankwise final : public RefreshManagerIF +{ +public: + RefreshManagerBankwise(std::map &); -// std::pair getNextCommand(); -// sc_time updateState(); -// sc_time getInitialDelay(); + std::pair getNextCommand(); + sc_time getTriggerDelay(); -//private: - -//}; +private: + const MemSpecDDR3 *memSpec; + std::map &bankMachines; + std::map refreshPayloads; + std::map triggerTimes; + enum class RmState {IDLE, REFRESHING}; + std::map states; +}; #endif // REFRESHMANAGERBANKWISE_H