From 73eb716deb50dd2789d97b871791657e5a3e55db Mon Sep 17 00:00:00 2001 From: "Thanh C. Tran" Date: Fri, 3 Mar 2017 03:32:18 +0100 Subject: [PATCH] Implement batch scheduler as a SYSTEMC process # Explain what has been changed # Explain why this change is being made # Provide links to any relevant tickets, articles or other resources --- DRAMSys/simulator/src/controller/scheduler/SMS.cpp | 3 +++ DRAMSys/simulator/src/controller/scheduler/SMS.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DRAMSys/simulator/src/controller/scheduler/SMS.cpp b/DRAMSys/simulator/src/controller/scheduler/SMS.cpp index 7e9fd5b5..4e8a86fb 100644 --- a/DRAMSys/simulator/src/controller/scheduler/SMS.cpp +++ b/DRAMSys/simulator/src/controller/scheduler/SMS.cpp @@ -68,8 +68,11 @@ void SMS::batchFormation() void SMS::batchScheduler() { + sc_time memClk = Configuration::getInstance().memSpec.clk; while (true) { + wait(memClk); + srand(time(NULL)); bool isSJF = (rand() % 100) < SJFprobability; if (!existReadyBatch()) diff --git a/DRAMSys/simulator/src/controller/scheduler/SMS.h b/DRAMSys/simulator/src/controller/scheduler/SMS.h index 6b7853a6..bb60f447 100644 --- a/DRAMSys/simulator/src/controller/scheduler/SMS.h +++ b/DRAMSys/simulator/src/controller/scheduler/SMS.h @@ -26,10 +26,13 @@ public: memrequestcounter.emplace(Thread(threadID), 0); memoryIntensity.emplace(Thread(threadID), 0); } + SC_THREAD(batchScheduler); } + SC_HAS_PROCESS(SMS); virtual ~SMS(){} virtual void schedule(gp *payload) override; virtual std::pair getNextRequest(Bank bank) override; + void batchScheduler(); private: std::map> buffer; @@ -40,7 +43,6 @@ private: std::map memoryIntensity; unsigned int SJFprobability; - void batchScheduler(); unsigned int totalMemoryRequests(); void batchFormation(); void selectSJF();