Clang works, not GCC

This commit is contained in:
Camille Monière 2022-02-11 19:17:11 +01:00
parent f2a7c0c886
commit cbd04f1a3e
Signed by: moniere
GPG key ID: 188DD5B072181C0F
5 changed files with 23 additions and 25 deletions

View file

@ -19,7 +19,6 @@ if (EXPORT_COMMANDS)
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif ()
option (ENABLE_XILINX "use Xilinx provided and proprietary headers." ON)
if (ENABLE_XILINX)
set (
@ -54,8 +53,7 @@ if ((NOT EXISTS ${AP_INCLUDE_DIR}/ap_int.h) OR (NOT EXISTS
message (
FATAL_ERROR
"Arbitrary precision headers not found in ${AP_INCLUDE_DIR}.\n"
"Consider disabling the ap_int feature using `-DENABLE_AP_INT=OFF`"
" or provide a suitable path to the headers."
"Please provide a suitable path to the headers."
)
endif ()

View file

@ -96,7 +96,7 @@ private:
public:
uint8_t rom[max_length];
constexpr CRomGeneratorConst() {
constexpr CRomGeneratorConst() : rom() {
for (unsigned n = 0; n < max_length; n++) {
const double chip_rotation = rotation / double(q) * double(n);
rom[n] = cordic_rom_gen(chip_rotation);
@ -106,7 +106,7 @@ public:
template <unsigned In_W, unsigned NStages, unsigned Tq>
void generate_rom_header_const(const char * filename = "rom_cordic.h") {
constexpr CRomGeneratorConst<In_W, NStages, Tq> rom;
constexpr CRomGeneratorConst<In_W, NStages, Tq> rom{};
FILE * rom_file = fopen(filename, "w");
if (!bool(rom_file)) {
@ -130,7 +130,7 @@ void generate_rom_header_const(const char * filename = "rom_cordic.h") {
template <unsigned In_W, unsigned NStages, unsigned Tq>
void generate_rom_header_const_raw(const char * filename = "rom_cordic.txt") {
constexpr CRomGeneratorConst<In_W, NStages, Tq> rom;
constexpr CRomGeneratorConst<In_W, NStages, Tq> rom{};
FILE * rom_file = fopen(filename, "w");
if (!bool(rom_file)) {

View file

@ -54,7 +54,7 @@ public:
const double re_x = floor(double(scale_factor - 1) * cos(-rotation / double(q) * double(n)));
const double im_x = floor(double(scale_factor - 1) * sin(-rotation / double(q) * double(n)));
const std::complex<int64_t> x {re_x, im_x};
const std::complex<int64_t> x {int64_t(re_x), int64_t(im_x)};
double error = 1000.;
uint8_t rom_v = 0x0;

View file

@ -11,6 +11,10 @@
#include <ap_fixed.h>
#include <ap_int.h>
template <uint8_t N_STAGES,
class T,
uint8_t ATAN_I>
struct CAtanLUT {
static constexpr double atanDbl[28] {
0.78539816339745, 0.46364760900081, 0.24497866312686, 0.12435499454676,
0.06241880999596, 0.03123983343027, 0.01562372862048, 0.00781234106010,
@ -20,10 +24,6 @@ static constexpr double atanDbl[28] {
0.00000095367432, 0.00000047683716, 0.00000023841858, 0.00000011920929,
0.00000005960464, 0.00000002980232, 0.00000001490116, 0.00000000745058};
template <uint8_t N_STAGES,
class T,
uint8_t ATAN_I>
struct CAtanLUT {
static_assert(N_STAGES < 28, "Not enough arctan available.");
static_assert(N_STAGES <= ATAN_I, "ATAN_I can't be less than N_STAGES.");
static_assert(std::__is_standard_integer<T>(), "Must be a standard C++ integer type.");

View file

@ -182,7 +182,7 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
// Save the results to a file
out_stream.open("results_ap.dat");
FILE * romf = fopen("rom.dat", "w");
// FILE * romf = fopen("rom.dat", "w");
constexpr cordic_rom cordic {};
@ -193,8 +193,8 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
// Execute
const uint8_t counter = uint8_t(iter & cnt_mask);
if (iter < cnt_mask + 1)
fprintf(romf, "%03d\n", (uint16_t) cordic.rom_cordic.rom[counter]);
// if (iter < cnt_mask + 1)
// fprintf(romf, "%03d\n", (uint16_t) cordic.rom_cordic.rom[counter]);
cordic.cordic(
values_re_in[iter], values_im_in[iter],
@ -211,7 +211,7 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
REQUIRE_THAT(values_im_out[iter].to_double() * 5. / 8. / cordic_rom::out_scale_factor, WithinAbsMatcher(results_im[iter], abs_margin));
}
out_stream.close();
fclose(romf);
// fclose(romf);
// Compare the results file with the golden results
// int retval = 0;
@ -260,7 +260,7 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
// Save the results to a file
out_stream.open("results_ap.dat");
FILE * romf = fopen("rom.dat", "w");
// FILE * romf = fopen("rom.dat", "w");
constexpr cordic_rom cordic {};
@ -271,8 +271,8 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
// Execute
const uint8_t counter = uint8_t(iter & cnt_mask);
if (iter < cnt_mask + 1)
fprintf(romf, "%03d\n", (uint16_t) cordic.rom_cordic.rom[counter]);
// if (iter < cnt_mask + 1)
// fprintf(romf, "%03d\n", (uint16_t) cordic.rom_cordic.rom[counter]);
cordic.cordic(
values_re_in[iter], values_im_in[iter],
@ -293,7 +293,7 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
abs_margin));
}
out_stream.close();
fclose(romf);
// fclose(romf);
// Compare the results file with the golden results
// int retval = 0;