Fix bugs
# Explain what has been changed # Explain why this change is being made # Provide links to any relevant tickets, articles or other resources
This commit is contained in:
@@ -55,7 +55,7 @@ void Controller::buildScheduler()
|
||||
}
|
||||
else if (selectedScheduler == "SMS")
|
||||
{
|
||||
scheduler = new SMS(*controllerCore, Configuration::getInstance().SJFProbability);
|
||||
scheduler = new SMS("SMS", *controllerCore, Configuration::getInstance().SJFProbability);
|
||||
}
|
||||
//else if (selectedScheduler == "PAR_BS")
|
||||
//{
|
||||
|
||||
@@ -6,6 +6,11 @@ ReadyBatch::ReadyBatch()
|
||||
thresholdAge = sc_time(Configuration::getInstance().ReadyBatchThresholdAge, SC_NS);
|
||||
}
|
||||
|
||||
ReadyBatch::~ReadyBatch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//unsigned int ReadyBatch::getNumRequests()
|
||||
//{
|
||||
// return readybatch.size();
|
||||
@@ -13,7 +18,8 @@ ReadyBatch::ReadyBatch()
|
||||
|
||||
Row ReadyBatch::getRow()
|
||||
{
|
||||
return DramExtension::getExtension(readybatch.front()).getRow();
|
||||
gp*& firstPayload = readybatch.front();
|
||||
return DramExtension::getExtension(firstPayload).getRow();
|
||||
}
|
||||
|
||||
//sc_time ReadyBatch::getTimeOfOldestRequest()
|
||||
@@ -34,7 +40,8 @@ bool ReadyBatch::addTransaction(gp* payload)
|
||||
{
|
||||
// sc_time currentAge = sc_time_stamp() - getTimeOfOldestRequest();
|
||||
Row newRow = DramExtension::getExtension(payload).getRow();
|
||||
if (/*getNumRequests() == fifosize || currentAge >= thresholdAge || */newRow != getRow()) {
|
||||
Row oldRow = readybatch.empty()? newRow : getRow();
|
||||
if (/*getNumRequests() == fifosize || currentAge >= thresholdAge || */newRow != oldRow) {
|
||||
return false;
|
||||
} else {
|
||||
readybatch.emplace_back(payload);
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
// unsigned int getNumRequests();
|
||||
std::deque<gp*>& getTransactions();
|
||||
bool isEmpty();
|
||||
~ReadyBatch();
|
||||
private:
|
||||
std::deque<gp*> readybatch;
|
||||
unsigned int fifosize;
|
||||
|
||||
@@ -17,7 +17,7 @@ using namespace std;
|
||||
class SMS: public sc_module, public IScheduler
|
||||
{
|
||||
public:
|
||||
SMS(ControllerCore &controllerCore, unsigned int SJFprobability) : IScheduler(controllerCore), SJFprobability(SJFprobability)
|
||||
SMS(sc_module_name /*_name*/, ControllerCore &controllerCore, unsigned int SJFprobability) : IScheduler(controllerCore), SJFprobability(SJFprobability)
|
||||
{
|
||||
// initialize memory request counter & memory request intensity for each thread
|
||||
unsigned int totalNumThreads = Configuration::getInstance().NumberOfTracePlayers;
|
||||
@@ -26,11 +26,19 @@ public:
|
||||
// memrequestcounter.emplace(Thread(threadID), 0);
|
||||
// memoryIntensity.emplace(Thread(threadID), 0);
|
||||
inFlightMemRequestCounter.emplace(Thread(threadID), 0);
|
||||
readybatches[Thread(threadID)] = new ReadyBatch();
|
||||
}
|
||||
SC_THREAD(batchScheduler);
|
||||
}
|
||||
SC_HAS_PROCESS(SMS);
|
||||
virtual ~SMS(){}
|
||||
virtual ~SMS()
|
||||
{
|
||||
unsigned int totalNumThreads = Configuration::getInstance().NumberOfTracePlayers;
|
||||
for (unsigned int threadID = 1; threadID <= totalNumThreads; threadID++)
|
||||
{
|
||||
delete readybatches[Thread(threadID)];
|
||||
}
|
||||
}
|
||||
virtual void schedule(gp *payload) override;
|
||||
virtual std::pair<Command, gp*> getNextRequest(Bank bank) override;
|
||||
void batchScheduler();
|
||||
|
||||
Reference in New Issue
Block a user