From 5b7210a2d718f3c32135909dfe904ed06d800a8f Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Mon, 24 Jul 2017 14:14:51 +0200 Subject: [PATCH] Improved FR_FCFS_GRP --- DRAMSys/simulator/src/controller/Controller.cpp | 2 +- DRAMSys/simulator/src/controller/Controller.h | 4 ++-- .../src/controller/scheduler/Fr_Fcfs_grouper.cpp | 14 +++++++++++++- .../src/controller/scheduler/Fr_Fcfs_grouper.h | 13 ++++++++++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/DRAMSys/simulator/src/controller/Controller.cpp b/DRAMSys/simulator/src/controller/Controller.cpp index 0f7ebbf3..1c4b2333 100644 --- a/DRAMSys/simulator/src/controller/Controller.cpp +++ b/DRAMSys/simulator/src/controller/Controller.cpp @@ -61,7 +61,7 @@ void Controller::buildScheduler() } else if (selectedScheduler == "FR_FCFS_GRP") { - scheduler = new FR_FCFS_GRP(*controllerCore); + scheduler = new FR_FCFS_GRP(*controllerCore,this); } else if (selectedScheduler == "SMS") { diff --git a/DRAMSys/simulator/src/controller/Controller.h b/DRAMSys/simulator/src/controller/Controller.h index 184cb445..4b58d50d 100644 --- a/DRAMSys/simulator/src/controller/Controller.h +++ b/DRAMSys/simulator/src/controller/Controller.h @@ -77,7 +77,7 @@ using namespace tlm; DECLARE_EXTENDED_PHASE(PendingRequest); -struct Controller: public sc_module, public IController +class Controller: public sc_module, public IController { public: Controller(sc_module_name /*name*/, TlmRecorder *rec) : @@ -109,12 +109,12 @@ public: tlm_utils::simple_initiator_socket iSocket; tlm_utils::simple_target_socket tSocket; unsigned int getTotalNumberOfPayloadsInSystem(); + void scheduleNextFromScheduler(Bank bank) override; private: void buildScheduler(); void payloadEntersSystem(tlm_generic_payload& payload); void payloadLeavesSystem(tlm_generic_payload& payload); - void scheduleNextFromScheduler(Bank bank) override; // --- FRONTEND ------ tlm_sync_enum nb_transport_fw(tlm_generic_payload& payload, tlm_phase& phase, sc_time& fwDelay); diff --git a/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.cpp b/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.cpp index 8f1e80a6..735c0045 100644 --- a/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.cpp +++ b/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.cpp @@ -154,11 +154,23 @@ std::pair FR_FCFS_GRP::getNextRequest(Bank bank) } } + // If nothing was found we check the other banks before we switch the mode: + pair other(Command::NOP, NULL); + unsigned int B = Configuration::getInstance().memSpec.NumberOfBanks; + + for(unsigned int i=1; ischeduleNextFromScheduler(nextBank); + } + // If nothing was found in the current mode, switch the mode and try again: + // FIXME: this is in my opinion not so clever yet, because we switch maybe + // even though there are still reads/writes request on other banks ... readMode = !readMode; return getNextRequest(bank); - reportFatal("FR_FCFS_RP", "Never should go here ..."); + reportFatal("FR_FCFS_GRP", "Never should go here ..."); } // There is a hazard if a read is found which will be scheduled before a write diff --git a/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.h b/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.h index bf13341f..d4db780d 100644 --- a/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.h +++ b/DRAMSys/simulator/src/controller/scheduler/Fr_Fcfs_grouper.h @@ -37,19 +37,26 @@ #define FR_FCFS_GROUPER_H #include "Fr_Fcfs.h" +#include "../Controller.h" + +class Controller; class FR_FCFS_GRP : public FR_FCFS { public: - FR_FCFS_GRP(ControllerCore &controllerCore) : FR_FCFS(controllerCore), - readMode(true) - {} + FR_FCFS_GRP(ControllerCore &controllerCore, Controller * c) : + FR_FCFS(controllerCore), + ctrl(c), + readMode(true) + { + } std::pair getNextRequest(Bank bank) override; private: + Controller * ctrl; bool hazardDetection(Bank bank, std::deque::iterator ext); unsigned int getNumberOfRequest(tlm::tlm_command cmd); void printDebugMessage(std::string message);