mirror of
https://github.com/DrasLorus/CORDIC_Rotate_APFX.git
synced 2024-11-22 04:33:17 +01:00
Fix synthesis and includes bugs
- `catch_common` target renamed `catch_common_${PROJECT_NAME}` to avoid conflict with other `catch_common` target when included in a top cmake project. - `scale_cordic(double)` moved outside of the SOFTWARE region, as it can be useful in Xilinx testbench and is not synthetized anyway. - A little modification for debbuging purpose, out_stream can be used to dump results in a file if not commented out.
This commit is contained in:
parent
0dc041b840
commit
a8433e0188
3 changed files with 9 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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<int64_t> cordic(std::complex<int64_t> 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<double> cordic(std::complex<double> x_in,
|
||||
uint64_t counter) {
|
||||
const std::complex<int64_t> fx_x_in(int64_t(x_in.real() * double(in_scale_factor)),
|
||||
|
|
|
@ -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.;
|
||||
|
|
Loading…
Reference in a new issue