From 5855da9131715918579735c5f73efb313fa66d44 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 10 Jan 2025 08:03:01 +0100 Subject: [PATCH 01/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index bccc926..414a772 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit bccc9269ff84181d1287dd6021ab5eb52f8909d0 +Subproject commit 414a7724e2723acb6cd309ff2fb62a38eb1ab6e5 From b63030b154227bc756caa00119cc3b622350b05d Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 29 Jan 2025 07:55:42 +0100 Subject: [PATCH 02/52] adds CONAN_USER_HOME setting to Jenkinsfile --- Jenkinsfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9dbfe3..3810729 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,21 +52,30 @@ pipeline { stage('SCC test pipeline') { parallel { stage('ubuntu-22.04') { - agent {docker { image 'ubuntu-22.04' } } + agent {docker { + image 'ubuntu-22.04' + args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-jammy' + } } stages { stage('Checkout') { steps { checkout_project() }} stage('Build & test') { steps { build_n_test_project() }} } } stage('rockylinux8') { - agent {docker { image 'rockylinux8' } } + agent {docker { + image 'rockylinux8' + args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-rocky8' + } } stages { stage('Checkout') { steps { checkout_project() }} stage('Build & test') { steps { build_n_test_project() }} } } stage('Format check') { - agent {docker { image 'ubuntu-22.04' } } + agent {docker { + image 'ubuntu-22.04' + args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-jammy' + } } stages { stage('Checkout') { steps { checkout_project() }} stage('Build & check format') { steps { From 1b99544779c7aa7fd99ff40ab68a7874d7f32e2d Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 29 Jan 2025 07:59:59 +0100 Subject: [PATCH 03/52] changes conan variable name to use the conan2 one (CONAN_HOME instead of CONAN_USER_HOME) --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3810729..737d0d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,7 +54,7 @@ pipeline { stage('ubuntu-22.04') { agent {docker { image 'ubuntu-22.04' - args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-jammy' + args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-jammy' } } stages { stage('Checkout') { steps { checkout_project() }} @@ -64,7 +64,7 @@ pipeline { stage('rockylinux8') { agent {docker { image 'rockylinux8' - args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-rocky8' + args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-rocky8' } } stages { stage('Checkout') { steps { checkout_project() }} @@ -74,7 +74,7 @@ pipeline { stage('Format check') { agent {docker { image 'ubuntu-22.04' - args ' -e CONAN_USER_HOME=/var/jenkins_home/workspace/conan-jammy' + args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-jammy' } } stages { stage('Checkout') { steps { checkout_project() }} From b274b0d80c44b0d052892787a20449b0e6a61435 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 29 Jan 2025 09:04:37 +0100 Subject: [PATCH 04/52] move format check into regular build --- Jenkinsfile | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 737d0d2..42bc1d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,6 +35,7 @@ void build_n_test_project() { . .venv/bin/activate pip3 install -r requirements.txt cmake -S . -B build --preset Release + cmake --build build --target format-check cmake --build build -j12 cmake --build build --target test ''' @@ -71,24 +72,6 @@ pipeline { stage('Build & test') { steps { build_n_test_project() }} } } - stage('Format check') { - agent {docker { - image 'ubuntu-22.04' - args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-jammy' - } } - stages { - stage('Checkout') { steps { checkout_project() }} - stage('Build & check format') { steps { - sh''' - python3 -mvenv .venv - . .venv/bin/activate - pip3 install -r requirements.txt - cmake -S . -B build --preset Release - cmake --build build --target format-check - ''' - }} - } - } } } } From de4d7401873cfe56ed1387baa4d0cc6706ba21c4 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 16 Mar 2025 18:50:10 +0100 Subject: [PATCH 05/52] updates scc and adds simspeed test --- CMakePresets.json | 9 ++++++--- scc | 2 +- tests/CMakeLists.txt | 1 + tests/sim_speed/CMakeLists.txt | 3 +++ tests/sim_speed/sc_main.cpp | 24 ++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 tests/sim_speed/CMakeLists.txt create mode 100644 tests/sim_speed/sc_main.cpp diff --git a/CMakePresets.json b/CMakePresets.json index 86840c3..774d9bb 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,7 +15,8 @@ "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", "CMAKE_BUILD_TYPE": "Debug", "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake" + "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } }, { @@ -24,7 +25,8 @@ "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", "CMAKE_BUILD_TYPE": "RelWithDebInfo", "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake" + "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } }, { @@ -33,7 +35,8 @@ "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", "CMAKE_BUILD_TYPE": "Release", "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake" + "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } } ] diff --git a/scc b/scc index 414a772..a288c89 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 414a7724e2723acb6cd309ff2fb62a38eb1ab6e5 +Subproject commit a288c896f80f68edcde3b2f17fe49e0a31a3afbe diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7004527..cf8aa2f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,6 +9,7 @@ add_subdirectory(configuration) add_subdirectory(configurer) add_subdirectory(sc_fixed_tracing) add_subdirectory(cxs_tlm) +add_subdirectory(sim_speed) if(FULL_TEST_SUITE) add_subdirectory(sim_performance) endif() diff --git a/tests/sim_speed/CMakeLists.txt b/tests/sim_speed/CMakeLists.txt new file mode 100644 index 0000000..8516c5c --- /dev/null +++ b/tests/sim_speed/CMakeLists.txt @@ -0,0 +1,3 @@ +project (sim_speed) +add_executable(${PROJECT_NAME} sc_main.cpp) +target_link_libraries (${PROJECT_NAME} LINK_PUBLIC scc-sysc) diff --git a/tests/sim_speed/sc_main.cpp b/tests/sim_speed/sc_main.cpp new file mode 100644 index 0000000..a9936b7 --- /dev/null +++ b/tests/sim_speed/sc_main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +using namespace sc_core; + +int sc_main(int argc, char* argv[]) { + const uint64_t NS_VAL = 100000000; + + sc_clock clk("clk", 1, SC_NS); + sc_time run_time(NS_VAL, SC_NS); + + auto start = std::chrono::high_resolution_clock::now(); + sc_start(run_time); + auto end = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(end - start); + + double simulated_cycles = (double)NS_VAL; + double real_us = duration.count(); + double speed_Mhz = simulated_cycles / real_us; + std::cout << "Simulation speed: " << speed_Mhz << " MHz\n"; + + return 0; +} From 626e542627b813397b85dbc366c9cfffab4b7d8d Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 28 Mar 2025 07:01:45 +0100 Subject: [PATCH 06/52] adds initial cmake preset for systemc 3.0 --- CMakePresets.json | 11 +++++++++++ scc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index 774d9bb..5fa3a72 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -38,6 +38,17 @@ "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } + },{ + "name": "DebugSC30", + "cacheVariables": { + "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CXX_STANDARD": "17", + "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_PREFIX_PATH": "/opt/shared/systemc/RockyLinux/3.0.1-cxx17" + + } } ] } \ No newline at end of file diff --git a/scc b/scc index a288c89..ca01246 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit a288c896f80f68edcde3b2f17fe49e0a31a3afbe +Subproject commit ca01246f5c1610e8caac0b3a5d0f2e0f36c4761c From d81315f28cb182810ebf66d586fefc0fa5fa1ca3 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 25 May 2025 12:40:19 +0200 Subject: [PATCH 07/52] updates build settings and scc --- .project | 1 + conanfile.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ conanfile.txt | 44 ----------------------------------- scc | 2 +- 4 files changed, 66 insertions(+), 45 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/.project b/.project index 781e2b6..e7ad514 100644 --- a/.project +++ b/.project @@ -28,5 +28,6 @@ org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.python.pydev.pythonNature diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..d187926 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,64 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout +from conan.tools.cmake.toolchain.toolchain import CMakeToolchain +import os + + +class Pkg(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = ( + "CMakeDeps" + ) + default_options = { + "llvm-core/*:targets": "X86", + "boost/*:fPIC": "True", + "boost/*:header_only": "False", + "boost/*:without_contract": "True", + "boost/*:without_fiber": "True", + "boost/*:without_graph": "True", + "boost/*:without_graph_parallel": "True", + "boost/*:without_iostreams": "True", + "boost/*:without_json": "True", + "boost/*:without_locale": "True", + "boost/*:without_log": "True", + "boost/*:without_math": "True", + "boost/*:without_mpi": "True", + "boost/*:without_nowide": "True", + "boost/*:without_python": "True", + "boost/*:without_random": "True", + "boost/*:without_regex": "True", + "boost/*:without_stacktrace": "True", + "boost/*:without_test": "True", + "boost/*:without_timer": "True", + "boost/*:without_type_erasure": "True", + "boost/*:without_wave": "True", + "systemc/*:shared": "True" + } + + def requirements(self): + self.requires("systemc/2.3.4") + self.requires("fmt/8.0.1") + self.requires("spdlog/1.9.2") + self.requires("boost/1.85.0") + self.requires("catch2/3.1.0") + self.requires("lz4/1.9.3") + self.requires("yaml-cpp/0.7.0") + self.requires("jsoncpp/1.9.5") + self.requires("zlib/1.2.12") + self.requires("rapidjson/cci.20230929") + if "WITH_LLVM" in os.environ: + self.requires("llvm-core/19.1.7") + if os.path.isdir("tgc-iss/dbt-rise-plugins"): + self.requires("lua/5.4.3") + + def build_requirements(self): + pass + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.user_presets_path = False + tc.generate() + \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 80c687f..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,44 +0,0 @@ -[requires] -jsoncpp/1.9.5 -yaml-cpp/0.6.3 -spdlog/1.9.2 -fmt/8.0.1 -boost/1.85.0 -gsl-lite/0.37.0 -systemc/2.3.4 -catch2/3.1.0 -zlib/1.2.11 -lz4/1.9.4 -rapidjson/cci.20230929 - -[options] -boost/*:fPIC=True -boost/*:header_only=False -boost/*:without_contract=True -boost/*:without_fiber=True -boost/*:without_graph=True -boost/*:without_graph_parallel=True -boost/*:without_iostreams=True -boost/*:without_json=True -boost/*:without_locale=True -boost/*:without_log=True -boost/*:without_math=True -boost/*:without_mpi=True -boost/*:without_nowide=True -boost/*:without_python=True -boost/*:without_random=True -boost/*:without_regex=True -boost/*:without_stacktrace=True -boost/*:without_test=True -boost/*:without_timer=True -boost/*:without_type_erasure=True -boost/*:without_wave=True -systemc/*:shared=False -systemc/*:disable_virtual_bind=False - -[generators] -CMakeDeps -CMakeToolchain - -[layout] -cmake_layout diff --git a/scc b/scc index ca01246..5824559 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit ca01246f5c1610e8caac0b3a5d0f2e0f36c4761c +Subproject commit 5824559e0d719ff8b259079c6b33ca0154f92ac9 From 4b3bbe0104940ac385a9946493afb174e3b35db4 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 25 May 2025 18:43:42 +0200 Subject: [PATCH 08/52] adds a test for scc::memory --- scc | 2 +- tests/CMakeLists.txt | 1 + tests/tlm_memory/CMakeLists.txt | 8 ++ tests/tlm_memory/memory_test.cpp | 137 +++++++++++++++++++++++++++++++ tests/tlm_memory/testbench.h | 42 ++++++++++ 5 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 tests/tlm_memory/CMakeLists.txt create mode 100644 tests/tlm_memory/memory_test.cpp create mode 100644 tests/tlm_memory/testbench.h diff --git a/scc b/scc index 5824559..2ab9bcd 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 5824559e0d719ff8b259079c6b33ca0154f92ac9 +Subproject commit 2ab9bcda6911387ce53b480072fb345c1f5531cf diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cf8aa2f..8976ad1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,6 +9,7 @@ add_subdirectory(configuration) add_subdirectory(configurer) add_subdirectory(sc_fixed_tracing) add_subdirectory(cxs_tlm) +add_subdirectory(tlm_memory) add_subdirectory(sim_speed) if(FULL_TEST_SUITE) add_subdirectory(sim_performance) diff --git a/tests/tlm_memory/CMakeLists.txt b/tests/tlm_memory/CMakeLists.txt new file mode 100644 index 0000000..ec5fda1 --- /dev/null +++ b/tests/tlm_memory/CMakeLists.txt @@ -0,0 +1,8 @@ +project (tlm_memory) +add_executable(${PROJECT_NAME} + memory_test.cpp + ${test_util_SOURCE_DIR}/sc_main.cpp +) +target_link_libraries (${PROJECT_NAME} PUBLIC scc::components test_util) + +catch_discover_tests(${PROJECT_NAME}) diff --git a/tests/tlm_memory/memory_test.cpp b/tests/tlm_memory/memory_test.cpp new file mode 100644 index 0000000..f07c0cc --- /dev/null +++ b/tests/tlm_memory/memory_test.cpp @@ -0,0 +1,137 @@ + +#include "testbench.h" +#include +#include +#undef CHECK +#include +#include +#include +#include +#include + +using namespace sc_core; +namespace scc { +factory::add tb; + +template void prepare_trans(tlm::tlm_generic_payload& trans, tlm::tlm_command cmd, uint64_t addr, T val) { + unsigned len = cmd == tlm::TLM_IGNORE_COMMAND ? 0 : sizeof(val); + unsigned char* data = len ? new unsigned char[len] : nullptr; + if(cmd == tlm::TLM_WRITE_COMMAND) { + memcpy(data, &val, len); + trans.set_command(cmd); + } + if(cmd == tlm::TLM_READ_COMMAND) { + memset(data, 0, len); + trans.set_command(tlm::TLM_READ_COMMAND); + } + trans.set_address(addr); + trans.set_data_ptr(data); + trans.set_data_length(len); + trans.set_streaming_width(len); + trans.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); +} + +TEST_CASE("simple_read_write_with host memory map", "[memory][tlm-level]") { + auto& dut = factory::get(); + std::array ref_data; + auto val = 256; + for(auto& e : ref_data) + e = --val; + dut.rst.write(true); + sc_start(10 * dut.clk.read()); + dut.rst.write(false); + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + sc_core::sc_time t; + for(uint64_t addr = 0; addr < 1024; addr += sizeof(uint64_t)) { + prepare_trans(gp, tlm::TLM_WRITE_COMMAND, addr, 123456789ULL); + dut.isck->b_transport(gp, t); + delete gp.get_data_ptr(); + sc_start(dut.clk.read()); + } + } + { + tlm::tlm_generic_payload gp; + prepare_trans(gp, tlm::TLM_READ_COMMAND, 256, 0ULL); + sc_core::sc_time t; + dut.isck->b_transport(gp, t); + uint64_t res; + memcpy(&res, gp.get_data_ptr(), sizeof(uint64_t)); + REQUIRE(res == 123456789ULL); + delete gp.get_data_ptr(); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + gp.set_command(tlm::TLM_IGNORE_COMMAND); + gp.set_address(256); + gp.set_data_ptr(nullptr); + gp.set_data_length(256); + gp.set_streaming_width(256); + gp.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); + auto ext = new scc::host_mem_map_extension(ref_data.data()); + gp.set_extension(ext); + dut.isck->transport_dbg(gp); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + prepare_trans(gp, tlm::TLM_READ_COMMAND, 256, 0ULL); + sc_core::sc_time t; + dut.isck->b_transport(gp, t); + uint64_t res; + memcpy(&res, gp.get_data_ptr(), sizeof(uint64_t)); + REQUIRE(res == 0xf8f9fafbfcfdfeffULL); + delete gp.get_data_ptr(); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + prepare_trans(gp, tlm::TLM_READ_COMMAND, 384, 0ULL); + sc_core::sc_time t; + dut.isck->b_transport(gp, t); + uint64_t res; + memcpy(&res, gp.get_data_ptr(), sizeof(uint64_t)); + REQUIRE(res == 0x78797a7b7c7d7e7fULL); + delete gp.get_data_ptr(); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + gp.set_command(tlm::TLM_IGNORE_COMMAND); + gp.set_address(256); + gp.set_data_ptr(nullptr); + gp.set_data_length(256); + gp.set_streaming_width(256); + gp.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); + auto ext = new scc::host_mem_map_extension(nullptr); + gp.set_extension(ext); + dut.isck->transport_dbg(gp); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + prepare_trans(gp, tlm::TLM_READ_COMMAND, 256, 0ULL); + sc_core::sc_time t; + dut.isck->b_transport(gp, t); + uint64_t res; + memcpy(&res, gp.get_data_ptr(), sizeof(uint64_t)); + REQUIRE(res == 123456789ULL); + delete gp.get_data_ptr(); + } + sc_start(dut.clk.read()); + { + tlm::tlm_generic_payload gp; + prepare_trans(gp, tlm::TLM_READ_COMMAND, 256, 0ULL); + sc_core::sc_time t; + dut.isck->b_transport(gp, t); + uint64_t res; + memcpy(&res, gp.get_data_ptr(), sizeof(uint64_t)); + REQUIRE(res == 123456789ULL); + delete gp.get_data_ptr(); + } + sc_start(dut.clk.read()); +} + +} // namespace scc diff --git a/tests/tlm_memory/testbench.h b/tests/tlm_memory/testbench.h new file mode 100644 index 0000000..4f0b721 --- /dev/null +++ b/tests/tlm_memory/testbench.h @@ -0,0 +1,42 @@ +#ifndef _TESTBENCH_H_ +#define _TESTBENCH_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace sc_core; +using namespace sc_dt; +using namespace std; +namespace scc { + +const char* sc_gen_unique_name(const char*, bool preserve_first); +struct testbench : public sc_core::sc_module { + + using transaction_type = tlm::tlm_base_protocol_types::tlm_payload_type; + using phase_type = tlm::tlm_base_protocol_types::tlm_phase_type; + + sc_core::sc_signal clk{"clk"}; + sc_core::sc_signal rst{"rst"}; + tlm::scc::initiator_mixin> isck{"isck"}; + scc::memory_tl<1_kB, scc::LT> mem{"mem"}; + + testbench() + : testbench(sc_core::sc_gen_unique_name("testbench", false)) {} + + testbench(sc_core::sc_module_name const& nm) + : sc_module(nm) { + isck(mem.target); + mem.clk_i(clk); + } + void start_of_simulation() { clk = 10_ns; } +}; +} // namespace scc +#endif // _TESTBENCH_H_ From 633a05c26591794d1b0e5098473555cf2227b7d3 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 25 May 2025 21:24:47 +0200 Subject: [PATCH 09/52] adds launch configs --- .launch/ace_pin_level.launch | 33 ++++++++++++++++ ...hb_pin_level ahb_delayed_read_write.launch | 38 +++++++++++++++++++ ...ahb_pin_level ahb_narrow_read_write.launch | 38 +++++++++++++++++++ .launch/ahb_pin_level ahb_read_write.launch | 38 +++++++++++++++++++ ...apb_pin_level apb_narrow_read_write.launch | 38 +++++++++++++++++++ .launch/apb_pin_level.launch | 37 ++++++++++++++++++ .../axi4_pin_level axi4_narrow_burst.launch | 37 ++++++++++++++++++ .launch/axi4_pin_level.launch | 37 ++++++++++++++++++ .launch/configurer.launch | 34 +++++++++++++++++ .launch/cxs_tlm.launch | 37 ++++++++++++++++++ .launch/sc_fixed_tracing.launch | 33 ++++++++++++++++ .launch/sim_performance.launch | 32 ++++++++++++++++ .launch/transaction_recording.launch | 33 ++++++++++++++++ 13 files changed, 465 insertions(+) create mode 100644 .launch/ace_pin_level.launch create mode 100644 .launch/ahb_pin_level ahb_delayed_read_write.launch create mode 100644 .launch/ahb_pin_level ahb_narrow_read_write.launch create mode 100644 .launch/ahb_pin_level ahb_read_write.launch create mode 100644 .launch/apb_pin_level apb_narrow_read_write.launch create mode 100644 .launch/apb_pin_level.launch create mode 100644 .launch/axi4_pin_level axi4_narrow_burst.launch create mode 100644 .launch/axi4_pin_level.launch create mode 100644 .launch/configurer.launch create mode 100644 .launch/cxs_tlm.launch create mode 100644 .launch/sc_fixed_tracing.launch create mode 100644 .launch/sim_performance.launch create mode 100644 .launch/transaction_recording.launch diff --git a/.launch/ace_pin_level.launch b/.launch/ace_pin_level.launch new file mode 100644 index 0000000..979107a --- /dev/null +++ b/.launch/ace_pin_level.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/ahb_pin_level ahb_delayed_read_write.launch b/.launch/ahb_pin_level ahb_delayed_read_write.launch new file mode 100644 index 0000000..a53fcee --- /dev/null +++ b/.launch/ahb_pin_level ahb_delayed_read_write.launch @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/ahb_pin_level ahb_narrow_read_write.launch b/.launch/ahb_pin_level ahb_narrow_read_write.launch new file mode 100644 index 0000000..89a8e15 --- /dev/null +++ b/.launch/ahb_pin_level ahb_narrow_read_write.launch @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/ahb_pin_level ahb_read_write.launch b/.launch/ahb_pin_level ahb_read_write.launch new file mode 100644 index 0000000..3d4c9d6 --- /dev/null +++ b/.launch/ahb_pin_level ahb_read_write.launch @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/apb_pin_level apb_narrow_read_write.launch b/.launch/apb_pin_level apb_narrow_read_write.launch new file mode 100644 index 0000000..d125e6e --- /dev/null +++ b/.launch/apb_pin_level apb_narrow_read_write.launch @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/apb_pin_level.launch b/.launch/apb_pin_level.launch new file mode 100644 index 0000000..af0bb0f --- /dev/null +++ b/.launch/apb_pin_level.launch @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/axi4_pin_level axi4_narrow_burst.launch b/.launch/axi4_pin_level axi4_narrow_burst.launch new file mode 100644 index 0000000..cccfb97 --- /dev/null +++ b/.launch/axi4_pin_level axi4_narrow_burst.launch @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/axi4_pin_level.launch b/.launch/axi4_pin_level.launch new file mode 100644 index 0000000..833d933 --- /dev/null +++ b/.launch/axi4_pin_level.launch @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/configurer.launch b/.launch/configurer.launch new file mode 100644 index 0000000..96b0a61 --- /dev/null +++ b/.launch/configurer.launch @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/cxs_tlm.launch b/.launch/cxs_tlm.launch new file mode 100644 index 0000000..403e3df --- /dev/null +++ b/.launch/cxs_tlm.launch @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/sc_fixed_tracing.launch b/.launch/sc_fixed_tracing.launch new file mode 100644 index 0000000..afe8bbc --- /dev/null +++ b/.launch/sc_fixed_tracing.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/sim_performance.launch b/.launch/sim_performance.launch new file mode 100644 index 0000000..85d34c7 --- /dev/null +++ b/.launch/sim_performance.launch @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.launch/transaction_recording.launch b/.launch/transaction_recording.launch new file mode 100644 index 0000000..92cc9d6 --- /dev/null +++ b/.launch/transaction_recording.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 22a8890f74a99a427e82f3202d4773e86bd71397 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Aug 2025 07:39:28 +0200 Subject: [PATCH 10/52] updates scc and adds scc::memory tests --- CMakeLists.txt | 2 +- conanfile.py | 5 +- scc | 2 +- tests/CMakeLists.txt | 1 + tests/cxs_tlm/testbench.h | 2 +- tests/memory_subsys/CMakeLists.txt | 8 ++++ tests/memory_subsys/memory_test.cpp | 72 +++++++++++++++++++++++++++++ tests/memory_subsys/testbench.h | 60 ++++++++++++++++++++++++ 8 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 tests/memory_subsys/CMakeLists.txt create mode 100644 tests/memory_subsys/memory_test.cpp create mode 100644 tests/memory_subsys/testbench.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 30fb7c7..8be6969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ include(CTest) include(Catch) enable_testing() - +set(WITH_SCP4SCC ON) add_subdirectory(scc) add_subdirectory(src) add_subdirectory(tests) diff --git a/conanfile.py b/conanfile.py index d187926..9be5614 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,7 +10,7 @@ class Pkg(ConanFile): "CMakeDeps" ) default_options = { - "llvm-core/*:targets": "X86", + "systemc/*:shared": "True", "boost/*:fPIC": "True", "boost/*:header_only": "False", "boost/*:without_contract": "True", @@ -32,7 +32,6 @@ class Pkg(ConanFile): "boost/*:without_timer": "True", "boost/*:without_type_erasure": "True", "boost/*:without_wave": "True", - "systemc/*:shared": "True" } def requirements(self): @@ -46,8 +45,6 @@ class Pkg(ConanFile): self.requires("jsoncpp/1.9.5") self.requires("zlib/1.2.12") self.requires("rapidjson/cci.20230929") - if "WITH_LLVM" in os.environ: - self.requires("llvm-core/19.1.7") if os.path.isdir("tgc-iss/dbt-rise-plugins"): self.requires("lua/5.4.3") diff --git a/scc b/scc index 2ab9bcd..c853691 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 2ab9bcda6911387ce53b480072fb345c1f5531cf +Subproject commit c8536918fe9ee8d83d339702c441cea28bae6b61 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8976ad1..0982470 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(configurer) add_subdirectory(sc_fixed_tracing) add_subdirectory(cxs_tlm) add_subdirectory(tlm_memory) +add_subdirectory(memory_subsys) add_subdirectory(sim_speed) if(FULL_TEST_SUITE) add_subdirectory(sim_performance) diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 00d99b9..5ef8617 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -29,7 +29,7 @@ template struct testbench : public sc_core::sc_module { cxs_transmitter tx{"tx"}; cxs_channel cxs_chan{"cxs_chan"}; cxs_receiver rx{"rx"}; - tlm::nw::target_mixin, cxs_packet_types> tsck{"tsck"}; + tlm::nw::target_mixin, false, cxs_packet_types> tsck{"tsck"}; testbench() : testbench(sc_core::sc_gen_unique_name("testbench", false)) {} diff --git a/tests/memory_subsys/CMakeLists.txt b/tests/memory_subsys/CMakeLists.txt new file mode 100644 index 0000000..dcb948a --- /dev/null +++ b/tests/memory_subsys/CMakeLists.txt @@ -0,0 +1,8 @@ +project (memory_subsys) +add_executable(${PROJECT_NAME} + memory_test.cpp + ${test_util_SOURCE_DIR}/sc_main.cpp +) +target_link_libraries (${PROJECT_NAME} PUBLIC scc::components test_util) + +catch_discover_tests(${PROJECT_NAME}) diff --git a/tests/memory_subsys/memory_test.cpp b/tests/memory_subsys/memory_test.cpp new file mode 100644 index 0000000..e5ac162 --- /dev/null +++ b/tests/memory_subsys/memory_test.cpp @@ -0,0 +1,72 @@ + +#include "testbench.h" +#include +#include +#undef CHECK +#include +#include +#include +#include +#include + +using namespace sc_core; +namespace scc { +factory::add tb; + +template void prepare_trans(tlm::tlm_generic_payload& trans, tlm::tlm_command cmd, uint64_t addr, T val) { + unsigned len = cmd == tlm::TLM_IGNORE_COMMAND ? 0 : sizeof(val); + unsigned char* data = len ? new unsigned char[len] : nullptr; + if(cmd == tlm::TLM_WRITE_COMMAND) { + memcpy(data, &val, len); + trans.set_command(cmd); + } + if(cmd == tlm::TLM_READ_COMMAND) { + memset(data, 0, len); + trans.set_command(tlm::TLM_READ_COMMAND); + } + trans.set_address(addr); + trans.set_data_ptr(data); + trans.set_data_length(len); + trans.set_streaming_width(len); + trans.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); +} + +template +void do_dmi_access(T& isck, uint64_t address, uint64_t expected_size) { + tlm::tlm_generic_payload gp; + tlm::tlm_dmi dmi; + gp.set_address(address); + auto res = isck->get_direct_mem_ptr(gp, dmi); + REQUIRE(res == true); + REQUIRE(dmi.get_start_address() == address); + REQUIRE(dmi.get_end_address() == (address + expected_size-1)); + REQUIRE(dmi.is_read_write_allowed()); +} + +TEST_CASE("simple_read_write_with host memory map", "[memory][tlm-level]") { + auto& dut = factory::get(); + std::array ref_data; + auto val = 256; + for(auto& e : ref_data) + e = --val; + dut.rst.write(true); + sc_start(10 * dut.clk.read()); + dut.rst.write(false); + sc_start(dut.clk.read()); + + do_dmi_access(dut.isck0, 0, 1_kB); + do_dmi_access(dut.isck0, 1_kB, 1_kB); + do_dmi_access(dut.isck0, 16_MB, 16_MB); + do_dmi_access(dut.isck0, 32_MB, 16_MB); + do_dmi_access(dut.isck0, 48_MB, 4_MB); + do_dmi_access(dut.isck0, 64_MB, 16_MB); + do_dmi_access(dut.isck0, 80_MB, 4_MB); + do_dmi_access(dut.isck1, 0 - 1_MB, 1_kB); + do_dmi_access(dut.isck1, 1_kB - 1_MB, 1_kB); + do_dmi_access(dut.isck1, 16_MB - 1_MB, 16_MB); + do_dmi_access(dut.isck1, 32_MB - 1_MB, 16_MB); + do_dmi_access(dut.isck1, 48_MB - 1_MB, 4_MB); + sc_start(dut.clk.read()); +} + +} // namespace scc diff --git a/tests/memory_subsys/testbench.h b/tests/memory_subsys/testbench.h new file mode 100644 index 0000000..363e1df --- /dev/null +++ b/tests/memory_subsys/testbench.h @@ -0,0 +1,60 @@ +#ifndef _TESTBENCH_H_ +#define _TESTBENCH_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace sc_core; +using namespace sc_dt; +using namespace std; +namespace scc { + +const char* sc_gen_unique_name(const char*, bool preserve_first); +struct testbench : public sc_core::sc_module { + + using transaction_type = tlm::tlm_base_protocol_types::tlm_payload_type; + using phase_type = tlm::tlm_base_protocol_types::tlm_phase_type; + + sc_core::sc_signal clk{"clk"}; + sc_core::sc_signal rst{"rst"}; + tlm::scc::initiator_mixin> isck0{"isck0"}; + tlm::scc::initiator_mixin> isck1{"isck1"}; + scc::router router{"router", 5, 2}; + scc::memory_tl<1_kB, scc::LT> mem0{"mem0"}; + scc::memory_tl<1_kB, scc::LT> mem1{"mem1"}; + scc::memory_tl<18_MB, scc::LT> mem2{"mem2"}; + scc::memory_tl<24_MB, scc::LT> mem3{"mem3"}; + scc::memory_tl<88_MB, scc::LT> mem4{"mem4"}; + + testbench() + : testbench(sc_core::sc_gen_unique_name("testbench", false)) {} + + testbench(sc_core::sc_module_name const& nm) + : sc_module(nm) { + isck0(router.target[0]); + isck1(router.target[1]); + router.set_initiator_base(1, 1_MB); + router.bind_target(mem0.target, 0, 0, 1_kB); + router.bind_target(mem1.target, 1, 1_kB, 1_kB); + router.bind_target(mem2.target, 2, 16_MB, 16_MB); + router.bind_target(mem3.target, 3, 32_MB, 20_MB); + router.bind_target(mem4.target, 4, 64_MB, 20_MB, false); + mem0.clk_i(clk); + mem1.clk_i(clk); + mem2.clk_i(clk); + mem3.clk_i(clk); + mem4.clk_i(clk); + } + void start_of_simulation() { clk = 10_ns; } +}; +} // namespace scc +#endif // _TESTBENCH_H_ From 6b93f2a06575e0d15ff0621f23569f33fcbc9f5b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Aug 2025 07:40:47 +0200 Subject: [PATCH 11/52] updates scc with fixed scc::router --- .launch/memory_subsys.launch | 37 ++++++++++++++++++++++++++++++++++++ scc | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .launch/memory_subsys.launch diff --git a/.launch/memory_subsys.launch b/.launch/memory_subsys.launch new file mode 100644 index 0000000..ec418dc --- /dev/null +++ b/.launch/memory_subsys.launch @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scc b/scc index c853691..1b44e14 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit c8536918fe9ee8d83d339702c441cea28bae6b61 +Subproject commit 1b44e143ffbfee93a7a53c0ac06cda11c46b4155 From 635a8674eeb790c5bc24a94843ac2b48758fdac5 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Aug 2025 07:47:40 +0200 Subject: [PATCH 12/52] puts version constraint to cmake --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b7d8b70..44a40ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ conan>=2.0 -cmake +cmake<4.0 clang-format==14.0 \ No newline at end of file From 2d92aabc2b909010a585dcec8122b4e6e31578ea Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Aug 2025 07:52:45 +0200 Subject: [PATCH 13/52] applies clang-format --- scc | 2 +- tests/memory_subsys/memory_test.cpp | 5 ++--- tests/memory_subsys/testbench.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scc b/scc index 1b44e14..7a5fd95 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 1b44e143ffbfee93a7a53c0ac06cda11c46b4155 +Subproject commit 7a5fd95c58765b3e3db8666842f3c8ae748fac60 diff --git a/tests/memory_subsys/memory_test.cpp b/tests/memory_subsys/memory_test.cpp index e5ac162..d0e50f8 100644 --- a/tests/memory_subsys/memory_test.cpp +++ b/tests/memory_subsys/memory_test.cpp @@ -31,15 +31,14 @@ template void prepare_trans(tlm::tlm_generic_payload& trans, tlm::t trans.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE); } -template -void do_dmi_access(T& isck, uint64_t address, uint64_t expected_size) { +template void do_dmi_access(T& isck, uint64_t address, uint64_t expected_size) { tlm::tlm_generic_payload gp; tlm::tlm_dmi dmi; gp.set_address(address); auto res = isck->get_direct_mem_ptr(gp, dmi); REQUIRE(res == true); REQUIRE(dmi.get_start_address() == address); - REQUIRE(dmi.get_end_address() == (address + expected_size-1)); + REQUIRE(dmi.get_end_address() == (address + expected_size - 1)); REQUIRE(dmi.is_read_write_allowed()); } diff --git a/tests/memory_subsys/testbench.h b/tests/memory_subsys/testbench.h index 363e1df..3ec7cb1 100644 --- a/tests/memory_subsys/testbench.h +++ b/tests/memory_subsys/testbench.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include #include #include #include From caafa19f441e40f4ae7cbaaeacf076644c3512b6 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Aug 2025 08:00:41 +0200 Subject: [PATCH 14/52] fixes memory_subsys test name --- tests/memory_subsys/memory_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/memory_subsys/memory_test.cpp b/tests/memory_subsys/memory_test.cpp index d0e50f8..b81109e 100644 --- a/tests/memory_subsys/memory_test.cpp +++ b/tests/memory_subsys/memory_test.cpp @@ -42,7 +42,7 @@ template void do_dmi_access(T& isck, uint64_t address, uint64_t exp REQUIRE(dmi.is_read_write_allowed()); } -TEST_CASE("simple_read_write_with host memory map", "[memory][tlm-level]") { +TEST_CASE("dmi_access", "[memory][tlm-level]") { auto& dut = factory::get(); std::array ref_data; auto val = 256; From 5f039ab457d78b61097d38b76753e08ce6f7517b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Sep 2025 08:36:02 +0200 Subject: [PATCH 15/52] cleans project setup --- .vscode/extensions.json | 16 +++ .vscode/launch.json | 25 ++--- .vscode/settings.json | 30 ++++++ .vscode/tasks.json | 16 --- CMakePresets.json | 42 +++----- cmake/GetGitRevisionDescription.cmake | 130 ----------------------- cmake/GetGitRevisionDescription.cmake.in | 41 ------- cmake/PackageConfigurator.cmake | 44 -------- cmake/Submodules.cmake | 57 ---------- 9 files changed, 74 insertions(+), 327 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json delete mode 100644 cmake/GetGitRevisionDescription.cmake delete mode 100644 cmake/GetGitRevisionDescription.cmake.in delete mode 100644 cmake/PackageConfigurator.cmake delete mode 100644 cmake/Submodules.cmake diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ff64ab2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,16 @@ +{ + "recommendations": [ + "mkhl.direnv", + "sanaajani.taskrunnercode", + "ms-vscode.cpptools-themes", + "cnshenj.vscode-task-manager", + "twxs.cmake", + "kylinideteam.cmake-intellisence", + "kylinideteam.kylin-cmake-tools", + "llvm-vs-code-extensions.vscode-clangd", + "eclipse-cdt.cdt-gdb-vscode", + "eclipse-cdt.memory-inspector", + "eclipse-cdt.peripheral-inspector", + "ms-python.python" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index fc26538..ea0ead0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,21 +5,18 @@ "version": "0.2.0", "configurations": [{ "name": "cci_param_restricted", - "type": "cppdbg", + "type": "gdb", "request": "launch", "cwd": "${workspaceRoot}", - "program": "${workspaceRoot}/build/tests/cci_param_restricted/cci_param_restricted", - "linux": { - "MIMode": "gdb", - "miDebuggerPath": "/usr/bin/gdb" - }, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], + "program": "${workspaceRoot}/build/Debug/tests/cci_param_restricted/cci_param_restricted", "preLaunchTask": "CMake: build" - }] + },{ + "name": "dmi_access", + "type": "gdb", + "request": "launch", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/build/Debug/tests/memory_subsys/memory_subsys", + "preLaunchTask": "CMake: build" + } + ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7287207 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "editor.rulers": [ + { + "column": 140, + "comment": "clang-format" + } + ], + "clangd.arguments": [ + "--pretty", + "--background-index", + "--compile-commands-dir=${workspaceFolder}/build" + ], + "cmake.buildDirectory" : "${workspaceRoot}/build/${buildType}", + "cmake.configureArgs": ["-B", "${workspaceRoot}/build/${buildType}"], + "cmake.configureOnOpen": false, + "cmake.configureOnEdit": true, + "cmake.autoSelectActiveFolder": true, + "cmake.exportCompileCommandsFile": true, + "cmake.skipConfigureIfCachePresent": false, + "cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", + "cmake.options.statusBarVisibility": "hidden", + "cmake.options.advanced": { + "configure": {"projectStatusVisibility": "visible"}, + "build": {"statusBarVisibility": "visible"} + }, + "todo-tree.ripgrep.ripgrep": "/bin/rg", + "files.watcherExclude": { + "**/build": true + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 8714fea..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "cmake", - "label": "CMake: build", - "command": "build", - "targets": [ - "all" - ], - "group": "build", - "problemMatcher": ["$gcc"], - "detail": "CMake template build task", - } - ] -} \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 5fa3a72..91e39fa 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -9,45 +9,37 @@ "patch": 0 }, "configurePresets": [ - { - "name": "Debug", + { + "name": "Base", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_BUILD_TYPE": "Debug", "CMAKE_CXX_STANDARD": "17", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + "CONAN_BUILD_PROFILE": "auto-cmake", + "WITH_TCC": "OFF" + } + }, + { + "name": "Debug", + "inherits": "Base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" } }, { "name": "RelWithDebInfo", "cacheVariables": { - "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { "name": "Release", "cacheVariables": { - "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" - } - },{ - "name": "DebugSC30", - "cacheVariables": { - "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_STANDARD": "17", - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_PREFIX_PATH": "/opt/shared/systemc/RockyLinux/3.0.1-cxx17" - + "CMAKE_BUILD_TYPE": "Release" } } ] diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake deleted file mode 100644 index bcd1d72..0000000 --- a/cmake/GetGitRevisionDescription.cmake +++ /dev/null @@ -1,130 +0,0 @@ -# - Returns a version string from Git -# -# These functions force a re-configure on each git commit so that you can -# trust the values of the variables in your build system. -# -# get_git_head_revision( [ ...]) -# -# Returns the refspec and sha hash of the current head revision -# -# git_describe( [ ...]) -# -# Returns the results of git describe on the source tree, and adjusting -# the output so that it tests false if an error occurs. -# -# git_get_exact_tag( [ ...]) -# -# Returns the results of git describe --exact-match on the source tree, -# and adjusting the output so that it tests false if there was no exact -# matching tag. -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -if(__get_git_revision_description) - return() -endif() -set(__get_git_revision_description YES) - -# We must run the following at "include" time, not at function call time, -# to find the path to this module rather than the path to a calling list file -get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) - -function(get_git_head_revision _refspecvar _hashvar) - set(GIT_PARENT_DIR "${CMAKE_CURRENT_LIST_DIR}") - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories - set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") - get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) - # We have reached the root directory, we are not in git - set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - endwhile() - # check if this is a submodule - if(NOT IS_DIRECTORY ${GIT_DIR}) - file(READ ${GIT_DIR} submodule) - string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) - get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) - get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) - endif() - set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() - - if(NOT EXISTS "${GIT_DIR}/HEAD") - return() - endif() - set(HEAD_FILE "${GIT_DATA}/HEAD") - configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") - - set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) -endfunction() - -function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() - - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() - - #message(STATUS "Arguments to execute_process: ${ARGN}") - - execute_process(COMMAND - "${GIT_EXECUTABLE}" - describe - ${hash} - ${ARGN} - WORKING_DIRECTORY - "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() - - set(${_var} "${out}" PARENT_SCOPE) -endfunction() - -function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) -endfunction() diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in deleted file mode 100644 index 6d8b708..0000000 --- a/cmake/GetGitRevisionDescription.cmake.in +++ /dev/null @@ -1,41 +0,0 @@ -# -# Internal file for GetGitRevisionDescription.cmake -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -set(HEAD_HASH) - -file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) - -string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) -if(HEAD_CONTENTS MATCHES "ref") - # named branch - string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") - if(EXISTS "@GIT_DIR@/${HEAD_REF}") - configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) - else() - configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) - file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) - if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") - set(HEAD_HASH "${CMAKE_MATCH_1}") - endif() - endif() -else() - # detached HEAD - configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) -endif() - -if(NOT HEAD_HASH) - file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) - string(STRIP "${HEAD_HASH}" HEAD_HASH) -endif() diff --git a/cmake/PackageConfigurator.cmake b/cmake/PackageConfigurator.cmake deleted file mode 100644 index b67615d..0000000 --- a/cmake/PackageConfigurator.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Create package-config files : -# - ConfigVersion.cmake -# - Config.cmake -# They are installed in lib/cmake/. -# -# Required variables : -# - VERSION -# - PROJECT_NAME -# - -# Include needed for 'write_basic_package_version_file' -include(CMakePackageConfigHelpers) - -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${VERSION} - COMPATIBILITY AnyNewerVersion -) - -configure_file(cmake/${PROJECT_NAME}Config.cmake - "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake" - COPYONLY -) - -# Destination -set(config_install_dir lib/cmake/${PROJECT_NAME}) - -# Config installation -# * /lib/cmake//Targets.cmake -install( - EXPORT ${PROJECT_NAME}Targets - DESTINATION ${config_install_dir} -) - -# Config installation -# * /lib/cmake//Config.cmake -# * /lib/cmake//ConfigVersion.cmake -install( - FILES - cmake/${PROJECT_NAME}Config.cmake - "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake" - DESTINATION ${config_install_dir} - COMPONENT devel -) \ No newline at end of file diff --git a/cmake/Submodules.cmake b/cmake/Submodules.cmake deleted file mode 100644 index 0d1b89d..0000000 --- a/cmake/Submodules.cmake +++ /dev/null @@ -1,57 +0,0 @@ -if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules") -message(STATUS "Updating submodules to their latest/fixed versions") -message(STATUS "(this can take a while, please be patient)") - -### First, get all submodules in -if(${GIT_SUBMODULES_CHECKOUT_QUIET}) - execute_process( - COMMAND git submodule update --init --recursive - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_QUIET - ERROR_QUIET - ) -else() - execute_process( - COMMAND git submodule update --init --recursive - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - ) -endif() - -### Then, checkout each submodule to the specified commit -# Note: Execute separate processes here, to make sure each one is run, -# should one crash (because of branch not existing, this, that ... whatever) -foreach(GIT_SUBMODULE ${GIT_SUBMODULES}) - - if( "${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}" STREQUAL "" ) - message(STATUS "no specific version given for submodule ${GIT_SUBMODULE}, checking out master") - if( "${GIT_SUBMODULE_BRANCH_${GIT_SUBMODULE}}" STREQUAL "" ) - set(GIT_SUBMODULE_VERSION_${GIT_SUBMODULE} "master") - else() - set(GIT_SUBMODULE_VERSION_${GIT_SUBMODULE} ${GIT_SUBMODULE_BRANCH_${GIT_SUBMODULE}}) - endif() - endif() - - if( "${GIT_SUBMODULE_DIR_${GIT_SUBMODULE}}" STREQUAL "" ) - set(GIT_SUBMODULES_DIRECTORY external) - else() - set(GIT_SUBMODULES_DIRECTORY ${GIT_SUBMODULE_DIR_${GIT_SUBMODULE}}) - endif() - - if(${GIT_SUBMODULES_CHECKOUT_QUIET}) - execute_process( - COMMAND git checkout ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE} - OUTPUT_QUIET - ERROR_QUIET - ) - else() - message(STATUS "checking out ${GIT_SUBMODULE}'s commit/tag ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}}") - execute_process( - COMMAND git checkout ${GIT_SUBMODULE_VERSION_${GIT_SUBMODULE}} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${GIT_SUBMODULES_DIRECTORY}/${GIT_SUBMODULE} - ) - endif() - -endforeach(${GIT_SUBMODULE}) - -endif() From 821f343a9b38d1809308f00b1803741156116e69 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Sep 2025 08:36:23 +0200 Subject: [PATCH 16/52] adds test for router default target DMI behavior --- scc | 2 +- tests/memory_subsys/memory_test.cpp | 1 + tests/memory_subsys/testbench.h | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scc b/scc index 7a5fd95..50de0c5 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 7a5fd95c58765b3e3db8666842f3c8ae748fac60 +Subproject commit 50de0c564ab314e385793e2a96b61d028f5cbdea diff --git a/tests/memory_subsys/memory_test.cpp b/tests/memory_subsys/memory_test.cpp index b81109e..81eec6e 100644 --- a/tests/memory_subsys/memory_test.cpp +++ b/tests/memory_subsys/memory_test.cpp @@ -65,6 +65,7 @@ TEST_CASE("dmi_access", "[memory][tlm-level]") { do_dmi_access(dut.isck1, 16_MB - 1_MB, 16_MB); do_dmi_access(dut.isck1, 32_MB - 1_MB, 16_MB); do_dmi_access(dut.isck1, 48_MB - 1_MB, 4_MB); + do_dmi_access(dut.isck0, 128_MB, 16_MB); sc_start(dut.clk.read()); } diff --git a/tests/memory_subsys/testbench.h b/tests/memory_subsys/testbench.h index 3ec7cb1..d0e6fc8 100644 --- a/tests/memory_subsys/testbench.h +++ b/tests/memory_subsys/testbench.h @@ -28,12 +28,13 @@ struct testbench : public sc_core::sc_module { sc_core::sc_signal rst{"rst"}; tlm::scc::initiator_mixin> isck0{"isck0"}; tlm::scc::initiator_mixin> isck1{"isck1"}; - scc::router router{"router", 5, 2}; + scc::router router{"router", 6, 2}; scc::memory_tl<1_kB, scc::LT> mem0{"mem0"}; scc::memory_tl<1_kB, scc::LT> mem1{"mem1"}; scc::memory_tl<18_MB, scc::LT> mem2{"mem2"}; scc::memory_tl<24_MB, scc::LT> mem3{"mem3"}; scc::memory_tl<88_MB, scc::LT> mem4{"mem4"}; + scc::memory<4_GB> mem5{"mem5"}; testbench() : testbench(sc_core::sc_gen_unique_name("testbench", false)) {} @@ -48,6 +49,8 @@ struct testbench : public sc_core::sc_module { router.bind_target(mem2.target, 2, 16_MB, 16_MB); router.bind_target(mem3.target, 3, 32_MB, 20_MB); router.bind_target(mem4.target, 4, 64_MB, 20_MB, false); + router.initiator[5].bind(mem5.target); + router.set_default_target(5); mem0.clk_i(clk); mem1.clk_i(clk); mem2.clk_i(clk); From e5f1e6442512ea6d8091623233c524deb3ea9e38 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Sep 2025 08:42:34 +0200 Subject: [PATCH 17/52] fixes preset definition --- CMakePresets.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index 91e39fa..62421df 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -32,12 +32,14 @@ }, { "name": "RelWithDebInfo", + "inherits": "Base", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { "name": "Release", + "inherits": "Base", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } From 87d89b822b6624f4d37e28748856b029a34f86cc Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Sep 2025 08:44:57 +0200 Subject: [PATCH 18/52] removes unused cmake defines and updates cmake-conan --- CMakePresets.json | 3 +-- cmake-conan | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 62421df..af42dd0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -19,8 +19,7 @@ "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CONAN_BUILD_PROFILE": "auto-cmake", - "WITH_TCC": "OFF" + "CONAN_BUILD_PROFILE": "auto-cmake" } }, { diff --git a/cmake-conan b/cmake-conan index c22bbf0..b0e4d1e 160000 --- a/cmake-conan +++ b/cmake-conan @@ -1 +1 @@ -Subproject commit c22bbf0af0b73d5f0def24a9cdf4ce503ae79e5d +Subproject commit b0e4d1ec08edb35ef31033938567d621f6643c17 From 572b4a2b27743e662a0030d9aa3cd5415172f088 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 12 Sep 2025 12:31:12 +0200 Subject: [PATCH 19/52] adds test preset and updates README.md --- .vscode/settings.json | 1 + CMakePresets.json | 10 +++++++++- README.md | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7287207..9ce5386 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,6 +5,7 @@ "comment": "clang-format" } ], + "editor.formatOnSave": true, "clangd.arguments": [ "--pretty", "--background-index", diff --git a/CMakePresets.json b/CMakePresets.json index af42dd0..084dea5 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -9,7 +9,7 @@ "patch": 0 }, "configurePresets": [ - { + { "name": "Base", "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", @@ -43,5 +43,13 @@ "CMAKE_BUILD_TYPE": "Release" } } + ], + "testPresets": [ + { + "name": "test-all", + "description": "run all test with Debug build", + "displayName": "", + "configurePreset": "Debug" + } ] } \ No newline at end of file diff --git a/README.md b/README.md index 98bb81b..a572179 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ In Console: python3 -mvenv .venv . .venv/bin/activate pip3 install -r requirements.txt - cmake -S . -B build --preset Release - cmake --build build -j30 - cmake --build build --target test + cmake --preset Release + cmake --build build/Release -j30 + cmake --build build/Release --target test \ No newline at end of file From 73e4d5d644870af3acdcb7cc72d14e6e66a3e569 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 22 Sep 2025 11:54:46 +0200 Subject: [PATCH 20/52] extends cxs_tlm test to support tracing --- .envrc | 6 +++- .gitignore | 1 + .vscode/launch.json | 56 ++++++++++++++++++++----------- .vscode/settings.json | 12 ++++--- Modulefile | 17 ---------- scc | 2 +- src/sc_main.cpp | 3 ++ tests/cxs_tlm/csx_packet_test.cpp | 2 +- tests/cxs_tlm/testbench.h | 17 +++++++++- 9 files changed, 71 insertions(+), 45 deletions(-) delete mode 100644 Modulefile diff --git a/.envrc b/.envrc index 488f293..4460a8b 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,8 @@ -module load ./Modulefile +module load tools/utilities +module load tools/cmake/3.28 +module load tools/clang/14.0 +module load tools/vscode + distro=`/bin/lsb_release -i -s` if [ $distro == "CentOS" ]; then . /opt/rh/devtoolset-8/enable diff --git a/.gitignore b/.gitignore index ffab976..65c3b47 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ /.venv/ /.cache /CMakeUserPresets.json +*.scview diff --git a/.vscode/launch.json b/.vscode/launch.json index ea0ead0..61973d6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,22 +1,38 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [{ - "name": "cci_param_restricted", - "type": "gdb", - "request": "launch", - "cwd": "${workspaceRoot}", - "program": "${workspaceRoot}/build/Debug/tests/cci_param_restricted/cci_param_restricted", - "preLaunchTask": "CMake: build" - },{ - "name": "dmi_access", - "type": "gdb", - "request": "launch", - "cwd": "${workspaceRoot}", - "program": "${workspaceRoot}/build/Debug/tests/memory_subsys/memory_subsys", - "preLaunchTask": "CMake: build" - } - ] + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "cci_param_restricted", + "type": "gdb", + "request": "launch", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/build/Debug/tests/cci_param_restricted/cci_param_restricted", + "preLaunchTask": "CMake: build" + }, + { + "name": "dmi_access", + "type": "gdb", + "request": "launch", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/build/Debug/tests/memory_subsys/memory_subsys", + "preLaunchTask": "CMake: build" + }, + { + "name": "cxs_tlm", + "type": "gdb", + "request": "launch", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/build/Debug/tests/cxs_tlm/cxs_tlm", + "arguments": "-n single-packet", + "preLaunchTask": "CMake: build", + "environment": { + "SCC_TEST_TRACE": "1", + "SCC_TEST_VERBOSE": "1" + }, + "openGdbConsole": true + } + ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 9ce5386..4dce1a6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,8 +11,8 @@ "--background-index", "--compile-commands-dir=${workspaceFolder}/build" ], - "cmake.buildDirectory" : "${workspaceRoot}/build/${buildType}", - "cmake.configureArgs": ["-B", "${workspaceRoot}/build/${buildType}"], + "cmake.buildDirectory": "${workspaceRoot}/build/${buildType}", + //"cmake.configureArgs": ["-B", "${workspaceRoot}/build/${buildType}"], "cmake.configureOnOpen": false, "cmake.configureOnEdit": true, "cmake.autoSelectActiveFolder": true, @@ -21,8 +21,12 @@ "cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", "cmake.options.statusBarVisibility": "hidden", "cmake.options.advanced": { - "configure": {"projectStatusVisibility": "visible"}, - "build": {"statusBarVisibility": "visible"} + "configure": { + "projectStatusVisibility": "visible" + }, + "build": { + "statusBarVisibility": "visible" + } }, "todo-tree.ripgrep.ripgrep": "/bin/rg", "files.watcherExclude": { diff --git a/Modulefile b/Modulefile deleted file mode 100644 index 4891e78..0000000 --- a/Modulefile +++ /dev/null @@ -1,17 +0,0 @@ -#%Module###################################################################### -## -## Project Module -## -proc ModulesHelp { } { - puts stderr "\tThe SCC Tests Project Module\n" - puts stderr "\tThis module loads PATHs and variables for SCC tests." -} - -set distro [exec /usr/bin/lsb_release -i -s] -if { $distro == "CentOS" && ![info exists ::env(PROJECT)] && ![info exists ::env(PCP_DIR)] } { - puts stderr "Don't forget to execute 'scl enable devtoolset-7 llvm-toolset-7 bash'" -} - -module load tools/utilities -module load tools/cmake/3.28 -module load tools/clang/14.0 diff --git a/scc b/scc index 50de0c5..4429911 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 50de0c564ab314e385793e2a96b61d028f5cbdea +Subproject commit 4429911c18aa91eeab9e902f488e86aca6060237 diff --git a/src/sc_main.cpp b/src/sc_main.cpp index b1fe425..a530f12 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -27,10 +28,12 @@ int sc_main(int argc, char* argv[]) { auto level = getenv("SCC_TEST_VERBOSE"); auto log_lvl = level ? static_cast(std::min(strtoul(level, nullptr, 10) + 4, 7UL)) : log::FATAL; scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35)); + scc::configurer cfg(""); // create tracer if environment variable SCC_TEST_TRACE is defined std::unique_ptr tracer; if(auto* test_trace = getenv("SCC_TEST_TRACE")) { tracer = std::make_unique(my_name, scc::tracer::ENABLE, scc::tracer::ENABLE); + cfg.set_value("scc_tracer.default_trace_enable", true); } int result = -1; if(setjmp(abrt) == 0) { diff --git a/tests/cxs_tlm/csx_packet_test.cpp b/tests/cxs_tlm/csx_packet_test.cpp index 8bfdcf3..4e2c492 100644 --- a/tests/cxs_tlm/csx_packet_test.cpp +++ b/tests/cxs_tlm/csx_packet_test.cpp @@ -5,7 +5,6 @@ #undef CHECK #include #include -#include using namespace sc_core; namespace cxs { @@ -17,6 +16,7 @@ template unsigned run_scenario(STATE& state, un auto& dut = factory::get>(); if(burst_factor) dut.tx.burst_len.set_value(burst_factor); + dut.rx.max_credit.set_value(5); dut.rst.write(true); sc_start(state.reset_cycles * dut.clk.period()); dut.rst.write(false); diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 5ef8617..2982a0c 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -2,12 +2,12 @@ #define _TESTBENCH_H_ #include +#include #include #include #include #include #include -#include #include #include #include @@ -27,7 +27,9 @@ template struct testbench : public sc_core::sc_module { sc_core::sc_signal rst{"rst"}; tlm::nw::initiator_mixin, cxs_packet_types> isck{"isck"}; cxs_transmitter tx{"tx"}; + tlm::nw::scv::tlm_recorder_module tx_rec{"tx_rec"}; cxs_channel cxs_chan{"cxs_chan"}; + tlm::nw::scv::tlm_recorder_module rx_rec{"rx_rec"}; cxs_receiver rx{"rx"}; tlm::nw::target_mixin, false, cxs_packet_types> tsck{"tsck"}; @@ -43,12 +45,25 @@ template struct testbench : public sc_core::sc_module { isck(tx.tsck); tx.clk_i(clk); tx.rst_i(rst); + cxs_chan.tx_clk_i(clk); + cxs_chan.rx_clk_i(clk); +#if 0 tx.isck(cxs_chan.tsck); cxs_chan.isck(rx.tsck); +#else + tx.isck(tx_rec.ts); + tx_rec.is(cxs_chan.tsck); + cxs_chan.isck(rx_rec.ts); + rx_rec.is(rx.tsck); +#endif rx.clk_i(clk); rx.rst_i(rst); rx.isck(tsck); + tx.clock_period.set_value(1_ns); + cxs_chan.tx_clock_period.set_value(1_ns); cxs_chan.channel_delay.set_value(100_ns); + cxs_chan.rx_clock_period.set_value(1_ns); + rx.clock_period.set_value(1_ns); rx.max_credit.set_value(15); } From d7e691337d6ea75a7d2fa7be00d82f2526804cbb Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 30 Sep 2025 07:20:03 +0200 Subject: [PATCH 21/52] extends CXS packet to work with varying credit settings --- .launch/.gitignore | 1 + .launch/cxs_tlm.launch | 2 +- scc | 2 +- tests/cxs_tlm/csx_packet_test.cpp | 45 +++++++++++++++++++------------ tests/cxs_tlm/testbench.h | 3 ++- 5 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 .launch/.gitignore diff --git a/.launch/.gitignore b/.launch/.gitignore new file mode 100644 index 0000000..a2be07b --- /dev/null +++ b/.launch/.gitignore @@ -0,0 +1 @@ +/cxs_tlm single-packet.launch diff --git a/.launch/cxs_tlm.launch b/.launch/cxs_tlm.launch index 403e3df..73588d7 100644 --- a/.launch/cxs_tlm.launch +++ b/.launch/cxs_tlm.launch @@ -30,7 +30,7 @@ - + diff --git a/scc b/scc index 4429911..3b715da 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 4429911c18aa91eeab9e902f488e86aca6060237 +Subproject commit 3b715da553833b807e6fd63740a4e62a5796ab7c diff --git a/tests/cxs_tlm/csx_packet_test.cpp b/tests/cxs_tlm/csx_packet_test.cpp index 4e2c492..39ace08 100644 --- a/tests/cxs_tlm/csx_packet_test.cpp +++ b/tests/cxs_tlm/csx_packet_test.cpp @@ -12,11 +12,10 @@ factory::add> tb8; factory::add> tb9; factory::add> tb10; -template unsigned run_scenario(STATE& state, unsigned burst_factor = 0) { +template unsigned run_scenario(STATE& state) { auto& dut = factory::get>(); - if(burst_factor) - dut.tx.burst_len.set_value(burst_factor); - dut.rx.max_credit.set_value(5); + dut.tx.burst_len.set_value(state.burst_factor); + dut.rx.max_credit.set_value(state.credits); dut.rst.write(true); sc_start(state.reset_cycles * dut.clk.period()); dut.rst.write(false); @@ -67,7 +66,7 @@ template unsigned run_scenario(STATE& state, un return cycles; } -template unsigned run_scenario(int width, STATE& state, unsigned burst_factor = 0) { +template unsigned run_scenario(int width, STATE& state) { switch(width) { case 8: case 256: @@ -85,32 +84,40 @@ template unsigned run_scenario(int width, STATE& state, unsigne TEST_CASE("single-packet", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{1}; unsigned resp_cnt{0}; + unsigned burst_factor{1}; + unsigned credits{1}; } state; state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); + std::array credits{1, 4, 15}; for(auto width = 8; width < 11; ++width) { - state.resp_cnt = 0; - auto cycles = run_scenario(width, state); + for(auto credit : credits) { + state.resp_cnt = 0; + state.credits = credit; + auto cycles = run_scenario(width, state); - REQUIRE(cycles < state.max_cycles); - REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); - REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + REQUIRE(cycles < state.max_cycles); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); - REQUIRE(state.resp_cnt == state.packet_sizes.size()); + REQUIRE(state.resp_cnt == state.packet_sizes.size()); + } } } TEST_CASE("multi-packet", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{2}; unsigned resp_cnt{0}; + unsigned burst_factor{1}; + unsigned credits{15}; } state; state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); @@ -128,16 +135,18 @@ TEST_CASE("multi-packet", "[CXS][tlm-level]") { TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{1}; unsigned resp_cnt{0}; + unsigned burst_factor{2}; + unsigned credits{2}; } state; state.packet_sizes.assign({4, 8, 16, 32, 64, 128, 256, 1024}); for(auto width = 8; width < 11; ++width) { state.resp_cnt = 0; - auto cycles = run_scenario(width, state, 2); + auto cycles = run_scenario(width, state); REQUIRE(cycles < state.max_cycles); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); @@ -150,16 +159,18 @@ TEST_CASE("single-packet-burst2", "[CXS][tlm-level]") { TEST_CASE("multi-packet-burst2", "[CXS][tlm-level]") { struct { unsigned int reset_cycles{4}; - unsigned int max_cycles = 5000; + unsigned int max_cycles = 20000; std::vector packet_sizes; unsigned granularity{2}; unsigned resp_cnt{0}; + unsigned burst_factor{2}; + unsigned credits{2}; } state; state.packet_sizes.assign({4, 8, 16, 32, 16, 64, 16, 128, 16, 256, 16, 1024}); for(auto width = 8; width < 11; ++width) { state.resp_cnt = 0; - auto cycles = run_scenario(width, state, 2); + auto cycles = run_scenario(width, state); REQUIRE(cycles < state.max_cycles); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); diff --git a/tests/cxs_tlm/testbench.h b/tests/cxs_tlm/testbench.h index 2982a0c..77cead5 100644 --- a/tests/cxs_tlm/testbench.h +++ b/tests/cxs_tlm/testbench.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,7 @@ template struct testbench : public sc_core::sc_module { tlm::tlm_sync_enum nb_transport_fw(transaction_type& trans, phase_type& phase, sc_core::sc_time& t) { if(phase == tlm::nw::REQUEST) { - SCCINFO(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name(); + SCCDEBUG(SCMOD) << "Received non-blocking transaction with phase " << phase.get_name(); recv.push_back(&trans); phase = tlm::nw::CONFIRM; return tlm::TLM_UPDATED; From b2fba1af375ebff76ba000a49bff6d08097f1f13 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 30 Sep 2025 13:56:08 +0200 Subject: [PATCH 22/52] updates scc --- CMakePresets.json | 8 ++++++++ scc | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index 084dea5..93eedb7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -29,6 +29,14 @@ "CMAKE_BUILD_TYPE": "Debug" } }, + { + "name": "DebugCXX20", + "inherits": "Base", + "cacheVariables": { + "CMAKE_CXX_STANDARD": "20", + "CMAKE_BUILD_TYPE": "Debug" + } + }, { "name": "RelWithDebInfo", "inherits": "Base", diff --git a/scc b/scc index 3b715da..6c25b65 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 3b715da553833b807e6fd63740a4e62a5796ab7c +Subproject commit 6c25b65dc95d8310f613d689ce1e4a59647521d6 From 7bb02bb49e7f5bb68e95ce2af9efcc366a841dc8 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 21 Oct 2025 16:52:01 +0200 Subject: [PATCH 23/52] adds initial files for mt test --- .gitignore | 3 +- .vscode/launch.json | 30 +++++++++ .vscode/settings.json | 1 + CMakePresets.json | 5 +- conanfile.py | 5 +- scc | 2 +- tests/CMakeLists.txt | 1 + tests/configuration/top_module.h | 44 ++++++------- tests/quantum_keeper_mt/CMakeLists.txt | 5 ++ tests/quantum_keeper_mt/sc_main.cpp | 46 ++++++++++++++ tests/quantum_keeper_mt/top_module.h | 88 ++++++++++++++++++++++++++ 11 files changed, 197 insertions(+), 33 deletions(-) create mode 100644 tests/quantum_keeper_mt/CMakeLists.txt create mode 100644 tests/quantum_keeper_mt/sc_main.cpp create mode 100644 tests/quantum_keeper_mt/top_module.h diff --git a/.gitignore b/.gitignore index 65c3b47..f9f9210 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ /.venv/ /.cache /CMakeUserPresets.json -*.scview +/*.scview +/*.log \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 61973d6..bbf0a1b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,36 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "gdb", + "request": "launch", + "name": "quantum_keeper_mt", + "program": "${workspaceFolder}/build/Debug/tests/quantum_keeper_mt/quantum_keeper_mt" + }, + { + "name": "cppdbg quantum_keeper_mt", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceRoot}/build/Debug/tests/quantum_keeper_mt/quantum_keeper_mt", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + }, { "name": "cci_param_restricted", "type": "gdb", diff --git a/.vscode/settings.json b/.vscode/settings.json index 4dce1a6..d46a1f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ } ], "editor.formatOnSave": true, + "editor.hover.delay": 1500, "clangd.arguments": [ "--pretty", "--background-index", diff --git a/CMakePresets.json b/CMakePresets.json index 93eedb7..0a556d8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,11 +15,12 @@ "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_CXX_STANDARD": "17", + "CMAKE_CXX_STANDARD": "20", "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", - "CONAN_BUILD_PROFILE": "auto-cmake" + "CONAN_HOST_PROFILE": "auto-cmake", + "CONAN_BUILD_PROFILE": "conan_host_profile" } }, { diff --git a/conanfile.py b/conanfile.py index 9be5614..edfda26 100644 --- a/conanfile.py +++ b/conanfile.py @@ -35,7 +35,7 @@ class Pkg(ConanFile): } def requirements(self): - self.requires("systemc/2.3.4") + self.requires("systemc/3.0.1") self.requires("fmt/8.0.1") self.requires("spdlog/1.9.2") self.requires("boost/1.85.0") @@ -44,9 +44,6 @@ class Pkg(ConanFile): self.requires("yaml-cpp/0.7.0") self.requires("jsoncpp/1.9.5") self.requires("zlib/1.2.12") - self.requires("rapidjson/cci.20230929") - if os.path.isdir("tgc-iss/dbt-rise-plugins"): - self.requires("lua/5.4.3") def build_requirements(self): pass diff --git a/scc b/scc index 6c25b65..e672491 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 6c25b65dc95d8310f613d689ce1e4a59647521d6 +Subproject commit e672491c6ac078698a945e6ec2742720846945bc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0982470..90877e2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,7 @@ add_subdirectory(sc_fixed_tracing) add_subdirectory(cxs_tlm) add_subdirectory(tlm_memory) add_subdirectory(memory_subsys) +add_subdirectory(quantum_keeper_mt) add_subdirectory(sim_speed) if(FULL_TEST_SUITE) add_subdirectory(sim_performance) diff --git a/tests/configuration/top_module.h b/tests/configuration/top_module.h index 2ce77ee..49663c0 100644 --- a/tests/configuration/top_module.h +++ b/tests/configuration/top_module.h @@ -32,6 +32,7 @@ #define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_ #include +#include #include #include #include @@ -40,6 +41,7 @@ #include "initiator.h" #include "router.h" #include "target.h" +#include /** * @class top_module @@ -89,15 +91,13 @@ public: /// Creating instances of initiator(s) for(int i = 0; i < n_initiators; i++) { - snprintf(initiatorName, sizeof(initiatorName), "initiator_%d", i); + auto initiatorName = fmt::format("initiator_{}", i); SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Creating initiator : " << initiatorName; - snprintf(stringMisc, sizeof(stringMisc), "%s.%s.initiator_ID", name(), initiatorName); - - snprintf(initiatorName, sizeof(initiatorName), "\"initiator_%d\"", i); - m_broker.set_preset_cci_value(stringMisc, cci::cci_value::from_json(initiatorName)); - snprintf(initiatorName, sizeof(initiatorName), "initiator_%d", i); - initiatorList.push_back(new initiator(initiatorName)); + auto paramName = fmt::format("{}.{}.initiator_ID", name(), initiatorName); + auto quotedInitiatorName = fmt::format("\"initiator_{}\"", i); + m_broker.set_preset_cci_value(paramName, cci::cci_value::from_json(quotedInitiatorName)); + initiatorList.push_back(new initiator(initiatorName.c_str())); // Binding of initiator to Router SCCINFO(SCMOD) << "[TOP MODULE C_TOR] : Binding Router_Initiator to " << initiatorName; @@ -109,22 +109,21 @@ public: // Creating instances of target(s) for(int i = 0; i < n_targets; i++) { - snprintf(targetName, sizeof(targetName), "target_%d", i); + auto targetName = fmt::format("target_{}", i); SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Creating target : " << targetName; - snprintf(stringMisc, sizeof(stringMisc), "%s.%s.target_ID", name(), targetName); - snprintf(targetName, sizeof(targetName), "\"target_%d\"", i); - m_broker.set_preset_cci_value(stringMisc, cci::cci_value::from_json(targetName)); - snprintf(targetName, sizeof(targetName), "target_%d", i); + auto paramName0 = fmt::format("{}.{}.initiator_ID", name(), targetName); + auto quotedTargetName = fmt::format("\"target_{}\"", i); + m_broker.set_preset_cci_value(paramName0, cci::cci_value::from_json(targetName)); // Set preset value for maximum target size(memory) - snprintf(stringMisc, sizeof(stringMisc), "%s.%s.s_size", name(), targetName); + auto paramName1 = fmt::format("{}.{}.initiator_ID", name(), targetName); ss.clear(); ss.str(""); ss << targetSize; - m_broker.set_preset_cci_value(stringMisc, cci::cci_value::from_json(ss.str())); - targetList.push_back(new target(targetName)); + m_broker.set_preset_cci_value(paramName1, cci::cci_value::from_json(ss.str())); + targetList.push_back(new target(targetName.c_str())); // Binding Router to target SCCINFO(SCMOD) << "[TOP MODULE C_TOR] : Binding Router_Initiator to " << targetName; @@ -133,7 +132,7 @@ public: // Try re-setting locked values for Router Table contents for(int i = 0; i < n_targets; i++) { - snprintf(targetName, sizeof(targetName), "%s.RouterInstance.r_index_%d", name(), i); + auto targetName = fmt::format("{}.RouterInstance.r_index_{}", name(), i); ss.clear(); ss.str(""); ss << i; @@ -145,12 +144,12 @@ public: SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what(); } - snprintf(targetName, sizeof(targetName), "%s.RouterInstance.r_sa_%d", name(), i); + targetName = fmt::format("{}.RouterInstance.r_sa_{}", name(), i); ss.clear(); ss.str(""); ss << (i * targetSize); - snprintf(targetBaseAddr, sizeof(targetBaseAddr), "%s.target_%d.s_base_addr", name(), i); + auto targetBaseAddr = fmt::format("{}.target_{}.s_base_addr", name(), i); cci::cci_param_untyped_handle h = m_broker.get_param_handle(targetBaseAddr); h.set_cci_value(cci::cci_value::from_json(ss.str())); @@ -162,7 +161,7 @@ public: SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what(); } - snprintf(targetName, sizeof(targetName), "%s.RouterInstance.r_ea_%d", name(), i); + targetName = fmt::format("{}.RouterInstance.r_ea_{}", name(), i); ss.clear(); ss.str(""); ss << ((i + 1) * targetSize - 1); @@ -210,15 +209,10 @@ private: std::vector initiatorList; ///< STD::VECTOR for initiators std::vector targetList; ///< STD::VECTOR for targets - char initiatorName[50]; ///< initiator_ID - char targetName[50]; ///< target_ID - char stringMisc[50]; ///< String to be used for misc things - char targetBaseAddr[50]; ///< The base address of the target - int addrValue{0}; ///< Address Value int targetSize; ///< Maximum target Size (preset value) int r_addr_max; ///< Maximum Router Table's memory range }; - // top_module +// top_module #endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_ diff --git a/tests/quantum_keeper_mt/CMakeLists.txt b/tests/quantum_keeper_mt/CMakeLists.txt new file mode 100644 index 0000000..413e451 --- /dev/null +++ b/tests/quantum_keeper_mt/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable (quantum_keeper_mt + sc_main.cpp +) +target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc-sysc) +add_test(NAME quantum_keeper_mt COMMAND quantum_keeper_mt) \ No newline at end of file diff --git a/tests/quantum_keeper_mt/sc_main.cpp b/tests/quantum_keeper_mt/sc_main.cpp new file mode 100644 index 0000000..7e0ca51 --- /dev/null +++ b/tests/quantum_keeper_mt/sc_main.cpp @@ -0,0 +1,46 @@ +#include "top_module.h" +#include "util/logging.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace scc; +using namespace sc_core; + +jmp_buf abrt; +void ABRThandler(int sig) { longjmp(abrt, 1); } + +int sc_main(int argc, char* argv[]) { + signal(SIGABRT, ABRThandler); + auto my_name = util::split(argv[0], '/').back(); + auto level = "3"; // getenv("SCC_TEST_VERBOSE"); + auto log_lvl = level ? static_cast(std::min(strtoul(level, nullptr, 10) + 4, 7UL)) : log::FATAL; + scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35)); + LOGGER(DEFAULT)::reporting_level().store(logging::TRACEALL); + scc::configurer cfg(""); + // create tracer if environment variable SCC_TEST_TRACE is defined + std::unique_ptr tracer; + if(auto* test_trace = getenv("SCC_TEST_TRACE")) { + tracer = std::make_unique(my_name, scc::tracer::ENABLE, scc::tracer::ENABLE); + tracer->set_default_trace_enable(true); + } + int result = -1; + tlm_utils::tlm_quantumkeeper::set_global_quantum(3_us); + if(setjmp(abrt) == 0) { + // instantiate design(s) + top_module top_mod("top_module_inst"); + // Start the simulation + sc_core::sc_start(20_us); + } else { + SCCERR() << "Some error occured"; + } + return sc_core::sc_report_handler::get_count(sc_core::SC_ERROR) + sc_core::sc_report_handler::get_count(sc_core::SC_WARNING); +} diff --git a/tests/quantum_keeper_mt/top_module.h b/tests/quantum_keeper_mt/top_module.h new file mode 100644 index 0000000..5a08c17 --- /dev/null +++ b/tests/quantum_keeper_mt/top_module.h @@ -0,0 +1,88 @@ +#ifndef _TOP_MODULE_H_ +#define _TOP_MODULE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct initiator : ::sc_core ::sc_module { + tlm_utils::simple_initiator_socket isckt{"isckt"}; + + initiator(sc_core::sc_module_name nm) + : sc_core::sc_module(nm) { + SC_THREAD(run); + } + + ~initiator() {} + +private: + void run() { + wait(sc_core::SC_ZERO_TIME); // guard elaboration phase + quantum_keeper.reset(); + core_executor.start([this]() { return thread_exec(); }); + wait(core_executor.thread_finish_event()); + sc_core::sc_stop(); + } + + sc_core::sc_time thread_exec() { + SCCDEBUG(SCMOD) << "starting thread_exec"; + for(auto i = 0u; i < 16; ++i) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + if(i && (i % 3) == 0) { + tlm::tlm_generic_payload gp; + sc_core::sc_time t; + SCCDEBUG(SCMOD) << "initiating b_transport at local time " << quantum_keeper.get_local_absolute_time(); + quantum_keeper.execute_on_sysc([this, &gp, &t]() { + SCCDEBUG(SCMOD) << "executing b_transport"; + auto t0 = sc_core::sc_time_stamp(); + this->isckt->b_transport(gp, t); + return t0 - sc_core::sc_time_stamp(); + }); + if(t.value()) { + SCCDEBUG(SCMOD) << "incrementing local time by b_transport delay of " << t; + quantum_keeper.inc(t); + } + } else { + quantum_keeper.check_and_sync(1_us); + } + SCCDEBUG(SCMOD) << "local time now " << quantum_keeper.get_local_absolute_time(); + } + SCCDEBUG(SCMOD) << "finished thread_exec at local time " << quantum_keeper.get_local_absolute_time(); + return quantum_keeper.get_local_absolute_time(); + } + tlm::scc::quantumkeeper_mt quantum_keeper; + scc::async_thread core_executor; +}; + +// top_module +struct top_module : ::sc_core ::sc_module { + initiator core{"core"}; + + tlm_utils::simple_target_socket tsckt{"tsckt"}; + + top_module(sc_core::sc_module_name nm) + : sc_core::sc_module(nm) { + core.isckt(tsckt); + tsckt.register_b_transport(this, &top_module::b_transport); + } + + ~top_module() {} + + void b_transport(tlm::tlm_generic_payload& gp, sc_core::sc_time& t) { + SCCDEBUG(SCMOD) << "Received b_transport call at local time " << t; + t += 5_us; + gp.set_response_status(tlm::TLM_OK_RESPONSE); + } +}; +#endif // _TOP_MODULE_H_ From b39fad3c48e1f7e95fb9d816fb373873ebe96fad Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 8 Nov 2025 15:27:38 +0100 Subject: [PATCH 24/52] applies clang-format --- scc | 2 +- tests/configuration/top_module.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scc b/scc index e672491..7aa84b9 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit e672491c6ac078698a945e6ec2742720846945bc +Subproject commit 7aa84b9561791b2f506fe749857420e26554364c diff --git a/tests/configuration/top_module.h b/tests/configuration/top_module.h index 49663c0..dbe5424 100644 --- a/tests/configuration/top_module.h +++ b/tests/configuration/top_module.h @@ -213,6 +213,5 @@ private: int targetSize; ///< Maximum target Size (preset value) int r_addr_max; ///< Maximum Router Table's memory range }; -// top_module #endif // EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_ From eae0fc24c8e6985705e298a03ca3af8af08ba5b2 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 8 Nov 2025 15:30:50 +0100 Subject: [PATCH 25/52] reverts C++ std --- CMakePresets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index 0a556d8..6bdc642 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,7 +15,7 @@ "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD": "17", "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", From 8b5c062847117d382cc5a77c7af5b5311c47a73b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 8 Nov 2025 19:15:25 +0100 Subject: [PATCH 26/52] updates C++ language level --- CMakePresets.json | 2 +- Jenkinsfile | 6 +++--- conanfile.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 6bdc642..0a556d8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,7 +15,7 @@ "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_POLICY_DEFAULT_CMP0091": "NEW", - "CMAKE_CXX_STANDARD": "17", + "CMAKE_CXX_STANDARD": "20", "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake-conan/conan_provider.cmake", diff --git a/Jenkinsfile b/Jenkinsfile index 42bc1d8..6b04247 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { stage('ubuntu-22.04') { agent {docker { image 'ubuntu-22.04' - args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-jammy' + args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-jammy-cxx20' } } stages { stage('Checkout') { steps { checkout_project() }} @@ -65,13 +65,13 @@ pipeline { stage('rockylinux8') { agent {docker { image 'rockylinux8' - args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-rocky8' + args ' -e CONAN_HOME=/var/jenkins_home/workspace/conan-rocky8-cxx20' } } stages { stage('Checkout') { steps { checkout_project() }} stage('Build & test') { steps { build_n_test_project() }} } - } + qq } } } } diff --git a/conanfile.py b/conanfile.py index edfda26..ba167cf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -27,7 +27,7 @@ class Pkg(ConanFile): "boost/*:without_python": "True", "boost/*:without_random": "True", "boost/*:without_regex": "True", - "boost/*:without_stacktrace": "True", + "boost/*:without_stacktrace": "False", "boost/*:without_test": "True", "boost/*:without_timer": "True", "boost/*:without_type_erasure": "True", From e20fbf0d28c40d62638ebbdb99d7fd32ddeb9482 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 8 Nov 2025 19:16:10 +0100 Subject: [PATCH 27/52] updates SCC and quantum keeper testcase --- scc | 2 +- tests/quantum_keeper_mt/sc_main.cpp | 1 + tests/quantum_keeper_mt/top_module.h | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scc b/scc index 7aa84b9..f396174 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 7aa84b9561791b2f506fe749857420e26554364c +Subproject commit f3961745afbf46d4321d4c40b5998d727050a4d6 diff --git a/tests/quantum_keeper_mt/sc_main.cpp b/tests/quantum_keeper_mt/sc_main.cpp index 7e0ca51..47c771a 100644 --- a/tests/quantum_keeper_mt/sc_main.cpp +++ b/tests/quantum_keeper_mt/sc_main.cpp @@ -39,6 +39,7 @@ int sc_main(int argc, char* argv[]) { top_module top_mod("top_module_inst"); // Start the simulation sc_core::sc_start(20_us); + SCCINFO() << "Simulation finished"; } else { SCCERR() << "Some error occured"; } diff --git a/tests/quantum_keeper_mt/top_module.h b/tests/quantum_keeper_mt/top_module.h index 5a08c17..a19d39a 100644 --- a/tests/quantum_keeper_mt/top_module.h +++ b/tests/quantum_keeper_mt/top_module.h @@ -45,9 +45,7 @@ private: SCCDEBUG(SCMOD) << "initiating b_transport at local time " << quantum_keeper.get_local_absolute_time(); quantum_keeper.execute_on_sysc([this, &gp, &t]() { SCCDEBUG(SCMOD) << "executing b_transport"; - auto t0 = sc_core::sc_time_stamp(); this->isckt->b_transport(gp, t); - return t0 - sc_core::sc_time_stamp(); }); if(t.value()) { SCCDEBUG(SCMOD) << "incrementing local time by b_transport delay of " << t; From a8c1295c73f9b39baf5f969dce99a60265aba274 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 8 Nov 2025 20:11:36 +0100 Subject: [PATCH 28/52] updates quantum_keeper_mt test --- scc | 2 +- tests/quantum_keeper_mt/sc_main.cpp | 6 +++--- tests/quantum_keeper_mt/top_module.h | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scc b/scc index f396174..9e1b18d 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit f3961745afbf46d4321d4c40b5998d727050a4d6 +Subproject commit 9e1b18db3f2d59fc0d2f22c8a677d03e9720ced4 diff --git a/tests/quantum_keeper_mt/sc_main.cpp b/tests/quantum_keeper_mt/sc_main.cpp index 47c771a..ab2b5f8 100644 --- a/tests/quantum_keeper_mt/sc_main.cpp +++ b/tests/quantum_keeper_mt/sc_main.cpp @@ -21,9 +21,9 @@ void ABRThandler(int sig) { longjmp(abrt, 1); } int sc_main(int argc, char* argv[]) { signal(SIGABRT, ABRThandler); auto my_name = util::split(argv[0], '/').back(); - auto level = "3"; // getenv("SCC_TEST_VERBOSE"); - auto log_lvl = level ? static_cast(std::min(strtoul(level, nullptr, 10) + 4, 7UL)) : log::FATAL; - scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35)); + auto level = getenv("SCC_TEST_VERBOSE"); + auto log_lvl = level ? static_cast(std::min(strtoul(level, nullptr, 10), 7UL)) : log::FATAL; + scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35).printSysTime()); LOGGER(DEFAULT)::reporting_level().store(logging::TRACEALL); scc::configurer cfg(""); // create tracer if environment variable SCC_TEST_TRACE is defined diff --git a/tests/quantum_keeper_mt/top_module.h b/tests/quantum_keeper_mt/top_module.h index a19d39a..eba9521 100644 --- a/tests/quantum_keeper_mt/top_module.h +++ b/tests/quantum_keeper_mt/top_module.h @@ -7,7 +7,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -15,6 +17,7 @@ #include #include #include +enum { CLIENT_DELAY = 100, SC_DELAY = 10 }; struct initiator : ::sc_core ::sc_module { tlm_utils::simple_initiator_socket isckt{"isckt"}; @@ -38,7 +41,7 @@ private: sc_core::sc_time thread_exec() { SCCDEBUG(SCMOD) << "starting thread_exec"; for(auto i = 0u; i < 16; ++i) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(CLIENT_DELAY)); if(i && (i % 3) == 0) { tlm::tlm_generic_payload gp; sc_core::sc_time t; @@ -73,6 +76,7 @@ struct top_module : ::sc_core ::sc_module { : sc_core::sc_module(nm) { core.isckt(tsckt); tsckt.register_b_transport(this, &top_module::b_transport); + SC_THREAD(run); } ~top_module() {} @@ -82,5 +86,13 @@ struct top_module : ::sc_core ::sc_module { t += 5_us; gp.set_response_status(tlm::TLM_OK_RESPONSE); } + + void run() { + wait(sc_core::SC_ZERO_TIME); + while(true) { + std::this_thread::sleep_for(std::chrono::milliseconds(SC_DELAY)); + wait(1500_ns); + } + } }; #endif // _TOP_MODULE_H_ From 5805d19cf0805aa8a4b017ae32aeb1109a0bc1dd Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 9 Nov 2025 07:30:07 +0100 Subject: [PATCH 29/52] fixes quantum_keeper test to adhere to chnaged logging --- scc | 2 +- tests/quantum_keeper_mt/sc_main.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scc b/scc index 9e1b18d..bf3b4e5 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 9e1b18db3f2d59fc0d2f22c8a677d03e9720ced4 +Subproject commit bf3b4e5179d08f86cec099d78f0595c3d3488571 diff --git a/tests/quantum_keeper_mt/sc_main.cpp b/tests/quantum_keeper_mt/sc_main.cpp index ab2b5f8..c96a7a0 100644 --- a/tests/quantum_keeper_mt/sc_main.cpp +++ b/tests/quantum_keeper_mt/sc_main.cpp @@ -24,7 +24,6 @@ int sc_main(int argc, char* argv[]) { auto level = getenv("SCC_TEST_VERBOSE"); auto log_lvl = level ? static_cast(std::min(strtoul(level, nullptr, 10), 7UL)) : log::FATAL; scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35).printSysTime()); - LOGGER(DEFAULT)::reporting_level().store(logging::TRACEALL); scc::configurer cfg(""); // create tracer if environment variable SCC_TEST_TRACE is defined std::unique_ptr tracer; From a07057e869a75637037b648862b2bf0cd1c4dbf1 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 9 Nov 2025 14:22:59 +0100 Subject: [PATCH 30/52] excludes quantum_keeper if SystemC is not 3.0 or higher --- scc | 2 +- tests/quantum_keeper_mt/CMakeLists.txt | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scc b/scc index bf3b4e5..e8cda40 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit bf3b4e5179d08f86cec099d78f0595c3d3488571 +Subproject commit e8cda40eaa6dcadc354c78857011e65efe44d061 diff --git a/tests/quantum_keeper_mt/CMakeLists.txt b/tests/quantum_keeper_mt/CMakeLists.txt index 413e451..9bcf71e 100644 --- a/tests/quantum_keeper_mt/CMakeLists.txt +++ b/tests/quantum_keeper_mt/CMakeLists.txt @@ -1,5 +1,8 @@ -add_executable (quantum_keeper_mt - sc_main.cpp -) -target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc-sysc) -add_test(NAME quantum_keeper_mt COMMAND quantum_keeper_mt) \ No newline at end of file +message(STATUS "SC_VERSION is ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH}") +if(SC_VERSION_MAJOR GREATER 2) + add_executable (quantum_keeper_mt + sc_main.cpp + ) + target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc-sysc) + add_test(NAME quantum_keeper_mt COMMAND quantum_keeper_mt) +endif() \ No newline at end of file From 687c544ccbbe9ab641f841644934b51be69ac6a4 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 9 Nov 2025 16:19:12 +0100 Subject: [PATCH 31/52] updates version of used packages --- conanfile.py | 4 ++-- scc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index ba167cf..2579ccc 100644 --- a/conanfile.py +++ b/conanfile.py @@ -40,10 +40,10 @@ class Pkg(ConanFile): self.requires("spdlog/1.9.2") self.requires("boost/1.85.0") self.requires("catch2/3.1.0") - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") self.requires("yaml-cpp/0.7.0") self.requires("jsoncpp/1.9.5") - self.requires("zlib/1.2.12") + self.requires("zlib/1.3.1") def build_requirements(self): pass diff --git a/scc b/scc index e8cda40..0a3b269 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit e8cda40eaa6dcadc354c78857011e65efe44d061 +Subproject commit 0a3b2697a5cc9c5d6d10bf41c721dd666e5ba841 From bd032c08ce3ddb7e035a97e816ff25e1eae1f4ec Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 9 Nov 2025 20:19:54 +0100 Subject: [PATCH 32/52] adds TSAN/ASAN buid settings --- .gitignore | 3 ++- CMakeLists.txt | 18 +++++++++++++++--- scc | 2 +- tests/ace_pin_level/CMakeLists.txt | 5 +++-- tests/ahb_pin_level/CMakeLists.txt | 4 +++- tests/apb_pin_level/CMakeLists.txt | 4 +++- tests/axi4_pin_level/CMakeLists.txt | 5 +++-- tests/cci_param_restricted/CMakeLists.txt | 4 +++- tests/cxs_tlm/CMakeLists.txt | 4 +++- tests/memory_subsys/CMakeLists.txt | 4 +++- tests/ordered_semaphore/CMakeLists.txt | 4 +++- tests/quantum_keeper_mt/CMakeLists.txt | 5 +---- tests/quantum_keeper_mt/top_module.h | 4 ++-- tests/tlm_memory/CMakeLists.txt | 4 +++- 14 files changed, 48 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index f9f9210..6bdbe0f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,5 @@ /.cache /CMakeUserPresets.json /*.scview -/*.log \ No newline at end of file +/*.log +/config \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8be6969..7c6b7fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ project(SCC_Test) option(FULL_TEST_SUITE "enable also long-running tests" OFF) option(ENABLE_SCV "Enable use of SCV" OFF) option(ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF) +option(ENABLE_CLANG_FORMAT "Enable clang-format targets" OFF) +option(THREAD_SANITIZER "Enable thread sanitizer TSan" OFF) +option(ADDR_SANITIZER "Enable address sanitizer ASan" OFF) include(GNUInstallDirs) include(BuildType) @@ -30,7 +33,15 @@ if(ENABLE_COVERAGE) include(CodeCoverage) append_coverage_compiler_flags() endif() - +if (THREAD_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -O0 -g") +elseif(ADDR_SANITIZER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O0 -g") +else() + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) + endif() +endif() if(ENABLE_CLANG_TIDY) find_program(CLANG_TIDY_EXE NAMES "clang-tidy") if(CLANG_TIDY_EXE) @@ -44,7 +55,9 @@ if(ENABLE_CLANG_TIDY) endif() set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/") -find_package(ClangFormat) +if(ENABLE_CLANG_FORMAT) + find_package(ClangFormat) +endif() find_package(ZLIB) find_package(lz4) # This line finds the boost lib and headers. @@ -57,7 +70,6 @@ find_package(Catch2) include(SystemCPackage) include(CTest) include(Catch) - enable_testing() set(WITH_SCP4SCC ON) add_subdirectory(scc) diff --git a/scc b/scc index 0a3b269..cc35ebf 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 0a3b2697a5cc9c5d6d10bf41c721dd666e5ba841 +Subproject commit cc35ebf490cf314972fde6570673c5ba40eb7b23 diff --git a/tests/ace_pin_level/CMakeLists.txt b/tests/ace_pin_level/CMakeLists.txt index 78d5cf1..f16e4c4 100644 --- a/tests/ace_pin_level/CMakeLists.txt +++ b/tests/ace_pin_level/CMakeLists.txt @@ -5,5 +5,6 @@ add_executable(${PROJECT_NAME} ${test_util_SOURCE_DIR}/sc_main.cpp ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) - -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/ahb_pin_level/CMakeLists.txt b/tests/ahb_pin_level/CMakeLists.txt index 621893d..d13d684 100644 --- a/tests/ahb_pin_level/CMakeLists.txt +++ b/tests/ahb_pin_level/CMakeLists.txt @@ -6,4 +6,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/apb_pin_level/CMakeLists.txt b/tests/apb_pin_level/CMakeLists.txt index bd52313..085edec 100644 --- a/tests/apb_pin_level/CMakeLists.txt +++ b/tests/apb_pin_level/CMakeLists.txt @@ -6,4 +6,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/axi4_pin_level/CMakeLists.txt b/tests/axi4_pin_level/CMakeLists.txt index 53ff21a..a16c2db 100644 --- a/tests/axi4_pin_level/CMakeLists.txt +++ b/tests/axi4_pin_level/CMakeLists.txt @@ -5,5 +5,6 @@ add_executable(${PROJECT_NAME} ${test_util_SOURCE_DIR}/sc_main.cpp ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) - -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/cci_param_restricted/CMakeLists.txt b/tests/cci_param_restricted/CMakeLists.txt index 6ac195e..9d85664 100644 --- a/tests/cci_param_restricted/CMakeLists.txt +++ b/tests/cci_param_restricted/CMakeLists.txt @@ -6,4 +6,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/cxs_tlm/CMakeLists.txt b/tests/cxs_tlm/CMakeLists.txt index ede8eff..d5c1190 100644 --- a/tests/cxs_tlm/CMakeLists.txt +++ b/tests/cxs_tlm/CMakeLists.txt @@ -5,4 +5,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC scc::busses test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/memory_subsys/CMakeLists.txt b/tests/memory_subsys/CMakeLists.txt index dcb948a..92ebe28 100644 --- a/tests/memory_subsys/CMakeLists.txt +++ b/tests/memory_subsys/CMakeLists.txt @@ -5,4 +5,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC scc::components test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/ordered_semaphore/CMakeLists.txt b/tests/ordered_semaphore/CMakeLists.txt index cf2d27d..334a28f 100644 --- a/tests/ordered_semaphore/CMakeLists.txt +++ b/tests/ordered_semaphore/CMakeLists.txt @@ -6,4 +6,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file diff --git a/tests/quantum_keeper_mt/CMakeLists.txt b/tests/quantum_keeper_mt/CMakeLists.txt index 9bcf71e..5666264 100644 --- a/tests/quantum_keeper_mt/CMakeLists.txt +++ b/tests/quantum_keeper_mt/CMakeLists.txt @@ -1,8 +1,5 @@ -message(STATUS "SC_VERSION is ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH}") if(SC_VERSION_MAJOR GREATER 2) - add_executable (quantum_keeper_mt - sc_main.cpp - ) + add_executable (quantum_keeper_mt sc_main.cpp) target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc-sysc) add_test(NAME quantum_keeper_mt COMMAND quantum_keeper_mt) endif() \ No newline at end of file diff --git a/tests/quantum_keeper_mt/top_module.h b/tests/quantum_keeper_mt/top_module.h index eba9521..10fd595 100644 --- a/tests/quantum_keeper_mt/top_module.h +++ b/tests/quantum_keeper_mt/top_module.h @@ -27,7 +27,7 @@ struct initiator : ::sc_core ::sc_module { SC_THREAD(run); } - ~initiator() {} + ~initiator() = default; private: void run() { @@ -79,7 +79,7 @@ struct top_module : ::sc_core ::sc_module { SC_THREAD(run); } - ~top_module() {} + ~top_module() = default; void b_transport(tlm::tlm_generic_payload& gp, sc_core::sc_time& t) { SCCDEBUG(SCMOD) << "Received b_transport call at local time " << t; diff --git a/tests/tlm_memory/CMakeLists.txt b/tests/tlm_memory/CMakeLists.txt index ec5fda1..31e2864 100644 --- a/tests/tlm_memory/CMakeLists.txt +++ b/tests/tlm_memory/CMakeLists.txt @@ -5,4 +5,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries (${PROJECT_NAME} PUBLIC scc::components test_util) -catch_discover_tests(${PROJECT_NAME}) +if(NOT THREAD_SANITIZER) + catch_discover_tests(${PROJECT_NAME}) +endif() \ No newline at end of file From 3082b3c98b587f18adb0d8d33b643aae8e2333a4 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 06:53:11 +0100 Subject: [PATCH 33/52] adds quantum_keeper_mt test --- .vscode/launch.json | 5 ++++- scc | 2 +- tests/quantum_keeper_mt/CMakeLists.txt | 2 +- tests/quantum_keeper_mt/sc_main.cpp | 3 +++ tests/quantum_keeper_mt/top_module.h | 27 +++++++++++++++++++------- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index bbf0a1b..0e8969e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,10 @@ "type": "gdb", "request": "launch", "name": "quantum_keeper_mt", - "program": "${workspaceFolder}/build/Debug/tests/quantum_keeper_mt/quantum_keeper_mt" + "program": "${workspaceFolder}/build/Debug/tests/quantum_keeper_mt/quantum_keeper_mt", + "environment": { + "SCC_TEST_VERBOSE": "7" + } }, { "name": "cppdbg quantum_keeper_mt", diff --git a/scc b/scc index cc35ebf..df0b696 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit cc35ebf490cf314972fde6570673c5ba40eb7b23 +Subproject commit df0b69632d336a5bffdcb7565f70440d904bc91c diff --git a/tests/quantum_keeper_mt/CMakeLists.txt b/tests/quantum_keeper_mt/CMakeLists.txt index 5666264..980c0ca 100644 --- a/tests/quantum_keeper_mt/CMakeLists.txt +++ b/tests/quantum_keeper_mt/CMakeLists.txt @@ -1,5 +1,5 @@ if(SC_VERSION_MAJOR GREATER 2) add_executable (quantum_keeper_mt sc_main.cpp) - target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc-sysc) + target_link_libraries (quantum_keeper_mt LINK_PUBLIC scc::components) add_test(NAME quantum_keeper_mt COMMAND quantum_keeper_mt) endif() \ No newline at end of file diff --git a/tests/quantum_keeper_mt/sc_main.cpp b/tests/quantum_keeper_mt/sc_main.cpp index c96a7a0..34a1961 100644 --- a/tests/quantum_keeper_mt/sc_main.cpp +++ b/tests/quantum_keeper_mt/sc_main.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ int sc_main(int argc, char* argv[]) { top_module top_mod("top_module_inst"); // Start the simulation sc_core::sc_start(20_us); + if(sc_core::sc_is_running()) + sc_core::sc_stop(); SCCINFO() << "Simulation finished"; } else { SCCERR() << "Some error occured"; diff --git a/tests/quantum_keeper_mt/top_module.h b/tests/quantum_keeper_mt/top_module.h index 10fd595..a08e34e 100644 --- a/tests/quantum_keeper_mt/top_module.h +++ b/tests/quantum_keeper_mt/top_module.h @@ -1,11 +1,13 @@ #ifndef _TOP_MODULE_H_ #define _TOP_MODULE_H_ +#include "scc/mt19937_rng.h" #include #include #include #include #include +#include #include #include #include @@ -17,13 +19,15 @@ #include #include #include + enum { CLIENT_DELAY = 100, SC_DELAY = 10 }; struct initiator : ::sc_core ::sc_module { tlm_utils::simple_initiator_socket isckt{"isckt"}; - initiator(sc_core::sc_module_name nm) - : sc_core::sc_module(nm) { + initiator(sc_core::sc_module_name nm, sc_core::sc_time period = 1_us) + : sc_core::sc_module(nm) + , period(period) { SC_THREAD(run); } @@ -55,7 +59,7 @@ private: quantum_keeper.inc(t); } } else { - quantum_keeper.check_and_sync(1_us); + quantum_keeper.check_and_sync(period); } SCCDEBUG(SCMOD) << "local time now " << quantum_keeper.get_local_absolute_time(); } @@ -64,17 +68,23 @@ private: } tlm::scc::quantumkeeper_mt quantum_keeper; scc::async_thread core_executor; + const sc_core::sc_time period{1_us}; }; // top_module struct top_module : ::sc_core ::sc_module { - initiator core{"core"}; + initiator core0{"core0"}; + initiator core1{"core1", 1500_ns}; + scc::router router{"router", 1, 2}; tlm_utils::simple_target_socket tsckt{"tsckt"}; top_module(sc_core::sc_module_name nm) : sc_core::sc_module(nm) { - core.isckt(tsckt); + core0.isckt(router.target[0]); + core1.isckt(router.target[1]); + router.initiator[0](tsckt); + router.set_default_target(0); tsckt.register_b_transport(this, &top_module::b_transport); SC_THREAD(run); } @@ -83,7 +93,8 @@ struct top_module : ::sc_core ::sc_module { void b_transport(tlm::tlm_generic_payload& gp, sc_core::sc_time& t) { SCCDEBUG(SCMOD) << "Received b_transport call at local time " << t; - t += 5_us; + auto cycles = rng.uniform(0, 5); + t += sc_core::sc_time(cycles, sc_core::SC_US); gp.set_response_status(tlm::TLM_OK_RESPONSE); } @@ -91,8 +102,10 @@ struct top_module : ::sc_core ::sc_module { wait(sc_core::SC_ZERO_TIME); while(true) { std::this_thread::sleep_for(std::chrono::milliseconds(SC_DELAY)); - wait(1500_ns); + wait(500_ns); } } + + scc::MT19937 rng; }; #endif // _TOP_MODULE_H_ From 5c65777f9a5824d080213a24b509e0e7016b27f5 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 09:09:30 +0100 Subject: [PATCH 34/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index df0b696..5659c0f 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit df0b69632d336a5bffdcb7565f70440d904bc91c +Subproject commit 5659c0f6cea42b9729ae7e32dbb43611df8ba272 From 9f39eddd367d342a2a24a7fc4aacdbd1f26b5be9 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 19:31:09 +0100 Subject: [PATCH 35/52] updates scc --- CMakeLists.txt | 2 +- scc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c6b7fb..ed26e15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if(ENABLE_CLANG_TIDY) endif() endif() -set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/") +set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/" ".direnv") if(ENABLE_CLANG_FORMAT) find_package(ClangFormat) endif() diff --git a/scc b/scc index 5659c0f..25252a4 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 5659c0f6cea42b9729ae7e32dbb43611df8ba272 +Subproject commit 25252a4de60ec366d502e374d0f0ab2e06eb1d67 From 0f4d1915a237c906cc6c78be64909651f117ce4f Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 19:33:54 +0100 Subject: [PATCH 36/52] fixes typo in Jenkins file --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6b04247..fbf66ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage('Checkout') { steps { checkout_project() }} stage('Build & test') { steps { build_n_test_project() }} } - qq } + } } } } From 86851e43094ae2059073f157fd625b815ee52155 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 19:43:15 +0100 Subject: [PATCH 37/52] adds removal of SystemC package to Jenkinsfile --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fbf66ef..2e529aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,9 +31,10 @@ void checkout_project() { void build_n_test_project() { sh''' - python3 -mvenv .venv - . .venv/bin/activate - pip3 install -r requirements.txt + python3 -mvenv .venv + . .venv/bin/activate + pip3 install -r requirements.txt + conan remove "systemc/*" cmake -S . -B build --preset Release cmake --build build --target format-check cmake --build build -j12 From c9ea0779feafb14c6dda9fc269f5783d07bd0654 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 25 Nov 2025 19:45:47 +0100 Subject: [PATCH 38/52] adds removal of SystemC package to Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e529aa..1c9e883 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,7 @@ void build_n_test_project() { python3 -mvenv .venv . .venv/bin/activate pip3 install -r requirements.txt - conan remove "systemc/*" + conan remove -c "systemc/*" cmake -S . -B build --preset Release cmake --build build --target format-check cmake --build build -j12 From a710b1ae0cccf48664d195b1d6c34d88f98f6823 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 26 Nov 2025 07:37:25 +0100 Subject: [PATCH 39/52] forces conan to rebuild all packages in Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1c9e883..76b9c20 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ void build_n_test_project() { . .venv/bin/activate pip3 install -r requirements.txt conan remove -c "systemc/*" - cmake -S . -B build --preset Release + cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=all" cmake --build build --target format-check cmake --build build -j12 cmake --build build --target test From 1d4a805f1e56461c535885286ff5aba92f9b428f Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 26 Nov 2025 07:39:19 +0100 Subject: [PATCH 40/52] forces conan to rebuild all packages in Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 76b9c20..1e888bb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ void build_n_test_project() { . .venv/bin/activate pip3 install -r requirements.txt conan remove -c "systemc/*" - cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=all" + cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=*" cmake --build build --target format-check cmake --build build -j12 cmake --build build --target test From e2e35f6c1a7bfef5dac8758df167bd2a701c90c2 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 26 Nov 2025 07:44:38 +0100 Subject: [PATCH 41/52] enables clang-format step in Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1e888bb..b0bd918 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ void build_n_test_project() { . .venv/bin/activate pip3 install -r requirements.txt conan remove -c "systemc/*" - cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=*" + cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=*" -DENABLE_CLANG_FORMAT=ON cmake --build build --target format-check cmake --build build -j12 cmake --build build --target test From d9a9693c777a74a79f706e6f566ff23614e8c030 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 26 Nov 2025 08:19:00 +0100 Subject: [PATCH 42/52] fixes cci_example test --- .vscode/launch.json | 9 +++++++++ tests/configuration/top_module.h | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e8969e..57bd73b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,6 +13,15 @@ "SCC_TEST_VERBOSE": "7" } }, + { + "type": "gdb", + "request": "launch", + "name": "cci-example", + "program": "${workspaceFolder}/build/Debug/tests/configuration/cci-example", + "environment": { + "SCC_TEST_VERBOSE": "7" + } + }, { "name": "cppdbg quantum_keeper_mt", "type": "cppdbg", diff --git a/tests/configuration/top_module.h b/tests/configuration/top_module.h index dbe5424..35a8efb 100644 --- a/tests/configuration/top_module.h +++ b/tests/configuration/top_module.h @@ -38,6 +38,7 @@ #include #include +#include "cci/core/cci_value.h" #include "initiator.h" #include "router.h" #include "target.h" @@ -114,7 +115,9 @@ public: auto paramName0 = fmt::format("{}.{}.initiator_ID", name(), targetName); auto quotedTargetName = fmt::format("\"target_{}\"", i); - m_broker.set_preset_cci_value(paramName0, cci::cci_value::from_json(targetName)); + cci::cci_value v; + v.set(targetName); + m_broker.set_preset_cci_value(paramName0, v); // Set preset value for maximum target size(memory) auto paramName1 = fmt::format("{}.{}.initiator_ID", name(), targetName); @@ -141,7 +144,7 @@ public: SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting fields of target_" << i; m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str())); } catch(sc_core::sc_report const& exception) { - SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what(); + SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what() << " (expected)"; } targetName = fmt::format("{}.RouterInstance.r_sa_{}", name(), i); From d97bb9877e312994a788460a8315ac6a51344fdd Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 28 Nov 2025 15:10:17 +0100 Subject: [PATCH 43/52] updates scc --- CMakePresets.json | 24 ++++++++++++++++-------- scc | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 0a556d8..6427ff7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -30,14 +30,22 @@ "CMAKE_BUILD_TYPE": "Debug" } }, - { - "name": "DebugCXX20", - "inherits": "Base", - "cacheVariables": { - "CMAKE_CXX_STANDARD": "20", - "CMAKE_BUILD_TYPE": "Debug" - } - }, + { + "name": "DebugWFormat", + "inherits": "Base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "ENABLE_CLANG_FORMAT": "ON" + } + }, + { + "name": "DebugCXX20", + "inherits": "Base", + "cacheVariables": { + "CMAKE_CXX_STANDARD": "20", + "CMAKE_BUILD_TYPE": "Debug" + } + }, { "name": "RelWithDebInfo", "inherits": "Base", diff --git a/scc b/scc index 25252a4..3f5d963 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 25252a4de60ec366d502e374d0f0ab2e06eb1d67 +Subproject commit 3f5d963ae0f7e83a340674d44c3a8e5125d221ef From 52114bf895b9f1be7712e0147d0eaf852146cca7 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Dec 2025 14:42:10 +0100 Subject: [PATCH 44/52] updates scc and used packages --- conanfile.py | 29 ++++++++++++++++------------- scc | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/conanfile.py b/conanfile.py index 2579ccc..27b49bb 100644 --- a/conanfile.py +++ b/conanfile.py @@ -6,9 +6,7 @@ import os class Pkg(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = ( - "CMakeDeps" - ) + generators = "CMakeDeps" default_options = { "systemc/*:shared": "True", "boost/*:fPIC": "True", @@ -35,24 +33,29 @@ class Pkg(ConanFile): } def requirements(self): - self.requires("systemc/3.0.1") - self.requires("fmt/8.0.1") - self.requires("spdlog/1.9.2") - self.requires("boost/1.85.0") - self.requires("catch2/3.1.0") - self.requires("lz4/1.9.4") - self.requires("yaml-cpp/0.7.0") - self.requires("jsoncpp/1.9.5") + if self.settings.compiler.cppstd: + cppstd = str(self.settings.compiler.cppstd).replace("gnu", "") + if cppstd == "11" or cppstd == "14": + self.requires("systemc/2.3.4") + else: + self.requires("systemc/3.0.1") + else: + self.requires("systemc/2.3.4") + self.requires("spdlog/1.16.0") + self.requires("boost/1.89.0") + self.requires("lz4/1.10.0") + self.requires("yaml-cpp/0.8.0") + self.requires("jsoncpp/1.9.6") self.requires("zlib/1.3.1") + self.requires("catch2/3.1.0") def build_requirements(self): pass def layout(self): cmake_layout(self) - + def generate(self): tc = CMakeToolchain(self) tc.user_presets_path = False tc.generate() - \ No newline at end of file diff --git a/scc b/scc index 3f5d963..5bb49d8 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 3f5d963ae0f7e83a340674d44c3a8e5125d221ef +Subproject commit 5bb49d85a106dffd5353ba40506ac5474b828fe5 From 79d76eea80c98511b4e5a908943df110d190e2f8 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Dec 2025 16:24:40 +0100 Subject: [PATCH 45/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index 5bb49d8..a2304f9 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 5bb49d85a106dffd5353ba40506ac5474b828fe5 +Subproject commit a2304f9a325d2ba521b50640c7708611ecb04e98 From b89b86a711d2b6fdf9b0e99336ab9538c61cb6ee Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Dec 2025 16:48:12 +0100 Subject: [PATCH 46/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index a2304f9..d0f9fa3 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit a2304f9a325d2ba521b50640c7708611ecb04e98 +Subproject commit d0f9fa3a5525eb780671fde830e634a639a02f59 From ac8386d0d9ca1e33f9191741392e749e6b0472fc Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Dec 2025 16:53:54 +0100 Subject: [PATCH 47/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index d0f9fa3..f279e60 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit d0f9fa3a5525eb780671fde830e634a639a02f59 +Subproject commit f279e606ad1ebdb7403c771b382cc565da72e387 From cfdd5d75d7b8f29132b81805e48406ec1ef1ff19 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Dec 2025 10:28:17 +0100 Subject: [PATCH 48/52] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index f279e60..d011dfe 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit f279e606ad1ebdb7403c771b382cc565da72e387 +Subproject commit d011dfe5066f992c37f9baee1599acadcc18ce98 From a0970534aeb4d3e8754973f63140e262a928eca8 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Dec 2025 12:39:31 +0100 Subject: [PATCH 49/52] update scc --- scc | 2 +- xxx.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 xxx.sh diff --git a/scc b/scc index d011dfe..a1704aa 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit d011dfe5066f992c37f9baee1599acadcc18ce98 +Subproject commit a1704aa0d60b772af7e5c6a4c95d2c5db056eecc diff --git a/xxx.sh b/xxx.sh new file mode 100644 index 0000000..8a8f4fd --- /dev/null +++ b/xxx.sh @@ -0,0 +1,2 @@ +echo $1 +exec clang-format -i $1 From bf2222686f145afab010886c55c4ee57b30bd1bc Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Dec 2025 12:40:51 +0100 Subject: [PATCH 50/52] removes accidentially added file --- xxx.sh | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 xxx.sh diff --git a/xxx.sh b/xxx.sh deleted file mode 100644 index 8a8f4fd..0000000 --- a/xxx.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo $1 -exec clang-format -i $1 From 5dec262eb4271d5db2c2ecf389619a981001c916 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 9 Dec 2025 07:58:06 +0100 Subject: [PATCH 51/52] removes scc git submodule and adds as FetchContent --- .gitmodules | 3 --- CMakeLists.txt | 24 ++++++++++++++++++++++-- scc | 1 - 3 files changed, 22 insertions(+), 6 deletions(-) delete mode 160000 scc diff --git a/.gitmodules b/.gitmodules index 1ddda03..a836f0d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "scc"] - path = scc - url = https://github.com/Minres/SystemC-Components.git [submodule "cmake-conan"] path = cmake-conan url = https://github.com/conan-io/cmake-conan.git diff --git a/CMakeLists.txt b/CMakeLists.txt index ed26e15..a49bf95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 3.16) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake) cmake_policy(SET CMP0110 NEW) project(SCC_Test) @@ -11,6 +10,22 @@ option(ENABLE_CLANG_FORMAT "Enable clang-format targets" OFF) option(THREAD_SANITIZER "Enable thread sanitizer TSan" OFF) option(ADDR_SANITIZER "Enable address sanitizer ASan" OFF) +if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scc") + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake) +else() + include(FetchContent) + FetchContent_Declare( + scc_git + GIT_REPOSITORY https://github.com/Minres/SystemC-Components.git + GIT_TAG develop + ) + FetchContent_GetProperties(scc_git) + if(NOT scc_git_POPULATED) + FetchContent_Populate(scc_git) + endif() + list(APPEND CMAKE_MODULE_PATH ${scc_git_SOURCE_DIR}/cmake) +endif() + include(GNUInstallDirs) include(BuildType) @@ -72,6 +87,11 @@ include(CTest) include(Catch) enable_testing() set(WITH_SCP4SCC ON) -add_subdirectory(scc) + +if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scc") + add_subdirectory(scc) +else() + add_subdirectory(${scc_git_SOURCE_DIR}) +endif() add_subdirectory(src) add_subdirectory(tests) diff --git a/scc b/scc deleted file mode 160000 index a1704aa..0000000 --- a/scc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1704aa0d60b772af7e5c6a4c95d2c5db056eecc From ffb9f28f894e3f35988cad017ab4cb24f205c139 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 9 Dec 2025 07:58:28 +0100 Subject: [PATCH 52/52] adds memory page_boundary_check test --- tests/memory_subsys/memory_test.cpp | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/memory_subsys/memory_test.cpp b/tests/memory_subsys/memory_test.cpp index 81eec6e..92f8f0d 100644 --- a/tests/memory_subsys/memory_test.cpp +++ b/tests/memory_subsys/memory_test.cpp @@ -6,8 +6,6 @@ #include #include #include -#include -#include using namespace sc_core; namespace scc { @@ -69,4 +67,33 @@ TEST_CASE("dmi_access", "[memory][tlm-level]") { sc_start(dut.clk.read()); } +TEST_CASE("page_boundary_check", "[memory][tlm-level]") { + auto& dut = factory::get(); + constexpr uint64_t kPageSize = decltype(dut.mem3)::page_size; + + std::array write_data{{0xAAu, 0xBBu}}; + tlm::tlm_generic_payload write; + sc_core::sc_time delay = sc_core::SC_ZERO_TIME; + write.set_command(tlm::TLM_WRITE_COMMAND); + write.set_address(kPageSize - 1); // straddles page boundary + write.set_data_length(write_data.size()); + write.set_streaming_width(write_data.size()); + write.set_data_ptr(write_data.data()); + dut.mem3.handle_operation(write, delay); + + std::array read_buf{{0xEEu, 0x00u, 0x00u, 0xEEu}}; + tlm::tlm_generic_payload read; + read.set_command(tlm::TLM_READ_COMMAND); + read.set_address(kPageSize - 1); + read.set_data_length(write_data.size()); + read.set_streaming_width(write_data.size()); + read.set_data_ptr(read_buf.data() + 1); // leave guard bytes at both ends + dut.mem3.handle_operation(read, delay); + + REQUIRE(read_buf[0] == 0xEEu); // leading guard untouched + REQUIRE(read_buf[1] == 0xAAu); // first byte read correctly + REQUIRE(read_buf[2] == 0xBBu); // second byte read correctly + REQUIRE(read_buf[3] == 0xEEu); // trailing guard must remain +} + } // namespace scc