diff --git a/AUTHORS b/AUTHORS index c55eb5ac3..8d9ab6084 100644 --- a/AUTHORS +++ b/AUTHORS @@ -33,21 +33,22 @@ Contact Information List of authors ------------------------------------------------------------------------------ -Carles Fernandez-Prades carles.fernandez@cttc.cat Project manager -Javier Arribas javier.arribas@cttc.cat Developer -Luis Esteve Elfau luis@epsilon-formacion.com Developer -Pau Closas pau.closas@cttc.cat Consultant -Carlos Aviles carlos.avilesr@googlemail.com Developer -David Pubill david.pubill@cttc.cat Developer -Mara Branzanti mara.branzanti@gmail.com Developer -Marc Molina marc.molina.pena@gmail.com Developer -Daniel Fehr daniel.co@bluewin.ch Developer -Marc Sales marcsales92@gmail.com Developer -Damian Miralles dmiralles2009@gmail.com Developer -Leonardo Tonetto tonetto.dev@gmail.com Contributor -Ignacio Paniego ignacio.paniego@gmail.com Web design -Eva Puchol eva.puchol@gmail.com Web developer -Carlos Paniego carpanie@hotmail.com Artwork +Carles Fernandez-Prades carles.fernandez@cttc.cat Project manager +Javier Arribas javier.arribas@cttc.cat Developer +Luis Esteve Elfau luis@epsilon-formacion.com Developer +Pau Closas pau.closas@cttc.cat Consultant +Carlos Aviles carlos.avilesr@googlemail.com Developer +David Pubill david.pubill@cttc.cat Developer +Mara Branzanti mara.branzanti@gmail.com Developer +Marc Molina marc.molina.pena@gmail.com Developer +Daniel Fehr daniel.co@bluewin.ch Developer +Marc Sales marcsales92@gmail.com Developer +Damian Miralles dmiralles2009@gmail.com Developer +Leonardo Tonetto tonetto.dev@gmail.com Contributor +Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor +Ignacio Paniego ignacio.paniego@gmail.com Web design +Eva Puchol eva.puchol@gmail.com Web developer +Carlos Paniego carpanie@hotmail.com Artwork diff --git a/cmake/Modules/TestForARM.cmake b/cmake/Modules/TestForARM.cmake new file mode 100644 index 000000000..dd9d512bf --- /dev/null +++ b/cmake/Modules/TestForARM.cmake @@ -0,0 +1,83 @@ +############################################################################## +# check if the compiler defines the architecture as ARM and set the +# version, if found. +# +# - Anthony Arnold +############################################################################## + +if (__TEST_FOR_ARM_INCLUDED) + return () +endif() +set(__TEST_FOR_ARM_INCLUDED TRUE) + +# Function checks if the input string defines ARM version and sets the +# output variable if found. +function(check_arm_version ppdef input_string version output_var) + string(REGEX MATCH "${ppdef}" _VERSION_MATCH "${input_string}") + if (NOT _VERSION_MATCH STREQUAL "") + set(${output_var} "${version}" PARENT_SCOPE) + endif(NOT _VERSION_MATCH STREQUAL "") +endfunction() + +message(STATUS "Checking for ARM") + +set (IS_ARM NO) +set (ARM_VERSION "") + +if (CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND echo "int main(){}" + COMMAND ${CMAKE_CXX_COMPILER} -dM -E - + OUTPUT_VARIABLE TEST_FOR_ARM_RESULTS) + + string(REGEX MATCH "__arm" ARM_FOUND "${TEST_FOR_ARM_RESULTS}") + + if (NOT ARM_FOUND STREQUAL "") + set(IS_ARM YES) + message(STATUS "ARM system detected") + + # detect the version + check_arm_version("__ARM_ARCH_2__" ${TEST_FOR_ARM_RESULTS} "armv2" ARM_VERSION) + check_arm_version("__ARM_ARCH_2A__" ${TEST_FOR_ARM_RESULTS} "armv2a" ARM_VERSION) + check_arm_version("__ARM_ARCH_3__" ${TEST_FOR_ARM_RESULTS} "armv3" ARM_VERSION) + check_arm_version("__ARM_ARCH_3M__" ${TEST_FOR_ARM_RESULTS} "armv3m" ARM_VERSION) + check_arm_version("__ARM_ARCH_4__" ${TEST_FOR_ARM_RESULTS} "armv4" ARM_VERSION) + check_arm_version("__ARM_ARCH_4T__" ${TEST_FOR_ARM_RESULTS} "armv4t" ARM_VERSION) + check_arm_version("__ARM_ARCH_5__" ${TEST_FOR_ARM_RESULTS} "armv5" ARM_VERSION) + check_arm_version("__ARM_ARCH_5T__" ${TEST_FOR_ARM_RESULTS} "armv5t" ARM_VERSION) + check_arm_version("__ARM_ARCH_5E__" ${TEST_FOR_ARM_RESULTS} "armv5e" ARM_VERSION) + check_arm_version("__ARM_ARCH_5TE__" ${TEST_FOR_ARM_RESULTS} "armv5te" ARM_VERSION) + check_arm_version("__ARM_ARCH_6__" ${TEST_FOR_ARM_RESULTS} "armv6" ARM_VERSION) + check_arm_version("__ARM_ARCH_6J__" ${TEST_FOR_ARM_RESULTS} "armv6j" ARM_VERSION) + check_arm_version("__ARM_ARCH_6K__" ${TEST_FOR_ARM_RESULTS} "armv6k" ARM_VERSION) + check_arm_version("__ARM_ARCH_6T2__" ${TEST_FOR_ARM_RESULTS} "armv6t2" ARM_VERSION) + check_arm_version("__ARM_ARCH_6Z__" ${TEST_FOR_ARM_RESULTS} "armv6z" ARM_VERSION) + check_arm_version("__ARM_ARCH_6ZK__" ${TEST_FOR_ARM_RESULTS} "armv6zk" ARM_VERSION) + check_arm_version("__ARM_ARCH_6M__" ${TEST_FOR_ARM_RESULTS} "armv6-m" ARM_VERSION) + check_arm_version("__ARM_ARCH_7__" ${TEST_FOR_ARM_RESULTS} "armv7" ARM_VERSION) + check_arm_version("__ARM_ARCH_7A__" ${TEST_FOR_ARM_RESULTS} "armv7-a" ARM_VERSION) + check_arm_version("__ARM_ARCH_7M__" ${TEST_FOR_ARM_RESULTS} "armv7-m" ARM_VERSION) + check_arm_version("__ARM_ARCH_7R__" ${TEST_FOR_ARM_RESULTS} "armv7-r" ARM_VERSION) + check_arm_version("__ARM_ARCH_7EM_" ${TEST_FOR_ARM_RESULTS} "armv7e-m" ARM_VERSION) + check_arm_version("__ARM_ARCH_7VE__" ${TEST_FOR_ARM_RESULTS} "armv7ve" ARM_VERSION) + check_arm_version("__ARM_ARCH_8A__" ${TEST_FOR_ARM_RESULTS} "armv8-a" ARM_VERSION) + + # anything else just define as arm + if (ARM_VERSION STREQUAL "") + message(STATUS "Couldn't detect ARM version. Setting to 'arm'") + set(ARM_VERSION "arm") + else (ARM_VERSION STREQUAL "") + message(STATUS "ARM version ${ARM_VERSION} detected") + endif (ARM_VERSION STREQUAL "") + + else (NOT ARM_FOUND STREQUAL "") + message(STATUS "System is not ARM") + endif(NOT ARM_FOUND STREQUAL "") + +else (CMAKE_COMPILE_IS_GNUCXX) + # TODO: Other compilers + message(STATUS "Not detecting ARM on non-GNUCXX compiler. Defaulting to false") + message(STATUS "If you are compiling for ARM, set IS_ARM=ON manually") +endif(CMAKE_COMPILER_IS_GNUCXX) + +set(IS_ARM ${IS_ARM} CACHE BOOL "Compiling for ARM") +set(ARM_VERSION ${ARM_VERSION} CACHE STRING "ARM version") diff --git a/cmake/Modules/TestForSSE.cmake b/cmake/Modules/TestForSSE.cmake new file mode 100644 index 000000000..9d9192f27 --- /dev/null +++ b/cmake/Modules/TestForSSE.cmake @@ -0,0 +1,36 @@ +############################################################################### +# Test for availability of SSE +# +# - Anthony Arnold +############################################################################### + + +function (test_for_sse h_file result_var name) + if (NOT DEFINED ${result_var}) + execute_process(COMMAND echo "#include <${h_file}>" + COMMAND ${CMAKE_CXX_COMPILER} -c -x c++ - + RESULT_VARIABLE COMPILE_RESULT + OUTPUT_QUIET ERROR_QUIET) + + if (COMPILE_RESULT EQUAL 0) + message(STATUS "Detected ${name}") + endif(COMPILE_RESULT EQUAL 0) + set(${result_var} ${compile_result} CACHE INTERNAL "${name} Available") + endif (NOT DEFINED ${result_var}) +endfunction(test_for_sse) + +message(STATUS "Testing for SIMD extensions") + +enable_language(C) + +test_for_sse("ammintrin.h" SSE4A_AVAILABLE "SSE4A") +test_for_sse("nmmintrin.h" SSE4_2_AVAILABLE "SSE4.2") +test_for_sse("smmintrin.h" SSE4_1_AVAILABLE "SSE4.1") +test_for_sse("tmmintrin.h" SSSE3_AVAILABLE "SSSE3") +test_for_sse("pmmintrin.h" SSE3_AVAILABLE "SSE3") +test_for_sse("emmintrin.h" SSE2_AVAILABLE "SSE2") +test_for_sse("xmmintrin.h" SSE_AVAILABLE "SSE1") +test_for_sse("mmintrin.h" MMX_AVAILABLE "MMX") +test_for_sse("wmmintrin.h" AES_AVAILABLE "AES") +test_for_sse("immintrin.h" AVX_AVAILABLE "AVX") + diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc index 88c97d00e..e1c23ea09 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc @@ -365,7 +365,7 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec update_local_carrier(); // perform Early, Prompt and Late correlation -#ifndef GENERIC_ARCH +#if USING_VOLK_CW_EPL_CORR_CUSTOM d_correlator.Carrier_wipeoff_and_EPL_volk_custom(d_current_prn_length_samples, in, d_carr_sign, diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index c4da7d0a2..136d61c59 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -40,6 +40,10 @@ if(ENABLE_GENERIC_ARCH) add_definitions( -DGENERIC_ARCH=1 ) endif(ENABLE_GENERIC_ARCH) +if (SSE3_AVAILABLE) + add_definitions( -DHAVE_SSE3=1 ) +endif(SSE3_AVAILABLE) + file(GLOB TRACKING_LIB_HEADERS "*.h") add_library(tracking_lib ${TRACKING_LIB_SOURCES} ${TRACKING_LIB_HEADERS}) source_group(Headers FILES ${TRACKING_LIB_HEADERS}) diff --git a/src/algorithms/tracking/libs/correlator.cc b/src/algorithms/tracking/libs/correlator.cc index c2b2b66dd..9179527f7 100644 --- a/src/algorithms/tracking/libs/correlator.cc +++ b/src/algorithms/tracking/libs/correlator.cc @@ -36,7 +36,7 @@ #include "correlator.h" #include -#ifndef GENERIC_ARCH +#if USING_VOLK_CW_EPL_CORR_CUSTOM #define LV_HAVE_SSE3 #include "volk_cw_epl_corr.h" #endif @@ -145,7 +145,7 @@ Correlator::~Correlator () {} -#ifndef GENERIC_ARCH +#if USING_VOLK_CW_EPL_CORR_CUSTOM void Correlator::Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out) { volk_cw_epl_corr_u(input, carrier, E_code, P_code, L_code, E_out, P_out, L_out, signal_length_samples); diff --git a/src/algorithms/tracking/libs/correlator.h b/src/algorithms/tracking/libs/correlator.h index cfbe641c6..b90123f9a 100644 --- a/src/algorithms/tracking/libs/correlator.h +++ b/src/algorithms/tracking/libs/correlator.h @@ -41,6 +41,9 @@ #include #include +#if !defined(GENERIC_ARCH) && HAVE_SSE3 +#define USING_VOLK_CW_EPL_CORR_CUSTOM 1 +#endif /*! * \brief Class that implements carrier wipe-off and correlators. @@ -60,8 +63,8 @@ public: void Carrier_wipeoff_and_EPL_volk_IQ(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out); Correlator(); ~Correlator(); -#ifndef GENERIC_ARCH - void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out); +#if USING_VOLK_CW_EPL_CORR_CUSTOM + void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned); #endif private: