Clean up unused classes & Add notes about SMS scheduler

This commit is contained in:
Thanh C. Tran
2017-06-12 12:34:53 +02:00
parent ab2b87aaeb
commit dca7d88a68
5 changed files with 9 additions and 147 deletions

View File

@@ -82,7 +82,6 @@ SOURCES += \
src/controller/scheduler/Fr_Fcfs.cpp \
src/controller/scheduler/Fifo.cpp \
src/controller/scheduler/SMS.cpp \
src/controller/scheduler/ReadyBatch.cpp \
src/controller/core/refresh/RefreshManagerBankwise.cpp \
src/controller/core/refresh/RefreshManager.cpp \
src/controller/core/scheduling/checker/WriteChecker.cpp \
@@ -133,7 +132,6 @@ HEADERS += \
src/controller/scheduler/Fr_Fcfs.h \
src/controller/scheduler/Fifo.h \
src/controller/scheduler/SMS.h \
src/controller/scheduler/ReadyBatch.h \
src/controller/Controller.h \
src/controller/core/refresh/RefreshManagerBankwise.h \
src/controller/core/refresh/RefreshManager.h \

View File

@@ -1,55 +0,0 @@
/*
* MPKC.h
*
* Created on: May 11, 2017
* Author: thanhtran
*/
#ifndef MPKC_H_
#define MPKC_H_
#include "../../../common/Utils.h"
using namespace std;
class MPKC: public sc_module
{
public:
MPKC(sc_module_name /*_name*/, sc_time memClk) : memClk(memClk)
{
lastGeneratedRequests = std::make_pair(0, 0);
SC_THREAD(updateMPKC);
}
SC_HAS_PROCESS(MPKC);
void updateMPKC()
{
while(true)
{
mpkc = 1 / (lastGeneratedRequests.second + numClk*memClk -lastGeneratedRequests.first);
wait(memClk);
numClk++;
}
}
float getMPKC()
{
return mpkc;
}
void sendNewRequest(sc_time timeOfGeneration)
{
std::swap(lastGeneratedRequests.first, lastGeneratedRequests.second);
lastGeneratedRequests.second = timeOfGeneration;
numClk = 0;
}
private:
unsigned int numClk = 0;
sc_time memClk;
float mpkc = 0;
std::pair<sc_time, sc_time> lastGeneratedRequests;
};
#endif /* MPKC_H_ */

View File

@@ -1,59 +0,0 @@
#include "ReadyBatch.h"
ReadyBatch::ReadyBatch()
{
fifosize = Configuration::getInstance().ReadyBatchSize;
thresholdAge = sc_time(Configuration::getInstance().ReadyBatchThresholdAge, SC_NS);
}
ReadyBatch::~ReadyBatch()
{
}
//unsigned int ReadyBatch::getNumRequests()
//{
// return readybatch.size();
//}
Row ReadyBatch::getRow()
{
return DramExtension::getExtension(readybatch.front()).getRow();
}
//sc_time ReadyBatch::getTimeOfOldestRequest()
//{
// sc_time oldestTime = sc_time_stamp();
// for (auto reqPayload = readybatch.begin(); reqPayload != readybatch.end(); reqPayload++)
// {
// sc_time requestTimeOfGeneration = GenerationExtension::getExtension(*reqPayload).TimeOfGeneration();
// if (requestTimeOfGeneration < oldestTime)
// {
// oldestTime = requestTimeOfGeneration;
// }
// }
// return oldestTime;
//}
bool ReadyBatch::addTransaction(gp* payload)
{
// sc_time currentAge = sc_time_stamp() - getTimeOfOldestRequest();
Row newRow = DramExtension::getExtension(payload).getRow();
Row oldRow = readybatch.empty()? newRow : getRow();
if (/*getNumRequests() == fifosize || currentAge >= thresholdAge || */newRow != oldRow) {
return false;
} else {
readybatch.emplace_back(payload);
return true;
}
}
std::deque<gp*>& ReadyBatch::getTransactions()
{
return readybatch;
}
bool ReadyBatch::isEmpty()
{
return readybatch.empty();
}

View File

@@ -1,30 +0,0 @@
#ifndef READYBATCH_H
#define READYBATCH_H
#include "tlm.h"
#include "../../common/dramExtension.h"
#include "../core/configuration/Configuration.h"
typedef tlm::tlm_generic_payload gp;
using namespace std;
class ReadyBatch
{
public:
ReadyBatch();
bool addTransaction(gp* payload);
// unsigned int getNumRequests();
std::deque<gp*>& getTransactions();
bool isEmpty();
~ReadyBatch();
private:
std::deque<gp*> readybatch;
unsigned int fifosize;
sc_time thresholdAge;
Row getRow();
// sc_time getTimeOfOldestRequest();
};
#endif // READYBATCH_H

View File

@@ -5,7 +5,6 @@
#include <time.h>
#include "sysc/utils/sc_report.h"
#include "IScheduler.h"
#include "ReadyBatch.h"
#include "../core/ControllerCore.h"
#include "../core/configuration/Configuration.h"
#include "../../common/dramExtension.h"
@@ -22,6 +21,15 @@
using namespace std;
typedef std::deque<gp*>::iterator gp_deque_iterator;
/**
* SMS - Staged Memory Scheduler involves 3 steps:
* 1. Arrage request in to each buffer of each thread
* 2. Forming ready batches for each thread, i.e all requests access the same row. The batch is deemed
* ready when the next request accesses different row OR When the buffer is full OR When this batch
* is too old
* 3. Send batches to bank buffers. The rules to send batches are Shortest-Job-First OR Round-Robin
* How we select the rule depends on the probability we setup earlier.
*/
class SMS: public sc_module, public IScheduler
{
public: