Merge branch 'develop' into main
This commit is contained in:
commit
c30656841c
|
@ -14,7 +14,7 @@
|
||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cmake4eclipse.mbs.toolchain.cmake.134761605" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cmake4eclipse.mbs.toolchain.cmake.134761605" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
<folderInfo id="cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612" name="/" resourcePath="">
|
<folderInfo id="cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612" name="/" resourcePath="">
|
||||||
<toolChain id="cmake4eclipse.mbs.toolchain.cmake.1883503430" name="CMake driven" superClass="cmake4eclipse.mbs.toolchain.cmake">
|
<toolChain id="cmake4eclipse.mbs.toolchain.cmake.1883503430" name="CMake driven" superClass="cmake4eclipse.mbs.toolchain.cmake">
|
||||||
<targetPlatform id="cmake4eclipse.mbs.targetPlatform.cmake.1279728098" name="Any Platform" superClass="cmake4eclipse.mbs.targetPlatform.cmake"/>
|
<targetPlatform id="cmake4eclipse.mbs.targetPlatform.cmake.1279728098" name="Any Platform" superClass="cmake4eclipse.mbs.targetPlatform.cmake"/>
|
||||||
|
@ -28,12 +28,12 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
<storageModule buildDir="build/${ConfigName}" dirtyTs="1703253448607" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
<storageModule buildDir="build/${ConfigName}" dirtyTs="1715065528068" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||||
<options/>
|
<options/>
|
||||||
<defs>
|
<defs>
|
||||||
<def name="CMAKE_BUILD_TYPE" type="STRING" val="Debug"/>
|
<def name="CMAKE_BUILD_TYPE" type="STRING" val="Debug"/>
|
||||||
<def name="BUILD_SCC_DOCUMENTATION" type="BOOL" val="OFF"/>
|
<def name="BUILD_SCC_DOCUMENTATION" type="BOOL" val="OFF"/>
|
||||||
<def name="ENABLE_CLANG_TIDY" type="STRING" val="ON"/>
|
<def name="ENABLE_CLANG_TIDY" type="STRING" val="OFF"/>
|
||||||
</defs>
|
</defs>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
|
|
2
.envrc
2
.envrc
|
@ -3,6 +3,8 @@ distro=`/bin/lsb_release -i -s`
|
||||||
if [ $distro == "CentOS" ]; then
|
if [ $distro == "CentOS" ]; then
|
||||||
. /opt/rh/devtoolset-8/enable
|
. /opt/rh/devtoolset-8/enable
|
||||||
. /opt/rh/rh-python38/enable
|
. /opt/rh/rh-python38/enable
|
||||||
|
elif [ $distro == "Rocky" ]; then
|
||||||
|
. /opt/rh/gcc-toolset-11/enable
|
||||||
fi
|
fi
|
||||||
layout python3
|
layout python3
|
||||||
[ -f .envrc.$USER ] && . .envrc.$USER
|
[ -f .envrc.$USER ] && . .envrc.$USER
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
/.venv/
|
/.venv/
|
||||||
/.pydevproject
|
/.pydevproject
|
||||||
/*.fst
|
/*.fst
|
||||||
|
/*.ftr
|
||||||
/*.gtkw
|
/*.gtkw
|
||||||
/.envrc.*
|
/.envrc.*
|
||||||
/.direnv/
|
/.direnv/
|
||||||
|
/.venv/
|
||||||
|
/.cache
|
||||||
|
|
|
@ -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"
|
||||||
|
}]
|
||||||
|
}
|
|
@ -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",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -59,7 +59,7 @@ find_package(ClangFormat)
|
||||||
|
|
||||||
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
||||||
conan_check()
|
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
|
GENERATORS cmake_find_package
|
||||||
OPTIONS fmt:header_only=True spdlog:header_only=True
|
OPTIONS fmt:header_only=True spdlog:header_only=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -89,6 +89,20 @@ pipeline {
|
||||||
stage('Build & test') { steps { build_n_test_project() }}
|
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
|
||||||
|
'''
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
# SystemC-Components-Test
|
||||||
Examples and tests for the SystemC-Components
|
Examples and tests for the SystemC-Components
|
||||||
|
|
||||||
|
|
2
scc
2
scc
|
@ -1 +1 @@
|
||||||
Subproject commit 6063f8da997247d68aec9422e39c93458f18bba0
|
Subproject commit ee3719d8a5d7b32b22fe42085fb67458905704ed
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
#include <catch2/catch_session.hpp>
|
#include <catch2/catch_session.hpp>
|
||||||
|
#include <csetjmp>
|
||||||
|
#include <csignal>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <scc/trace.h>
|
#include <scc/trace.h>
|
||||||
|
@ -16,19 +18,26 @@
|
||||||
using namespace scc;
|
using namespace scc;
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
|
|
||||||
|
jmp_buf abrt;
|
||||||
|
void ABRThandler(int sig) { longjmp(abrt, 1); }
|
||||||
|
|
||||||
int sc_main(int argc, char* argv[]) {
|
int sc_main(int argc, char* argv[]) {
|
||||||
|
signal(SIGABRT, ABRThandler);
|
||||||
auto my_name = util::split(argv[0], '/').back();
|
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
|
// create tracer if environment variable SCC_TEST_TRACE is defined
|
||||||
std::unique_ptr<scc::tracer> tracer;
|
std::unique_ptr<scc::tracer> tracer;
|
||||||
if(getenv("SCC_TEST_TRACE"))
|
if(getenv("SCC_TEST_TRACE"))
|
||||||
tracer = std::make_unique<scc::tracer>(my_name, scc::tracer::file_type::TEXT, true);
|
tracer = std::make_unique<scc::tracer>(my_name, scc::tracer::NONE, scc::tracer::ENABLE);
|
||||||
|
int result = -1;
|
||||||
|
if(setjmp(abrt) == 0) {
|
||||||
// instantiate design(s)
|
// instantiate design(s)
|
||||||
factory::get_instance().create();
|
factory::get_instance().create();
|
||||||
// run tests
|
// run tests
|
||||||
int result = Catch::Session().run(argc, argv);
|
result = Catch::Session().run(argc, argv);
|
||||||
// destroy design(s)
|
// destroy design(s)
|
||||||
sc_stop();
|
sc_stop();
|
||||||
factory::get_instance().destroy();
|
factory::get_instance().destroy();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
add_subdirectory(io-redirector)
|
add_subdirectory(io-redirector)
|
||||||
add_subdirectory(ordered_semaphore)
|
add_subdirectory(ordered_semaphore)
|
||||||
|
add_subdirectory(cci_param_restricted)
|
||||||
add_subdirectory(ahb_pin_level)
|
add_subdirectory(ahb_pin_level)
|
||||||
add_subdirectory(axi4_pin_level)
|
add_subdirectory(axi4_pin_level)
|
||||||
add_subdirectory(ace_pin_level)
|
add_subdirectory(ace_pin_level)
|
||||||
add_subdirectory(configuration)
|
add_subdirectory(configuration)
|
||||||
|
add_subdirectory(configurer)
|
||||||
if(FULL_TEST_SUITE)
|
if(FULL_TEST_SUITE)
|
||||||
add_subdirectory(sim_performance)
|
add_subdirectory(sim_performance)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -136,7 +136,7 @@ template <typename STATE> unsigned run_scenario(STATE& state) {
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") {
|
void axi4_burst_alignment(bool pipelined_wrreq, bool write_bp) {
|
||||||
struct {
|
struct {
|
||||||
unsigned int ResetCycles{4};
|
unsigned int ResetCycles{4};
|
||||||
unsigned int BurstLengthByte{16};
|
unsigned int BurstLengthByte{16};
|
||||||
|
@ -148,6 +148,9 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") {
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
|
auto& dut = factory::get<testbench>();
|
||||||
|
dut.intor_bfm.pipelined_wrreq = pipelined_wrreq;
|
||||||
|
dut.tgt_pe.wr_data_accept_delay.value = write_bp ? 1 : 0;
|
||||||
auto cycles = run_scenario(state);
|
auto cycles = run_scenario(state);
|
||||||
|
|
||||||
REQUIRE(cycles < 1000);
|
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 {
|
struct {
|
||||||
unsigned int ResetCycles{4};
|
unsigned int ResetCycles{4};
|
||||||
unsigned int BurstLengthByte{16};
|
unsigned int BurstLengthByte{16};
|
||||||
|
@ -187,6 +190,9 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") {
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
|
auto& dut = factory::get<testbench>();
|
||||||
|
dut.intor_bfm.pipelined_wrreq = pipelined_wrreq;
|
||||||
|
dut.tgt_pe.wr_data_accept_delay.value = write_bp ? 1 : 0;
|
||||||
auto cycles = run_scenario(state);
|
auto cycles = run_scenario(state);
|
||||||
|
|
||||||
REQUIRE(cycles < 1000);
|
REQUIRE(cycles < 1000);
|
||||||
|
@ -209,3 +215,19 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") {
|
||||||
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
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); }
|
||||||
|
|
|
@ -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})
|
|
@ -0,0 +1,145 @@
|
||||||
|
#ifndef SC_INCLUDE_DYNAMIC_PROCESSES
|
||||||
|
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
||||||
|
#include <sysc/kernel/sc_simcontext.h>
|
||||||
|
#endif
|
||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
#include <factory.h>
|
||||||
|
#include <scc/cci_param_restricted.h>
|
||||||
|
#include <scc/utilities.h>
|
||||||
|
#include <systemc>
|
||||||
|
|
||||||
|
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<int> param1{"param1", 5, scc::min_max_restriction(0, 10), "This is parameter 1"};
|
||||||
|
scc::cci_param_restricted<int> param2{"param2", 5, scc::min_max_excl_restriction(0, 10), "This is parameter 3"};
|
||||||
|
scc::cci_param_restricted<int> param3{"param3", 10, scc::min_restriction(0), "This is parameter 2"};
|
||||||
|
scc::cci_param_restricted<int> param4{"param4", 10, scc::min_excl_restriction(0), "This is parameter 4"};
|
||||||
|
scc::cci_param_restricted<int> param5{"param5", 1, scc::max_restriction(10), "This is parameter 5"};
|
||||||
|
scc::cci_param_restricted<int> param6{"param6", 1, scc::max_excl_restriction(10), "This is parameter 6"};
|
||||||
|
scc::cci_param_restricted<int> param7{"param7", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 7"};
|
||||||
|
std::array<int, 5> values_arr{1, 2, 4, 8, 16};
|
||||||
|
scc::cci_param_restricted<int> param8{"param8", 4, scc::discrete_restriction(values_arr), "This is parameter 8"};
|
||||||
|
std::vector<int> values_vec{1, 2, 4, 8, 16};
|
||||||
|
scc::cci_param_restricted<int> param9{"param9", 4, scc::discrete_restriction(values_vec), "This is parameter 9"};
|
||||||
|
};
|
||||||
|
|
||||||
|
factory::add<top> 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<top>();
|
||||||
|
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<top>();
|
||||||
|
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<top>();
|
||||||
|
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<top>();
|
||||||
|
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();
|
||||||
|
}
|
|
@ -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)
|
|
@ -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 <pvs@circuitsutra.com>
|
||||||
|
* @date 29th April, 2011 (Friday)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <scc/cci_util.h>
|
||||||
|
#include <scc/configurer.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
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> int_param0{"int_param0", 0, "This is parameter 1", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<int> int_param1{"int_param1", 1, "This is parameter 3", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<int64_t> int64_param0{"int64_param0", 10, "This is parameter 2", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<int64_t> int64_param1{"int64_param1", 10, "This is parameter 4", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<unsigned> unsigned_param{"unsigned_param", 1, "This is parameter 5", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<uint64_t> uint64_param{"uint64_param", 1, "This is parameter 6", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<float> float_param{"float_param", 4, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<double> double_param{"double_param", 4, "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<std::string> string_param{"string_param", "", "This is parameter 7", cci::CCI_ABSOLUTE_NAME, sc_main_orig};
|
||||||
|
cci::cci_param<sc_core::sc_time> 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> 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> 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'
|
|
@ -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
|
Loading…
Reference in New Issue