mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-18 16:53:15 +00:00
Added experimental SIMD-accelerated correlator for tracking, using GNURadio volk libraries.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@134 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
305d9f14c1
commit
b72802a51f
@ -17,7 +17,7 @@ ControlThread.wait_for_flowgraph=false
|
||||
SignalSource.implementation=File_Signal_Source
|
||||
|
||||
;#filename: path to file with the captured GNSS signal samples to be processed
|
||||
SignalSource.filename=/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/agilent_cap2.dat
|
||||
SignalSource.filename=/media/DATALOGGER/signals/Agilent GPS Generator/cap2/agilent_cap2.dat
|
||||
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ SignalConditioner.dump=false
|
||||
|
||||
;######### CHANNELS CONFIGURATION CONFIG ############
|
||||
;#count: Number of avalable satellite channels.
|
||||
Channels.count=6
|
||||
Channels.count=4
|
||||
|
||||
;######### ACQUISITION GLOBAL CONFIG ############
|
||||
|
||||
@ -160,7 +160,7 @@ Tracking.item_type=gr_complex
|
||||
Tracking.if=0
|
||||
|
||||
;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
|
||||
Tracking.dump=true
|
||||
Tracking.dump=false
|
||||
|
||||
;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
|
||||
Tracking.dump_filename=./tracking_ch_
|
||||
|
@ -7,7 +7,7 @@ lib gnuradio-core ;
|
||||
project : requirements
|
||||
<define>OMNITHREAD_POSIX
|
||||
<cxxflags>"-std=c++0x -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
|
||||
<linkflags>"-larmadillo -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -llapack -lblas -lprofiler -ltcmalloc"
|
||||
<linkflags>"-larmadillo -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -llapack -lblas -lprofiler -ltcmalloc -lvolk"
|
||||
<include>src/algorithms/acquisition/adapters
|
||||
<include>src/algorithms/acquisition/gnuradio_blocks
|
||||
<include>src/algorithms/channel/adapters
|
||||
@ -41,6 +41,7 @@ project : requirements
|
||||
<include>$GNURADIO_ROOT/gnuradio-core/src/lib/io
|
||||
<include>$GNURADIO_ROOT/gnuradio-core/src/lib/general
|
||||
<include>$GNURADIO_ROOT/gnuradio-core/src/lib/gengen
|
||||
<include>$GNURADIO_ROOT/volk/lib
|
||||
<threading>multi
|
||||
<toolset>darwin:<include>/opt/local/include ;
|
||||
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \todo Include in definition header file
|
||||
*/
|
||||
@ -106,12 +108,18 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satell
|
||||
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS+2];
|
||||
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
d_early_code = new gr_complex[d_vector_length*2];
|
||||
d_prompt_code = new gr_complex[d_vector_length*2];
|
||||
d_late_code = new gr_complex[d_vector_length*2];
|
||||
//d_early_code = new gr_complex[d_vector_length*2];
|
||||
//d_prompt_code = new gr_complex[d_vector_length*2];
|
||||
//d_late_code = new gr_complex[d_vector_length*2];
|
||||
// space for carrier wipeoff LO vector
|
||||
d_carr_sign = new gr_complex[d_vector_length*2];
|
||||
//d_carr_sign = new gr_complex[d_vector_length*2];
|
||||
|
||||
posix_memalign((void**)&d_early_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_late_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_prompt_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_carr_sign,16, d_vector_length*sizeof(gr_complex)*2);
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0;
|
||||
@ -251,7 +259,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
|
||||
phase += phase_step;
|
||||
}
|
||||
d_rem_carr_phase = fmod(phase, TWO_PI);
|
||||
d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + d_rem_carr_phase;
|
||||
d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + phase;
|
||||
}
|
||||
|
||||
|
||||
@ -262,10 +270,16 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
{
|
||||
d_dump_file.close();
|
||||
delete[] d_ca_code;
|
||||
delete[] d_early_code;
|
||||
delete[] d_prompt_code;
|
||||
delete[] d_late_code;
|
||||
delete[] d_carr_sign;
|
||||
|
||||
//delete[] d_early_code;
|
||||
//delete[] d_prompt_code;
|
||||
//delete[] d_late_code;
|
||||
//delete[] d_carr_sign;
|
||||
free(d_prompt_code);
|
||||
free(d_late_code);
|
||||
free(d_early_code);
|
||||
free(d_carr_sign);
|
||||
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -345,12 +359,34 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
update_local_code();
|
||||
update_local_carrier();
|
||||
|
||||
gr_complex bb_signal_sample(0,0);
|
||||
|
||||
gr_complex* E_out;
|
||||
gr_complex* P_out;
|
||||
gr_complex* L_out;
|
||||
|
||||
posix_memalign((void**)&E_out, 16, 8);
|
||||
posix_memalign((void**)&P_out, 16, 8);
|
||||
posix_memalign((void**)&L_out, 16, 8);
|
||||
|
||||
// perform Early, Prompt and Late correlation
|
||||
/*!
|
||||
* \todo Use SIMD-enabled correlators
|
||||
*/
|
||||
d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples,
|
||||
in,
|
||||
d_carr_sign,
|
||||
d_early_code,
|
||||
d_prompt_code,
|
||||
d_late_code,
|
||||
E_out,
|
||||
P_out,
|
||||
L_out);
|
||||
|
||||
d_Early=E_out[0];
|
||||
d_Prompt=P_out[0];
|
||||
d_Late=L_out[0];
|
||||
free(E_out);
|
||||
free(P_out);
|
||||
free(L_out);
|
||||
/*
|
||||
gr_complex bb_signal_sample(0,0);
|
||||
for(int i=0; i<d_current_prn_length_samples; i++)
|
||||
{
|
||||
//Perform the carrier wipe-off
|
||||
@ -360,7 +396,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
d_Prompt += bb_signal_sample * d_prompt_code[i];
|
||||
d_Late += bb_signal_sample * d_late_code[i];
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
* DLL, FLL, and PLL discriminators
|
||||
*/
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
|
||||
//#include "GPS_L1_CA.h"
|
||||
#include "correlator.h"
|
||||
|
||||
class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc;
|
||||
typedef boost::shared_ptr<Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc>
|
||||
@ -182,6 +183,9 @@ private:
|
||||
float d_acq_code_phase_samples;
|
||||
float d_acq_carrier_doppler_hz;
|
||||
|
||||
// correlator
|
||||
correlator d_correlator;
|
||||
|
||||
// FLL + PLL filter
|
||||
float d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory
|
||||
Tracking_FLL_PLL_filter d_carrier_loop_filter;
|
||||
|
170
src/algorithms/tracking/libs/correlator.cc
Normal file
170
src/algorithms/tracking/libs/correlator.cc
Normal file
@ -0,0 +1,170 @@
|
||||
/*!
|
||||
* \file correlator.h
|
||||
* \brief Highly optimized vector correlator class
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements a high optimized vector correlator class.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief High optimized vector correlator class
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include "correlator.h"
|
||||
|
||||
unsigned long correlator::next_power_2(unsigned long v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v++;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
void correlator::Carrier_wipeoff_and_EPL_generic(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)
|
||||
{
|
||||
gr_complex bb_signal_sample(0,0);
|
||||
|
||||
//std::cout<<"length="<<signal_length_samples<<std::endl;
|
||||
|
||||
*E_out=0;
|
||||
*P_out=0;
|
||||
*L_out=0;
|
||||
// perform Early, Prompt and Late correlation
|
||||
for(int i=0; i<signal_length_samples; i++)
|
||||
{
|
||||
//Perform the carrier wipe-off
|
||||
bb_signal_sample = input[i] * carrier[i];
|
||||
// Now get early, late, and prompt values for each
|
||||
*E_out += bb_signal_sample*E_code[i];
|
||||
*P_out += bb_signal_sample*P_code[i];
|
||||
*L_out += bb_signal_sample*L_code[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void correlator::Carrier_wipeoff_and_EPL_volk(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)
|
||||
{
|
||||
gr_complex* bb_signal;
|
||||
gr_complex* input_aligned;
|
||||
//gr_complex* carrier_aligned;
|
||||
|
||||
// signal_length_samples=next_power_2(signal_length_samples);
|
||||
//std::cout<<"length="<<signal_length_samples<<std::endl;
|
||||
|
||||
//long int new_length=next_power_2(signal_length_samples);
|
||||
|
||||
posix_memalign((void**)&bb_signal, 16, signal_length_samples*sizeof(gr_complex));
|
||||
posix_memalign((void**)&input_aligned, 16, signal_length_samples*sizeof(gr_complex));
|
||||
//posix_memalign((void**)&carrier_aligned, 16, new_length*sizeof(gr_complex));
|
||||
|
||||
memcpy(input_aligned,input,signal_length_samples*sizeof(gr_complex));
|
||||
//memcpy(carrier_aligned,carrier,signal_length_samples*sizeof(gr_complex));
|
||||
|
||||
volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
|
||||
volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
|
||||
free(bb_signal);
|
||||
free(input_aligned);
|
||||
//free(carrier_aligned);
|
||||
}
|
||||
|
||||
void correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()
|
||||
{
|
||||
//
|
||||
struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc();
|
||||
std::vector<std::string> arch_list;
|
||||
|
||||
for(int i = 0; i < desc.n_archs; i++) {
|
||||
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
|
||||
arch_list.push_back(std::string(desc.indices[i]));
|
||||
}
|
||||
|
||||
|
||||
//first let's get a list of available architectures for the test
|
||||
if(arch_list.size() < 2) {
|
||||
std::cout << "no architectures to test" << std::endl;
|
||||
this->volk_32fc_x2_dot_prod_32fc_a_best_arch="generic";
|
||||
}else{
|
||||
std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl;
|
||||
for (unsigned int i=0;i<arch_list.size();i++)
|
||||
{
|
||||
std::cout<<"Arch "<<i<<":"<<arch_list.at(i)<< std::endl;
|
||||
}
|
||||
// TODO: Make a test to find the best architecture
|
||||
this->volk_32fc_x2_dot_prod_32fc_a_best_arch=arch_list.at(arch_list.size()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a()
|
||||
{
|
||||
//
|
||||
struct volk_func_desc desc=volk_32fc_x2_multiply_32fc_a_get_func_desc();
|
||||
std::vector<std::string> arch_list;
|
||||
|
||||
for(int i = 0; i < desc.n_archs; i++) {
|
||||
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
|
||||
arch_list.push_back(std::string(desc.indices[i]));
|
||||
}
|
||||
|
||||
this->volk_32fc_x2_multiply_32fc_a_best_arch="generic";
|
||||
//first let's get a list of available architectures for the test
|
||||
if(arch_list.size() < 2) {
|
||||
std::cout << "no architectures to test" << std::endl;
|
||||
}else{
|
||||
std::cout << "Detected architectures in this machine for volk_32fc_x2_multiply_32fc_a:" << std::endl;
|
||||
for (unsigned int i=0;i<arch_list.size();i++)
|
||||
{
|
||||
std::cout<<"Arch "<<i<<":"<<arch_list.at(i)<< std::endl;
|
||||
if (arch_list.at(i).compare("sse3")==1)
|
||||
{
|
||||
// TODO: Make a test to find the best architecture
|
||||
this->volk_32fc_x2_multiply_32fc_a_best_arch="sse3";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
correlator::correlator ()
|
||||
{
|
||||
cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
|
||||
cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
|
||||
}
|
||||
|
||||
|
||||
correlator::~correlator ()
|
||||
{}
|
58
src/algorithms/tracking/libs/correlator.h
Normal file
58
src/algorithms/tracking/libs/correlator.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* \file correlator.h
|
||||
* \brief High optimized vector correlator class
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that implements a high optimized vector correlator class.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef CORRELATOR_H_
|
||||
#define CORRELATOR_H_
|
||||
/*!
|
||||
* \brief High optimized vector correlator class
|
||||
*
|
||||
*/
|
||||
|
||||
#include <volk/volk.h>
|
||||
#include <gnuradio/gr_block.h>
|
||||
class correlator
|
||||
{
|
||||
private:
|
||||
std::string volk_32fc_x2_multiply_32fc_a_best_arch;
|
||||
std::string volk_32fc_x2_dot_prod_32fc_a_best_arch;
|
||||
|
||||
unsigned long next_power_2(unsigned long v);
|
||||
void cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
|
||||
void cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
|
||||
|
||||
public:
|
||||
void Carrier_wipeoff_and_EPL_generic(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);
|
||||
void Carrier_wipeoff_and_EPL_volk(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);
|
||||
correlator();
|
||||
~correlator();
|
||||
};
|
||||
#endif
|
@ -4,4 +4,5 @@ obj tracking_discriminators : tracking_discriminators.cc ;
|
||||
obj CN_estimators : CN_estimators.cc ;
|
||||
obj tracking_FLL_PLL_filter : tracking_FLL_PLL_filter.cc ;
|
||||
obj tracking_2nd_PLL_filter : tracking_2nd_PLL_filter.cc ;
|
||||
obj tracking_2nd_DLL_filter : tracking_2nd_DLL_filter.cc ;
|
||||
obj tracking_2nd_DLL_filter : tracking_2nd_DLL_filter.cc ;
|
||||
obj correlator : correlator.cc ;
|
@ -41,6 +41,7 @@ exe gnss-sdr : main.cc
|
||||
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
||||
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
||||
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
||||
../algorithms/tracking/libs//correlator
|
||||
../core/libs//INIReader
|
||||
../core/libs//ini
|
||||
../core/libs//string_converter
|
||||
|
Loading…
x
Reference in New Issue
Block a user