diff --git a/CMakeLists.txt b/CMakeLists.txt index 335bb35..d9c6e89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,9 +97,9 @@ endif () set ( ROM_TYPE "ml" - CACHE STRING "RomGenerator to use, either 'ml' or 'cst'." + CACHE STRING "RomGenerator to use, either 'ml' or 'cst'." ) -set_property(CACHE ROM_TYPE PROPERTY STRINGS "ml" "cst") +set_property (CACHE ROM_TYPE PROPERTY STRINGS "ml" "cst") set ( CORDIC_W @@ -126,8 +126,9 @@ add_subdirectory (RomGenerators) set (ROM_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sources/CordicRoms) string ( - CONFIGURE ${ROM_DIRECTORY}/cordic_rom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.hpp - ROM_HEADER + CONFIGURE + ${ROM_DIRECTORY}/cordic_rom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.hpp + ROM_HEADER ) add_custom_command ( OUTPUT ${ROM_HEADER} @@ -135,8 +136,12 @@ add_custom_command ( WORKING_DIRECTORY ${ROM_DIRECTORY} ) -set (CORDIC_ROM_HEADER CCordicRotateRom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.hpp) -set (CORDIC_ROM_SOURCE CCordicRotateRom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.cpp) +set (CORDIC_ROM_HEADER + CCordicRotateRom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.hpp +) +set (CORDIC_ROM_SOURCE + CCordicRotateRom_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.cpp +) configure_file ( sources/CCordicRotateRom/CCordicRotateRom.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/sources/CCordicRotateRom/${CORDIC_ROM_HEADER} @ONLY diff --git a/RomGenerators/CMakeLists.txt b/RomGenerators/CMakeLists.txt index d784d47..10c5ff6 100644 --- a/RomGenerators/CMakeLists.txt +++ b/RomGenerators/CMakeLists.txt @@ -34,8 +34,7 @@ project ( ) add_library ( - romgen sources/RomGeneratorML/RomGeneratorML.cpp - sources/RomGeneratorConst/RomGeneratorConst.cpp + romgen sources/RomGeneratorML/RomGeneratorML.cpp sources/RomGeneratorConst/RomGeneratorConst.cpp ) target_include_directories (romgen PUBLIC sources) @@ -74,10 +73,10 @@ set ( CACHE STRING "Rotation denominator." ) -set (current_generator_source ${CMAKE_CURRENT_SOURCE_DIR}/sources/main_generator_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.cpp) -configure_file ( - sources/main_generator.cpp.in - ${current_generator_source} @ONLY +set ( + current_generator_source + ${CMAKE_CURRENT_SOURCE_DIR}/sources/main_generator_${ROM_TYPE}_${CORDIC_W}_${CORDIC_STAGES}_${CORDIC_Q}_${CORDIC_DIVIDER}.cpp ) +configure_file (sources/main_generator.cpp.in ${current_generator_source} @ONLY) add_executable (rom_generator ${current_generator_source}) target_link_libraries (rom_generator PUBLIC romgen) diff --git a/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp b/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp index 597517f..3834777 100644 --- a/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp +++ b/RomGenerators/sources/RomGeneratorConst/RomGeneratorConst.hpp @@ -42,7 +42,7 @@ public: static constexpr double rotation = pi / divider; static constexpr double q = Tq; static constexpr uint32_t max_length = 2 * divider * Tq; // 2pi / (pi / divider) * q - static constexpr int64_t scale_factor = int64_t(1U << (In_W - 1)); + static constexpr int64_t scale_factor = int64_t(1U << (In_W - 1)); static constexpr double atanDbl[28] { 0.78539816339745, 0.46364760900081, 0.24497866312686, 0.12435499454676, @@ -152,7 +152,7 @@ void generate_rom_header_cst(const char * filename) { fprintf(rom_file, "%3d, ", uint16_t(rom.rom[u])); } fprintf(rom_file, "%3d};\n", uint16_t(rom.rom[rom.max_length - 1])); - + fprintf(rom_file, "\n} // namespace cordic_roms\n\n"); fprintf(rom_file, "#endif // %s\n\n", upper_file_def); }