diff --git a/DRAMSys/simulator/CMakeLists.txt b/DRAMSys/simulator/CMakeLists.txt index ff12803b..dac282fe 100644 --- a/DRAMSys/simulator/CMakeLists.txt +++ b/DRAMSys/simulator/CMakeLists.txt @@ -47,7 +47,6 @@ add_executable(DRAMSys ExampleInitiator.h MemoryManager.cpp StlPlayer.cpp - TracePlayer.cpp TrafficGenerator.cpp TrafficInitiator.cpp TraceSetup.cpp diff --git a/DRAMSys/simulator/StlPlayer.cpp b/DRAMSys/simulator/StlPlayer.cpp index f0b5e48e..24e4a5d6 100644 --- a/DRAMSys/simulator/StlPlayer.cpp +++ b/DRAMSys/simulator/StlPlayer.cpp @@ -49,7 +49,7 @@ StlPlayer::StlPlayer(const sc_module_name &name, unsigned int maxPendingWriteRequests, TraceSetup *setup, bool relative) - : TracePlayer(name, setup), file(pathToTrace), + : TrafficInitiator(name, setup), file(pathToTrace), currentBuffer(&lineContents[0]), parseBuffer(&lineContents[1]), relative(relative) diff --git a/DRAMSys/simulator/StlPlayer.h b/DRAMSys/simulator/StlPlayer.h index 76c3199f..ba48619d 100644 --- a/DRAMSys/simulator/StlPlayer.h +++ b/DRAMSys/simulator/StlPlayer.h @@ -46,7 +46,7 @@ #include #include #include "TraceSetup.h" -#include "TracePlayer.h" +#include "TrafficInitiator.h" struct LineContent { @@ -56,7 +56,7 @@ struct LineContent std::vector data; }; -class StlPlayer : public TracePlayer +class StlPlayer : public TrafficInitiator { public: StlPlayer(const sc_module_name &name, diff --git a/DRAMSys/simulator/TracePlayer.cpp b/DRAMSys/simulator/TracePlayer.cpp deleted file mode 100644 index b262bd1c..00000000 --- a/DRAMSys/simulator/TracePlayer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021, Technische Universität 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: - * Derek Christ - */ - -#include "TracePlayer.h" - -TracePlayer::TracePlayer(const sc_core::sc_module_name &name, TraceSetup *setup) : - TrafficInitiator(name, setup) -{ -} diff --git a/DRAMSys/simulator/TracePlayer.h b/DRAMSys/simulator/TracePlayer.h deleted file mode 100644 index 23f0729b..00000000 --- a/DRAMSys/simulator/TracePlayer.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021, Technische Universität 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: - * Derek Christ - */ - -#ifndef TRACEPLAYER_H -#define TRACEPLAYER_H - -#include -#include "TrafficInitiator.h" - -class TracePlayer : public TrafficInitiator -{ -protected: - TracePlayer(const sc_module_name &name, TraceSetup *setup); -}; - -#endif // TRACEPLAYER_H diff --git a/DRAMSys/simulator/TraceSetup.cpp b/DRAMSys/simulator/TraceSetup.cpp index 855581c7..ba23072e 100644 --- a/DRAMSys/simulator/TraceSetup.cpp +++ b/DRAMSys/simulator/TraceSetup.cpp @@ -151,7 +151,7 @@ TraceSetup::TraceSetup(const std::string &uri, if (addressDistribution == "sequential") { - unsigned int addressIncrement = 0x0; + uint64_t addressIncrement = 0x0; if (!value["addressIncrement"].is_number_unsigned()) SC_REPORT_FATAL("TraceSetup", "Address increment is not a number."); diff --git a/DRAMSys/simulator/TrafficGenerator.cpp b/DRAMSys/simulator/TrafficGenerator.cpp index 84855284..51c7751f 100644 --- a/DRAMSys/simulator/TrafficGenerator.cpp +++ b/DRAMSys/simulator/TrafficGenerator.cpp @@ -59,7 +59,8 @@ TrafficGenerator::TrafficGenerator(const sc_module_name &name, void TrafficGenerator::nextPayload() { - if (transactionsSent >= numRequests) { + if (transactionsSent >= numRequests) + { finished = true; return; } @@ -72,9 +73,12 @@ void TrafficGenerator::nextPayload() uint64_t address = getNextAddress(); tlm::tlm_command command; - if (randomRwDistribution(randomGenerator) < rwRatio) { + if (randomRwDistribution(randomGenerator) < rwRatio) + { command = tlm::TLM_READ_COMMAND; - } else { + } + else + { command = tlm::TLM_WRITE_COMMAND; } @@ -131,7 +135,8 @@ TrafficGeneratorSequential::TrafficGeneratorSequential(const sc_core::sc_module_ uint64_t numRequests, unsigned int maxPendingReadRequests, unsigned int maxPendingWriteRequests, - float rwRatio, unsigned int addressIncrement, + float rwRatio, + uint64_t addressIncrement, unsigned int seed, TraceSetup *setup) : TrafficGenerator(name, tCK, numRequests, maxPendingReadRequests, diff --git a/DRAMSys/simulator/TrafficGenerator.h b/DRAMSys/simulator/TrafficGenerator.h index d7732d09..583bf8b6 100644 --- a/DRAMSys/simulator/TrafficGenerator.h +++ b/DRAMSys/simulator/TrafficGenerator.h @@ -64,9 +64,8 @@ protected: private: unsigned int burstlenght; sc_time tCK; - unsigned int numRequests; + uint64_t numRequests; float rwRatio; - unsigned int addressIncrement; std::uniform_real_distribution randomRwDistribution = std::uniform_real_distribution(0.0f, 1.0f); }; @@ -98,15 +97,15 @@ public: unsigned int maxPendingReadRequests, unsigned int maxPendingWriteRequests, float rwRatio, - unsigned int addressIncrement, + uint64_t addressIncrement, unsigned int seed, TraceSetup *setup); private: virtual uint64_t getNextAddress() override; - unsigned int currentAddress = 0x0; - unsigned int addressIncrement; + uint64_t currentAddress = 0x0; + uint64_t addressIncrement; }; #endif // TRAFFICGENERATOR_H diff --git a/DRAMSys/simulator/TrafficInitiator.cpp b/DRAMSys/simulator/TrafficInitiator.cpp index 865da77e..9b54943f 100644 --- a/DRAMSys/simulator/TrafficInitiator.cpp +++ b/DRAMSys/simulator/TrafficInitiator.cpp @@ -96,7 +96,8 @@ void TrafficInitiator::peqCallback(tlm_generic_payload &payload, pendingWriteRequests--; // If the initiator wasn't able to send the next payload in the END_REQ phase, do it now. - if (payloadPostponed) { + if (payloadPostponed) + { nextPayload(); payloadPostponed = false; }