Formatting

This commit is contained in:
Camille Monière 2022-04-21 15:32:39 +02:00
parent da8bffc606
commit cb06836072
Signed by: moniere
GPG key ID: 188DD5B072181C0F
6 changed files with 10 additions and 14 deletions

View file

@ -18,6 +18,3 @@
*/ */
#include "CCordicAbs.hpp" #include "CCordicAbs.hpp"

View file

@ -63,11 +63,10 @@ public:
} }
static constexpr ap_uint<Out_W> scale_cordic(ap_uint<Out_W> in) { static constexpr ap_uint<Out_W> scale_cordic(ap_uint<Out_W> in) {
return ap_uint<Out_W>(ap_uint<Out_W+4>(in * ap_uint<4>(kn_i)) >> 4U); return ap_uint<Out_W>(ap_uint<Out_W + 4>(in * ap_uint<4>(kn_i)) >> 4U);
} }
#if !defined(XILINX_MAJOR) || XILINX_MAJOR >= 2020
#if !defined (XILINX_MAJOR) || XILINX_MAJOR >= 2020
static constexpr ap_uint<Out_W> process(ap_int<In_W> re_in, ap_int<In_W> im_in) { static constexpr ap_uint<Out_W> process(ap_int<In_W> re_in, ap_int<In_W> im_in) {
ap_int<Out_W> A[nb_stages + 1]; ap_int<Out_W> A[nb_stages + 1];
ap_int<Out_W> B[nb_stages + 1]; ap_int<Out_W> B[nb_stages + 1];

View file

@ -34,7 +34,7 @@ struct hls_abs<false> {
template <int _Tsize> template <int _Tsize>
static ap_uint<_Tsize + 1> abs(ap_int<_Tsize> value) { static ap_uint<_Tsize + 1> abs(ap_int<_Tsize> value) {
const ap_uint<_Tsize - 1> u_value = value.range(_Tsize - 2, 0); const ap_uint<_Tsize - 1> u_value = value.range(_Tsize - 2, 0);
const bool sign_value = value.bit(_Tsize - 1); const bool sign_value = value.bit(_Tsize - 1);
const ap_uint<_Tsize + 1> a_value = sign_value const ap_uint<_Tsize + 1> a_value = sign_value
? ap_uint<_Tsize + 1>((~u_value) + true) ? ap_uint<_Tsize + 1>((~u_value) + true)

View file

@ -134,7 +134,7 @@ TEST_CASE("Constexpr CordicAbs works with C-Types", "[CORDICABS]") {
// outfile << values_in[iter].real() << " " << values_in[iter].imag() << " " << values_out[iter] << " " << results[iter] << endl; // outfile << values_in[iter].real() << " " << values_in[iter].imag() << " " << values_out[iter] << " " << results[iter] << endl;
REQUIRE_THAT(cordic_abs::scale_cordic(double(values_out[iter])) / cordic_abs::out_scale_factor , WithinAbsMatcher(results[iter], abs_margin)); REQUIRE_THAT(cordic_abs::scale_cordic(double(values_out[iter])) / cordic_abs::out_scale_factor, WithinAbsMatcher(results[iter], abs_margin));
} }
// outfile.close(); // outfile.close();
} }
@ -145,7 +145,7 @@ TEST_CASE("Constexpr CordicAbs works with AP-Types", "[CORDICABS]") {
SECTION("W:16 - I:4 - Stages:6") { SECTION("W:16 - I:4 - Stages:6") {
typedef CCordicAbs<16, 4, 6> cordic_abs; typedef CCordicAbs<16, 4, 6> cordic_abs;
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
constexpr unsigned n_lines = 100000; constexpr unsigned n_lines = 100000;

View file

@ -19,7 +19,7 @@
#include "top_level_cordic.hpp" #include "top_level_cordic.hpp"
#if !defined (XILINX_MAJOR) || XILINX_MAJOR >= 2020 #if !defined(XILINX_MAJOR) || XILINX_MAJOR >= 2020
void cordic_abs_16_4_6( void cordic_abs_16_4_6(
ap_int<cordic_abs_t::In_W> re_in, ap_int<cordic_abs_t::In_W> re_in,
@ -38,8 +38,8 @@ void cordic_abs_16_4_6(
#else #else
constexpr unsigned In_W = cordic_abs_t::In_W; constexpr unsigned In_W = cordic_abs_t::In_W;
constexpr unsigned Out_W = cordic_abs_t::Out_W; constexpr unsigned Out_W = cordic_abs_t::Out_W;
constexpr unsigned nb_stages = cordic_abs_t::nb_stages; constexpr unsigned nb_stages = cordic_abs_t::nb_stages;
static ap_uint<Out_W> process(ap_int<In_W> re_in, ap_int<In_W> im_in) { static ap_uint<Out_W> process(ap_int<In_W> re_in, ap_int<In_W> im_in) {

View file

@ -22,6 +22,6 @@
typedef CCordicAbs<16, 4, 6> cordic_abs_t; typedef CCordicAbs<16, 4, 6> cordic_abs_t;
void cordic_abs_16_4_6( void cordic_abs_16_4_6(
ap_int<cordic_abs_t::In_W> re_in, ap_int<cordic_abs_t::In_W> re_in,
ap_int<cordic_abs_t::In_W> im_in, ap_int<cordic_abs_t::In_W> im_in,
ap_uint<cordic_abs_t::Out_W> & module_out); ap_uint<cordic_abs_t::Out_W> & module_out);