1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 11:10:33 +00:00
no-cheetah

# Conflicts:
#	src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt
This commit is contained in:
Carles Fernandez 2016-12-25 19:10:02 +01:00
commit 9664b65720
15 changed files with 148 additions and 175 deletions

View File

@ -17,7 +17,7 @@ This section describes how to set up the compilation environment in GNU/Linux or
GNU/Linux
----------
* Tested distributions: Ubuntu 14.04 LTS and above, Debian 8.0 "jessie" and above, Linaro 15.03
* Tested distributions: Ubuntu 14.04 LTS and [above](http://packages.ubuntu.com/search?keywords=gnss-sdr), Debian 8.0 "jessie" and [above](https://packages.debian.org/search?searchon=names&keywords=gnss-sdr), Linaro 15.03
* Known to work but not continually tested: Arch Linux, Fedora, and openSUSE
* Supported microprocessor architectures:
* i386: Intel x86 instruction set (32-bit microprocessors).
@ -46,7 +46,8 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \
libboost-serialization-dev libboost-program-options-dev libboost-test-dev \
liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev \
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev \
python-mako python-six
~~~~~~
Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line

View File

@ -29,7 +29,7 @@ GNSS-SDR.SUPL_CI=0x31b0
SignalSource.implementation=File_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE
SignalSource.filename=/Users/carlesfernandez/Documents/workspace/code2/trunk/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ;/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE
;#item_type: Type and resolution for each of the signal samples.
SignalSource.item_type=ishort

View File

@ -75,16 +75,17 @@ SET(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\"
# Python
include(VolkPython) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
VOLK_PYTHON_CHECK_MODULE("python >= 2.7" sys "sys.version.split()[0] >= '2.7'" PYTHON_MIN_VER_FOUND)
VOLK_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND)
VOLK_PYTHON_CHECK_MODULE("mako >= 0.9.1" mako "mako.__version__ >= '0.9.1'" MAKO_FOUND)
VOLK_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)
if(NOT PYTHON_MIN_VER_FOUND)
message(FATAL_ERROR "Python 2.7 or greater required to build VOLK_GNSSSDR")
endif()
# Cheetah
if(NOT CHEETAH_FOUND)
message(FATAL_ERROR "Cheetah templates required to build VOLK_GNSSSDR")
# Mako
if(NOT MAKO_FOUND)
message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR")
endif()
# Six
if(NOT SIX_FOUND)

View File

@ -17,7 +17,7 @@ However, you can install and use VOLK_GNSSSDR kernels as you use VOLK's, indepen
First, make sure that the required dependencies are installed in you machine:
~~~~~~
$ sudo apt-get install git subversion cmake python-cheetah libboost-dev libbbost-filesystem
$ sudo apt-get install git subversion cmake python-mako python-six libboost-dev libbbost-filesystem
~~~~~~
In order to build and install the library, go to the base folder of the source code and do:

View File

@ -27,22 +27,7 @@ import optparse
import volk_gnsssdr_arch_defs
import volk_gnsssdr_machine_defs
import volk_gnsssdr_kernel_defs
from Cheetah import Template
def __escape_pre_processor(code):
out = list()
for line in code.splitlines():
m = re.match('^(\s*)#(\s*)(\w+)(.*)$', line)
if m:
p0, p1, fcn, stuff = m.groups()
conly = fcn in ('include', 'define', 'ifdef', 'ifndef', 'endif', 'elif', 'pragma')
both = fcn in ('if', 'else')
istmpl = '$' in stuff
if 'defined' in stuff: istmpl = False
if conly or (both and not istmpl):
line = '%s\\#%s%s%s'%(p0, p1, fcn, stuff)
out.append(line)
return '\n'.join(out)
from mako.template import Template
def __parse_tmpl(_tmpl, **kwargs):
defs = {
@ -53,13 +38,12 @@ def __parse_tmpl(_tmpl, **kwargs):
'kernels': volk_gnsssdr_kernel_defs.kernels,
}
defs.update(kwargs)
_tmpl = __escape_pre_processor(_tmpl)
_tmpl = """
/* this file was generated by volk_gnsssdr template utils, do not edit! */
/* this file was generated by volk_gnsssdr template utils, do not edit! */
""" + _tmpl
return str(Template.Template(_tmpl, defs))
""" + _tmpl
return str(Template(_tmpl).render(**defs))
def main():
parser = optparse.OptionParser()

View File

@ -110,93 +110,91 @@ bool volk_gnsssdr_is_aligned(const void *ptr)
#define LV_HAVE_GENERIC
#define LV_HAVE_DISPATCHER
#for $kern in $kernels
%for kern in kernels:
#if $kern.has_dispatcher
#include <volk_gnsssdr/$(kern.name).h> //pulls in the dispatcher
#end if
%if kern.has_dispatcher:
#include <volk_gnsssdr/${kern.name}.h> //pulls in the dispatcher
%endif
static inline void __$(kern.name)_d($kern.arglist_full)
static inline void __${kern.name}_d(${kern.arglist_full})
{
#if $kern.has_dispatcher
$(kern.name)_dispatcher($kern.arglist_names);
%if kern.has_dispatcher:
${kern.name}_dispatcher(${kern.arglist_names});
return;
#end if
%endif
if (volk_gnsssdr_is_aligned(
#set $num_open_parens = 0
#for $arg_type, $arg_name in $kern.args
#if '*' in $arg_type
VOLK_OR_PTR($arg_name,
#set $num_open_parens += 1
#end if
#end for
0$(')'*$num_open_parens)
if (volk_gnsssdr_is_aligned(<% num_open_parens = 0 %>
%for arg_type, arg_name in kern.args:
%if '*' in arg_type:
VOLK_OR_PTR(${arg_name},<% num_open_parens += 1 %>
%endif
%endfor
0<% end_open_parens = ')'*num_open_parens %>${end_open_parens}
)){
$(kern.name)_a($kern.arglist_names);
${kern.name}_a(${kern.arglist_names});
}
else{
$(kern.name)_u($kern.arglist_names);
${kern.name}_u(${kern.arglist_names});
}
}
static inline void __init_$(kern.name)(void)
static inline void __init_${kern.name}(void)
{
const char *name = get_machine()->$(kern.name)_name;
const char **impl_names = get_machine()->$(kern.name)_impl_names;
const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
const size_t n_impls = get_machine()->$(kern.name)_n_impls;
const char *name = get_machine()->${kern.name}_name;
const char **impl_names = get_machine()->${kern.name}_impl_names;
const int *impl_deps = get_machine()->${kern.name}_impl_deps;
const bool *alignment = get_machine()->${kern.name}_impl_alignment;
const size_t n_impls = get_machine()->${kern.name}_n_impls;
const size_t index_a = volk_gnsssdr_rank_archs(name, impl_names, impl_deps, alignment, n_impls, true/*aligned*/);
const size_t index_u = volk_gnsssdr_rank_archs(name, impl_names, impl_deps, alignment, n_impls, false/*unaligned*/);
$(kern.name)_a = get_machine()->$(kern.name)_impls[index_a];
$(kern.name)_u = get_machine()->$(kern.name)_impls[index_u];
${kern.name}_a = get_machine()->${kern.name}_impls[index_a];
${kern.name}_u = get_machine()->${kern.name}_impls[index_u];
assert($(kern.name)_a);
assert($(kern.name)_u);
assert(${kern.name}_a);
assert(${kern.name}_u);
$(kern.name) = &__$(kern.name)_d;
${kern.name} = &__${kern.name}_d;
}
static inline void __$(kern.name)_a($kern.arglist_full)
static inline void __${kern.name}_a(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)_a($kern.arglist_names);
__init_${kern.name}();
${kern.name}_a(${kern.arglist_names});
}
static inline void __$(kern.name)_u($kern.arglist_full)
static inline void __${kern.name}_u(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)_u($kern.arglist_names);
__init_${kern.name}();
${kern.name}_u(${kern.arglist_names});
}
static inline void __$(kern.name)($kern.arglist_full)
static inline void __${kern.name}(${kern.arglist_full})
{
__init_$(kern.name)();
$(kern.name)($kern.arglist_names);
__init_${kern.name}();
${kern.name}(${kern.arglist_names});
}
$kern.pname $(kern.name)_a = &__$(kern.name)_a;
$kern.pname $(kern.name)_u = &__$(kern.name)_u;
$kern.pname $(kern.name) = &__$(kern.name);
${kern.pname} ${kern.name}_a = &__${kern.name}_a;
${kern.pname} ${kern.name}_u = &__${kern.name}_u;
${kern.pname} ${kern.name} = &__${kern.name};
void $(kern.name)_manual($kern.arglist_full, const char* impl_name)
void ${kern.name}_manual(${kern.arglist_full}, const char* impl_name)
{
const int index = volk_gnsssdr_get_index(
get_machine()->$(kern.name)_impl_names,
get_machine()->$(kern.name)_n_impls,
get_machine()->${kern.name}_impl_names,
get_machine()->${kern.name}_n_impls,
impl_name
);
get_machine()->$(kern.name)_impls[index](
$kern.arglist_names
get_machine()->${kern.name}_impls[index](
${kern.arglist_names}
);
}
volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void) {
const char **impl_names = get_machine()->$(kern.name)_impl_names;
const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
const size_t n_impls = get_machine()->$(kern.name)_n_impls;
volk_gnsssdr_func_desc_t ${kern.name}_get_func_desc(void) {
const char **impl_names = get_machine()->${kern.name}_impl_names;
const int *impl_deps = get_machine()->${kern.name}_impl_deps;
const bool *alignment = get_machine()->${kern.name}_impl_alignment;
const size_t n_impls = get_machine()->${kern.name}_n_impls;
volk_gnsssdr_func_desc_t desc = {
impl_names,
impl_deps,
@ -206,4 +204,4 @@ volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void) {
return desc;
}
#end for
%endfor

View File

@ -68,23 +68,23 @@ VOLK_API size_t volk_gnsssdr_get_alignment(void);
*/
VOLK_API bool volk_gnsssdr_is_aligned(const void *ptr);
#for $kern in $kernels
%for kern in kernels:
//! A function pointer to the dispatcher implementation
extern VOLK_API $kern.pname $kern.name;
extern VOLK_API ${kern.pname} ${kern.name};
//! A function pointer to the fastest aligned implementation
extern VOLK_API $kern.pname $(kern.name)_a;
extern VOLK_API ${kern.pname} ${kern.name}_a;
//! A function pointer to the fastest unaligned implementation
extern VOLK_API $kern.pname $(kern.name)_u;
extern VOLK_API ${kern.pname} ${kern.name}_u;
//! Call into a specific implementation given by name
extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
extern VOLK_API void ${kern.name}_manual(${kern.arglist_full}, const char* impl_name);
//! Get description paramaters for this kernel
extern VOLK_API volk_gnsssdr_func_desc_t $(kern.name)_get_func_desc(void);
#end for
extern VOLK_API volk_gnsssdr_func_desc_t ${kern.name}_get_func_desc(void);
%endfor
__VOLK_DECL_END

View File

@ -19,10 +19,10 @@
#ifndef INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H
#define INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED_H
#for $i, $arch in enumerate($archs)
#ifndef LV_$(arch.name.upper())
#define LV_$(arch.name.upper()) $i
#endif
#end for
%for i, arch in enumerate(archs):
//#ifndef LV_${arch.name.upper()}
#define LV_${arch.name.upper()} ${i}
//#endif
%endfor
#endif /*INCLUDED_VOLK_GNSSSDR_CONFIG_FIXED*/

View File

@ -147,15 +147,14 @@ static int has_neon(void){
#endif
}
#for $arch in $archs
static int i_can_has_$arch.name (void) {
#for $check, $params in $arch.checks
if ($(check)($(', '.join($params))) == 0) return 0;
#end for
%for arch in archs:
static int i_can_has_${arch.name} (void) {
%for check, params in arch.checks:
if (${check}(<% joined_params = ', '.join(params)%>${joined_params}) == 0) return 0;
%endfor
return 1;
}
#end for
%endfor
#if defined(HAVE_FENV_H)
#if defined(FE_TONEAREST)
@ -182,17 +181,17 @@ static int i_can_has_$arch.name (void) {
#endif
void volk_gnsssdr_cpu_init() {
#for $arch in $archs
volk_gnsssdr_cpu.has_$arch.name = &i_can_has_$arch.name;
#end for
%for arch in archs:
volk_gnsssdr_cpu.has_${arch.name} = &i_can_has_${arch.name};
%endfor
set_float_rounding();
}
unsigned int volk_gnsssdr_get_lvarch() {
unsigned int retval = 0;
volk_gnsssdr_cpu_init();
#for $arch in $archs
retval += volk_gnsssdr_cpu.has_$(arch.name)() << LV_$(arch.name.upper());
#end for
%for arch in archs:
retval += volk_gnsssdr_cpu.has_${arch.name}() << LV_${arch.name.upper()};
%endfor
return retval;
}

View File

@ -24,9 +24,9 @@
__VOLK_DECL_BEGIN
struct VOLK_CPU {
#for $arch in $archs
int (*has_$arch.name) ();
#end for
%for arch in archs:
int (*has_${arch.name}) ();
%endfor
};
extern struct VOLK_CPU volk_gnsssdr_cpu;

View File

@ -16,12 +16,12 @@
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*/
#set $this_machine = $machine_dict[$args[0]]
#set $arch_names = $this_machine.arch_names
<% this_machine = machine_dict[args[0]] %>
<% arch_names = this_machine.arch_names %>
#for $arch in $this_machine.archs
#define LV_HAVE_$(arch.name.upper()) 1
#end for
%for arch in this_machine.archs:
#define LV_HAVE_${arch.name.upper()} 1
%endfor
#include <volk_gnsssdr/volk_gnsssdr_common.h>
#include "volk_gnsssdr_machines.h"
@ -31,46 +31,28 @@
#include "config.h"
#endif
#for $kern in $kernels
#include <volk_gnsssdr/$(kern.name).h>
#end for
%for kern in kernels:
#include <volk_gnsssdr/${kern.name}.h>
%endfor
########################################################################
#def make_arch_have_list($archs)
$(' | '.join(['(1 << LV_%s)'%a.name.upper() for a in $archs]))#slurp
#end def
########################################################################
#def make_impl_name_list($impls)
{$(', '.join(['"%s"'%i.name for i in $impls]))}#slurp
#end def
########################################################################
#def make_impl_align_list($impls)
{$(', '.join(['true' if i.is_aligned else 'false' for i in $impls]))}#slurp
#end def
########################################################################
#def make_impl_deps_list($impls)
{$(', '.join([' | '.join(['(1 << LV_%s)'%d.upper() for d in i.deps]) for i in $impls]))}#slurp
#end def
########################################################################
#def make_impl_fcn_list($name, $impls)
{$(', '.join(['%s_%s'%($name, i.name) for i in $impls]))}#slurp
#end def
struct volk_gnsssdr_machine volk_gnsssdr_machine_$(this_machine.name) = {
$make_arch_have_list($this_machine.archs),
"$this_machine.name",
$this_machine.alignment,
#for $kern in $kernels
#set $impls = $kern.get_impls($arch_names)
"$kern.name", ##//kernel name
$make_impl_name_list($impls), ##//list of kernel implementations by name
$make_impl_deps_list($impls), ##//list of arch dependencies per implementation
$make_impl_align_list($impls), ##//alignment required? for each implementation
$make_impl_fcn_list($kern.name, $impls), ##//pointer to each implementation
$(len($impls)), ##//number of implementations listed here
#end for
struct volk_gnsssdr_machine volk_gnsssdr_machine_${this_machine.name} = {
<% make_arch_have_list = (' | '.join(['(1 << LV_%s)'%a.name.upper() for a in this_machine.archs])) %> ${make_arch_have_list},
<% this_machine_name = "\""+this_machine.name+"\"" %> ${this_machine_name},
${this_machine.alignment},
##//list all kernels
%for kern in kernels:
<% impls = kern.get_impls(arch_names) %>
##//kernel name
<% kern_name = "\""+kern.name+"\"" %> ${kern_name},
##//list of kernel implementations by name
<% make_impl_name_list = "{"+', '.join(['"%s"'%i.name for i in impls])+"}" %> ${make_impl_name_list},
##//list of arch dependencies per implementation
<% make_impl_deps_list = "{"+', '.join([' | '.join(['(1 << LV_%s)'%d.upper() for d in i.deps]) for i in impls])+"}" %> ${make_impl_deps_list},
##//alignment required? for each implementation
<% make_impl_align_list = "{"+', '.join(['true' if i.is_aligned else 'false' for i in impls])+"}" %> ${make_impl_align_list},
##//pointer to each implementation
<% make_impl_fcn_list = "{"+', '.join(['%s_%s'%(kern.name, i.name) for i in impls])+"}" %> ${make_impl_fcn_list},
##//number of implementations listed here
<% len_impls = len(impls) %> ${len_impls},
%endfor
};

View File

@ -21,11 +21,11 @@
#include "volk_gnsssdr_machines.h"
struct volk_gnsssdr_machine *volk_gnsssdr_machines[] = {
#for $machine in $machines
#ifdef LV_MACHINE_$(machine.name.upper())
&volk_gnsssdr_machine_$(machine.name),
%for machine in machines:
#ifdef LV_MACHINE_${machine.name.upper()}
&volk_gnsssdr_machine_${machine.name},
#endif
#end for
%endfor
};
unsigned int n_volk_gnsssdr_machines = sizeof(volk_gnsssdr_machines)/sizeof(*volk_gnsssdr_machines);

View File

@ -31,21 +31,21 @@ struct volk_gnsssdr_machine {
const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_gnsssdr_get_lvarch format)
const char *name;
const size_t alignment; //the maximum byte alignment required for functions in this library
#for $kern in $kernels
const char *$(kern.name)_name;
const char *$(kern.name)_impl_names[$(len($archs))];
const int $(kern.name)_impl_deps[$(len($archs))];
const bool $(kern.name)_impl_alignment[$(len($archs))];
const $(kern.pname) $(kern.name)_impls[$(len($archs))];
const size_t $(kern.name)_n_impls;
#end for
%for kern in kernels:
const char *${kern.name}_name;
const char *${kern.name}_impl_names[<%len_archs=len(archs)%>${len_archs}];
const int ${kern.name}_impl_deps[${len_archs}];
const bool ${kern.name}_impl_alignment[${len_archs}];
const ${kern.pname} ${kern.name}_impls[${len_archs}];
const size_t ${kern.name}_n_impls;
%endfor
};
#for $machine in $machines
#ifdef LV_MACHINE_$(machine.name.upper())
extern struct volk_gnsssdr_machine volk_gnsssdr_machine_$(machine.name);
%for machine in machines:
#ifdef LV_MACHINE_${machine.name.upper()}
extern struct volk_gnsssdr_machine volk_gnsssdr_machine_${machine.name};
#endif
#end for
%endfor
__VOLK_DECL_END

View File

@ -22,8 +22,8 @@
#include <inttypes.h>
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
#for $kern in $kernels
typedef void (*$(kern.pname))($kern.arglist_types);
#end for
%for kern in kernels:
typedef void (*${kern.pname})(${kern.arglist_types});
%endfor
#endif /*INCLUDED_VOLK_GNSSSDR_TYPEDEFS*/

View File

@ -377,7 +377,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
//remnant code phase [chips]
d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast<double>(d_fs_in));
current_synchro_data.Flag_valid_symbol_output = true;
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
{
// fill buffer with prompt correlator output values
@ -395,6 +399,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
{
d_carrier_lock_fail_counter++;
//current_synchro_data.Flag_valid_symbol_output = false;
d_acc_carrier_phase_rad = 0.0;
std::cout << "----------------------------Cycle slip! Threshold: " << d_carrier_lock_threshold << " detector: " << d_carrier_lock_test << " CN0: " << d_CN0_SNV_dB_Hz << " Sat: " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
}
else
{
@ -424,7 +432,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
current_synchro_data.Flag_valid_symbol_output = true;
//current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms = 1;
}
else