diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa9494be..fcca29ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,7 @@ build: after_script: - find . -name "*.o" -type f -delete - find . -name "*.a" -type f -delete + - rm -r build/coverage/_deps artifacts: paths: - build/coverage @@ -26,6 +27,8 @@ test: script: - cd build/coverage - ctest --output-on-failure -j$(nproc) + after_script: + - find . -name "*.tdb" -type f -delete artifacts: paths: - build/coverage diff --git a/CMakeLists.txt b/CMakeLists.txt index 05ff2ae8..d966f05c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,8 @@ set(DRAMSYS_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/configs") set(DRAMSYS_EXTENSIONS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extensions") ### Build options ### +option(BUILD_SHARED_LIBS "Build shared libraries" OFF) + option(DRAMSYS_BUILD_TESTS "Build DRAMSys unit tests" OFF) option(DRAMSYS_BUILD_BENCHMARKS "Build DRAMSys benchmarks" OFF) option(DRAMSYS_VERBOSE_CMAKE_OUTPUT "Show detailed CMake output" OFF) @@ -156,6 +158,9 @@ if (NOT TARGET SystemC::systemc) FetchContent_MakeAvailable(systemc) endif() +# Set include directories to SYSTEM to suppress warnings +set_target_properties(systemc PROPERTIES SYSTEM TRUE) + ### DRAMPower ### if (DRAMSYS_WITH_DRAMPOWER) FetchContent_Declare( diff --git a/CMakePresets.json b/CMakePresets.json index 3bd3c6fc..565ab0b9 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -62,7 +62,7 @@ }, { "name": "dev", - "generator": "Unix Makefiles", + "generator": "Ninja", "binaryDir": "${sourceDir}/build", "inherits": [ "dev-mode", @@ -70,8 +70,8 @@ ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic" + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always" } } ] -} \ No newline at end of file +} diff --git a/NOTICE b/NOTICE new file mode 100644 index 00000000..4f3db50d --- /dev/null +++ b/NOTICE @@ -0,0 +1,35 @@ +NOTICE + +This software uses the following third-party libraries: + +1. SQLite3 + License: Public Domain + License URL: https://www.sqlite.org/copyright.html + +2. NLohmann JSON + License: MIT + License URL: https://github.com/nlohmann/json/blob/develop/LICENSE.MIT + +3. SystemC + License: Apache-2.0 + License URL: https://github.com/accellera-official/systemc/blob/main/LICENSE + +4. Qt5 + License: LGPL-3.0-only + License URL: https://doc.qt.io/qt-5/lgpl.html + +5. Qwt6 (Qt Widgets for Technical Applications) + License: Qwt License (based on LGPL-2.1) + License URL: https://qwt.sourceforge.io/qwtlicense.html + +6. Google Test + License: BSD-3-Clause + License URL: https://github.com/google/googletest/blob/main/LICENSE + +7. Google Benchmark + License: Apache-2.0 + License URL: https://github.com/google/benchmark/blob/main/LICENSE + +8. Pybind11 + License: BSD-3-Clause + License URL: https://github.com/pybind/pybind11/blob/master/LICENSE diff --git a/README.md b/README.md index 5d0ec205..2fdc6d04 100644 --- a/README.md +++ b/README.md @@ -58,21 +58,26 @@ To use DRAMSys, first clone the repository. ### Dependencies -DRAMSys requires a **C++17** compiler. The build process is based on **CMake** (minimum version **3.24**). Furthermore, the simulator is based on **SystemC**. SystemC is included with FetchContent and will be build automatically with the project. If you want to use a preinstalled SystemC version, export the environment variable `SYSTEMC_HOME` (SystemC installation directory). Also make sure that the SystemC library was built with the same C++ version. +DRAMSys requires a **C++17** compiler. The build process is based on **CMake** (minimum version **3.24**). Furthermore, the simulator is based on **SystemC**. SystemC is included with FetchContent and will be build automatically with the project. If you want to use a preinstalled SystemC version, export the environment variable `SYSTEMC_HOME` (SystemC installation directory) and set the CMake option `DRAMSYS_USE_EXTERNAL_SYSTEMC`. Also make sure that the SystemC library was built with the same C++ version. ### Building DRAMSys -To build the standalone simulator for running memory trace files or traffic generators, create a build folder in the project root directory, then run CMake and make: +To build the standalone simulator for running memory trace files or traffic generators, first configure the project using CMake, then build the project: -```bash +```console $ cd DRAMSys -$ mkdir build -$ cd build -$ cmake .. -$ make +$ cmake -S . -B build +$ cmake --build build ``` -To include **DRAMPower** in your build enable the CMake option `DRAMSYS_WITH_DRAMPOWER`. If you plan to integrate DRAMSys into your own SystemC TLM-2.0 project you can build only the DRAMSys library by disabling the CMake option `DRAMSYS_BUILD_CLI`. +To include **DRAMPower** in your build enable the CMake option `DRAMSYS_WITH_DRAMPOWER`: +```console +$ cmake -B build -D DRAMSYS_WITH_DRAMPOWER=Y +``` + +If you plan to integrate DRAMSys into your own SystemC TLM-2.0 project you can build only the DRAMSys library by disabling the CMake option `DRAMSYS_BUILD_CLI`. + +In order to include any proprietary extensions such as the Trace Analyzer, enable the CMake option `DRAMSYS_ENABLE_EXTENSIONS`. To build DRAMSys on Windows 10 we recommend to use the **Windows Subsystem for Linux (WSL)**. @@ -80,7 +85,7 @@ To build DRAMSys on Windows 10 we recommend to use the **Windows Subsystem for L From the build directory use the commands below to execute the DRAMSys standalone. -```bash +```console $ cd bin $ ./DRAMSys ``` @@ -89,35 +94,42 @@ The default configuration file is *ddr4-example.json* located in *configs/*, the To run DRAMSys with a specific configuration file: -```bash +```console $ ./DRAMSys ../../configs/lpddr4-example.json ``` To run DRAMSys with a specific configuration file and configuration folder: -```bash +```console $ ./DRAMSys ../../tests/tests_regression/DDR3/ddr3-example.json ../../tests/tests_regression/DDR3/ ``` More information on the configuration can be found [here](configs/README.md). ## gem5 Coupling + There are two ways to couple DRAMSys with **gem5**: - Use the official integration of DRAMSys in gem5. More information can be found in `ext/dramsys` of the gem5 repository. - (Deprecated) Compile gem5 as a shared library and link it with DRAMSys, which is only supported in older versions of DRAMSys (tag v4.0). ## Development + Some additional development sources required for tests may be obtained using Git LFS. Make sure to have Git LFS installed through your system's package manager and set up for your user: -```bash -git lfs install +```console +$ git lfs install ``` To make the additional files available, run: -```bash -git lfs pull +```console +$ git lfs pull ``` +## Third-party libraries + +This application uses several third-party libraries. +For detailed license information, please refer to the [NOTICE](NOTICE) file. + ## Contact Information Further questions about the simulator and the Trace Analyzer can be directed to: diff --git a/benches/CMakeLists.txt b/benches/CMakeLists.txt index 3c6ed571..23e7b1c8 100644 --- a/benches/CMakeLists.txt +++ b/benches/CMakeLists.txt @@ -35,8 +35,6 @@ ### benches_dramsys ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(benches_dramsys) add_executable(${PROJECT_NAME} diff --git a/extensions/apps/traceAnalyzer/scripts/memUtil.py b/extensions/apps/traceAnalyzer/scripts/memUtil.py index c1d8bd5e..90824c46 100644 --- a/extensions/apps/traceAnalyzer/scripts/memUtil.py +++ b/extensions/apps/traceAnalyzer/scripts/memUtil.py @@ -108,7 +108,14 @@ def maximum_data_rate(connection): width = memspec.getIntValue("memarchitecturespec", "nbrOfDevices") * memspec.getIntValue("memarchitecturespec", "width") except: width = memspec.getIntValue("memarchitecturespec", "width") - clk = memspec.getIntValue("memtimingspec", "clkMhz") + + # Backwards compatibility for traces where clkMHz was not yet replaced with tCK + clk = None + try: + clk = 1000000 / memspec.getIntValue("memtimingspec", "tCK") + except: + clk = memspec.getIntValue("memtimingspec", "clkMhz") + rate = memspec.getIntValue("memarchitecturespec", "dataRate") if getPseudoChannelMode(connection): maxDataRate = float(clk) * float(width) * float(rate) * 2 diff --git a/extensions/apps/traceAnalyzer/traceanalyzer.cpp b/extensions/apps/traceAnalyzer/traceanalyzer.cpp index 9169643d..1d93d32a 100644 --- a/extensions/apps/traceAnalyzer/traceanalyzer.cpp +++ b/extensions/apps/traceAnalyzer/traceanalyzer.cpp @@ -58,6 +58,8 @@ void TraceAnalyzer::setUpGui() ui->setupUi(this); setUpStatusBar(); ui->traceFileTabs->clear(); + + QObject::connect(ui->actionAbout_Qt, &QAction::triggered, qApp, &QApplication::aboutQt); } TraceAnalyzer::TraceAnalyzer(QWidget* parent) : diff --git a/extensions/apps/traceAnalyzer/traceanalyzer.ui b/extensions/apps/traceAnalyzer/traceanalyzer.ui index 68871011..589fa98d 100644 --- a/extensions/apps/traceAnalyzer/traceanalyzer.ui +++ b/extensions/apps/traceAnalyzer/traceanalyzer.ui @@ -76,6 +76,7 @@ &Help + @@ -240,6 +241,14 @@ &Simulate... + + + About &Qt + + + QAction::AboutQtRole + + diff --git a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp index 504cb391..e6f163df 100644 --- a/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp +++ b/extensions/standards/LPDDR5/DRAMSys/controller/checker/CheckerLPDDR5.cpp @@ -553,7 +553,7 @@ sc_time CheckerLPDDR5::timeToSatisfyConstraints(Command command, lastCommandStart = lastScheduledByCommandAndBank[Command::WRA][bank]; if (lastCommandStart != scMaxTime) { - if (lastBurstLengthByCommandAndBank[Command::RDA][bank] == 32) + if (lastBurstLengthByCommandAndBank[Command::WRA][bank] == 32) earliestTimeToStart = std::max(earliestTimeToStart, lastCommandStart + memSpec.tWL + memSpec.BL_n_min_32 + memSpec.tCK + diff --git a/scripts/simulation/example_ddr3_simulations.json b/scripts/simulation/example_ddr3_simulations.json index 871a948b..06a094c0 100644 --- a/scripts/simulation/example_ddr3_simulations.json +++ b/scripts/simulation/example_ddr3_simulations.json @@ -111,7 +111,7 @@ "XPDLL": 20, "XS": 96, "XSDLL": 512, - "clkMhz": 800 + "tCK": 1250 } }, "simconfig": { diff --git a/src/configuration/CMakeLists.txt b/src/configuration/CMakeLists.txt index d64f76a0..62c90967 100644 --- a/src/configuration/CMakeLists.txt +++ b/src/configuration/CMakeLists.txt @@ -41,7 +41,7 @@ project(DRAMSys_Configuration) file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) -add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES}) +add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) @@ -57,4 +57,4 @@ target_compile_definitions(${PROJECT_NAME} add_library(DRAMSys::config ALIAS ${PROJECT_NAME}) -build_source_group() \ No newline at end of file +build_source_group() diff --git a/src/libdramsys/CMakeLists.txt b/src/libdramsys/CMakeLists.txt index 685a604b..ed088348 100644 --- a/src/libdramsys/CMakeLists.txt +++ b/src/libdramsys/CMakeLists.txt @@ -41,7 +41,7 @@ project(DRAMSys_libdramsys) file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) -add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES}) +add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/libdramsys/DRAMSys/controller/McConfig.cpp b/src/libdramsys/DRAMSys/controller/McConfig.cpp index a2b9bb5e..7a728569 100644 --- a/src/libdramsys/DRAMSys/controller/McConfig.cpp +++ b/src/libdramsys/DRAMSys/controller/McConfig.cpp @@ -75,6 +75,14 @@ McConfig::McConfig(const Config::McConfig& config, const MemSpec& memSpec) : config.BlockingWriteDelay.value_or(DEFAULT_BLOCKING_WRITE_DELAY_NS), sc_core::SC_NS)) { + if (schedulerBuffer == Config::SchedulerBufferType::ReadWrite && + config.RequestBufferSize.has_value()) + { + SC_REPORT_WARNING("McConfig", + "RequestBufferSize ignored when using ReadWrite SchedulerBuffer. Use " + "RequestBufferSizeRead and RequestBufferSizeWrite instead!"); + } + if (pagePolicy == Config::PagePolicyType::Invalid) SC_REPORT_FATAL("McConfig", "Invalid PagePolicy"); diff --git a/src/simulator/CMakeLists.txt b/src/simulator/CMakeLists.txt index 91a9fc47..2af018a2 100644 --- a/src/simulator/CMakeLists.txt +++ b/src/simulator/CMakeLists.txt @@ -45,7 +45,7 @@ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) list(FILTER SOURCE_FILES EXCLUDE REGEX "main.cpp") -add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES}) +add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index b9ee220d..11da2de1 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -41,7 +41,7 @@ project(DRAMSys_Util) file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp) -add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES}) +add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/tests/tests_configuration/CMakeLists.txt b/tests/tests_configuration/CMakeLists.txt index cf0d7e06..28db25bc 100644 --- a/tests/tests_configuration/CMakeLists.txt +++ b/tests/tests_configuration/CMakeLists.txt @@ -2,8 +2,6 @@ ### tests_configuration ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(tests_configuration) add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test_configuration.cpp) diff --git a/tests/tests_configuration/test_configuration.cpp b/tests/tests_configuration/test_configuration.cpp index ce44f156..94ff53a2 100644 --- a/tests/tests_configuration/test_configuration.cpp +++ b/tests/tests_configuration/test_configuration.cpp @@ -75,6 +75,7 @@ protected: addressMapBitVector({13, 14, 15}), addressMapBitVector({17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}), addressMapBitVector({33}), + std::nullopt, std::nullopt}; DRAMSys::Config::McConfig mcConfig{PagePolicyType::Open, diff --git a/tests/tests_dramsys/CMakeLists.txt b/tests/tests_dramsys/CMakeLists.txt index 8c8d48aa..ed845693 100644 --- a/tests/tests_dramsys/CMakeLists.txt +++ b/tests/tests_dramsys/CMakeLists.txt @@ -2,8 +2,6 @@ ### tests_dramsys ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(tests_dramsys) file(GLOB_RECURSE SOURCE_FILES *.cpp) diff --git a/tests/tests_dramsys/b_transport/configs/no_storage.json b/tests/tests_dramsys/b_transport/configs/no_storage.json index 94c45781..e45a7b78 100644 --- a/tests/tests_dramsys/b_transport/configs/no_storage.json +++ b/tests/tests_dramsys/b_transport/configs/no_storage.json @@ -135,7 +135,7 @@ "simconfig": { "AddressOffset": 0, "CheckTLM2Protocol": false, - "DatabaseRecording": true, + "DatabaseRecording": false, "Debug": false, "EnableWindowing": false, "PowerAnalysis": false, diff --git a/tests/tests_dramsys/b_transport/configs/storage.json b/tests/tests_dramsys/b_transport/configs/storage.json index 283008db..9f060231 100644 --- a/tests/tests_dramsys/b_transport/configs/storage.json +++ b/tests/tests_dramsys/b_transport/configs/storage.json @@ -133,7 +133,7 @@ "simconfig": { "AddressOffset": 0, "CheckTLM2Protocol": false, - "DatabaseRecording": true, + "DatabaseRecording": false, "Debug": false, "EnableWindowing": false, "PowerAnalysis": false, diff --git a/tests/tests_regression/CMakeLists.txt b/tests/tests_regression/CMakeLists.txt index e1d97ebf..f16d332a 100644 --- a/tests/tests_regression/CMakeLists.txt +++ b/tests/tests_regression/CMakeLists.txt @@ -35,8 +35,6 @@ ### tests_regression ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(tests_regression) find_program(SqlDiff sqldiff) diff --git a/tests/tests_simulator/CMakeLists.txt b/tests/tests_simulator/CMakeLists.txt index 03f5e401..b08874f4 100644 --- a/tests/tests_simulator/CMakeLists.txt +++ b/tests/tests_simulator/CMakeLists.txt @@ -2,8 +2,6 @@ ### tests_simulator ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(tests_simulator) add_executable(${PROJECT_NAME} diff --git a/tests/tests_util/CMakeLists.txt b/tests/tests_util/CMakeLists.txt index 65542c88..560caf76 100644 --- a/tests/tests_util/CMakeLists.txt +++ b/tests/tests_util/CMakeLists.txt @@ -2,8 +2,6 @@ ### tests_util ### ############################################### -cmake_minimum_required(VERSION 3.1.0) - project(tests_util) file(GLOB_RECURSE SOURCE_FILES *.cpp) @@ -20,4 +18,4 @@ target_link_libraries(${PROJECT_NAME} gtest_discover_tests(${PROJECT_NAME}) -build_source_group() \ No newline at end of file +build_source_group()