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); +}