Working on RefreshManagerBankwise.

This commit is contained in:
Lukas Steiner (2)
2019-08-14 13:48:04 +02:00
parent 0918a78648
commit 47ee187bc3
4 changed files with 118 additions and 18 deletions

View File

@@ -39,11 +39,12 @@
RefreshManager::RefreshManager(std::map<Bank, BankMachine *> &bankMachines) : bankMachines(bankMachines)
{
setUpDummy(refreshPayload);
memSpec = dynamic_cast<MemSpecDDR3 *>(Configuration::getInstance().memSpec);
if (memSpec == nullptr)
SC_REPORT_FATAL("CheckerDDR3", "Wrong MemSpec chosen");
setUpDummy(refreshPayload);
timeForNextTrigger = memSpec->tREFI - memSpec->tRP;
}

View File

@@ -35,11 +35,7 @@
#ifndef REFRESHMANAGER_H
#define REFRESHMANAGER_H
#include <systemc.h>
#include <tlm.h>
#include <utility>
#include "RefreshManagerIF.h"
#include "../Command.h"
#include "../core/configuration/MemSpec.h"
#include "../BankMachine.h"

View File

@@ -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<Bank, BankMachine *> &bankMachines)
: bankMachines(bankMachines)
{
memSpec = dynamic_cast<MemSpecDDR3 *>(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<sc_time, Bank>(currentREFB, Bank(bankID)));
triggerTimes.insert(std::pair<sc_time, Bank>(currentPRE, Bank(bankID)));
currentREFB += memSpec->clk;
currentPRE += memSpec->clk;
}
}
std::pair<Command, tlm_generic_payload *> RefreshManagerBankwise::getNextCommand()
{
}
sc_time RefreshManagerBankwise::getTriggerDelay()
{
}

View File

@@ -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 <vector>
#include <utility>
//class RefreshManagerBankwise : public RefreshManagerIF
//{
//public:
// RefreshManagerBankwise();
class RefreshManagerBankwise final : public RefreshManagerIF
{
public:
RefreshManagerBankwise(std::map<Bank, BankMachine *> &);
// std::pair<Command, tlm_generic_payload *> getNextCommand();
// sc_time updateState();
// sc_time getInitialDelay();
std::pair<Command, tlm_generic_payload *> getNextCommand();
sc_time getTriggerDelay();
//private:
//};
private:
const MemSpecDDR3 *memSpec;
std::map<Bank, BankMachine *> &bankMachines;
std::map<Bank, tlm_generic_payload> refreshPayloads;
std::map<sc_time, Bank> triggerTimes;
enum class RmState {IDLE, REFRESHING};
std::map<Bank, RmState> states;
};
#endif // REFRESHMANAGERBANKWISE_H