adds test for tracing of sc_fixed datatypes
This commit is contained in:
parent
9a41d1ac80
commit
12f3ecd6f3
@ -14,7 +14,7 @@
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<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="">
|
||||
<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"/>
|
||||
@ -28,8 +28,8 @@
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule buildDir="build/${ConfigName}" dirtyTs="1715065528068" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||
<options/>
|
||||
<storageModule buildDir="build/${ConfigName}" dirtyTs="1728554089717" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||
<options otherArguments="--preset Debug"/>
|
||||
<defs>
|
||||
<def name="CMAKE_BUILD_TYPE" type="STRING" val="Debug"/>
|
||||
<def name="BUILD_SCC_DOCUMENTATION" type="BOOL" val="OFF"/>
|
||||
|
2
scc
2
scc
@ -1 +1 @@
|
||||
Subproject commit 010aac102a7bfda042debf09c51981ee55c723ac
|
||||
Subproject commit 966e575aba7f2f4ffc8a422d522f7173c4c7d98c
|
@ -7,6 +7,7 @@ add_subdirectory(axi4_pin_level)
|
||||
add_subdirectory(ace_pin_level)
|
||||
add_subdirectory(configuration)
|
||||
add_subdirectory(configurer)
|
||||
add_subdirectory(sc_fixed_tracing)
|
||||
if(FULL_TEST_SUITE)
|
||||
add_subdirectory(sim_performance)
|
||||
endif()
|
||||
|
3
tests/sc_fixed_tracing/CMakeLists.txt
Normal file
3
tests/sc_fixed_tracing/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
add_executable (sc_fixed_tracing sc_main.cpp)
|
||||
target_link_libraries (sc_fixed_tracing LINK_PUBLIC scc-sysc)
|
||||
add_test(NAME sc_fixed_tracing_test COMMAND sc_fixed_tracing )
|
82
tests/sc_fixed_tracing/sc_main.cpp
Normal file
82
tests/sc_fixed_tracing/sc_main.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
#define SC_INCLUDE_FX
|
||||
#include <scc/cci_util.h>
|
||||
#include <scc/configurer.h>
|
||||
#include <scc/observer.h>
|
||||
#include <scc/sc_variable.h>
|
||||
#include <scc/tracer.h>
|
||||
#include <string>
|
||||
#include <systemc>
|
||||
|
||||
using namespace sc_dt;
|
||||
using namespace std;
|
||||
|
||||
struct testbench : public sc_core::sc_module {
|
||||
scc::sc_variable<sc_dt::sc_fixed<6, 4>> a{"a", sc_dt::sc_fixed<6, 4>()};
|
||||
scc::sc_variable<sc_fixed<4, 2, SC_RND, SC_SAT>> b_sc_sat{"b_sc_sat", 0};
|
||||
scc::sc_variable<sc_fixed<8, 3>> a_qant{"a_qant", 0};
|
||||
scc::sc_variable<sc_fixed<5, 3, SC_RND>> b_sc_rnd{"b_sc_rnd", 0};
|
||||
scc::sc_variable<sc_fixed<5, 3, SC_TRN>> b_sc_trn{"b_sc_trn", 0};
|
||||
sc_fixed<5, 3> a_fixed;
|
||||
sc_dt::sc_fix a_fix{5, 3};
|
||||
sc_fxtype_params params{5, 4};
|
||||
sc_fxtype_context context{params};
|
||||
// becase we do not specify in b_fix constructor anything
|
||||
// the parameters are taken form the latest created context
|
||||
sc_fix b_fix;
|
||||
sc_fix c_fix{5, 3};
|
||||
|
||||
testbench(sc_core::sc_module_name const& nm)
|
||||
: sc_module(nm) {
|
||||
SC_HAS_PROCESS(testbench);
|
||||
SC_THREAD(run);
|
||||
}
|
||||
|
||||
void trace(sc_core::sc_trace_file* trf) const override {
|
||||
a.trace(trf);
|
||||
scc::sc_trace(trf, a_fixed, std::string(name()) + ".a_fixed");
|
||||
scc::sc_trace(trf, a_fix, std::string(name()) + ".a_fix");
|
||||
scc::sc_trace(trf, b_fix, std::string(name()) + ".b_fix");
|
||||
scc::sc_trace(trf, c_fix, std::string(name()) + ".c_fix");
|
||||
}
|
||||
|
||||
void run() {
|
||||
wait(1_ns);
|
||||
init();
|
||||
wait(1_ns);
|
||||
test_overflow_modes();
|
||||
wait(1_ns);
|
||||
test_quantization_modes();
|
||||
wait(1_ns);
|
||||
this->a = 2;
|
||||
wait(1_ps);
|
||||
sc_core::sc_stop();
|
||||
}
|
||||
|
||||
void init() {
|
||||
a_fixed = 1.75;
|
||||
a_fix = 1.75;
|
||||
b_fix = 1.75;
|
||||
c_fix = 1.75;
|
||||
}
|
||||
void test_overflow_modes() {
|
||||
a = -7;
|
||||
b_sc_sat = *a;
|
||||
}
|
||||
|
||||
void test_quantization_modes() {
|
||||
a_qant = -2.3125;
|
||||
b_sc_rnd = *a_qant;
|
||||
b_sc_trn = *a_qant;
|
||||
}
|
||||
};
|
||||
|
||||
int sc_main(int sc_argc, char* sc_argv[]) {
|
||||
scc::init_logging(scc::log::INFO);
|
||||
scc::configurer cfg("");
|
||||
scc::tracer trc("sc_fixed_tracing");
|
||||
testbench tb("tb");
|
||||
sc_core::sc_start();
|
||||
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'
|
Loading…
Reference in New Issue
Block a user