From 8f0e59c85e02a407ffb23caddc2d9244c42abc55 Mon Sep 17 00:00:00 2001 From: "Lukas Steiner (2)" Date: Wed, 19 Jun 2019 11:16:38 +0200 Subject: [PATCH] Included templates for new DRAMs. --- DRAMSys/library/library.pro | 12 ++++- .../configuration/ConfigurationLoader.cpp | 1 + .../core/configuration/ConfigurationLoader.h | 1 + .../controller/core/configuration/MemSpec.h | 1 + DRAMSys/library/src/simulation/DramDDR3.cpp | 41 ++++++++++++++++ DRAMSys/library/src/simulation/DramDDR3.h | 47 +++++++++++++++++++ DRAMSys/library/src/simulation/DramDDR4.cpp | 6 +++ DRAMSys/library/src/simulation/DramDDR4.h | 12 +++++ .../library/src/simulation/DramRecordable.cpp | 41 ++++++++++++++++ .../library/src/simulation/DramRecordable.h | 46 ++++++++++++++++++ .../src/simulation/DramRecordablePower.cpp | 41 ++++++++++++++++ .../src/simulation/DramRecordablePower.h | 46 ++++++++++++++++++ .../library/src/simulation/RecordableDram.cpp | 8 ++-- .../library/src/simulation/RecordableDram.h | 2 +- 14 files changed, 298 insertions(+), 7 deletions(-) create mode 100644 DRAMSys/library/src/simulation/DramDDR3.cpp create mode 100644 DRAMSys/library/src/simulation/DramDDR3.h create mode 100644 DRAMSys/library/src/simulation/DramDDR4.cpp create mode 100644 DRAMSys/library/src/simulation/DramDDR4.h create mode 100644 DRAMSys/library/src/simulation/DramRecordable.cpp create mode 100644 DRAMSys/library/src/simulation/DramRecordable.h create mode 100644 DRAMSys/library/src/simulation/DramRecordablePower.cpp create mode 100644 DRAMSys/library/src/simulation/DramRecordablePower.h diff --git a/DRAMSys/library/library.pro b/DRAMSys/library/library.pro index ab7ca602..6fbf6467 100644 --- a/DRAMSys/library/library.pro +++ b/DRAMSys/library/library.pro @@ -143,7 +143,11 @@ SOURCES += \ src/common/XmlAddressDecoder.cpp \ src/controller/core/timingCalculations.cpp \ src/common/dramExtensions.cpp \ - src/common/utils.cpp + src/common/utils.cpp \ + src/simulation/DramDDR3.cpp \ + src/simulation/DramDDR4.cpp \ + src/simulation/DramRecordable.cpp \ + src/simulation/DramRecordablePower.cpp HEADERS += \ src/common/third_party/tinyxml2/tinyxml2.h \ @@ -220,7 +224,11 @@ HEADERS += \ src/controller/core/timingCalculations.h \ src/common/dramExtensions.h \ src/common/utils.h \ - src/controller/core/configuration/TemperatureSimConfig.h + src/controller/core/configuration/TemperatureSimConfig.h \ + src/simulation/DramDDR3.h \ + src/simulation/DramDDR4.h \ + src/simulation/DramRecordable.h \ + src/simulation/DramRecordablePower.h #src/common/third_party/json/include/nlohmann/json.hpp \ thermalsim = $$(THERMALSIM) diff --git a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp index 79b9965f..def1d129 100644 --- a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Lukas Steiner */ #include "ConfigurationLoader.h" diff --git a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.h b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.h index d7a12c57..7a4e0410 100644 --- a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.h +++ b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.h @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Lukas Steiner */ #ifndef CONFIGURATIONLOADER_H diff --git a/DRAMSys/library/src/controller/core/configuration/MemSpec.h b/DRAMSys/library/src/controller/core/configuration/MemSpec.h index fc4fb576..d13f2701 100644 --- a/DRAMSys/library/src/controller/core/configuration/MemSpec.h +++ b/DRAMSys/library/src/controller/core/configuration/MemSpec.h @@ -32,6 +32,7 @@ * Authors: * Janik Schlemminger * Matthias Jung + * Lukas Steiner */ #ifndef MEMSPEC_H diff --git a/DRAMSys/library/src/simulation/DramDDR3.cpp b/DRAMSys/library/src/simulation/DramDDR3.cpp new file mode 100644 index 00000000..1999d3a5 --- /dev/null +++ b/DRAMSys/library/src/simulation/DramDDR3.cpp @@ -0,0 +1,41 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#include "DramDDR3.h" + +DramDDR3::DramDDR3(sc_module_name name) : Dram(name) +{ + +} diff --git a/DRAMSys/library/src/simulation/DramDDR3.h b/DRAMSys/library/src/simulation/DramDDR3.h new file mode 100644 index 00000000..a64cdeaf --- /dev/null +++ b/DRAMSys/library/src/simulation/DramDDR3.h @@ -0,0 +1,47 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#ifndef DRAMDDR3_H +#define DRAMDDR3_H + +#include "Dram.h" + +class DramDDR3 : public Dram +{ +public: + DramDDR3(sc_module_name); +}; + +#endif // DRAMDDR3_H diff --git a/DRAMSys/library/src/simulation/DramDDR4.cpp b/DRAMSys/library/src/simulation/DramDDR4.cpp new file mode 100644 index 00000000..1390f29d --- /dev/null +++ b/DRAMSys/library/src/simulation/DramDDR4.cpp @@ -0,0 +1,6 @@ +#include "DramDDR4.h" + +DramDDR4::DramDDR4(sc_module_name name) : Dram(name) +{ + +} diff --git a/DRAMSys/library/src/simulation/DramDDR4.h b/DRAMSys/library/src/simulation/DramDDR4.h new file mode 100644 index 00000000..14212125 --- /dev/null +++ b/DRAMSys/library/src/simulation/DramDDR4.h @@ -0,0 +1,12 @@ +#ifndef DRAMDDR4_H +#define DRAMDDR4_H + +#include "Dram.h" + +class DramDDR4 : public Dram +{ +public: + DramDDR4(sc_module_name); +}; + +#endif // DRAMDDR4_H diff --git a/DRAMSys/library/src/simulation/DramRecordable.cpp b/DRAMSys/library/src/simulation/DramRecordable.cpp new file mode 100644 index 00000000..85d9d73a --- /dev/null +++ b/DRAMSys/library/src/simulation/DramRecordable.cpp @@ -0,0 +1,41 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#include "DramRecordable.h" + +DramRecordable::DramRecordable() +{ + +} diff --git a/DRAMSys/library/src/simulation/DramRecordable.h b/DRAMSys/library/src/simulation/DramRecordable.h new file mode 100644 index 00000000..cbbfea32 --- /dev/null +++ b/DRAMSys/library/src/simulation/DramRecordable.h @@ -0,0 +1,46 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#ifndef DRAMRECORDABLE_H +#define DRAMRECORDABLE_H + + +class DramRecordable +{ +public: + DramRecordable(); +}; + +#endif // DRAMRECORDABLE_H diff --git a/DRAMSys/library/src/simulation/DramRecordablePower.cpp b/DRAMSys/library/src/simulation/DramRecordablePower.cpp new file mode 100644 index 00000000..c1287cd3 --- /dev/null +++ b/DRAMSys/library/src/simulation/DramRecordablePower.cpp @@ -0,0 +1,41 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#include "DramRecordablePower.h" + +DramRecordablePower::DramRecordablePower() +{ + +} diff --git a/DRAMSys/library/src/simulation/DramRecordablePower.h b/DRAMSys/library/src/simulation/DramRecordablePower.h new file mode 100644 index 00000000..032022bd --- /dev/null +++ b/DRAMSys/library/src/simulation/DramRecordablePower.h @@ -0,0 +1,46 @@ +/* + * 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. + * + * Authors: + * Lukas Steiner + */ + +#ifndef DRAMRECORDABLEPOWER_H +#define DRAMRECORDABLEPOWER_H + + +class DramRecordablePower +{ +public: + DramRecordablePower(); +}; + +#endif // DRAMRECORDABLEPOWER_H diff --git a/DRAMSys/library/src/simulation/RecordableDram.cpp b/DRAMSys/library/src/simulation/RecordableDram.cpp index 295cac31..699f0a74 100644 --- a/DRAMSys/library/src/simulation/RecordableDram.cpp +++ b/DRAMSys/library/src/simulation/RecordableDram.cpp @@ -98,19 +98,19 @@ tlm_sync_enum RecordableDram::nb_transport_fw(tlm_generic_payload &payload, // It estimates the current average power which will be stored in the trace database for visualization purposes. void RecordableDram::powerWindow() { - unsigned long long clk_cycles = 0; + unsigned long long clkCycles = 0; do { // At the very beginning (zero clock cycles) the energy is 0, so we wait first wait(powerWindowSize); - clk_cycles = sc_time_stamp().value() / + clkCycles = sc_time_stamp().value() / Configuration::getInstance().memSpec->clk.value(); - DRAMPower->calcWindowEnergy(clk_cycles); + DRAMPower->calcWindowEnergy(clkCycles); // During operation the energy should never be zero since the device is always consuming - assert(!is_equal(DRAMPower->getEnergy().window_energy, 0.0)); + assert(!isEqual(DRAMPower->getEnergy().window_energy, 0.0)); // Store the time (in seconds) and the current average power (in mW) into the database recordPower(); diff --git a/DRAMSys/library/src/simulation/RecordableDram.h b/DRAMSys/library/src/simulation/RecordableDram.h index a362f2cc..0434177a 100644 --- a/DRAMSys/library/src/simulation/RecordableDram.h +++ b/DRAMSys/library/src/simulation/RecordableDram.h @@ -62,7 +62,7 @@ private: // When working with floats, we have to decide ourselves what is an // acceptable definition for "equal". Here the number is compared with a // suitable error margin (0.00001). - bool is_equal(double a, double b, const double epsilon = 1e-05) + bool isEqual(double a, double b, const double epsilon = 1e-05) { return std::fabs(a - b) < epsilon; }