From c0a95d0a5774e6e9f8911f737b073df504d8e329 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 22 Dec 2023 22:54:40 +0100 Subject: [PATCH 01/18] adds format-check to Jenkins --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9e3d9c4..07eacc9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -89,6 +89,21 @@ pipeline { stage('Build & test') { steps { build_n_test_project() }} } } + // + stage('CLang') { + agent {docker { image 'ubuntu-riscv' } } + stages { + stage('Checkout') { steps { checkout_project() }} + stage('Setup') { steps { setup_conan() }} + stage('Build & check format') { steps { + sh''' + cmake -S . -B build + cmake --build build -j12 + cmake --build build --target format-check + ''' + }} + } + } } } } From 7f508b10068f3489b6cc1cf350fd6e7cdfd0e83c Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 23 Dec 2023 14:03:24 +0100 Subject: [PATCH 02/18] adds build status --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c7d55fc..171f11e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://jenkins.minres.com/view/SystemC/job/SCC%20Test/job/develop/badge/icon)](https://jenkins.minres.com/view/SystemC/job/SCC%20Test/job/develop/) + # SystemC-Components-Test Examples and tests for the SystemC-Components From e27b33947b375b4d1093693e1fd34878d6bbaccf Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Apr 2024 22:19:43 +0200 Subject: [PATCH 03/18] adds test for restricted cci_params --- .gitignore | 2 ++ scc | 2 +- tests/CMakeLists.txt | 1 + tests/cci_param_restricted/CMakeLists.txt | 9 +++++ tests/cci_param_restricted/test.cpp | 40 +++++++++++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/cci_param_restricted/CMakeLists.txt create mode 100644 tests/cci_param_restricted/test.cpp diff --git a/.gitignore b/.gitignore index a12f4a1..9382033 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ /*.gtkw /.envrc.* /.direnv/ +/.venv/ +/.cache diff --git a/scc b/scc index 6063f8d..933ae38 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 6063f8da997247d68aec9422e39c93458f18bba0 +Subproject commit 933ae38f47ef9e97992af3809757baa935c7ffe7 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f2f005e..68439bd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(io-redirector) add_subdirectory(ordered_semaphore) +add_subdirectory(cci_param_restricted) add_subdirectory(ahb_pin_level) add_subdirectory(axi4_pin_level) add_subdirectory(ace_pin_level) diff --git a/tests/cci_param_restricted/CMakeLists.txt b/tests/cci_param_restricted/CMakeLists.txt new file mode 100644 index 0000000..6ac195e --- /dev/null +++ b/tests/cci_param_restricted/CMakeLists.txt @@ -0,0 +1,9 @@ +project (cci_param_restricted) + +add_executable(${PROJECT_NAME} + test.cpp + ${test_util_SOURCE_DIR}/sc_main.cpp +) +target_link_libraries (${PROJECT_NAME} PUBLIC test_util) + +catch_discover_tests(${PROJECT_NAME}) diff --git a/tests/cci_param_restricted/test.cpp b/tests/cci_param_restricted/test.cpp new file mode 100644 index 0000000..f045524 --- /dev/null +++ b/tests/cci_param_restricted/test.cpp @@ -0,0 +1,40 @@ +#ifndef SC_INCLUDE_DYNAMIC_PROCESSES +#define SC_INCLUDE_DYNAMIC_PROCESSES +#include +#endif +#include +#include +#include +#include +#include + +using namespace sc_core; + +struct top : public sc_core::sc_module { + top() + : top("top") {} + top(sc_module_name const& nm) + : sc_core::sc_module(nm) {} + + scc::cci_param_restricted param1{"param1", 1, scc::min_max_restriction(0, 10), "This is parameter 1"}; + scc::cci_param_restricted param2{"param2", 1, scc::min_restriction(0), "This is parameter 2"}; + scc::cci_param_restricted param3{"param3", 1, scc::min_max_excl_restriction(0, 10), "This is parameter 3"}; + scc::cci_param_restricted param4{"param4", 1, scc::min_excl_restriction(0), "This is parameter 4"}; + scc::cci_param_restricted param5{"param5", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 5"}; +}; + +factory::add tb; + +TEST_CASE("simple cci_param_restricted test", "[SCC][cci_param_restricted]") { + + auto& dut = factory::get(); + auto run1 = sc_spawn([&dut]() { + wait(1_ns); + sc_core::sc_stop(); + }); + + sc_start(10_ns); + REQUIRE(run1.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 1); +} From d7ce4b9a8ef01b7adaec1810b8698308a9066e89 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Apr 2024 22:34:42 +0200 Subject: [PATCH 04/18] update scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index 933ae38..c42c12c 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 933ae38f47ef9e97992af3809757baa935c7ffe7 +Subproject commit c42c12c2662c955748d1574093f3bdf9c0efcc64 From 90002786a43a475606874717798e2dd1b3d1a406 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 4 Apr 2024 22:41:37 +0200 Subject: [PATCH 05/18] fixes wrong expectation --- tests/cci_param_restricted/test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cci_param_restricted/test.cpp b/tests/cci_param_restricted/test.cpp index f045524..0ffa6b5 100644 --- a/tests/cci_param_restricted/test.cpp +++ b/tests/cci_param_restricted/test.cpp @@ -29,12 +29,12 @@ TEST_CASE("simple cci_param_restricted test", "[SCC][cci_param_restricted]") { auto& dut = factory::get(); auto run1 = sc_spawn([&dut]() { - wait(1_ns); + sc_core::wait(1_ns); sc_core::sc_stop(); }); sc_start(10_ns); REQUIRE(run1.terminated()); REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); - REQUIRE(sc_report_handler::get_count(SC_WARNING) == 1); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); } From f4506a064bd7de1952cb0668158b69a9935b3299 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Apr 2024 08:41:47 +0200 Subject: [PATCH 06/18] adds vscode setup --- .vscode/launch.json | 25 +++++++++++++++++++++++++ .vscode/tasks.json | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..fc26538 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // 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": "cppdbg", + "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 + } + ], + "preLaunchTask": "CMake: build" + }] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..8714fea --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "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 From c6167118d54a294eb1349283e4f7138fa7de2f08 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 5 Apr 2024 08:42:10 +0200 Subject: [PATCH 07/18] adds additional tests --- src/sc_main.cpp | 2 +- tests/cci_param_restricted/test.cpp | 60 ++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/sc_main.cpp b/src/sc_main.cpp index 6a26589..7ad3209 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -18,7 +18,7 @@ using namespace sc_core; int sc_main(int argc, char* argv[]) { auto my_name = util::split(argv[0], '/').back(); - scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE") ? log::DEBUG : log::FATAL).logAsync(false)); + scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE") ? log::DEBUG : log::FATAL).logAsync(false).msgTypeFieldWidth(35)); // create tracer if environment variable SCC_TEST_TRACE is defined std::unique_ptr tracer; if(getenv("SCC_TEST_TRACE")) diff --git a/tests/cci_param_restricted/test.cpp b/tests/cci_param_restricted/test.cpp index 0ffa6b5..3fb0f4c 100644 --- a/tests/cci_param_restricted/test.cpp +++ b/tests/cci_param_restricted/test.cpp @@ -17,24 +17,72 @@ struct top : public sc_core::sc_module { : sc_core::sc_module(nm) {} scc::cci_param_restricted param1{"param1", 1, scc::min_max_restriction(0, 10), "This is parameter 1"}; - scc::cci_param_restricted param2{"param2", 1, scc::min_restriction(0), "This is parameter 2"}; - scc::cci_param_restricted param3{"param3", 1, scc::min_max_excl_restriction(0, 10), "This is parameter 3"}; + scc::cci_param_restricted param2{"param2", 1, scc::min_max_excl_restriction(0, 10), "This is parameter 3"}; + scc::cci_param_restricted param3{"param3", 1, scc::min_restriction(0), "This is parameter 2"}; scc::cci_param_restricted param4{"param4", 1, scc::min_excl_restriction(0), "This is parameter 4"}; scc::cci_param_restricted param5{"param5", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 5"}; }; factory::add tb; -TEST_CASE("simple cci_param_restricted test", "[SCC][cci_param_restricted]") { - +TEST_CASE("simple cci_param_restricted min_max test", "[SCC][cci_param_restricted]") { + sc_report_handler::set_actions(SC_ERROR, SC_LOG | SC_CACHE_REPORT | SC_DISPLAY | SC_DO_NOTHING); auto& dut = factory::get(); auto run1 = sc_spawn([&dut]() { sc_core::wait(1_ns); - sc_core::sc_stop(); + for(auto i : {0, 5, 10, -1, 11}) { + dut.param1.set_value(i); + sc_core::wait(1_ns); + } }); sc_start(10_ns); REQUIRE(run1.terminated()); - REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 2); REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); + auto run2 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {0, 5, 10, -1, 11}) { + dut.param2.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run2.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 4); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); +} + +TEST_CASE("simple cci_param_restricted min test", "[SCC][cci_param_restricted]") { + sc_report_handler::set_actions(SC_ERROR, SC_LOG | SC_CACHE_REPORT | SC_DISPLAY | SC_DO_NOTHING); + auto& dut = factory::get(); + auto run1 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {0, 5, -1}) { + dut.param3.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run1.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 1); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); + auto run2 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {0, 5, -1}) { + dut.param4.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run2.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 2); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); } From 775cacf2b5d39f3b03d466ed883235aa3131008a Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 6 Apr 2024 10:45:08 +0200 Subject: [PATCH 08/18] extends cci_param_restricted tests --- scc | 2 +- tests/cci_param_restricted/test.cpp | 67 ++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/scc b/scc index c42c12c..ff7c45b 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit c42c12c2662c955748d1574093f3bdf9c0efcc64 +Subproject commit ff7c45b19477f1591489465d3ae65458bf643de6 diff --git a/tests/cci_param_restricted/test.cpp b/tests/cci_param_restricted/test.cpp index 3fb0f4c..925edbc 100644 --- a/tests/cci_param_restricted/test.cpp +++ b/tests/cci_param_restricted/test.cpp @@ -16,11 +16,17 @@ struct top : public sc_core::sc_module { top(sc_module_name const& nm) : sc_core::sc_module(nm) {} - scc::cci_param_restricted param1{"param1", 1, scc::min_max_restriction(0, 10), "This is parameter 1"}; - scc::cci_param_restricted param2{"param2", 1, scc::min_max_excl_restriction(0, 10), "This is parameter 3"}; - scc::cci_param_restricted param3{"param3", 1, scc::min_restriction(0), "This is parameter 2"}; - scc::cci_param_restricted param4{"param4", 1, scc::min_excl_restriction(0), "This is parameter 4"}; - scc::cci_param_restricted param5{"param5", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 5"}; + scc::cci_param_restricted param1{"param1", 5, scc::min_max_restriction(0, 10), "This is parameter 1"}; + scc::cci_param_restricted param2{"param2", 5, scc::min_max_excl_restriction(0, 10), "This is parameter 3"}; + scc::cci_param_restricted param3{"param3", 10, scc::min_restriction(0), "This is parameter 2"}; + scc::cci_param_restricted param4{"param4", 10, scc::min_excl_restriction(0), "This is parameter 4"}; + scc::cci_param_restricted param5{"param5", 1, scc::max_restriction(10), "This is parameter 5"}; + scc::cci_param_restricted param6{"param6", 1, scc::max_excl_restriction(10), "This is parameter 6"}; + scc::cci_param_restricted param7{"param7", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 7"}; + std::array values_arr{1, 2, 4, 8, 16}; + scc::cci_param_restricted param8{"param8", 4, scc::discrete_restriction(values_arr), "This is parameter 8"}; + std::vector values_vec{1, 2, 4, 8, 16}; + scc::cci_param_restricted param9{"param9", 4, scc::discrete_restriction(values_vec), "This is parameter 9"}; }; factory::add tb; @@ -86,3 +92,54 @@ TEST_CASE("simple cci_param_restricted min test", "[SCC][cci_param_restricted]") REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); sc_report_handler::initialize(); } + +TEST_CASE("simple cci_param_restricted max test", "[SCC][cci_param_restricted]") { + sc_report_handler::set_actions(SC_ERROR, SC_LOG | SC_CACHE_REPORT | SC_DISPLAY | SC_DO_NOTHING); + auto& dut = factory::get(); + auto run1 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {0, 10, 11}) { + dut.param5.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run1.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 1); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); + auto run2 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {0, 10, 11}) { + dut.param6.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run2.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 2); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); +} + +TEST_CASE("simple cci_param_restricted discrete test", "[SCC][cci_param_restricted]") { + sc_report_handler::set_actions(SC_ERROR, SC_LOG | SC_CACHE_REPORT | SC_DISPLAY | SC_DO_NOTHING); + auto& dut = factory::get(); + auto run1 = sc_spawn([&dut]() { + sc_core::wait(1_ns); + for(auto i : {4, 10}) { + dut.param7.set_value(i); + dut.param8.set_value(i); + dut.param9.set_value(i); + sc_core::wait(1_ns); + } + }); + + sc_start(10_ns); + REQUIRE(run1.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 3); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + sc_report_handler::initialize(); +} From 3a8a675bfd7971cbaa70a341d1a0a0e7c4aa6235 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 6 Apr 2024 12:45:28 +0200 Subject: [PATCH 09/18] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index ff7c45b..fe86bd5 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit ff7c45b19477f1591489465d3ae65458bf643de6 +Subproject commit fe86bd5b68198a75082fe0b351cd675a62808c58 From 0992cefeb877a9f554b73a56b9fb82d93416a243 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 6 Apr 2024 12:50:52 +0200 Subject: [PATCH 10/18] changes Jenkins step name --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07eacc9..fa67378 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -90,7 +90,7 @@ pipeline { } } // - stage('CLang') { + stage('Format check') { agent {docker { image 'ubuntu-riscv' } } stages { stage('Checkout') { steps { checkout_project() }} @@ -98,7 +98,6 @@ pipeline { stage('Build & check format') { steps { sh''' cmake -S . -B build - cmake --build build -j12 cmake --build build --target format-check ''' }} From f639576ac0d2df710872c44d47cba045603b9e5b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 3 May 2024 22:14:29 +0200 Subject: [PATCH 11/18] adds simple configurer test --- CMakeLists.txt | 2 +- scc | 2 +- tests/CMakeLists.txt | 1 + tests/configurer/CMakeLists.txt | 3 ++ tests/configurer/sc_main.cpp | 67 +++++++++++++++++++++++++++++++++ tests/configurer/test.yaml | 10 +++++ 6 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 tests/configurer/CMakeLists.txt create mode 100644 tests/configurer/sc_main.cpp create mode 100644 tests/configurer/test.yaml diff --git a/CMakeLists.txt b/CMakeLists.txt index 746423b..6db850c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ find_package(ClangFormat) set(CONAN_CMAKE_SILENT_OUTPUT ON) conan_check() -conan_configure(REQUIRES fmt/8.0.1 spdlog/1.9.2 boost/1.75.0 gsl-lite/0.37.0 systemc/2.3.3 catch2/3.1.0 zlib/1.2.11 lz4/1.9.4 +conan_configure(REQUIRES jsoncpp/1.9.5 yaml-cpp/0.6.3 spdlog/1.9.2 fmt/8.0.1 boost/1.75.0 gsl-lite/0.37.0 systemc/2.3.3 catch2/3.1.0 zlib/1.2.11 lz4/1.9.4 GENERATORS cmake_find_package OPTIONS fmt:header_only=True spdlog:header_only=True ) diff --git a/scc b/scc index fe86bd5..b70b27a 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit fe86bd5b68198a75082fe0b351cd675a62808c58 +Subproject commit b70b27a878fdec49b6413fd3737d4e10ae72acb3 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 68439bd..5e98656 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,6 +5,7 @@ add_subdirectory(ahb_pin_level) add_subdirectory(axi4_pin_level) add_subdirectory(ace_pin_level) add_subdirectory(configuration) +add_subdirectory(configurer) if(FULL_TEST_SUITE) add_subdirectory(sim_performance) endif() diff --git a/tests/configurer/CMakeLists.txt b/tests/configurer/CMakeLists.txt new file mode 100644 index 0000000..1a17ded --- /dev/null +++ b/tests/configurer/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable (configurer sc_main.cpp) +target_link_libraries (configurer LINK_PUBLIC scc-sysc) +add_test(NAME configurer_test COMMAND configurer ${CMAKE_CURRENT_SOURCE_DIR}/test.yaml) \ No newline at end of file diff --git a/tests/configurer/sc_main.cpp b/tests/configurer/sc_main.cpp new file mode 100644 index 0000000..cbdd986 --- /dev/null +++ b/tests/configurer/sc_main.cpp @@ -0,0 +1,67 @@ +/***************************************************************************** + + Licensed to Accellera Systems Initiative Inc. (Accellera) under one or + more contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright ownership. + Accellera licenses this file to you under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing + permissions and limitations under the License. + + ****************************************************************************/ + +#ifndef SC_INCLUDE_DYNAMIC_PROCESSES +#define SC_INCLUDE_DYNAMIC_PROCESSES +#endif + +/** + * @file main.cpp + * @brief Testbench file + * This file declares and implements the functionality of the target. + * Few of the parameters of the target sc_module are configured by the + * router sc_module. + * @author P V S Phaneendra, CircuitSutra Technologies + * @date 29th April, 2011 (Friday) + */ + +#include +#include + +/** + * @fn int sc_main(int argc, char* argv[]) + * @brief The testbench for the hierarchical override of parameter values example + * @param argc The number of input arguments + * @param argv The list of input arguments + * @return An integer for the execution status + */ +int sc_main(int sc_argc, char* sc_argv[]) { + scc::init_logging(scc::log::INFO); + scc::configurer cfg(sc_argc == 2 ? sc_argv[1] : "test.yaml"); + cfg.dump_configuration("dump.yaml", true); + cci::cci_originator sc_main_orig("SC_MAIN"); + cci::cci_param int_param0{"int_param0", 0, "This is parameter 1", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param int_param1{"int_param1", 1, "This is parameter 3", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param int64_param0{"int64_param0", 10, "This is parameter 2", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param int64_param1{"int64_param1", 10, "This is parameter 4", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param unsigned_param{"unsigned_param", 1, "This is parameter 5", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param uint64_param{"uint64_param", 1, "This is parameter 6", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param float_param{"float_param", 4, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param double_param{"double_param", 4, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param string_param{"string_param", "", "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param sc_time_param{"sc_time_param", sc_core::SC_ZERO_TIME, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, + sc_main_orig}; + // Start the simulation + SCCINFO("sc_main") << "Begin Simulation."; + sc_core::sc_start(sc_core::SC_ZERO_TIME); + SCCINFO("sc_main") << "End Simulation."; + + return sc_core::sc_report_handler::get_count(sc_core::SC_ERROR) + sc_core::sc_report_handler::get_count(sc_core::SC_WARNING); +; +} // End of 'sc_main' diff --git a/tests/configurer/test.yaml b/tests/configurer/test.yaml new file mode 100644 index 0000000..82a7a43 --- /dev/null +++ b/tests/configurer/test.yaml @@ -0,0 +1,10 @@ +int_param0: 1 +int_param1: -1 +int64_param0: 2 +int64_param1: -2 +unsigned_param: 3 +uint64_param: 4 +float_param: 5.0 +double_param: 6 +string_param: test entry +sc_time_param: 10 ns From aff456d6f483ddace3fd9291a3dd2f6e44a4fb2c Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 3 May 2024 22:46:53 +0200 Subject: [PATCH 12/18] adds missed format fix --- tests/configurer/sc_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/configurer/sc_main.cpp b/tests/configurer/sc_main.cpp index cbdd986..e03ef18 100644 --- a/tests/configurer/sc_main.cpp +++ b/tests/configurer/sc_main.cpp @@ -63,5 +63,4 @@ int sc_main(int sc_argc, char* sc_argv[]) { SCCINFO("sc_main") << "End Simulation."; return sc_core::sc_report_handler::get_count(sc_core::SC_ERROR) + sc_core::sc_report_handler::get_count(sc_core::SC_WARNING); -; } // End of 'sc_main' From 904d897773f9f8aee4b4e81a5d45d2abff7dddb2 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 7 May 2024 10:59:57 +0200 Subject: [PATCH 13/18] adds test for CCI enum macro --- .cproject | 6 +++--- scc | 2 +- tests/configurer/sc_main.cpp | 5 +++++ tests/configurer/test.yaml | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.cproject b/.cproject index 301b355..5484523 100644 --- a/.cproject +++ b/.cproject @@ -14,7 +14,7 @@ - + @@ -28,12 +28,12 @@ - + - + diff --git a/scc b/scc index b70b27a..580bce2 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit b70b27a878fdec49b6413fd3737d4e10ae72acb3 +Subproject commit 580bce2322e3d7d576f460ee490c6c5ca0e1a6c1 diff --git a/tests/configurer/sc_main.cpp b/tests/configurer/sc_main.cpp index e03ef18..1d6a873 100644 --- a/tests/configurer/sc_main.cpp +++ b/tests/configurer/sc_main.cpp @@ -31,9 +31,12 @@ * @date 29th April, 2011 (Friday) */ +#include #include #include +DEFINE_ENUM4CCI(trace_lvl, (NONE)(LOW)(MEDIUM)(HIGH)(FULL)) + /** * @fn int sc_main(int argc, char* argv[]) * @brief The testbench for the hierarchical override of parameter values example @@ -57,6 +60,8 @@ int sc_main(int sc_argc, char* sc_argv[]) { cci::cci_param string_param{"string_param", "", "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; cci::cci_param sc_time_param{"sc_time_param", sc_core::SC_ZERO_TIME, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param trace_lvl_param{"trace_lvl_param", trace_lvl::NONE, "This is parameter 8", cci::CCI_ABSOLUTE_NAME, + sc_main_orig}; // Start the simulation SCCINFO("sc_main") << "Begin Simulation."; sc_core::sc_start(sc_core::SC_ZERO_TIME); diff --git a/tests/configurer/test.yaml b/tests/configurer/test.yaml index 82a7a43..ecd8ebd 100644 --- a/tests/configurer/test.yaml +++ b/tests/configurer/test.yaml @@ -8,3 +8,4 @@ float_param: 5.0 double_param: 6 string_param: test entry sc_time_param: 10 ns +trace_lvl_param: MEDIUM \ No newline at end of file From f82c3ce2297115edbe92c9ff680d7249c2a3525d Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 7 May 2024 12:26:37 +0200 Subject: [PATCH 14/18] adds namespaced CCI enum test --- scc | 2 +- tests/configurer/sc_main.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scc b/scc index 580bce2..40b696a 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 580bce2322e3d7d576f460ee490c6c5ca0e1a6c1 +Subproject commit 40b696a98b0fe179f6e0413a4223418f84288e85 diff --git a/tests/configurer/sc_main.cpp b/tests/configurer/sc_main.cpp index 1d6a873..cd91c3e 100644 --- a/tests/configurer/sc_main.cpp +++ b/tests/configurer/sc_main.cpp @@ -36,6 +36,7 @@ #include DEFINE_ENUM4CCI(trace_lvl, (NONE)(LOW)(MEDIUM)(HIGH)(FULL)) +DEFINE_NS_ENUM4CCI(test, log_lvl, (NONE)(LOW)(MEDIUM)(HIGH)(FULL)) /** * @fn int sc_main(int argc, char* argv[]) @@ -62,6 +63,8 @@ int sc_main(int sc_argc, char* sc_argv[]) { sc_main_orig}; cci::cci_param trace_lvl_param{"trace_lvl_param", trace_lvl::NONE, "This is parameter 8", cci::CCI_ABSOLUTE_NAME, sc_main_orig}; + cci::cci_param test_log_lvl_param{"test_log_lvl_param", test::log_lvl::NONE, "This is parameter 9", + cci::CCI_ABSOLUTE_NAME, sc_main_orig}; // Start the simulation SCCINFO("sc_main") << "Begin Simulation."; sc_core::sc_start(sc_core::SC_ZERO_TIME); From f8bd40cd609b53da0cf4d9a02a2aa09b6b307aac Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 8 May 2024 17:19:37 +0200 Subject: [PATCH 15/18] adds error catching code to close databases properly --- src/sc_main.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/sc_main.cpp b/src/sc_main.cpp index 7ad3209..6ff5088 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -7,6 +7,8 @@ #include "factory.h" #include +#include +#include #include #include #include @@ -16,19 +18,26 @@ 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(); - scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE") ? log::DEBUG : log::FATAL).logAsync(false).msgTypeFieldWidth(35)); + scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE") ? log::TRACE : log::FATAL).logAsync(false).msgTypeFieldWidth(35)); // create tracer if environment variable SCC_TEST_TRACE is defined std::unique_ptr tracer; if(getenv("SCC_TEST_TRACE")) - tracer = std::make_unique(my_name, scc::tracer::file_type::TEXT, true); - // instantiate design(s) - factory::get_instance().create(); - // run tests - int result = Catch::Session().run(argc, argv); - // destroy design(s) - sc_stop(); - factory::get_instance().destroy(); + tracer = std::make_unique(my_name, scc::tracer::NONE, scc::tracer::ENABLE); + int result = -1; + if(setjmp(abrt) == 0) { + // instantiate design(s) + factory::get_instance().create(); + // run tests + result = Catch::Session().run(argc, argv); + // destroy design(s) + sc_stop(); + factory::get_instance().destroy(); + } return result; } From c929dcb5ea3d711e0cff4180ad11fc3f4ade3a9c Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 8 May 2024 17:20:26 +0200 Subject: [PATCH 16/18] adds pipelining of wr req to AXI/ACE pinlevel adapters --- .gitignore | 1 + scc | 2 +- tests/axi4_pin_level/narrow_burst_test.cpp | 26 ++++++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9382033..af81461 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ /.venv/ /.pydevproject /*.fst +/*.ftr /*.gtkw /.envrc.* /.direnv/ diff --git a/scc b/scc index 40b696a..2a1d3c1 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 40b696a98b0fe179f6e0413a4223418f84288e85 +Subproject commit 2a1d3c1c2e8dae7c6b6fc7353d7ca8ae76357e06 diff --git a/tests/axi4_pin_level/narrow_burst_test.cpp b/tests/axi4_pin_level/narrow_burst_test.cpp index 13eca15..3119369 100644 --- a/tests/axi4_pin_level/narrow_burst_test.cpp +++ b/tests/axi4_pin_level/narrow_burst_test.cpp @@ -136,7 +136,7 @@ template unsigned run_scenario(STATE& state) { return cycles; } -TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") { +void axi4_burst_alignment(bool pipelined_wrreq, bool write_bp) { struct { unsigned int ResetCycles{4}; unsigned int BurstLengthByte{16}; @@ -148,6 +148,9 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") { unsigned resp_cnt{0}; } state; + auto& dut = factory::get(); + dut.intor_bfm.pipelined_wrreq = pipelined_wrreq; + dut.tgt_pe.wr_data_accept_delay.value = write_bp ? 1 : 0; auto cycles = run_scenario(state); REQUIRE(cycles < 1000); @@ -175,7 +178,7 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") { } } -TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") { +void axi4_narrow_burst(bool pipelined_wrreq, bool write_bp) { struct { unsigned int ResetCycles{4}; unsigned int BurstLengthByte{16}; @@ -187,6 +190,9 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") { unsigned resp_cnt{0}; } state; + auto& dut = factory::get(); + dut.intor_bfm.pipelined_wrreq = pipelined_wrreq; + dut.tgt_pe.wr_data_accept_delay.value = write_bp ? 1 : 0; auto cycles = run_scenario(state); REQUIRE(cycles < 1000); @@ -209,3 +215,19 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") { CHECK(is_equal(*send_tx[i], *recv_tx[i])); } } + +TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") { axi4_burst_alignment(false, false); } + +TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") { axi4_narrow_burst(false, false); } + +TEST_CASE("axi4_burst_alignment_with_bp", "[AXI][pin-level]") { axi4_burst_alignment(false, true); } + +TEST_CASE("axi4_narrow_burst_with_bp", "[AXI][pin-level]") { axi4_narrow_burst(false, true); } + +TEST_CASE("axi4_burst_alignment_pipelined_write", "[AXI][pin-level]") { axi4_burst_alignment(true, false); } + +TEST_CASE("axi4_narrow_burst_pipelined_write", "[AXI][pin-level]") { axi4_narrow_burst(true, false); } + +TEST_CASE("axi4_burst_alignment_pipelined_write_with_bp", "[AXI][pin-level]") { axi4_burst_alignment(true, true); } + +TEST_CASE("axi4_narrow_burst_pipelined_write_with_bp", "[AXI][pin-level]") { axi4_narrow_burst(true, true); } From 892554f1f3b74efab34088a88dca19fe470b6494 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 8 May 2024 21:03:18 +0200 Subject: [PATCH 17/18] updates scc --- scc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scc b/scc index 2a1d3c1..959f329 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 2a1d3c1c2e8dae7c6b6fc7353d7ca8ae76357e06 +Subproject commit 959f32940b209787e2402ff8f43f8d6b0ef8a0d3 From 1e7f9cfc222bdc2dcdabc32385ee0f03e78634e1 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 4 Jun 2024 10:09:24 +0200 Subject: [PATCH 18/18] updates boost, Rocky8 setup and scc --- .envrc | 2 ++ CMakeLists.txt | 2 +- scc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.envrc b/.envrc index de09571..488f293 100644 --- a/.envrc +++ b/.envrc @@ -3,6 +3,8 @@ distro=`/bin/lsb_release -i -s` if [ $distro == "CentOS" ]; then . /opt/rh/devtoolset-8/enable . /opt/rh/rh-python38/enable +elif [ $distro == "Rocky" ]; then + . /opt/rh/gcc-toolset-11/enable fi layout python3 [ -f .envrc.$USER ] && . .envrc.$USER diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db850c..808a583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ find_package(ClangFormat) set(CONAN_CMAKE_SILENT_OUTPUT ON) conan_check() -conan_configure(REQUIRES jsoncpp/1.9.5 yaml-cpp/0.6.3 spdlog/1.9.2 fmt/8.0.1 boost/1.75.0 gsl-lite/0.37.0 systemc/2.3.3 catch2/3.1.0 zlib/1.2.11 lz4/1.9.4 +conan_configure(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 GENERATORS cmake_find_package OPTIONS fmt:header_only=True spdlog:header_only=True ) diff --git a/scc b/scc index 959f329..93d56f8 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 959f32940b209787e2402ff8f43f8d6b0ef8a0d3 +Subproject commit 93d56f8367550b62cca6b5055e7250741a96cc71