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/.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/.gitignore b/.gitignore
index a12f4a1..af81461 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,9 @@
/.venv/
/.pydevproject
/*.fst
+/*.ftr
/*.gtkw
/.envrc.*
/.direnv/
+/.venv/
+/.cache
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 746423b..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 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.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/Jenkinsfile b/Jenkinsfile
index 9e3d9c4..fa67378 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -89,6 +89,20 @@ pipeline {
stage('Build & test') { steps { build_n_test_project() }}
}
}
+ //
+ stage('Format check') {
+ 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 --target format-check
+ '''
+ }}
+ }
+ }
}
}
}
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
diff --git a/scc b/scc
index 6063f8d..ee3719d 160000
--- a/scc
+++ b/scc
@@ -1 +1 @@
-Subproject commit 6063f8da997247d68aec9422e39c93458f18bba0
+Subproject commit ee3719d8a5d7b32b22fe42085fb67458905704ed
diff --git a/src/sc_main.cpp b/src/sc_main.cpp
index 6a26589..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));
+ 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;
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f2f005e..5e98656 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,9 +1,11 @@
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)
add_subdirectory(configuration)
+add_subdirectory(configurer)
if(FULL_TEST_SUITE)
add_subdirectory(sim_performance)
endif()
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); }
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..925edbc
--- /dev/null
+++ b/tests/cci_param_restricted/test.cpp
@@ -0,0 +1,145 @@
+#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", 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;
+
+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);
+ 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) == 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();
+}
+
+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();
+}
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..cd91c3e
--- /dev/null
+++ b/tests/configurer/sc_main.cpp
@@ -0,0 +1,74 @@
+/*****************************************************************************
+
+ 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
+#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[])
+ * @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};
+ 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);
+ 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..ecd8ebd
--- /dev/null
+++ b/tests/configurer/test.yaml
@@ -0,0 +1,11 @@
+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
+trace_lvl_param: MEDIUM
\ No newline at end of file