Added response queues with fifo and reorder policies.
This commit is contained in:
@@ -47,90 +47,116 @@ set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ Version")
|
||||
set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
|
||||
|
||||
include_directories(
|
||||
src/simulation
|
||||
src/simulation/dram
|
||||
src/controller
|
||||
src/controller/checker
|
||||
src/controller/cmdmux
|
||||
src/controller/powerdown
|
||||
src/controller/refresh
|
||||
src/controller/scheduler
|
||||
src/common
|
||||
src/common/third_party/DRAMPower/src
|
||||
src/configuration
|
||||
src/configuration/memspec
|
||||
src/error
|
||||
src/error/ECC
|
||||
src/common
|
||||
src/common/third_party/DRAMPower/src
|
||||
src/configuration
|
||||
src/configuration/memspec
|
||||
src/controller
|
||||
src/controller/checker
|
||||
src/controller/cmdmux
|
||||
src/controller/powerdown
|
||||
src/controller/refresh
|
||||
src/controller/respqueue
|
||||
src/controller/scheduler
|
||||
src/error
|
||||
src/error/ECC
|
||||
src/simulation
|
||||
src/simulation/dram
|
||||
)
|
||||
|
||||
add_library(DRAMSysLibrary
|
||||
src/common/third_party/tinyxml2/tinyxml2.cpp
|
||||
src/common/TlmRecorder.cpp
|
||||
src/common/DebugManager.cpp
|
||||
src/configuration/Configuration.cpp
|
||||
src/simulation/MemoryManager.cpp
|
||||
src/simulation/TemperatureController.cpp
|
||||
src/configuration/ConfigurationLoader.cpp
|
||||
src/controller/Command.cpp
|
||||
src/error/errormodel.cpp
|
||||
src/simulation/TracePlayer.cpp
|
||||
src/simulation/TraceSetup.cpp
|
||||
src/simulation/DRAMSys.cpp
|
||||
src/simulation/Setup.cpp
|
||||
src/error/ECC/Bit.cpp
|
||||
src/error/ECC/ECC.cpp
|
||||
src/error/ECC/Word.cpp
|
||||
src/error/eccbaseclass.cpp
|
||||
src/error/ecchamming.cpp
|
||||
src/common/AddressDecoder.cpp
|
||||
src/simulation/dram/Dram.cpp
|
||||
src/simulation/Arbiter.cpp
|
||||
src/common/CongenAddressDecoder.cpp
|
||||
src/common/XmlAddressDecoder.cpp
|
||||
src/common/timingCalculations.cpp
|
||||
src/common/dramExtensions.cpp
|
||||
src/common/utils.cpp
|
||||
src/simulation/dram/DramDDR3.cpp
|
||||
src/simulation/dram/DramDDR4.cpp
|
||||
src/simulation/dram/DramRecordable.cpp
|
||||
src/simulation/dram/DramWideIO.cpp
|
||||
src/configuration/memspec/MemSpec.cpp
|
||||
src/controller/BankMachine.cpp
|
||||
src/controller/Controller.cpp
|
||||
src/controller/scheduler/SchedulerFifo.cpp
|
||||
src/controller/scheduler/SchedulerFrFcfs.cpp
|
||||
src/controller/cmdmux/CmdMuxStrict.cpp
|
||||
src/controller/cmdmux/CmdMuxOldest.cpp
|
||||
src/controller/ControllerRecordable.cpp
|
||||
src/controller/checker/CheckerDDR3.cpp
|
||||
src/controller/refresh/RefreshManager.cpp
|
||||
src/controller/refresh/RefreshManagerDummy.cpp
|
||||
src/controller/refresh/RefreshManagerBankwise.cpp
|
||||
src/controller/checker/CheckerWideIO.cpp
|
||||
src/configuration/memspec/MemSpecDDR3.cpp
|
||||
src/configuration/memspec/MemSpecDDR4.cpp
|
||||
src/configuration/memspec/MemSpecWideIO.cpp
|
||||
src/configuration/memspec/MemSpecLPDDR4.cpp
|
||||
src/controller/checker/CheckerDDR4.cpp
|
||||
src/simulation/dram/DramLPDDR4.cpp
|
||||
src/controller/checker/CheckerLPDDR4.cpp
|
||||
src/configuration/memspec/MemSpecWideIO2.cpp
|
||||
src/simulation/dram/DramWideIO2.cpp
|
||||
src/controller/checker/CheckerWideIO2.cpp
|
||||
src/configuration/memspec/MemSpecHBM2.cpp
|
||||
src/simulation/dram/DramHBM2.cpp
|
||||
src/controller/checker/CheckerHBM2.cpp
|
||||
src/configuration/memspec/MemSpecGDDR5.cpp
|
||||
src/configuration/memspec/MemSpecGDDR5X.cpp
|
||||
src/configuration/memspec/MemSpecGDDR6.cpp
|
||||
src/controller/checker/CheckerGDDR5.cpp
|
||||
src/controller/checker/CheckerGDDR5X.cpp
|
||||
src/controller/checker/CheckerGDDR6.cpp
|
||||
src/simulation/dram/DramGDDR5.cpp
|
||||
src/simulation/dram/DramGDDR5X.cpp
|
||||
src/simulation/dram/DramGDDR6.cpp
|
||||
src/controller/powerdown/PowerDownManagerStaggered.cpp
|
||||
src/controller/powerdown/PowerDownManagerDummy.cpp
|
||||
src/common/third_party/tinyxml2/tinyxml2.cpp
|
||||
src/common/TlmRecorder.cpp
|
||||
src/common/DebugManager.cpp
|
||||
src/common/CongenAddressDecoder.cpp
|
||||
src/common/XmlAddressDecoder.cpp
|
||||
src/common/timingCalculations.cpp
|
||||
src/common/dramExtensions.cpp
|
||||
src/common/utils.cpp
|
||||
src/common/AddressDecoder.cpp
|
||||
src/common/protocol.h
|
||||
src/common/tlm2_base_protocol_checker.h
|
||||
|
||||
src/configuration/Configuration.cpp
|
||||
src/configuration/ConfigurationLoader.cpp
|
||||
src/configuration/TemperatureSimConfig.h
|
||||
|
||||
src/configuration/memspec/MemSpec.cpp
|
||||
src/configuration/memspec/MemSpecDDR3.cpp
|
||||
src/configuration/memspec/MemSpecDDR4.cpp
|
||||
src/configuration/memspec/MemSpecLPDDR4.cpp
|
||||
src/configuration/memspec/MemSpecWideIO.cpp
|
||||
src/configuration/memspec/MemSpecWideIO2.cpp
|
||||
src/configuration/memspec/MemSpecGDDR5.cpp
|
||||
src/configuration/memspec/MemSpecGDDR5X.cpp
|
||||
src/configuration/memspec/MemSpecGDDR6.cpp
|
||||
src/configuration/memspec/MemSpecHBM2.cpp
|
||||
|
||||
src/controller/BankMachine.cpp
|
||||
src/controller/Command.cpp
|
||||
src/controller/GenericController.h
|
||||
src/controller/Controller.cpp
|
||||
src/controller/ControllerRecordable.cpp
|
||||
|
||||
src/controller/checker/CheckerIF.h
|
||||
src/controller/checker/CheckerDDR3.cpp
|
||||
src/controller/checker/CheckerDDR4.cpp
|
||||
src/controller/checker/CheckerLPDDR4.cpp
|
||||
src/controller/checker/CheckerWideIO.cpp
|
||||
src/controller/checker/CheckerWideIO2.cpp
|
||||
src/controller/checker/CheckerGDDR5.cpp
|
||||
src/controller/checker/CheckerGDDR5X.cpp
|
||||
src/controller/checker/CheckerGDDR6.cpp
|
||||
src/controller/checker/CheckerHBM2.cpp
|
||||
|
||||
src/controller/cmdmux/CmdMuxIF.h
|
||||
src/controller/cmdmux/CmdMuxOldest.cpp
|
||||
src/controller/cmdmux/CmdMuxStrict.cpp
|
||||
|
||||
src/controller/powerdown/PowerDownManagerIF.h
|
||||
src/controller/powerdown/PowerDownManagerDummy.cpp
|
||||
src/controller/powerdown/PowerDownManagerStaggered.cpp
|
||||
|
||||
src/controller/refresh/RefreshManagerIF.h
|
||||
src/controller/refresh/RefreshManagerDummy.cpp
|
||||
src/controller/refresh/RefreshManager.cpp
|
||||
src/controller/refresh/RefreshManagerBankwise.cpp
|
||||
|
||||
src/controller/respqueue/RespQueueIF.h
|
||||
src/controller/respqueue/RespQueueFifo.cpp
|
||||
src/controller/respqueue/RespQueueReorder.cpp
|
||||
|
||||
src/controller/scheduler/SchedulerIF.h
|
||||
src/controller/scheduler/SchedulerFifo.cpp
|
||||
src/controller/scheduler/SchedulerFrFcfs.cpp
|
||||
|
||||
src/error/eccbaseclass.cpp
|
||||
src/error/ecchamming.cpp
|
||||
src/error/errormodel.cpp
|
||||
|
||||
src/error/ECC/Bit.cpp
|
||||
src/error/ECC/ECC.cpp
|
||||
src/error/ECC/Word.cpp
|
||||
|
||||
src/simulation/Arbiter.cpp
|
||||
src/simulation/DRAMSys.cpp
|
||||
src/simulation/MemoryManager.cpp
|
||||
src/simulation/Setup.cpp
|
||||
src/simulation/TemperatureController.cpp
|
||||
src/simulation/TracePlayer.cpp
|
||||
src/simulation/TraceSetup.cpp
|
||||
|
||||
src/simulation/dram/Dram.cpp
|
||||
src/simulation/dram/DramRecordable.cpp
|
||||
src/simulation/dram/DramDDR3.cpp
|
||||
src/simulation/dram/DramDDR4.cpp
|
||||
src/simulation/dram/DramLPDDR4.cpp
|
||||
src/simulation/dram/DramWideIO.cpp
|
||||
src/simulation/dram/DramWideIO2.cpp
|
||||
src/simulation/dram/DramGDDR5.cpp
|
||||
src/simulation/dram/DramGDDR5X.cpp
|
||||
src/simulation/dram/DramGDDR6.cpp
|
||||
src/simulation/dram/DramHBM2.cpp
|
||||
)
|
||||
|
||||
# Build:
|
||||
|
||||
@@ -55,12 +55,14 @@
|
||||
#include "refresh/RefreshManagerBankwise.h"
|
||||
#include "powerdown/PowerDownManagerStaggered.h"
|
||||
#include "powerdown/PowerDownManagerDummy.h"
|
||||
#include "respqueue/RespQueueFifo.h"
|
||||
#include "respqueue/RespQueueReorder.h"
|
||||
|
||||
Controller::Controller(sc_module_name name) :
|
||||
GenericController(name)
|
||||
{
|
||||
SC_METHOD(controllerMethod);
|
||||
sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEventQueue;
|
||||
sensitive << beginReqEvent << endRespEvent << controllerEvent << dataResponseEvent;
|
||||
dont_initialize();
|
||||
|
||||
Configuration &config = Configuration::getInstance();
|
||||
@@ -187,6 +189,8 @@ Controller::Controller(sc_module_name name) :
|
||||
}
|
||||
}
|
||||
|
||||
respQueue = new RespQueueFifo();
|
||||
|
||||
startBandwidthIdleCollector();
|
||||
}
|
||||
|
||||
@@ -194,6 +198,7 @@ Controller::~Controller()
|
||||
{
|
||||
endBandwithIdleCollector();
|
||||
|
||||
delete respQueue;
|
||||
for (auto it : refreshManagers)
|
||||
delete it;
|
||||
for (auto it : powerDownManagers)
|
||||
@@ -212,14 +217,17 @@ void Controller::controllerMethod()
|
||||
releasePayload();
|
||||
|
||||
// (2) Send next result to arbiter
|
||||
if (payloadToRelease == nullptr && !responseQueue.empty())
|
||||
{
|
||||
std::pair<sc_time, tlm_generic_payload *> element = responseQueue.front();
|
||||
if (sc_time_stamp() >= element.first)
|
||||
{
|
||||
payloadToRelease = element.second;
|
||||
responseQueue.pop();
|
||||
if (payloadToRelease == nullptr)
|
||||
{
|
||||
payloadToRelease = respQueue->nextPayload();
|
||||
|
||||
if (payloadToRelease != nullptr)
|
||||
sendToFrontend(payloadToRelease, BEGIN_RESP);
|
||||
else
|
||||
{
|
||||
sc_time triggerTime = respQueue->getTriggerTime();
|
||||
if (triggerTime != sc_max_time())
|
||||
dataResponseEvent.notify(triggerTime - sc_time_stamp());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,8 +365,11 @@ tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &trans,
|
||||
if (phase == END_RD || phase == END_RDA || phase == END_WR || phase == END_WRA)
|
||||
{
|
||||
// TODO: check this part (order of responses)
|
||||
responseQueue.push({(sc_time_stamp() + delay), &trans});
|
||||
dataResponseEventQueue.notify(delay);
|
||||
respQueue->insertPayload(&trans, delay);
|
||||
|
||||
sc_time triggerTime = respQueue->getTriggerTime();
|
||||
if (triggerTime != sc_max_time())
|
||||
dataResponseEvent.notify(triggerTime - sc_time_stamp());
|
||||
|
||||
Rank rank = DramExtension::getRank(trans);
|
||||
ranksNumberOfPayloads[rank.ID()]--;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "checker/CheckerIF.h"
|
||||
#include "refresh/RefreshManagerIF.h"
|
||||
#include "powerdown/PowerDownManagerIF.h"
|
||||
#include "respqueue/RespQueueIF.h"
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
@@ -81,6 +82,7 @@ private:
|
||||
tlm_generic_payload *payloadToRelease = nullptr;
|
||||
sc_time timeToRelease = sc_max_time();
|
||||
std::queue<std::pair<sc_time, tlm_generic_payload *>> responseQueue;
|
||||
RespQueueIF *respQueue;
|
||||
|
||||
std::vector<BankMachine *> bankMachines;
|
||||
std::vector<std::vector<BankMachine *>> bankMachinesOnRank;
|
||||
@@ -94,8 +96,7 @@ private:
|
||||
void acquirePayload();
|
||||
|
||||
void controllerMethod();
|
||||
sc_event beginReqEvent, endRespEvent, controllerEvent;
|
||||
sc_event_queue dataResponseEventQueue;
|
||||
sc_event beginReqEvent, endRespEvent, controllerEvent, dataResponseEvent;
|
||||
|
||||
// Bandwidth related
|
||||
sc_time idleStart;
|
||||
|
||||
65
DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp
Normal file
65
DRAMSys/library/src/controller/respqueue/RespQueueFifo.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
*/
|
||||
|
||||
#include "RespQueueFifo.h"
|
||||
|
||||
void RespQueueFifo::insertPayload(tlm_generic_payload *payload, sc_time delay)
|
||||
{
|
||||
buffer.push({payload, sc_time_stamp() + delay});
|
||||
}
|
||||
|
||||
tlm_generic_payload *RespQueueFifo::nextPayload()
|
||||
{
|
||||
if (!buffer.empty())
|
||||
{
|
||||
std::pair<tlm_generic_payload *, sc_time> element = buffer.front();
|
||||
if (element.second <= sc_time_stamp())
|
||||
{
|
||||
buffer.pop();
|
||||
return element.first;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sc_time RespQueueFifo::getTriggerTime() const
|
||||
{
|
||||
if (!buffer.empty())
|
||||
{
|
||||
sc_time triggerTime = buffer.front().second;
|
||||
if (triggerTime > sc_time_stamp())
|
||||
return triggerTime;
|
||||
}
|
||||
return sc_max_time();
|
||||
}
|
||||
57
DRAMSys/library/src/controller/respqueue/RespQueueFifo.h
Normal file
57
DRAMSys/library/src/controller/respqueue/RespQueueFifo.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
*/
|
||||
|
||||
#ifndef RESPQUEUEFIFO_H
|
||||
#define RESPQUEUEFIFO_H
|
||||
|
||||
#include <systemc.h>
|
||||
#include <tlm.h>
|
||||
#include "RespQueueIF.h"
|
||||
#include <utility>
|
||||
#include <queue>
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
class RespQueueFifo final : public RespQueueIF
|
||||
{
|
||||
public:
|
||||
virtual void insertPayload(tlm_generic_payload *, sc_time) override;
|
||||
virtual tlm_generic_payload *nextPayload() override;
|
||||
virtual sc_time getTriggerTime() const override;
|
||||
|
||||
private:
|
||||
std::queue<std::pair<tlm_generic_payload *, sc_time>> buffer;
|
||||
};
|
||||
|
||||
#endif // RESPQUEUEFIFO_H
|
||||
51
DRAMSys/library/src/controller/respqueue/RespQueueIF.h
Normal file
51
DRAMSys/library/src/controller/respqueue/RespQueueIF.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
*/
|
||||
|
||||
#ifndef RESPQUEUEIF_H
|
||||
#define RESPQUEUEIF_H
|
||||
|
||||
#include <systemc.h>
|
||||
#include <tlm.h>
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
class RespQueueIF
|
||||
{
|
||||
public:
|
||||
virtual void insertPayload(tlm_generic_payload *, sc_time) = 0;
|
||||
virtual tlm_generic_payload *nextPayload() = 0;
|
||||
virtual sc_time getTriggerTime() const = 0;
|
||||
};
|
||||
|
||||
#endif // RESPQUEUEIF_H
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
*/
|
||||
|
||||
#include "RespQueueReorder.h"
|
||||
#include "../../common/dramExtensions.h"
|
||||
|
||||
void RespQueueReorder::insertPayload(tlm_generic_payload *payload, sc_time delay)
|
||||
{
|
||||
buffer[DramExtension::getPayloadID(payload)] = {payload, sc_time_stamp() + delay};
|
||||
}
|
||||
|
||||
tlm_generic_payload *RespQueueReorder::nextPayload()
|
||||
{
|
||||
if (!buffer.empty())
|
||||
{
|
||||
if (buffer.begin()->first == currentPayloadID)
|
||||
{
|
||||
std::pair<tlm_generic_payload *, sc_time> element = buffer.begin()->second;
|
||||
if (element.second <= sc_time_stamp())
|
||||
{
|
||||
buffer.erase(currentPayloadID++);
|
||||
return element.first;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sc_time RespQueueReorder::getTriggerTime() const
|
||||
{
|
||||
if (!buffer.empty())
|
||||
{
|
||||
if (buffer.begin()->first == currentPayloadID)
|
||||
{
|
||||
sc_time triggerTime = buffer.begin()->second.second;
|
||||
if (triggerTime > sc_time_stamp())
|
||||
return triggerTime;
|
||||
}
|
||||
}
|
||||
return sc_max_time();
|
||||
}
|
||||
58
DRAMSys/library/src/controller/respqueue/RespQueueReorder.h
Normal file
58
DRAMSys/library/src/controller/respqueue/RespQueueReorder.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*
|
||||
* Author: Lukas Steiner
|
||||
*/
|
||||
|
||||
#ifndef RESPQUEUEREORDER_H
|
||||
#define RESPQUEUEREORDER_H
|
||||
|
||||
#include <systemc.h>
|
||||
#include <tlm.h>
|
||||
#include "RespQueueIF.h"
|
||||
#include <map>
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
class RespQueueReorder final : public RespQueueIF
|
||||
{
|
||||
public:
|
||||
virtual void insertPayload(tlm_generic_payload *, sc_time) override;
|
||||
virtual tlm_generic_payload *nextPayload() override;
|
||||
virtual sc_time getTriggerTime() const override;
|
||||
|
||||
private:
|
||||
uint64_t currentPayloadID = 0;
|
||||
// Muss die Zeit aller Payloads gespeichert werden?
|
||||
std::map<uint64_t, std::pair<tlm_generic_payload *, sc_time>> buffer;
|
||||
};
|
||||
|
||||
#endif // RESPQUEUEREORDER_H
|
||||
Reference in New Issue
Block a user