From f639576ac0d2df710872c44d47cba045603b9e5b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 3 May 2024 22:14:29 +0200 Subject: [PATCH] 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