Fixed compilation in zynq

master
Ismael Gomez 6 years ago
parent 8f541cf4e1
commit a8a0c3ebe7

@ -253,16 +253,16 @@ macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wmissing-field-initializers -Wtype-limits -std=c++03") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wmissing-field-initializers -Wtype-limits -std=c++03")
find_package(SSE) find_package(SSE)
if (HAVE_AVX2) if (HAVE_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
else (HAVE_AVX2) else (HAVE_AVX2)
if(HAVE_AVX) if(HAVE_AVX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE) elseif(HAVE_SSE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
endif(HAVE_AVX) endif(HAVE_AVX)
endif (HAVE_AVX2) endif (HAVE_AVX2)
endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@ -270,7 +270,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clan
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE) ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -D_GNU_SOURCE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -D_GNU_SOURCE")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")
@ -292,12 +292,12 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
find_package(SSE) find_package(SSE)
if (HAVE_AVX2) if (HAVE_AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
else (HAVE_AVX2) else (HAVE_AVX2)
if(HAVE_AVX) if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE) elseif(HAVE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
endif(HAVE_AVX) endif(HAVE_AVX)
endif (HAVE_AVX2) endif (HAVE_AVX2)
@ -306,8 +306,8 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif (HAVE_FMA) endif (HAVE_FMA)
if (HAVE_AVX512) if (HAVE_AVX512)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512cd -mavx512bw -mavx512dq -DLV_HAVE_AVX512") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mavx512f -mavx512cd -mavx512bw -mavx512dq -DLV_HAVE_AVX512")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512cd -mavx512bw -mavx512dq -DLV_HAVE_AVX512") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mavx512f -mavx512cd -mavx512bw -mavx512dq -DLV_HAVE_AVX512")
endif(HAVE_AVX512) endif(HAVE_AVX512)
if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
@ -316,14 +316,14 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif(HAVE_SSE) endif(HAVE_SSE)
endif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") endif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=native -DIS_ARM -DHAVE_NEON") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIS_ARM -DHAVE_NEON -mfloat-abi=hard -mfpu=neon")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIS_ARM") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIS_ARM -mfloat-abi=hard -mfpu=neon")
message(STATUS "have ARM") message(STATUS "Detected ARM processor")
set(HAVE_NEON "True") set(HAVE_NEON "True")
else(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") else(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch")
set(HAVE_NEON "False") set(HAVE_NEON "False")
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch")
set(CMAKE_REQUIRED_FLAGS ${CMAKE_C_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${CMAKE_C_FLAGS})
if(NOT HAVE_SSE AND NOT HAVE_NEON AND NOT DISABLE_SIMD) if(NOT HAVE_SSE AND NOT HAVE_NEON AND NOT DISABLE_SIMD)

@ -179,7 +179,7 @@
#else #else
#if HAVE_NEON #ifdef WINIMP_IS_NEON16
#include <arm_neon.h> #include <arm_neon.h>
#define WINIMP arm16 #define WINIMP arm16
@ -777,7 +777,7 @@ void MAKE_FUNC(extract_input)(llr_t *input, llr_t *systematic, llr_t *app2, llr_
#ifdef HAVE_NEON #ifdef WINIMP_IS_NEON16
#define insert_bit(a,b) ap = v_insert_s16(ap, app1[k+(a%b)*nof_blocks], 7-a); \ #define insert_bit(a,b) ap = v_insert_s16(ap, app1[k+(a%b)*nof_blocks], 7-a); \
reset_cnt(a,b); reset_cnt(a,b);
#else #else
@ -787,7 +787,7 @@ void MAKE_FUNC(extract_input)(llr_t *input, llr_t *systematic, llr_t *app2, llr_
#ifndef HAVE_NEON #ifndef WINIMP_IS_NEON16
#define decide_for(b) for (uint32_t i = 0; i < long_cb/8; i++) { \ #define decide_for(b) for (uint32_t i = 0; i < long_cb/8; i++) { \
insert_bit(0,b);\ insert_bit(0,b);\
insert_bit(1,b);\ insert_bit(1,b);\
@ -816,7 +816,7 @@ void MAKE_FUNC(extract_input)(llr_t *input, llr_t *systematic, llr_t *app2, llr_
void MAKE_FUNC(decision_byte)(llr_t *app1, uint8_t *output, uint32_t long_cb) void MAKE_FUNC(decision_byte)(llr_t *app1, uint8_t *output, uint32_t long_cb)
{ {
uint32_t k=0; uint32_t k=0;
#ifdef HAVE_NEON #ifdef WINIMP_IS_NEON16
int8_t z = 0; int8_t z = 0;
int8x16_t zeros = vld1q_dup_s8(&z); int8x16_t zeros = vld1q_dup_s8(&z);
int16x8_t ap; int16x8_t ap;

@ -100,9 +100,22 @@ srslte_tdec_8bit_impl_t sse8_win_impl = {
}; };
#endif #endif
/* AVX window implementation */
#ifdef LV_HAVE_AVX2
#define WINIMP_IS_AVX8
#include "srslte/phy/fec/turbodecoder_win.h"
#undef WINIMP_IS_AVX8
srslte_tdec_8bit_impl_t avx8_win_impl = {
tdec_winavx8_init,
tdec_winavx8_free,
tdec_winavx8_dec,
tdec_winavx8_extract_input,
tdec_winavx8_decision_byte
};
#endif
#ifdef HAVE_NEON #ifdef HAVE_NEON
//#include "srslte/phy/fec/turbodecoder_neon.h"
#define WINIMP_IS_NEON16 #define WINIMP_IS_NEON16
#include "srslte/phy/fec/turbodecoder_win.h" #include "srslte/phy/fec/turbodecoder_win.h"
#undef WINIMP_IS_NEON16 #undef WINIMP_IS_NEON16
@ -116,20 +129,6 @@ srslte_tdec_16bit_impl_t arm16_win_impl = {
}; };
#endif #endif
/* AVX window implementation */
#ifdef LV_HAVE_AVX2
#define WINIMP_IS_AVX8
#include "srslte/phy/fec/turbodecoder_win.h"
#undef WINIMP_IS_AVX8
srslte_tdec_8bit_impl_t avx8_win_impl = {
tdec_winavx8_init,
tdec_winavx8_free,
tdec_winavx8_dec,
tdec_winavx8_extract_input,
tdec_winavx8_decision_byte
};
#endif
#define AUTO_16_SSE 0 #define AUTO_16_SSE 0
#define AUTO_16_SSEWIN 1 #define AUTO_16_SSEWIN 1
#define AUTO_16_AVXWIN 2 #define AUTO_16_AVXWIN 2

@ -360,7 +360,6 @@ int init37_neon(srslte_viterbi_t *q, int poly[3], uint32_t framebits, bool tail_
q->decode = decode37_neon; q->decode = decode37_neon;
q->free = free37_neon; q->free = free37_neon;
q->decode_f = NULL; q->decode_f = NULL;
printf("USING NEON VITERBI***************\n");
q->symbols_uc = srslte_vec_malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t)); q->symbols_uc = srslte_vec_malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t));
if (!q->symbols_uc) { if (!q->symbols_uc) {
perror("malloc"); perror("malloc");

@ -34,7 +34,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
// Enable to measure execution time // Enable to measure execution time
//#define DO_OFDM #define DO_OFDM
#ifdef DO_OFDM #ifdef DO_OFDM
#define NOF_CE_SYMBOLS SRSLTE_SF_LEN_PRB(cell.nof_prb) #define NOF_CE_SYMBOLS SRSLTE_SF_LEN_PRB(cell.nof_prb)

Loading…
Cancel
Save