diff --git a/CMakeLists.txt b/CMakeLists.txt index 4461a40..69a887c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,15 @@ option (EXPORT_COMMANDS "export compile commands, for use with clangd for exampl option (ENABLE_XILINX "use Xilinx provided and proprietary headers." OFF) option (ENABLE_TESTING "use Catch2 in conjunction with CTest as a test suite." ON) + +option (PEDANTIC "use -Wall and -pedantic." ON) + #################################################################################################### +if (PEDANTIC) + add_compile_options(-Wall -pedantic) +endif () + if (EXPORT_COMMANDS) set (CMAKE_EXPORT_COMPILE_COMMANDS ON) endif () diff --git a/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp b/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp index 4839e3c..d63a449 100644 --- a/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp +++ b/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp @@ -40,7 +40,7 @@ private: double B = 0; uint8_t R = 0; - uint8_t mask = 0x80; + const uint8_t sig_mask = 0x80; double beta = rot_in; @@ -57,12 +57,12 @@ private: } if ((beta < -half_pi) || (beta > half_pi)) { - R = R | mask; + R = R | sig_mask; beta = beta < 0 ? beta + pi : beta - pi; // A = -A; // B = -B; } else { - R = R & (~mask); + R = R & (~sig_mask); } for (uint8_t u = 1; u < NStages + 1; u++) { @@ -77,7 +77,7 @@ private: const double sigma = beta < 0 ? -1. : 1; - R = beta < 0 ? R | mask : R & ~mask; + R = beta < 0 ? R | mask : R & nmask; const double factor = sigma / double(1U << (u - 1)); diff --git a/sources/tb/cordic_tb.cpp b/sources/tb/cordic_tb.cpp index 860252d..d275d5f 100644 --- a/sources/tb/cordic_tb.cpp +++ b/sources/tb/cordic_tb.cpp @@ -301,22 +301,13 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") { } TEST_CASE("ROM-based Cordic constexpr are evaluated during compilation.", "[CORDIC]") { - constexpr unsigned n_lines = 100000; - SECTION("W:16 - I:4 - Stages:6 - q:64 - C-Types") { static constexpr cordic_rom cordic {}; - constexpr double rotation = cordic_rom::rom_cordic.rotation; - constexpr double q = cordic_rom::rom_cordic.q; - constexpr uint64_t max_length = cordic_rom::rom_cordic.max_length; - constexpr complex value_in = (1U << 12) * 97; constexpr uint8_t angle = 169; - double results_re[n_lines]; - double results_im[n_lines]; - constexpr complex res1 = cordic.cordic(value_in, angle); constexpr complex res2 = cordic.cordic(value_in, angle); static_assert(res1 == res2, "Test");