41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
|
#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", 1, scc::min_max_restriction(0, 10), "This is parameter 1"};
|
||
|
scc::cci_param_restricted<int> param2{"param2", 1, scc::min_restriction(0), "This is parameter 2"};
|
||
|
scc::cci_param_restricted<int> param3{"param3", 1, scc::min_max_excl_restriction(0, 10), "This is parameter 3"};
|
||
|
scc::cci_param_restricted<int> param4{"param4", 1, scc::min_excl_restriction(0), "This is parameter 4"};
|
||
|
scc::cci_param_restricted<int> param5{"param5", 4, scc::discrete_restriction({1, 2, 4, 8, 16}), "This is parameter 5"};
|
||
|
};
|
||
|
|
||
|
factory::add<top> tb;
|
||
|
|
||
|
TEST_CASE("simple cci_param_restricted test", "[SCC][cci_param_restricted]") {
|
||
|
|
||
|
auto& dut = factory::get<top>();
|
||
|
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);
|
||
|
}
|