diff --git a/CMakeLists.txt b/CMakeLists.txt index ab5f75f..27af801 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,18 +189,18 @@ if (ENABLE_TESTING) ) configure_file (sources/tb/cordic_rom_tb.cpp.in ${TB_SOURCE} @ONLY) - add_library (catch_common OBJECT sources/tb/main_catch2.cpp) - target_link_libraries (catch_common PUBLIC Catch2::Catch2) + add_library (catch_common_${PROJECT_NAME} OBJECT sources/tb/main_catch2.cpp) + target_link_libraries (catch_common_${PROJECT_NAME} PUBLIC Catch2::Catch2) file (GLOB ALL_ROM_TB_SOURCES sources/tb/cordic_rom_*.cpp) list (REMOVE_ITEM ALL_ROM_TB_SOURCES ${TB_SOURCE}) add_executable (cordic_tb sources/tb/cordic_tb.cpp ${TB_SOURCE} ${ALL_ROM_TB_SOURCES}) - target_link_libraries (cordic_tb PUBLIC cordic catch_common) + target_link_libraries (cordic_tb PRIVATE cordic catch_common_${PROJECT_NAME}) include (CTest) include (Catch) - catch_discover_tests (cordic_tb) + catch_discover_tests (cordic_tb WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data) endif () file (GLOB ALL_ROM_HEADERS sources/CordicRoms/cordic_rom_*.hpp) diff --git a/sources/CCordicRotateConstexpr/CCordicRotateConstexpr.hpp b/sources/CCordicRotateConstexpr/CCordicRotateConstexpr.hpp index ac65840..4b9ad36 100644 --- a/sources/CCordicRotateConstexpr/CCordicRotateConstexpr.hpp +++ b/sources/CCordicRotateConstexpr/CCordicRotateConstexpr.hpp @@ -65,6 +65,10 @@ public: return in * kn_i / 16U; } + static constexpr double scale_cordic(double in) { + return in * kn_values[nb_stages - 1]; + } + #if !defined(__SYNTHESIS__) && defined(SOFTWARE) static constexpr std::complex cordic(std::complex x_in, uint64_t counter) { @@ -92,10 +96,6 @@ public: return {(A), (B)}; } - static constexpr double scale_cordic(double in) { - return in * kn_values[nb_stages - 1]; - } - static constexpr std::complex cordic(std::complex x_in, uint64_t counter) { const std::complex fx_x_in(int64_t(x_in.real() * double(in_scale_factor)), diff --git a/sources/tb/cordic_tb.cpp b/sources/tb/cordic_tb.cpp index a1314b5..58f1926 100644 --- a/sources/tb/cordic_tb.cpp +++ b/sources/tb/cordic_tb.cpp @@ -206,7 +206,7 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") { fclose(INPUT); // Save the results to a file - // out_stream.open("results_ap.dat"); + // ofstream out_stream("results_ap.dat"); // FILE * romf = fopen("rom.dat", "w"); constexpr double abs_margin = double(1 << (cordic.Out_I - 1)) * 2. / 100.;