From 606d273bee60c0e9cd4ac4c415e32c763d8d44bf Mon Sep 17 00:00:00 2001 From: "Lukas Steiner (2)" Date: Thu, 10 Oct 2019 15:21:58 +0200 Subject: [PATCH] Included memspec and dram component for HBM2. --- DRAMSys/library/library.pro | 8 +- .../src/configuration/memspec/MemSpecHBM2.cpp | 88 ++++++++++++++++++ .../src/configuration/memspec/MemSpecHBM2.h | 93 +++++++++++++++++++ .../library/src/simulation/dram/DramHBM2.cpp | 59 ++++++++++++ .../library/src/simulation/dram/DramHBM2.h | 53 +++++++++++ 5 files changed, 299 insertions(+), 2 deletions(-) create mode 100644 DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp create mode 100644 DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h create mode 100644 DRAMSys/library/src/simulation/dram/DramHBM2.cpp create mode 100644 DRAMSys/library/src/simulation/dram/DramHBM2.h diff --git a/DRAMSys/library/library.pro b/DRAMSys/library/library.pro index 52a33ecd..e67fc6f1 100644 --- a/DRAMSys/library/library.pro +++ b/DRAMSys/library/library.pro @@ -143,7 +143,9 @@ SOURCES += \ src/controller/checker/CheckerLPDDR4.cpp \ src/configuration/memspec/MemSpecWideIO2.cpp \ src/simulation/dram/DramWideIO2.cpp \ - src/controller/checker/CheckerWideIO2.cpp + src/controller/checker/CheckerWideIO2.cpp \ + src/configuration/memspec/MemSpecHBM2.cpp \ + src/simulation/dram/DramHBM2.cpp HEADERS += \ src/common/third_party/tinyxml2/tinyxml2.h \ @@ -220,7 +222,9 @@ HEADERS += \ src/controller/checker/CheckerLPDDR4.h \ src/configuration/memspec/MemSpecWideIO2.h \ src/simulation/dram/DramWideIO2.h \ - src/controller/checker/CheckerWideIO2.h + src/controller/checker/CheckerWideIO2.h \ + src/configuration/memspec/MemSpecHBM2.h \ + src/simulation/dram/DramHBM2.h #src/common/third_party/json/include/nlohmann/json.hpp \ thermalsim = $$(THERMALSIM) diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp new file mode 100644 index 00000000..1ffc78f5 --- /dev/null +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.cpp @@ -0,0 +1,88 @@ +/* + * 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 "MemSpecHBM2.h" + +MemSpecHBM2::MemSpecHBM2() +{ + commandLength[Command::ACT] = 2; +} + +sc_time MemSpecHBM2::getRefreshIntervalAB() const +{ + return tREFI; +} + +sc_time MemSpecHBM2::getRefreshIntervalPB() const +{ + return tREFISB; +} + +sc_time MemSpecHBM2::getExecutionTime(Command command) const +{ + if (command == Command::PRE || command == Command::PREA) + return tRP; + else if (command == Command::ACT) // TODO: read or write? + return tRCDRD + clk; + else if (command == Command::RD || command == Command::RDA) + return tRL + tDQSCK + getReadAccessTime(); + else if (command == Command::WR || command == Command::WRA) + return tWL + getWriteAccessTime(); + else if (command == Command::REFA) + return tRFC; + else if (command == Command::REFB) + return tRFCSB; + else + { + SC_REPORT_FATAL("getExecutionTime", + "command not known or command doesn't have a fixed execution time"); + return SC_ZERO_TIME; + } +} + +TimeInterval MemSpecHBM2::getIntervalOnDataStrobe(Command command) const +{ + if (command == Command::RD || command == Command::RDA) + return TimeInterval(sc_time_stamp() + tRL + tDQSCK, + sc_time_stamp() + tRL + tDQSCK + getReadAccessTime()); + else if (command == Command::WR || command == Command::WRA) + return TimeInterval(sc_time_stamp() + tWL, + sc_time_stamp() + tWL + getWriteAccessTime()); + else + { + SC_REPORT_FATAL("MemSpecLPDDR4", "Method was called with invalid argument"); + return TimeInterval(); + } +} diff --git a/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h new file mode 100644 index 00000000..0448bcaa --- /dev/null +++ b/DRAMSys/library/src/configuration/memspec/MemSpecHBM2.h @@ -0,0 +1,93 @@ +/* + * 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 MEMSPECHBM2_H +#define MEMSPECHBM2_H + +#include "MemSpec.h" + +struct MemSpecHBM2 final : public MemSpec +{ + MemSpecHBM2(); + + // Memspec Variables: + sc_time tDQSCK; +// sc_time tDQSQ; // TODO: check actual value of this parameter + sc_time tRC; + sc_time tRAS; + sc_time tRCDRD; + sc_time tRCDWR; + sc_time tRRDL; + sc_time tRRDS; + sc_time tFAW; + sc_time tRTPL; + sc_time tRTPS; + sc_time tRP; + sc_time tRL; + sc_time tWL; + sc_time tPL; + sc_time tWR; + sc_time tCCDL; + sc_time tCCDS; +// sc_time tCCDR; // TODO: consecutive reads to different stack IDs + sc_time tWTRL; + sc_time tWTRS; + sc_time tRTW; + sc_time tXP; + sc_time tCKE; + sc_time tPD = tCKE; + sc_time tRDPDE = tRL + tPL + (BurstLength / 2) * clk + clk; + sc_time tWRPDE = tWL + tPL + (BurstLength / 2) * clk + clk + tWR; + sc_time tWRAPDE = tWL + tPL + (BurstLength / 2) * clk + clk + tWR; + sc_time tCKESR = tCKE + clk; + sc_time tRDSRE = tRL + tPL + (BurstLength / 2) * clk + clk; + sc_time tXS; + sc_time tRFC; + sc_time tRFCSB; + sc_time tRREFD; + sc_time tREFI; + sc_time tREFISB; + + // Currents and Voltages: + // TODO: to be completed + + virtual sc_time getRefreshIntervalPB() const override; + virtual sc_time getRefreshIntervalAB() const override; + + virtual sc_time getExecutionTime(Command) const override; + virtual TimeInterval getIntervalOnDataStrobe(Command) const override; +}; + +#endif // MEMSPECHBM2_H diff --git a/DRAMSys/library/src/simulation/dram/DramHBM2.cpp b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp new file mode 100644 index 00000000..cea6f476 --- /dev/null +++ b/DRAMSys/library/src/simulation/dram/DramHBM2.cpp @@ -0,0 +1,59 @@ +/* + * 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 "DramHBM2.h" + +#include "Dram.h" +#include "../../configuration/Configuration.h" +#include "../../common/third_party/DRAMPower/src/libdrampower/LibDRAMPower.h" +#include "../../configuration/memspec/MemSpecHBM2.h" + +DramHBM2::DramHBM2(sc_module_name name) : Dram(name) +{ + if (StoreMode == StorageMode::ErrorModel) + SC_REPORT_FATAL("DramHBM2", "Error Model not supported for HBM2"); + + // Parameters for DRAMPower + MemSpecHBM2 *memSpec = dynamic_cast(this->memSpec); + if (memSpec == nullptr) + SC_REPORT_FATAL("DramHBM2", "Wrong MemSpec chosen"); + + if (Configuration::getInstance().PowerAnalysis) + { + SC_REPORT_FATAL("DramHBM2", "DRAMPower not supported for HBM2"); + } + else + DRAMPower = new libDRAMPowerDummy(); +} diff --git a/DRAMSys/library/src/simulation/dram/DramHBM2.h b/DRAMSys/library/src/simulation/dram/DramHBM2.h new file mode 100644 index 00000000..84cb5d0b --- /dev/null +++ b/DRAMSys/library/src/simulation/dram/DramHBM2.h @@ -0,0 +1,53 @@ +/* + * 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 DRAMHBM2_H +#define DRAMHBM2_H + +#include +#include +#include "Dram.h" + +using namespace tlm; + +class DramHBM2 : public Dram +{ +public: + DramHBM2(sc_module_name); + SC_HAS_PROCESS(DramHBM2); + virtual ~DramHBM2() {} +}; + +#endif // DRAMHBM2_H