GCC now works.

This commit is contained in:
Camille Monière 2022-02-11 20:17:10 +01:00
parent cbd04f1a3e
commit d92d11e3e7
Signed by: moniere
GPG key ID: 188DD5B072181C0F
4 changed files with 15 additions and 16 deletions

View file

@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 3.16.0 FATAL_ERROR)
# setting this is required # setting this is required
set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)

View file

@ -45,10 +45,9 @@ template <uint8_t N_STAGES,
uint8_t OUT_I, uint8_t OUT_I,
uint8_t ATAN_I> uint8_t ATAN_I>
class CCordicRotate { class CCordicRotate {
private:
static constexpr auto atanLUT = CAtanLUT<N_STAGES, uint64_t, ATAN_I>();
public: public:
static constexpr const CAtanLUT<N_STAGES, uint64_t, ATAN_I> & atanLUT = CAtanLUT<N_STAGES, uint64_t, ATAN_I>();
static void process( static void process(
const ap_fixed<TH_W, TH_I> & fx_angle, const ap_fixed<TH_W, TH_I> & fx_angle,
const ap_fixed<IN_W, IN_I> & fx_re_in, const ap_fixed<IN_W, IN_I> & fx_re_in,

View file

@ -25,7 +25,7 @@ class CCordicRotateRomHalfPi {
static_assert(TNStages > 1, "2 stages of CORDIC is the minimum."); static_assert(TNStages > 1, "2 stages of CORDIC is the minimum.");
public: public:
static constexpr CRomGeneratorConst<TIn_W, TNStages, Tq> rom_cordic {}; static constexpr const CRomGeneratorConst<TIn_W, TNStages, Tq> & rom_cordic = CRomGeneratorConst<TIn_W, TNStages, Tq>();
static constexpr unsigned In_W = TIn_W; static constexpr unsigned In_W = TIn_W;
static constexpr unsigned In_I = TIn_I; static constexpr unsigned In_I = TIn_I;
@ -129,7 +129,6 @@ public:
} }
}; };
#if 0 #if 0
template <> template <>
inline void CCordicRotateRomHalfPi<16, 4, 6, 64>::cordic( inline void CCordicRotateRomHalfPi<16, 4, 6, 64>::cordic(

View file

@ -9,8 +9,9 @@ using namespace std;
using Catch::Matchers::Floating::WithinAbsMatcher; using Catch::Matchers::Floating::WithinAbsMatcher;
typedef CCordicRotate<8, 14, 4, 17, 5, 19, 7, 12> cordic_legacy;
TEST_CASE("Adaptive CORDIC work as intended", "[!hide][WIP]") { TEST_CASE("Adaptive CORDIC work as intended", "[!hide][WIP]") {
typedef CCordicRotate<8, 14, 4, 17, 5, 19, 7, 12> cordic_legacy;
string input_fn = "../data/input.dat"; // _8_14_4_17_5_19_7_12 string input_fn = "../data/input.dat"; // _8_14_4_17_5_19_7_12
string output_fn = "../data/output.dat"; // _8_14_4_17_5_19_7_12 string output_fn = "../data/output.dat"; // _8_14_4_17_5_19_7_12
@ -72,9 +73,11 @@ TEST_CASE("Adaptive CORDIC work as intended", "[!hide][WIP]") {
// Return 0 if the test passed // Return 0 if the test passed
} }
typedef CCordicRotateRomHalfPi<16, 4, 6, 64> cordic_rom;
TEST_CASE("ROM-based Cordic works with C-Types", "[CORDIC]") { TEST_CASE("ROM-based Cordic works with C-Types", "[CORDIC]") {
SECTION("W:16 - I:4 - Stages:6 - q:64") { SECTION("W:16 - I:4 - Stages:6 - q:64") {
typedef CCordicRotateRomHalfPi<16, 4, 6, 64> cordic_rom; static constexpr cordic_rom cordic {};
string input_fn = "../data/input.dat"; // _8_14_4_17_5_19_7_12 string input_fn = "../data/input.dat"; // _8_14_4_17_5_19_7_12
string output_fn = "../data/output.dat"; // _8_14_4_17_5_19_7_12 string output_fn = "../data/output.dat"; // _8_14_4_17_5_19_7_12
@ -110,8 +113,6 @@ TEST_CASE("ROM-based Cordic works with C-Types", "[CORDIC]") {
// Save the results to a file // Save the results to a file
FILE.open("results.dat"); FILE.open("results.dat");
constexpr cordic_rom cordic {};
constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.; constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.;
// Executing the encoder // Executing the encoder
@ -141,7 +142,8 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
constexpr unsigned n_lines = 100000; constexpr unsigned n_lines = 100000;
SECTION("W:16 - I:4 - Stages:6 - q:64") { SECTION("W:16 - I:4 - Stages:6 - q:64") {
typedef CCordicRotateRomHalfPi<16, 4, 6, 64> cordic_rom;
static constexpr cordic_rom cordic {};
string input_fn = "../data/input.dat"; string input_fn = "../data/input.dat";
@ -184,7 +186,6 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
out_stream.open("results_ap.dat"); out_stream.open("results_ap.dat");
// FILE * romf = fopen("rom.dat", "w"); // FILE * romf = fopen("rom.dat", "w");
constexpr cordic_rom cordic {};
constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.; constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.;
@ -219,7 +220,8 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
} }
SECTION("W:16 - I:4 - Stages:6 - q:64 - internal scaling") { SECTION("W:16 - I:4 - Stages:6 - q:64 - internal scaling") {
typedef CCordicRotateRomHalfPi<16, 4, 6, 64> cordic_rom; // typedef CCordicRotateRomHalfPi<16, 4, 6, 64> cordic_rom;
static constexpr cordic_rom cordic {};
string input_fn = "../data/input.dat"; string input_fn = "../data/input.dat";
@ -262,8 +264,6 @@ TEST_CASE("ROM-based Cordic works with AP-Types", "[CORDIC]") {
out_stream.open("results_ap.dat"); out_stream.open("results_ap.dat");
// FILE * romf = fopen("rom.dat", "w"); // FILE * romf = fopen("rom.dat", "w");
constexpr cordic_rom cordic {};
constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.; constexpr double abs_margin = double(1 << cordic.Out_I) * 2. / 100.;
// Executing the encoder // Executing the encoder