Read Priorization for FR_FCFS
I Added the feature that RD is always prioritized before WR for FR_FCFS. Instead of searching the next row hit for a specific bank it searches for the next row hit which is a read. If there is not read hit found it searches for a write read. If no write read is found it takes the oldest request. Even this could be further improved of course because RD/WR switching is actually not a per bank problem its because of the shared busses.
This commit is contained in:
@@ -117,7 +117,8 @@ SOURCES += \
|
||||
src/error/ECC/ECC.cpp \
|
||||
src/error/ECC/Word.cpp \
|
||||
src/error/eccbaseclass.cpp \
|
||||
src/error/ecchamming.cpp
|
||||
src/error/ecchamming.cpp \
|
||||
src/controller/scheduler/Fr_Fcfs_read_priority.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/common/third_party/tinyxml2/tinyxml2.h \
|
||||
@@ -186,7 +187,8 @@ HEADERS += \
|
||||
src/error/ECC/ECC.h \
|
||||
src/error/ECC/Word.h \
|
||||
src/error/eccbaseclass.h \
|
||||
src/error/ecchamming.h
|
||||
src/error/ecchamming.h \
|
||||
src/controller/scheduler/Fr_Fcfs_read_priority.h
|
||||
|
||||
thermalsim = $$(THERMALSIM)
|
||||
isEmpty(thermalsim) {
|
||||
|
||||
13
DRAMSys/simulator/resources/configs/mcconfigs/fr_fcfs_rp.xml
Normal file
13
DRAMSys/simulator/resources/configs/mcconfigs/fr_fcfs_rp.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<mcconfig>
|
||||
<BankwiseLogic value="0"/>
|
||||
<OpenPagePolicy value="1" />
|
||||
<MaxNrOfTransactions value="8" />
|
||||
<Scheduler value="FR_FCFS_RP" />
|
||||
<Capsize value="5" />
|
||||
<!-- 4 Modes: NoPowerDown, Staggered, TimeoutPDN, TimeoutSREF -->
|
||||
<PowerDownMode value="NoPowerDown" />
|
||||
<PowerDownTimeout value="100" />
|
||||
<!-- Error Model: -->
|
||||
<ControllerCoreDisableRefresh value="0"/>
|
||||
</mcconfig>
|
||||
|
||||
@@ -53,6 +53,10 @@ void Controller::buildScheduler()
|
||||
{
|
||||
scheduler = new FR_FCFS(*controllerCore);
|
||||
}
|
||||
else if (selectedScheduler == "FR_FCFS_RP")
|
||||
{
|
||||
scheduler = new FR_FCFS_RP(*controllerCore);
|
||||
}
|
||||
else if (selectedScheduler == "SMS")
|
||||
{
|
||||
scheduler = new SMS("SMS", *controllerCore, Configuration::getInstance().SJFProbability);
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#include "scheduler/Fifo.h"
|
||||
#include "scheduler/FifoStrict.h"
|
||||
#include "scheduler/Fr_Fcfs.h"
|
||||
#include "scheduler/Fr_Fcfs_read_priority.h"
|
||||
#include "scheduler/SMS.h"
|
||||
#include "scheduler/IScheduler.h"
|
||||
|
||||
|
||||
@@ -55,8 +55,10 @@ public:
|
||||
std::pair<Command, tlm::tlm_generic_payload*> getNextRequest(Bank bank) override;
|
||||
virtual gp* getPendingRequest(Bank bank) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
std::map<Bank, std::deque<gp*>> buffer;
|
||||
|
||||
private:
|
||||
std::deque<gp*>::iterator FindRowHit(Bank bank);
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
* Authors:
|
||||
* Matthias Jung
|
||||
*/
|
||||
|
||||
#include "Fr_Fcfs_read_priority.h"
|
||||
|
||||
// The FR_FCFS_Read_Priority works exactly like the FR_FCFS but reads are
|
||||
// prioratized over writes. For detailed documentation look into the FR_FCFS.
|
||||
|
||||
std::pair<Command, gp*> FR_FCFS_RP::getNextRequest(Bank bank)
|
||||
{
|
||||
// If the bank is empty like Bank0 in the example we do nothing
|
||||
if(buffer[bank].empty())
|
||||
{
|
||||
return pair<Command, tlm::tlm_generic_payload*>(Command::NOP, NULL);
|
||||
}
|
||||
|
||||
// In FR_FCFS row hits have always the highest priority, therefore we search
|
||||
// for row hits. If we find a row hit, we remove the transaction from the
|
||||
// queue and send it to the DRAM.
|
||||
deque<gp*>::iterator it = FindRowHit_RP(bank);
|
||||
if(it != buffer[bank].end())
|
||||
{
|
||||
gp* payload = *it;
|
||||
buffer[bank].erase(it);
|
||||
return pair<Command, gp*>(getReadWriteCommand(*payload), payload);
|
||||
}
|
||||
|
||||
// If there is no row hit, the FR_FCFS takes always the oldest transaction
|
||||
// in the buffer, i.e. the transaction in the front.
|
||||
return pair<Command, gp*>(getNextCommand(buffer[bank].front()),
|
||||
buffer[bank].front());
|
||||
}
|
||||
|
||||
// This function searches for a row hit in the scheduling queue of the specific
|
||||
// bank like FindRowHit in FR_FCFS. However, it will search for reads first and
|
||||
// it will take a write only if there is no read row hit.
|
||||
// If no row hit is found the end of the queue is returned.
|
||||
//
|
||||
// Note: end() Returns an iterator referring to the past-the-end element in the
|
||||
// deque container. The past-the-end element is the theoretical element that
|
||||
// would follow the last element in the deque container. It does not point to
|
||||
// any element, and thus shall not be dereferenced.
|
||||
deque<gp*>::iterator FR_FCFS_RP::FindRowHit_RP(Bank bank)
|
||||
{
|
||||
deque<gp*> &queue = buffer[bank];
|
||||
|
||||
if(!controllerCore.getRowBufferStates().rowBufferIsOpen(bank))
|
||||
return queue.end();
|
||||
|
||||
// Traverse the scheduling queue of the specific
|
||||
// bank and serach for read hits:
|
||||
for(auto it = queue.begin(); it!=queue.end(); it++)
|
||||
{
|
||||
gp* payload = *it;
|
||||
//Found read row-hit and return the according iterator
|
||||
if(DramExtension::getRow(payload)
|
||||
== controllerCore.getRowBufferStates().getRowInRowBuffer(bank)
|
||||
&& payload->get_command() == tlm::TLM_READ_COMMAND)
|
||||
{
|
||||
return it;
|
||||
}
|
||||
}
|
||||
// Traverse the scheduling queue of the specific
|
||||
// bank and serach for write hits in case no read was found:
|
||||
for(auto it = queue.begin(); it!=queue.end(); it++)
|
||||
{
|
||||
gp* payload = *it;
|
||||
//Found read row-hit and return the according iterator
|
||||
if(DramExtension::getRow(payload)
|
||||
== controllerCore.getRowBufferStates().getRowInRowBuffer(bank)
|
||||
&& payload->get_command() == tlm::TLM_WRITE_COMMAND)
|
||||
{
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
// If neither read or write hit was found we return the end:
|
||||
return queue.end();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
* Authors:
|
||||
* Matthias Jung
|
||||
*/
|
||||
|
||||
#ifndef FR_FCFS_READ_PRIORITY_H
|
||||
#define FR_FCFS_READ_PRIORITY_H
|
||||
|
||||
#include "Fr_Fcfs.h"
|
||||
|
||||
class FR_FCFS_RP : public FR_FCFS
|
||||
{
|
||||
public:
|
||||
FR_FCFS_RP(ControllerCore &controllerCore) : FR_FCFS(controllerCore) {}
|
||||
|
||||
std::pair<Command, tlm::tlm_generic_payload*>
|
||||
getNextRequest(Bank bank) override;
|
||||
|
||||
private:
|
||||
|
||||
std::deque<gp*>::iterator FindRowHit_RP(Bank bank);
|
||||
};
|
||||
|
||||
#endif // FR_FCFS_READ_PRIORITY_H
|
||||
Reference in New Issue
Block a user