1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-11 16:40:09 +00:00

Code cleaning: deleted old dependences with Gregory GPS-SDR files

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@160 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2012-02-16 16:13:45 +00:00
parent ac3fbe2819
commit b7bb79a058
20 changed files with 270 additions and 3031 deletions

View File

@ -78,17 +78,7 @@ GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
printf("vector_length_ %i\n\r", vector_length_);
if (item_type_.compare("short") == 0)
{
item_size_ = sizeof(short);
acquisition_ss_ = gps_l1_ca_gps_sdr_make_acquisition_ss(
acquisition_ms_, if_, fs_in_, vector_length_, queue_, dump_,
dump_filename_);
stream_to_vector_ = gr_make_stream_to_vector(item_size_, 2
* vector_length_);
}
else if (item_type_.compare("gr_complex") == 0)
if (item_type_.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = gps_l1_ca_gps_sdr_make_acquisition_cc(
@ -121,10 +111,6 @@ void GpsL1CaGpsSdrAcquisition::set_satellite(Gnss_Satellite satellite)
{
acquisition_cc_->set_satellite(gnss_satellite_);
}
else
{
acquisition_ss_->set_satellite(gnss_satellite_);
}
}
@ -137,10 +123,6 @@ void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel)
{
acquisition_cc_->set_channel(channel_);
}
else
{
acquisition_ss_->set_channel(channel_);
}
}
// Set acquisition threshold
@ -152,10 +134,6 @@ void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold)
{
acquisition_cc_->set_threshold(threshold_);
}
else
{
acquisition_ss_->set_threshold(threshold_);
}
}
// Set maximum Doppler shift
@ -167,10 +145,6 @@ void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max)
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
else
{
acquisition_ss_->set_doppler_max(doppler_max_);
}
}
// Set Channel Queue
@ -183,10 +157,6 @@ void GpsL1CaGpsSdrAcquisition::set_channel_queue(
{
acquisition_cc_->set_channel_queue(channel_internal_queue_);
}
else
{
acquisition_ss_->set_channel_queue(channel_internal_queue_);
}
}
signed int GpsL1CaGpsSdrAcquisition::prn_code_phase()
@ -196,10 +166,6 @@ signed int GpsL1CaGpsSdrAcquisition::prn_code_phase()
{
return acquisition_cc_->prn_code_phase();
}
else
{
return acquisition_ss_->prn_code_phase();
}
}
float GpsL1CaGpsSdrAcquisition::doppler_freq_shift()
@ -209,10 +175,6 @@ float GpsL1CaGpsSdrAcquisition::doppler_freq_shift()
{
return acquisition_cc_->doppler_freq_phase();
}
else
{
return acquisition_ss_->doppler_freq_phase();
}
}
signed int GpsL1CaGpsSdrAcquisition::mag()
@ -221,10 +183,6 @@ signed int GpsL1CaGpsSdrAcquisition::mag()
{
return acquisition_cc_->mag();
}
else
{
return acquisition_ss_->mag();
}
}
void GpsL1CaGpsSdrAcquisition::reset()
@ -233,10 +191,6 @@ void GpsL1CaGpsSdrAcquisition::reset()
{
acquisition_cc_->set_active(true);
}
else
{
acquisition_ss_->set_active(true);
}
}
unsigned long int GpsL1CaGpsSdrAcquisition::get_sample_stamp()
@ -246,10 +200,6 @@ unsigned long int GpsL1CaGpsSdrAcquisition::get_sample_stamp()
{
return acquisition_cc_->get_sample_stamp();
}
else
{
return acquisition_ss_->get_sample_stamp();
}
}
void GpsL1CaGpsSdrAcquisition::connect(gr_top_block_sptr top_block)
@ -262,11 +212,6 @@ void GpsL1CaGpsSdrAcquisition::connect(gr_top_block_sptr top_block)
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
//top_block->connect(acquisition_cc_, 0, vector_to_stream_, 0);
}
else
{
top_block->connect(stream_to_vector_, 0, acquisition_ss_, 0);
//top_block->connect(acquisition_ss_, 0, vector_to_stream_, 0);
}
}
@ -278,11 +223,6 @@ void GpsL1CaGpsSdrAcquisition::disconnect(gr_top_block_sptr top_block)
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
//top_block->disconnect(acquisition_cc_, 0, vector_to_stream_, 0);
}
else
{
top_block->disconnect(stream_to_vector_, 0, acquisition_ss_, 0);
//top_block->disconnect(acquisition_ss_, 0, vector_to_stream_, 0);
}
}
gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_left_block()
@ -296,10 +236,6 @@ gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_right_block()
{
return acquisition_cc_;
}
else
{
return acquisition_ss_;
}
}

View File

@ -36,7 +36,7 @@
#include "acquisition_interface.h"
#include "gps_l1_ca_gps_sdr_acquisition_cc.h"
#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
//#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
#include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface;
@ -96,7 +96,7 @@ public:
private:
gps_l1_ca_gps_sdr_acquisition_cc_sptr acquisition_cc_;
gps_l1_ca_gps_sdr_acquisition_ss_sptr acquisition_ss_;
//gps_l1_ca_gps_sdr_acquisition_ss_sptr acquisition_ss_;
gr_block_sptr stream_to_vector_;
gr_block_sptr complex_to_short_;
gr_block_sptr short_to_complex_;

View File

@ -34,7 +34,6 @@
#include "gps_l1_ca_pcps_acquisition_cc.h"
#include "gps_sdr_signal_processing.h"
#include "control_message_factory.h"
#include "gps_sdr_x86.h"
#include <gnuradio/gr_io_signature.h>
#include <sstream>
#include <glog/log_severity.h>

View File

@ -33,7 +33,7 @@
// #include <gnuradio/usrp_source_c.h>
#include <gnuradio/gr_file_sink.h>
#include "direct_resampler_conditioner_cc.h"
#include "direct_resampler_conditioner_ss.h"
//#include "direct_resampler_conditioner_ss.h"
#include "configuration_interface.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -65,12 +65,12 @@ DirectResamplerConditioner::DirectResamplerConditioner(
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
sample_freq_out_);
}
else if (item_type_.compare("short") == 0)
{
item_size_ = sizeof(short);
resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
sample_freq_out_);
}
// else if (item_type_.compare("short") == 0)
// {
// item_size_ = sizeof(short);
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
// sample_freq_out_);
// }
else
{
LOG_AT_LEVEL(WARNING) << item_type_

View File

@ -1,4 +1,4 @@
project : build-dir ../../../../build ;
obj direct_resampler_conditioner_cc : direct_resampler_conditioner_cc.cc ;
obj direct_resampler_conditioner_ss : direct_resampler_conditioner_ss.cc ;
#obj direct_resampler_conditioner_ss : direct_resampler_conditioner_ss.cc ;

View File

@ -1,169 +0,0 @@
/*----------------------------------------------------------------------------------------------*/
/*! \file defines.h
//
// FILENAME: defines.h
//
// DESCRIPTION: Important, non board-specific defines, many associated with IS-GPS-200D.
//
// DEVELOPERS: Gregory W. Heckler (2003-2009)
//
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
//
// This file is part of the GPS Software Defined Radio (GPS-SDR)
//
// The GPS-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 2 of
// the License, or (at your option) any later version. The GPS-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.
//
// Note: Comments within this file follow a syntax that is compatible with
// DOXYGEN and are utilized for automated document extraction
//
// Reference:
*/
/*----------------------------------------------------------------------------------------------*/
#ifndef DEFINES_H_
#define DEFINES_H_
/* For unnamed pipes */
/*----------------------------------------------------------------------------------------------*/
#define READ (0) //!< Read handle
#define WRITE (1) //!< Write handle
#define TRUE (1) //!< True?
#define FALSE (0) //!< False!
/*----------------------------------------------------------------------------------------------*/
/* First make some type prototypes */
/*----------------------------------------------------------------------------------------------*/
typedef unsigned char uint8; //!< Unsigned byte
typedef unsigned short uint16; //!< Unsigned word
//typedef unsigned long uint32; //!< Unsigned double word
typedef unsigned long long uint64; //!< Unsigned quadruple word
typedef signed char int8; //!< Signed byte
typedef signed short int16; //!< Signed word
//typedef signed long int32; //!< Signed double word
typedef signed long long int64; //!< Signed quadruple word
typedef signed int int32;
typedef unsigned int uint32;
/*----------------------------------------------------------------------------------------------*/
/* Constants for scaling the ephemeris found in the data message
the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc
Additionally some of the PI*2^N terms are used in the tracking stuff
TWO_PX ==> 2^X
TWO_NX ==> 2^-X
PI_TWO_NX ==> Pi*2^-X
PI_TWO_PX ==> Pi*2^X
ONE_PI_TWO_PX = (1/Pi)*2^X
*/
/*----------------------------------------------------------------------------------------------*/
#define TWO_P4 (16) //!< 2^4
#define TWO_P11 (2048) //!< 2^11
#define TWO_P12 (4096) //!< 2^12
#define TWO_P14 (16384) //!< 2^14
#define TWO_P16 (65536) //!< 2^16
#define TWO_P19 (524288) //!< 2^19
#define TWO_P31 (2147483648.0) //!< 2^31
#define TWO_P32 (4294967296.0) //!< 2^32 this is too big for an int so add the x.0
#define TWO_P57 (1.441151880758559e+017) //!< 2^57
#define TWO_N5 (0.03125) //!< 2^-5
#define TWO_N11 (4.882812500000000e-004) //!< 2^-11
#define TWO_N19 (1.907348632812500e-006) //!< 2^-19
#define TWO_N20 (9.536743164062500e-007) //!< 2^-20
#define TWO_N21 (4.768371582031250e-007) //!< 2^-21
#define TWO_N24 (5.960464477539063e-008) //!< 2^-24
#define TWO_N25 (2.980232238769531e-008) //!< 2^-25
#define TWO_N27 (7.450580596923828e-009) //!< 2^-27
#define TWO_N29 (1.862645149230957e-009) //!< 2^-29
#define TWO_N30 (9.313225746154785e-010) //!< 2^-30
#define TWO_N31 (4.656612873077393e-010) //!< 2^-31
#define TWO_N32 (2.328306436538696e-010) //!< 2^-32
#define TWO_N33 (1.164153218269348e-010) //!< 2^-33
#define TWO_N38 (3.637978807091713e-012) //!< 2^-38
#define TWO_N43 (1.136868377216160e-013) //!< 2^-43
#define TWO_N50 (8.881784197001252e-016) //!< 2^-50
#define TWO_N55 (2.775557561562891e-017) //!< 2^-55
#define TWO_P56 (7.205759403792794e+016) //!< 2^56
#define TWO_P57 (1.441151880758559e+017) //!< 2^57
#define PI_TWO_N19 (5.992112452678286e-006) //!< Pi*2^-19
#define PI_TWO_N43 (3.571577341960839e-013) //!< Pi*2^-43
#define PI_TWO_N31 (1.462918079267160e-009) //!< Pi*2^-31
#define PI_TWO_N38 (1.142904749427469e-011) //!< Pi*2^-38
#define PI_TWO_N23 (3.745070282923929e-007) //!< Pi*2^-23
/* from ICD-GPS-2000 !!! Do not extend the number of significant digits !!! */
#ifndef PI
#define PI (3.141592653589793) //!< Pi
#endif
#ifndef TWO_PI
#define TWO_PI (6.283185307179586) //!< 2*Pi
#endif
#define THREE_PI_OVER_2 (4.7123889803) //!< 3*Pi/2
#define PI_OVER_2 (1.5707963267) //!< Pi/2
#define RAD_2_DEG (57.29577951308232) //!< 180/Pi
#define DEG_2_RAD (0.01745329251994) //!< Pi/180
/*----------------------------------------------------------------------------------------------*/
/* Channel Defines */
/*----------------------------------------------------------------------------------------------*/
#define FRAME_SIZE_PLUS_2 (12) //!< Number of 30 bit words in subframe plus 2
#define PREAMBLE (unsigned long)(0x008B) //!< GPS data message preamble.
#define INVERSEPREAMBLE (unsigned long)(0x0074) //!< Inverted preamble.
/*----------------------------------------------------------------------------------------------*/
/* PVT Stuff */
/*----------------------------------------------------------------------------------------------*/
#define GRAVITY_CONSTANT (3.986005e14) //!< Earth's WGS-84 gravitational constant (m^3/s^2) as specified in IS-GPS-200D
const double WGS84OE = 7.2921151467e-5; //!< Earth's WGS-84 rotation rate (rads/s) as specified in IS-GPS-200D
#define WGS84_MAJOR_AXIS (6378137.0) //!< Earth's WGS-84 ellipsoid's major axis
#define WGS84_MINOR_AXIS (6356752.314245) //!< Earth's WGS-84 ellipsoid's minor axis
#define SECONDS_IN_1024_WEEKS (619315200.0) //!< Number of seconds in 1024 weeks
#define SECONDS_IN_WEEK (604800.0) //!< Number of seconds in a week
#define HALF_OF_SECONDS_IN_WEEK (302400.0) //!< Number of seconds in one half of a week
#define SECONDS_IN_DAY (86400.0) //!< Number of seconds in a day
#define SECONDS_IN_HOUR (3600.0) //!< Number of seconds in an hour
#define SECONDS_IN_MINUTE (60.0) //!< Number of seconds in a minute
#define SECONDS_IN_HALF_HOUR (1800.0) //!< Number of seconds in a half hour
#define FOUR_HOURS (14400.0) //!< Number of seconds in 4 hrs
#define SECONDS_PER_MZCOUNT (0.6) //!< Seconds per RTCM-104 modified Z-count.
#define L1 (1.57542e9)
#define L2 (1.2276e9)
#define L1_WAVELENGTH (1.902936727983649e-001) //!< Meters
#define L1_OVER_C (5.255035468570728) //!< L1 over Speed O Light
#define C_OVER_L1 (0.190293672798365) //!< Speed O Light over L1
#ifndef SPEED_OF_LIGHT
#define SPEED_OF_LIGHT (2.99792458e8) //!< Speed of light (m/s) as specified in IS-GPS-200D
#endif
#define INVERSE_L1 (6.347513678891978e-10) //!< 1/L1
#define INVERSE_SPEED_OF_LIGHT (3.33564095198152049576e-9) //!< Inverse speed of light
#define CODE_RATE (1.023e6) //!< L1 C/A code chipping rate
#define INVERSE_CODE_RATE (9.775171065493646e-07) //!< 1/L1 C/A code chipping rate
#define CODE_CHIPS (1023)
#define SAMPS_MS (2048) //!< All incoming signals are resampled to this sampling frequency
#define SAMPLE_FREQUENCY (2048000) //!< All incoming signals are resampled to this sampling frequency
#define INVERSE_SAMPLE_FREQUENCY (4.882812500000000e-7)
/*----------------------------------------------------------------------------------------------*/
/* Global Serial Port */
/*----------------------------------------------------------------------------------------------*/
#define CHECK_STATUS(x) if((x) != NU_SUCCESS) {ERC_System_Error((x));}
#define READ (0)
#define WRITE (1)
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
#define NON_EXISTENT_SV (666)
#define NON_EXISTENT_IODE (9999)
#define STALE_SPS_VALUE (99999)
/*----------------------------------------------------------------------------------------------*/
#endif //DEFINES_H_

View File

@ -1,816 +0,0 @@
/*----------------------------------------------------------------------------------------------*/
/*! \file fft.cpp
//
// FILENAME: fft.cpp
//
// DESCRIPTION: Implements member functions of the FFT class.
//
// DEVELOPERS: Gregory W. Heckler (2003-2009)
//
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
//
// This file is part of the GPS Software Defined Radio (GPS-SDR)
//
// The GPS-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 2 of
// the License, or (at your option) any later version. The GPS-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.
//
// Note: Comments within this file follow a syntax that is compatible with
// DOXYGEN and are utilized for automated document extraction
//
// Reference:
*/
/*----------------------------------------------------------------------------------------------*/
#include "gps_sdr_fft.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
//#define NO_SIMD
#ifdef NO_SIMD
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize);
void bfly(CPX *_A, CPX *_B, MIX *_W);
void bflydf(CPX *_A, CPX *_B, MIX *_W);
void bfly_noscale(CPX *_A, CPX *_B, MIX *_W);
void bflydf_noscale(CPX *_A, CPX *_B, MIX *_W);
#else
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize) __attribute__ ((noinline));
#endif
FFT::FFT()
{
N = 0;
}
FFT::FFT(int32 _N)
{
int32 lcv;
for(lcv = 0; lcv < MAX_RANKS; lcv++)
R[lcv] = 1;
N = _N;
M = 0;
/* Get the number of ranks */
while(_N > 1)
{
M++;
_N >>= 1;
}
W = (MIX *)malloc(N/2*sizeof(MIX)); // Forward twiddle lookup
iW = (MIX *)malloc(N/2*sizeof(MIX)); // Inverse twiddle lookup
BR = (int32 *)malloc(N*sizeof(int32)); // Bit reverse lookup
BRX = (int32 *)malloc(N*sizeof(CPX)); // Shuffle temp array
initW();
initBR();
}
FFT::FFT(int32 _N, int32 _R[MAX_RANKS])
{
int32 lcv;
for(lcv = 0; lcv < MAX_RANKS; lcv++)
R[lcv] = _R[lcv];
N = _N;
M = 0;
/* Get the number of ranks */
while(_N > 1)
{
M++;
_N >>= 1;
}
W = (MIX *)malloc(N/2*sizeof(MIX)); // Forward twiddle lookup
iW = (MIX *)malloc(N/2*sizeof(MIX)); // Inverse twiddle lookup
BR = (int32 *)malloc(N*sizeof(int32)); // Bit reverse lookup
BRX = (int32 *)malloc(N*sizeof(CPX)); // Shuffle temp array
initW();
initBR();
}
FFT::~FFT()
{
free(BRX);
free(BR);
free(W);
free(iW);
}
void FFT::initW()
{
int32 lcv;
double s, c, phase;
const double pi = 3.14159265358979323846264338327;
for(lcv = 0; lcv < N/2; lcv++)
{
//Forward twiddles
phase = (-2*pi*lcv)/N;
c = floor(16384*cos(phase));
s = floor(16384*sin(phase));
W[lcv].i = (short)(c);
W[lcv].q = (short)(s);
W[lcv].nq = (short)(-s);
W[lcv].ni = (short)(c);
// fprintf(stdout,"W:%d,%d\n",W[lcv].i,W[lcv].q);
//Inverse twiddles
iW[lcv].i = (short)(c);
iW[lcv].q = (short)(-s);
iW[lcv].nq = (short)(s);
iW[lcv].ni = (short)(c);
}
}
void FFT::initBR()
{
int lcv, lcv2, index;
for(lcv = 0; lcv < N; lcv++)
{
index = 0;
for(lcv2 = 0; lcv2 < M; lcv2++)
{
index += ((lcv >> lcv2) & 0x1);
index <<= 1;
}
index >>= 1;
BR[lcv] = index;
// fprintf(stdout,"BR:%d\n",BR[lcv]);
}
}
void FFT::doFFT(CPX *_x, bool _shuf)
{
int32 lcv, nblocks, bsize;
CPX *a, *b;
MIX *w;
if(_shuf) {
doShuffle(_x); //bit reverse the array
}
bsize = 1;
nblocks = N >> 1;
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
{
a = _x;
b = _x + bsize;
w = W;
if(R[lcv])
rank(a, b, w, nblocks, bsize);
else
rank_noscale(a, b, w, nblocks, bsize);
bsize <<= 1;
nblocks >>= 1;
}
}
void FFT::doiFFT(CPX *_x, bool _shuf)
{
int32 lcv, nblocks, bsize;
CPX *a, *b;
MIX *w;
if(_shuf)
doShuffle(_x); //bit reverse the array
bsize = 1;
nblocks = N >> 1;
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
{
a = _x;
b = _x + bsize;
w = iW;
if(R[lcv])
rank(a, b, w, nblocks, bsize);
else
rank_noscale(a, b, w, nblocks, bsize);
bsize <<= 1;
nblocks >>= 1;
}
}
void FFT::doFFTdf(CPX *_x, bool _shuf)
{
int32 lcv;
int32 bsize;
int32 nblocks;
CPX *a, *b;
MIX *w;
bsize = N >> 1;
nblocks = 1;
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
{
a = _x;
b = _x + bsize;
w = W;
if(R[lcv])
rankdf(a, b, w, nblocks, bsize);
else
rankdf_noscale(a, b, w, nblocks, bsize);
bsize >>= 1;
nblocks <<= 1;
}
if(_shuf)
doShuffle(_x); //bit reverse the array
}
void FFT::doiFFTdf(CPX *_x, bool _shuf)
{
int32 lcv;
int32 bsize, nblocks;
CPX *a, *b;
MIX *w;
bsize = N >> 1;
nblocks = 1;
for(lcv = 0; lcv < M; lcv++) //Loop over M ranks
{
a = _x;
b = _x + bsize;
w = iW;
if(R[lcv])
rankdf(a, b, w, nblocks, bsize);
else
rankdf_noscale(a, b, w, nblocks, bsize);
bsize >>= 1;
nblocks <<= 1;
}
if(_shuf)
doShuffle(_x); //bit reverse the array
}
void FFT::doShuffle(CPX *_x)
{
int32 lcv;
int32 *p = (int32 *)_x;
memcpy(BRX, p, N*sizeof(CPX));
for(lcv = 0; lcv < N; lcv++)
p[lcv] = BRX[BR[lcv]];
}
#ifdef NO_SIMD /* Include the cPP FFT Functions */
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
int32 lcv, lcv2;
MIX *wbase = _W;
for(lcv = 0; lcv < _nblocks; lcv++)
{
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
{
bfly(_A, _B, _W);
_A++; _B++; _W+=_nblocks;
}
_A += _bsize;
_B += _bsize;
_W = wbase;
}
}
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
int32 lcv, lcv2;
MIX *wbase = _W;
for(lcv = 0; lcv < _nblocks; lcv++)
{
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
{
bfly_noscale(_A, _B, _W);
_A++; _B++; _W+=_nblocks;
}
_A += _bsize;
_B += _bsize;
_W = wbase;
}
}
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
int32 lcv, lcv2;
MIX *wbase = _W;
for(lcv = 0; lcv < _nblocks; lcv++)
{
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
{
bflydf(_A, _B, _W);
_A++; _B++; _W+=_nblocks;
}
_A += _bsize;
_B += _bsize;
_W = wbase;
}
}
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
int32 lcv, lcv2;
MIX *wbase = _W;
for(lcv = 0; lcv < _nblocks; lcv++)
{
for(lcv2 = 0; lcv2 < _bsize; lcv2++)
{
bflydf_noscale(_A, _B, _W);
_A++; _B++; _W+=_nblocks;
}
_A += _bsize;
_B += _bsize;
_W = wbase;
}
}
void bfly(CPX *_A, CPX *_B, MIX *_W)
{
int32 bi, bq;
_A->i >>= 1;
_A->q >>= 1;
_B->i >>= 1;
_B->q >>= 1;
bi = _B->i*_W->i - _B->q*_W->q;
bq = _B->i*_W->q + _B->q*_W->i;
bi = (bi + 8192) >> 14;
bq = (bq + 8192) >> 14;
_B->i = _A->i - (int16)bi;
_B->q = _A->q - (int16)bq;
_A->i += (int16)bi;
_A->q += (int16)bq;
}
void bfly_noscale(CPX *_A, CPX *_B, MIX *_W)
{
int32 bi, bq;
bi = _B->i*_W->i - _B->q*_W->q;
bq = _B->i*_W->q + _B->q*_W->i;
bi = (bi + 8192) >> 14;
bq = (bq + 8192) >> 14;
_B->i = _A->i - (int16)bi;
_B->q = _A->q - (int16)bq;
_A->i += (int16)bi;
_A->q += (int16)bq;
}
void bflydf(CPX *_A, CPX *_B, MIX *_W)
{
int32 bi, bq;
_A->i >>= 1;
_A->q >>= 1;
_B->i >>= 1;
_B->q >>= 1;
bi = _B->i;
bq = _B->q;
_B->i = _A->i - bi;
_B->q = _A->q - bq;
_A->i = _A->i + bi;
_A->q = _A->q + bq;
bi = _A->i*_W->i - _A->q*_W->q;
bq = _A->i*_W->q + _A->q*_W->i;
bi = (bi + 8192) >> 14;
bq = (bq + 8192) >> 14;
_A->i += (int16)bi;
_A->q += (int16)bq;
}
void bflydf_noscale(CPX *_A, CPX *_B, MIX *_W)
{
int32 bi, bq;
bi = _B->i;
bq = _B->q;
_B->i = _A->i - bi;
_B->q = _A->q - bq;
_A->i = _A->i + bi;
_A->q = _A->q + bq;
bi = _A->i*_W->i - _A->q*_W->q;
bq = _A->i*_W->q + _A->q*_W->i;
bi = (bi + 8192) >> 14;
bq = (bq + 8192) >> 14;
_A->i += (int16)bi;
_A->q += (int16)bq;
}
#else /* Include the SIMD FFT Functions */
void rank(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
__asm
(
".intel_syntax noprefix \n" //Use intel syntax
"push ebx\n\t"
"mov ebx, [ebp+8] \n" //A
"mov edi, [ebp+12] \n" //B
"mov edx, [ebp+20] \n" //nblocks
"mov eax, 0x00002000 \n"
"movd mm4, eax \n"
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
"B%=: \n"
"mov esi, [ebp+16] \n" //W
"mov ecx, 0x0 \n"
"mov eax, [ebp+20] \n" //nblocks
"sal eax, 3 \n" //make into bytes
"S%=: \n"
"movd mm0, [ebx+ecx*4]\n" //Copy A to mm0
"movd mm1, [edi+ecx*4]\n" //Copy B to mm1
"movq mm2, [esi] \n" //Copy W to mm2
"psraw mm0, 1 \n" //Divide A by 2
"psraw mm1, 1 \n" //Divide B by 2
"movq mm3, mm0 \n" //Copy A to mm3
"punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
"pmaddwd mm1, mm2 \n" //Multiply and add
"padddw mm1, mm4 \n"
"psrad mm1, 0xe \n" //Right shift by 14 bits
"packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
"paddw mm0, mm1 \n" //A+Bw
"psubw mm3, mm1 \n" //A-Bw
"movd [ebx+ecx*4], mm0\n" //Copy back to A
"movd [edi+ecx*4], mm3\n" //Copy back to B
"add esi, eax \n"
"add ecx, 0x1 \n"
"cmp ecx, [ebp+24] \n"
"jne S%= \n"
"sal ecx, 3 \n"
"add ebx, ecx \n"
"add edi, ecx \n"
"sub edx, 0x1 \n"
"jnz B%= \n"
"pop ebx\n\t"
"EMMS \n" //Done with MMX
".att_syntax \n" //Back to ATT syntax
:
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
: "%eax", "%ecx", "%edx", "%edi", "%esi"
);
}
void rank_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
__asm
(
".intel_syntax noprefix \n" //Use intel syntax
"push ebx\n\t"
"mov ebx, [ebp+8] \n" //A
"mov edi, [ebp+12] \n" //B
"mov edx, [ebp+20] \n" //nblocks
"mov eax, 0x00002000 \n"
"movd mm4, eax \n"
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
"B%=: \n"
"mov esi, [ebp+16] \n" //W
"mov ecx, 0x0 \n"
"mov eax, [ebp+20] \n" //nblocks
"sal eax, 3 \n" //make into bytes
"S%=: \n"
"movd mm0, [ebx+ecx*4]\n" //Copy A to mm0
"movd mm1, [edi+ecx*4]\n" //Copy B to mm1
"movq mm2, [esi] \n" //Copy W to mm2
"movq mm3, mm0 \n" //Copy A to mm3
"punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
"pmaddwd mm1, mm2 \n" //Multiply and add
"padddw mm1, mm4 \n"
"psrad mm1, 0xe \n" //Right shift by 14 bits
"packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
"paddw mm0, mm1 \n" //A+Bw
"psubw mm3, mm1 \n" //A-Bw
"movd [ebx+ecx*4], mm0\n" //Copy back to A
"movd [edi+ecx*4], mm3\n" //Copy back to B
"add esi, eax \n"
"add ecx, 0x1 \n"
"cmp ecx, [ebp+24] \n"
"jne S%= \n"
"sal ecx, 3 \n"
"add ebx, ecx \n"
"add edi, ecx \n"
"sub edx, 0x1 \n"
"jnz B%= \n"
"pop ebx\n\t"
"EMMS \n" //Done with MMX
".att_syntax \n" //Back to ATT syntax
:
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
: "%eax", "%ecx", "%edx", "%edi", "%esi"
);
}
//static void bflydf(void *_A, void *_B, void *_W)
//{
//
// __asm
// {
// mov ebx, _A;
// mov edi, _B;
// mov esi, _W;
//
// movd mm0, [ebx]; /*move 32 bits from A to bottom 32 bits of mm0*/
// movd mm1, [edi]; /*move 32 bits from B to bottom 32 bits of mm1*/
// movq mm2, [esi]; /*move 64 bits from W to mm2*/
// psraw mm0, 0x1;
// psraw mm1, 0x1;
// movq mm3, mm0; /*copy A to mm3*/
// paddw mm0, mm1; /*A+B*/
// psubw mm3, mm1; /*A-B*/
// punpckldq mm3, mm3; /*copy bottom 32 bits of B data into high 32 bits*/
// pmaddwd mm3, mm2; /*complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
// psrad mm3, 0xf; /*right shift 0..31 by 16, 32..63 by 16*/
// packssdw mm3, mm3; /*pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
// movd [ebx], mm0;
// movd [edi], mm3;
//
// EMMS;
// }
//}
void rankdf(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
__asm
(
".intel_syntax noprefix \n" //Use intel syntax
"push ebx\n\t"
"mov ebx, [ebp+8] \n" //A
"mov edi, [ebp+12] \n" //B
"mov edx, [ebp+20] \n" //nblocks
"mov eax, 0x00002000 \n"
"movd mm4, eax \n"
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
"B%=: \n"
"mov esi, [ebp+16] \n" //W
"mov ecx, [ebp+24] \n" //bsize
"mov eax, [ebp+20] \n" //nblocks
"sal eax, 3 \n" //make into bytes
"L%=: \n"
"movd mm0, [ebx] \n" //Copy A to mm0
"movd mm1, [edi] \n" //Copy B to mm1
"movq mm2, [esi] \n" //Copy W to mm2
"psraw mm0, 1 \n" //Divide A by 2
"psraw mm1, 1 \n" //Divide B by 2
"movq mm3, mm0 \n" //Copy A to mm3
"paddw mm0, mm1 \n" //A+B
"psubw mm3, mm1 \n" //A-B
"punpckldq mm3, mm3 \n" //Copy bottom 32 bits of B data into high 32 bits*/
"pmaddwd mm3, mm2 \n" //Complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
"padddw mm3, mm4 \n"
"psrad mm3, 0xe \n" //Right shift 0..31 by 14, 32..63 by 14*/
"packssdw mm3, mm3 \n" //Pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
"movd [ebx], mm0 \n" //Copy back to A
"movd [edi], mm3 \n" //Copy back to B
"add ebx, 0x4 \n"
"add edi, 0x4 \n"
"add esi, eax \n"
"loop L%= \n"
"mov ecx, [ebp+24] \n" //bsize
"sal ecx, 2 \n"
"add ebx, ecx \n"
"add edi, ecx \n"
"sub edx, 0x1 \n"
"jnz B%= \n"
"pop ebx\n\t"
"EMMS \n" //Done with MMX
".att_syntax \n" //Back to ATT syntax
:
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
: "%eax", "%ecx", "%edx", "%edi", "%esi"
);
}
void rankdf_noscale(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
{
__asm
(
".intel_syntax noprefix \n" //Use intel syntax
"push ebx\n\t"
"mov ebx, [ebp+8] \n" //A
"mov edi, [ebp+12] \n" //B
"mov edx, [ebp+20] \n" //nblocks
"mov eax, 0x00002000 \n"
"movd mm4, eax \n"
"punpckldq mm4, mm4 \n" //Low 32 bits to high 32 bits
"B%=: \n"
"mov esi, [ebp+16] \n" //W
"mov ecx, [ebp+24] \n" //bsize
"mov eax, [ebp+20] \n" //nblocks
"sal eax, 3 \n" //make into bytes
"L%=: \n"
"movd mm0, [ebx] \n" //Copy A to mm0
"movd mm1, [edi] \n" //Copy B to mm1
"movq mm2, [esi] \n" //Copy W to mm2
"movq mm3, mm0 \n" //Copy A to mm3
"paddw mm0, mm1 \n" //A+B
"psubw mm3, mm1 \n" //A-B
"punpckldq mm3, mm3 \n" //Copy bottom 32 bits of B data into high 32 bits*/
"pmaddwd mm3, mm2 \n" //Complex multiply, real now 0..31 of mm1, imag 32..63 of mm1*/
"padddw mm3, mm4 \n"
"psrad mm3, 0xe \n" //Right shift 0..31 by 14, 32..63 by 14*/
"packssdw mm3, mm3 \n" //Pack bits 0..31 to 0..16, bits 32..63 to 16..31*/
"movd [ebx], mm0 \n" //Copy back to A
"movd [edi], mm3 \n" //Copy back to B
"add ebx, 0x4 \n"
"add edi, 0x4 \n"
"add esi, eax \n"
"loop L%= \n"
"mov ecx, [ebp+24] \n" //bsize
"sal ecx, 2 \n"
"add ebx, ecx \n"
"add edi, ecx \n"
"sub edx, 0x1 \n"
"jnz B%= \n"
"pop ebx\n\t"
"EMMS \n" //Done with MMX
".att_syntax \n" //Back to ATT syntax
:
: "m" (_A), "m" (_B), "m" (_W), "m" (_nblocks), "m" (_bsize)
: "%eax", "%ecx", "%edx", "%edi", "%esi"
);
}
//void bfly(CPX *_A, CPX *_B, MIX *_W)
//{
// __asm
// (
// ".intel_syntax noprefix \n" //Use intel syntax
// "mov ebx, [ebp+8] \n" //A
// "mov edi, [ebp+12] \n" //B
// "mov esi, [ebp+16] \n" //W
// "movd mm0, [ebx] \n" //Copy A to mm0
// "movd mm1, [edi] \n" //Copy B to mm1
// "movq mm2, [esi] \n" //Copy W to mm2
// "psraw mm0, 1 \n" //Divide A by 2
// "psraw mm1, 1 \n" //Divide B by 2
// "movq mm3, mm0 \n" //Copy A to mm3
// "punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
// "pmaddwd mm1, mm2 \n" //Multiply and add
// "psrad mm1, 0xe \n" //Right shift by 14 bits
// "packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
// "paddw mm0, mm1 \n" //A+Bw
// "psubw mm3, mm1 \n" //A-Bw
// "movd [ebx], mm0 \n" //Copy back to A
// "movd [edi], mm3 \n" //Copy back to B
// "EMMS \n" //Done with MMX
// ".att_syntax \n" //Back to ATT syntax
// :
// :
// : "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi"
// );
//}
//
//
//void block(CPX *_A, CPX *_B, MIX *_W, int32 _nblocks, int32 _bsize)
//{
//
// __asm
// (
// ".intel_syntax noprefix \n" //Use intel syntax
// "mov ebx, [ebp+8] \n" //A
// "mov edi, [ebp+12] \n" //B
// "mov esi, [ebp+16] \n" //W
// "mov eax, [ebp+20] \n" //nblocks
// "sal eax, 3 \n" //make into bytes
// "mov ecx, [ebp+24] \n" //bsize
// "Lbsize: \n"
// "movd mm0, [ebx] \n" //Copy A to mm0
// "movd mm1, [edi] \n" //Copy B to mm1
// "movq mm2, [esi] \n" //Copy W to mm2
// "psraw mm0, 1 \n" //Divide A by 2
// "psraw mm1, 1 \n" //Divide B by 2
// "movq mm3, mm0 \n" //Copy A to mm3
// "punpckldq mm1, mm1 \n" //Low 32 bits to high 32 bits
// "pmaddwd mm1, mm2 \n" //Multiply and addint64
// "psrad mm1, 0xe \n" //Right shift by 14 bits
// "packssdw mm1, mm1 \n" //Pack back into 16 bit interleaved
// "paddw mm0, mm1 \n" //A+Bw
// "psubw mm3, mm1 \n" //A-Bw
// "movd [ebx], mm0 \n" //Copy back to A
// "movd [edi], mm3 \n" //Copy back to B
// "add ebx, 0x4 \n"
// "add edi, 0x4 \n"
// "add esi, eax \n"
// "loop Lbsize \n"
// "EMMS \n" //Done with MMX
// ".att_syntax \n" //Back to ATT syntax
// :
// :
// : "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi"
// );
//
//}
#endif

View File

@ -1,69 +0,0 @@
/*----------------------------------------------------------------------------------------------*/
/*! \file fft.h
//
// FILENAME: fft.h
//
// DESCRIPTION: Defines the FFT class.
//
// DEVELOPERS: Gregory W. Heckler (2003-2009)
//
// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009
//
// This file is part of the GPS Software Defined Radio (GPS-SDR)
//
// The GPS-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 2 of
// the License, or (at your option) any later version. The GPS-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.
//
// Note: Comments within this file follow a syntax that is compatible with
// DOXYGEN and are utilized for automated document extraction
//
// Reference:
*/
/*----------------------------------------------------------------------------------------------*/
#ifndef FFT_H_
#define FFT_H_
#include "gps_sdr_defines.h"
#include "gps_sdr_signal_processing.h"
#define MAX_RANKS (16)
/*! @ingroup CLASSES
@brief /xyzzy */
class FFT
{
private:
MIX *W; //!< Twiddle lookup array for FFT
MIX *iW; //!< Twiddle lookup array for iFFT
int32 *BRX; //!< Re-order temp array
int32 *BR; //!< Re-order index array
int32 N; //!< Length (should be 2^N!!!)
int32 M; //!< Log2(N) (number of ranks)
int32 R[16]; //!< Programmable rank scaling
void initW(); //!< Initialize twiddles
void initBR(); //!< Initialize re-order array
void doShuffle(CPX *_x); //!< Do bit-reverse shuffling
public:
FFT(); //!< Initialize FFT
FFT(int32 _N); //!< Initialize FFT for 2^N
FFT(int32 _N, int32 _R[MAX_RANKS]); //!< Initialize FFT for 2^N, with ranks
~FFT(); //!< Destructor
void doFFT(CPX *_x, bool _shuf); //!< Forward FFT, decimate in time
void doiFFT(CPX *_x, bool _shuf); //!< Inverse FFT, decimate in time
void doFFTdf(CPX *_x, bool _shuf); //!< Forward FFT, decimate in frequency
void doiFFTdf(CPX *_x, bool _shuf); //!< Inverse FFT, decimate in frequency
};
#endif /*FFT_H_*/

View File

@ -76,68 +76,69 @@ void code_gen_conplex(std::complex<float>* _dest, signed int _prn, unsigned int
/*!
* code_gen, generate the given prn code
* */
signed int code_gen(CPX *_dest, signed int _prn)
{
unsigned int G1[1023];
unsigned int G2[1023];
unsigned int G1_register[10], G2_register[10];
unsigned int feedback1, feedback2;
unsigned int lcv, lcv2;
unsigned int delay;
signed int prn = _prn-1; //Move the PRN code to fit an array indices
/* G2 Delays as defined in GPS-ISD-200D */
signed int delays[51] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472,
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862, 145, 175, 52, 21, 237, 235, 886, 657, 634, 762,
355, 1012, 176, 603, 130, 359, 595, 68, 386};
/* A simple error check */
if((prn < 0) || (prn > 51))
return(0);
for(lcv = 0; lcv < 10; lcv++)
{
G1_register[lcv] = 1;
G2_register[lcv] = 1;
}
/* Generate G1 & G2 Register */
for(lcv = 0; lcv < 1023; lcv++)
{
G1[lcv] = G1_register[0];
G2[lcv] = G2_register[0];
feedback1 = G1_register[7]^G1_register[0];
feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1;
for(lcv2 = 0; lcv2 < 9; lcv2++)
{
G1_register[lcv2] = G1_register[lcv2+1];
G2_register[lcv2] = G2_register[lcv2+1];
}
G1_register[9] = feedback1;
G2_register[9] = feedback2;
}
/* Set the delay */
delay = 1023 - delays[prn];
/* Generate PRN from G1 and G2 Registers */
for(lcv = 0; lcv < 1023; lcv++)
{
_dest[lcv].i = G1[lcv]^G2[delay];
_dest[lcv].q = 0;
delay++;
delay %= 1023;
}
return(1);
}
/*----------------------------------------------------------------------------------------------*/
//signed int code_gen(CPX *_dest, signed int _prn)
//{
//
// unsigned int G1[1023];
// unsigned int G2[1023];
// unsigned int G1_register[10], G2_register[10];
// unsigned int feedback1, feedback2;
// unsigned int lcv, lcv2;
// unsigned int delay;
// signed int prn = _prn-1; //Move the PRN code to fit an array indices
//
// /* G2 Delays as defined in GPS-ISD-200D */
// signed int delays[51] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472,
// 473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862, 145, 175, 52, 21, 237, 235, 886, 657, 634, 762,
// 355, 1012, 176, 603, 130, 359, 595, 68, 386};
//
// /* A simple error check */
// if((prn < 0) || (prn > 51))
// return(0);
//
// for(lcv = 0; lcv < 10; lcv++)
// {
// G1_register[lcv] = 1;
// G2_register[lcv] = 1;
// }
//
// /* Generate G1 & G2 Register */
// for(lcv = 0; lcv < 1023; lcv++)
// {
// G1[lcv] = G1_register[0];
// G2[lcv] = G2_register[0];
//
// feedback1 = G1_register[7]^G1_register[0];
// feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1;
//
// for(lcv2 = 0; lcv2 < 9; lcv2++)
// {
// G1_register[lcv2] = G1_register[lcv2+1];
// G2_register[lcv2] = G2_register[lcv2+1];
// }
//
// G1_register[9] = feedback1;
// G2_register[9] = feedback2;
// }
//
// /* Set the delay */
// delay = 1023 - delays[prn];
//
// /* Generate PRN from G1 and G2 Registers */
// for(lcv = 0; lcv < 1023; lcv++)
// {
// _dest[lcv].i = G1[lcv]^G2[delay];
// _dest[lcv].q = 0;
//
// delay++;
// delay %= 1023;
// }
//
// return(1);
//
//}
///*----------------------------------------------------------------------------------------------*/
@ -198,31 +199,31 @@ void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, sig
/*!
* sine_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
* */
void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps) {
signed int lcv;
signed short c, s;
float phase, phase_step;
phase = 0;
phase_step = (float)TWO_PI*_f/_fs;
for(lcv = 0; lcv < _samps; lcv++) {
c = (signed short)floor(16383.0*cos(phase));
s = (signed short)floor(16383.0*sin(phase));
_dest[lcv].i = c;
_dest[lcv].q = s;
phase += phase_step;
}
}
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps) {
//
// signed int lcv;
// signed short c, s;
// float phase, phase_step;
//
// phase = 0;
// phase_step = (float)TWO_PI*_f/_fs;
//
// for(lcv = 0; lcv < _samps; lcv++) {
// c = (signed short)floor(16383.0*cos(phase));
// s = (signed short)floor(16383.0*sin(phase));
// _dest[lcv].i = c;
// _dest[lcv].q = s;
//
// phase += phase_step;
// }
//}
/*----------------------------------------------------------------------------------------------*/
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps) {
double phase, phase_step;
phase_step = ((double)TWO_PI*_f)/_fs;
phase_step = (GPS_TWO_PI*_f)/_fs;
for(unsigned int i = 0; i < _samps; i++) {
@ -236,27 +237,27 @@ void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigne
/*----------------------------------------------------------------------------------------------*/
void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p)
{
signed int lcv;
int16 c, s;
double phase, phase_step;
phase = _p;
phase_step = (double)TWO_PI*_f/_fs;
for(lcv = 0; lcv < _samps; lcv++)
{
c = (int16)floor(16383.0*cos(phase));
s = (int16)floor(16383.0*sin(phase));
_dest[lcv].i = c;
_dest[lcv].q = s;
phase += phase_step;
}
}
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p)
//{
//
// signed int lcv;
// int16 c, s;
// double phase, phase_step;
//
// phase = _p;
// phase_step = (double)TWO_PI*_f/_fs;
//
// for(lcv = 0; lcv < _samps; lcv++)
// {
// c = (int16)floor(16383.0*cos(phase));
// s = (int16)floor(16383.0*sin(phase));
// _dest[lcv].i = c;
// _dest[lcv].q = s;
//
// phase += phase_step;
// }
//
//}
/*----------------------------------------------------------------------------------------------*/
@ -264,56 +265,56 @@ void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p)
/*!
* wipeoff_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
* */
void wipeoff_gen(MIX *_dest, double _f, double _fs, signed int _samps)
{
signed int lcv;
int16 c, s;
double phase, phase_step;
phase = 0;
phase_step = (double)TWO_PI*_f/_fs;
for(lcv = 0; lcv < _samps; lcv++)
{
c = (int16)floor(16383.0*cos(phase));
s = (int16)floor(16383.0*sin(phase));
_dest[lcv].i = _dest[lcv].ni = c;
_dest[lcv].q = s;
_dest[lcv].nq = -s;
phase += phase_step;
}
}
//void wipeoff_gen(MIX *_dest, double _f, double _fs, signed int _samps)
//{
//
// signed int lcv;
// int16 c, s;
// double phase, phase_step;
//
// phase = 0;
// phase_step = (double)TWO_PI*_f/_fs;
//
// for(lcv = 0; lcv < _samps; lcv++)
// {
// c = (int16)floor(16383.0*cos(phase));
// s = (int16)floor(16383.0*sin(phase));
// _dest[lcv].i = _dest[lcv].ni = c;
// _dest[lcv].q = s;
// _dest[lcv].nq = -s;
//
// phase += phase_step;
// }
//
//}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed int _samps)
{
signed int lcv, k;
unsigned int phase_step;
unsigned int lphase, phase;
phase_step = (unsigned int)floor((double)4294967296.0*_fdest/_fsource);
k = lphase = phase = 0;
for(lcv = 0; lcv < _samps; lcv++)
{
if(phase <= lphase)
{
_dest[k] = _source[lcv];
k++;
}
lphase = phase;
phase += phase_step;
}
}
//void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed int _samps)
//{
//
// signed int lcv, k;
// unsigned int phase_step;
// unsigned int lphase, phase;
//
// phase_step = (unsigned int)floor((double)4294967296.0*_fdest/_fsource);
//
// k = lphase = phase = 0;
//
// for(lcv = 0; lcv < _samps; lcv++)
// {
// if(phase <= lphase)
// {
// _dest[k] = _source[lcv];
// k++;
// }
//
// lphase = phase;
// phase += phase_step;
// }
//
//}
/*----------------------------------------------------------------------------------------------*/
@ -326,40 +327,40 @@ void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed
/*!
* Gather statistics and run AGC
* */
signed int run_agc(CPX *_buff, signed int _samps, signed int _bits, signed int _scale)
{
signed int lcv, num;
int16 max, *p;
int16 val;
p = (int16 *)&_buff[0];
val = (1 << (_scale - 1));
max = 1 << _bits;
num = 0;
if(_scale)
{
for(lcv = 0; lcv < 2*_samps; lcv++)
{
p[lcv] += val;
p[lcv] >>= _scale;
if(abs(p[lcv]) > max)
num++;
}
}
else
{
for(lcv = 0; lcv < 2*_samps; lcv++)
{
if(abs(p[lcv]) > max)
num++;
}
}
return(num);
}
//signed int run_agc(CPX *_buff, signed int _samps, signed int _bits, signed int _scale)
//{
// signed int lcv, num;
// int16 max, *p;
// int16 val;
//
// p = (int16 *)&_buff[0];
//
// val = (1 << (_scale - 1));
// max = 1 << _bits;
// num = 0;
//
// if(_scale)
// {
// for(lcv = 0; lcv < 2*_samps; lcv++)
// {
// p[lcv] += val;
// p[lcv] >>= _scale;
// if(abs(p[lcv]) > max)
// num++;
// }
// }
// else
// {
// for(lcv = 0; lcv < 2*_samps; lcv++)
// {
// if(abs(p[lcv]) > max)
// num++;
// }
// }
//
// return(num);
//
//}
/*----------------------------------------------------------------------------------------------*/
@ -367,22 +368,22 @@ signed int run_agc(CPX *_buff, signed int _samps, signed int _bits, signed int _
/*!
* Get a rough first guess of scale value to quickly initialize agc
* */
void init_agc(CPX *_buff, signed int _samps, signed int bits, signed int *scale)
{
signed int lcv;
int16 *p;
signed int max;
p = (int16 *)&_buff[0];
max = 0;
for(lcv = 0; lcv < 2*_samps; lcv++)
{
if(p[lcv] > max)
max = p[lcv];
}
scale[0] = (1 << 14) / max;
}
//void init_agc(CPX *_buff, signed int _samps, signed int bits, signed int *scale)
//{
// signed int lcv;
// int16 *p;
// signed int max;
//
// p = (int16 *)&_buff[0];
//
// max = 0;
// for(lcv = 0; lcv < 2*_samps; lcv++)
// {
// if(p[lcv] > max)
// max = p[lcv];
// }
//
// scale[0] = (1 << 14) / max;
//
//}
/*----------------------------------------------------------------------------------------------*/

View File

@ -1,56 +1,58 @@
#ifndef GPS_SDR_SIGNAL_PROCESSING_H_
#define GPS_SDR_SIGNAL_PROCESSING_H_
#include "gps_sdr_defines.h"
//#include "gps_sdr_defines.h"
#include "GPS_L1_CA.h"
#include <complex>
#include <iostream>
/*
* Signal processing functions from gps-sdr.
*/
/*----------------------------------------------------------------------------------------------*/
/*! @ingroup STRUCTS
* @brief Define the CPX structure, used in the Fine_Acquisition FFT */
typedef struct CPX
{
int16 i; //!< Real value
int16 q; //!< Imaginary value
} CPX;
/*! \ingroup STRUCTS
* @brief Format of complex accumulations */
typedef struct CPX_ACCUM {
int32 i; //!< Inphase (real)
int32 q; //!< Quadrature (imaginary)
} CPX_ACCUM;
/*! \ingroup STRUCTS
*
*/
typedef struct MIX {
int16 i; //!< Inphase (real)
int16 nq; //!< Quadrature (imaginary)
int16 q; //!< Quadrature (imaginary)
int16 ni; //!< Inphase (real)
} MIX;
///*
// * Signal processing functions from gps-sdr.
// */
//
///*----------------------------------------------------------------------------------------------*/
///*! @ingroup STRUCTS
// * @brief Define the CPX structure, used in the Fine_Acquisition FFT */
//typedef struct CPX
//{
// int16 i; //!< Real value
// int16 q; //!< Imaginary value
//} CPX;
//
///*! \ingroup STRUCTS
// * @brief Format of complex accumulations */
//typedef struct CPX_ACCUM {
//
// int32 i; //!< Inphase (real)
// int32 q; //!< Quadrature (imaginary)
//
//} CPX_ACCUM;
//
//
///*! \ingroup STRUCTS
// *
// */
//typedef struct MIX {
//
// int16 i; //!< Inphase (real)
// int16 nq; //!< Quadrature (imaginary)
// int16 q; //!< Quadrature (imaginary)
// int16 ni; //!< Inphase (real)
//
//} MIX;
/*----------------------------------------------------------------------------------------------*/
void code_gen_conplex(std::complex<float>* _dest, int32 _prn, unsigned int _chip_shift);
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int32 _fs, unsigned int _chip_shift);
int32 code_gen(CPX *_dest, int32 _prn);
void sine_gen(CPX *_dest, double _f, double _fs, int32 _samps);
void code_gen_conplex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
//signed int code_gen(CPX *_dest, signed int _prn);
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps);
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps);
void sine_gen(CPX *_dest, double _f, double _fs, int32 _samps, double _p);
void wipeoff_gen(MIX *_dest, double _f, double _fs, int32 _samps);
void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, int32 _samps);
void init_agc(CPX *_buff, int32 _samps, int32 bits, int32 *scale);
int32 run_agc(CPX *_buff, int32 _samps, int32 bits, int32 scale);
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p);
//void wipeoff_gen(MIX *_dest, double _f, double _fs, signed int _samps);
//void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed int _samps);
//void init_agc(CPX *_buff, signed int _samps, signed int bits, signed int *scale);
//signed int run_agc(CPX *_buff, signed int _samps, signed int bits, signed int scale);
#endif /* GPS_SDR_SIGNAL_PROCESSING_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
/*!
* \file gps_sdr_simd.cc
* \brief Contains prototypes for SIMD instructions
* \author Copyright 2008 Gregory W Heckler
*
* This class implements operations in assembler (SSE technology in Intel processors)
* It has been copied from Gregory W Heckler's GPS-SDR Project
* Please see http://github.com/gps-sdr/gps-sdr
*
* -------------------------------------------------------------------------
*
* 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 SIMD_H_
#define SIMD_H_
#include "gps_sdr_defines.h"
#include "gps_sdr_signal_processing.h"
/* Found in CPUID.cpp */
/*----------------------------------------------------------------------------------------------*/
//bool CPU_MMX(); //!< Does the CPU support MMX?
//bool CPU_SSE(); //!< Does the CPU support SSE?
//bool CPU_SSE2(); //!< Does the CPU support SSE2?
//bool CPU_SSE3(); //!< Does the CPU support SSE3?
//bool CPU_SSSE3(); //!< Does the CPU support SSSE3? No thats not a typo!
//bool CPU_SSE41(); //!< Does the CPU support SSE4.1?
//bool CPU_SSE42(); //!< Does the CPU support SSE4.2?
//void Init_SIMD(); //!< Initialize the global function pointers
/*----------------------------------------------------------------------------------------------*/
/* Found in SSE.cpp */
/*----------------------------------------------------------------------------------------------*/
void sse_add(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector addition
void sse_sub(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector difference
void sse_mul(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector multiply
int32 sse_dot(int16 *A, int16 *B, int32 cnt) __attribute__ ((noinline)); //!< Compute vector dot product
void sse_conj(CPX *A, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector conjugate
void sse_cacc(CPX *A, MIX *B, int32 cnt, int32 *iaccum, int32 *baccum) __attribute__ ((noinline)); //!< Compute dot product of cpx and a mix vector
void sse_cmul(CPX *A, CPX *B, int32 cnt) __attribute__ ((noinline)); //!< Pointwise vector multiply
void sse_cmuls(CPX *A, CPX *B, int32 cnt, int32 shift) __attribute__ ((noinline)); //!< Pointwise vector multiply with shift
void sse_cmulsc(CPX *A, CPX *B, CPX *C, int32 cnt, int32 shift) __attribute__ ((noinline)); //!< Pointwise vector multiply with shift, dump results into C
void sse_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum) __attribute__ ((noinline)); //!< This is a long story
void sse_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum) __attribute__ ((noinline)); //!< This is a long story
void sse_max(int32 *_A, int32 *_index, int32 *_magt, int32 _cnt) __attribute__ ((noinline));
/*----------------------------------------------------------------------------------------------*/
#endif /*SIMD_H_*/

View File

@ -1,493 +0,0 @@
/*! \file x86.cpp
Emulate SIMD functionality with plain x86 crap, for older processors
*/
/************************************************************************************************
Copyright 2008 Gregory W Heckler
This file is part of the GPS Software Defined Radio (GPS-SDR)
The GPS-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 2 of the
License, or (at your option) any later version.
The GPS-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 GPS-SDR; if not,
write to the:
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
************************************************************************************************/
#include "gps_sdr_x86.h"
#include "gr_complex.h"
#include <complex>
/*----------------------------------------------------------------------------------------------*/
void x86_add(int16 *_A, int16 *_B, int32 _cnt)
{
int16 *a = _A;
int16 *b = _B;
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
a[lcv] += b[lcv];
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_sub(int16 *_A, int16 *_B, int32 _cnt)
{
int16 *a = _A;
int16 *b = _B;
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
a[lcv] -= b[lcv];
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_mul(int16 *_A, int16 *_B, int32 _cnt)
{
int16 *a = _A;
int16 *b = _B;
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
a[lcv] *= b[lcv];
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_muls(int16 *_A, int16 *_B, int32 _cnt, int32 _shift)
{
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
{
_A[lcv] *= *_B;
_A[lcv] >>= _shift;
}
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
int32 x86_dot(int16 *_A, int16 *_B, int32 _cnt)
{
int32 accum = 0;
int16 *a = _A;
int16 *b = _B;
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
accum += (int32)a[lcv]*(int32)b[lcv];
return(accum);
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_conj(CPX *_A, int32 _cnt)
{
int32 lcv;
for(lcv = 0; lcv < _cnt; lcv++)
_A[lcv].q = -_A[lcv].q;
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_cmul(CPX *_A, CPX *_B, int32 _cnt)
{
int32 lcv;
int32 ai, aq;
int32 bi, bq;
int32 ti, tq;
for(lcv = 0; lcv < _cnt; lcv++)
{
ai = _A[lcv].i;
aq = _A[lcv].q;
bi = _B[lcv].i;
bq = _B[lcv].q;
ti = ai*bi-aq*bq;
tq = ai*bq+aq*bi;
_A[lcv].i = (int16)(ti);
_A[lcv].q = (int16)(tq);
}
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_cmuls(CPX *_A, CPX *_B, int32 _cnt, int32 _shift)
{
int32 lcv;
int32 ai, aq;
int32 bi, bq;
int32 ti, tq;
int32 shift;
int32 round;
shift = _shift;
round = 1 << (shift-1);
for(lcv = 0; lcv < _cnt; lcv++)
{
ai = _A[lcv].i;
aq = _A[lcv].q;
bi = _B[lcv].i;
bq = _B[lcv].q;
ti = ai*bi-aq*bq;
tq = ai*bq+aq*bi;
ti += round;
tq += round;
ti >>= shift;
tq >>= shift;
_A[lcv].i = (int16)ti;
_A[lcv].q = (int16)tq;
}
}
/*----------------------------------------------------------------------------------------------*/
void x86_cmulsc_complex(std::complex<float> *_A, std::complex<float> *_B, std::complex<float> *_C, int32 _cnt) {
for(int i = 0; i < _cnt; i++) {
_C[i] = _A[i] * _B[i];
}
}
/*----------------------------------------------------------------------------------------------*/
void x86_cmulsc(CPX *_A, CPX *_B, CPX *_C, int32 _cnt, int32 _shift)
{
int32 lcv;
int32 ai, aq;
int32 bi, bq;
int32 ti, tq;
int32 shift;
int32 round;
shift = _shift;
round = 1 << (shift-1);
for(lcv = 0; lcv < _cnt; lcv++)
{
ai = _A[lcv].i;
aq = _A[lcv].q;
bi = _B[lcv].i;
bq = _B[lcv].q;
ti = ai*bi-aq*bq;
tq = ai*bq+aq*bi;
ti += round;
tq += round;
ti >>= shift;
tq >>= shift;
_C[lcv].i = (int16)ti;
_C[lcv].q = (int16)tq;
}
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_cacc(CPX *_A, MIX *_B, int32 _cnt, int32 *_iaccum, int32 *_qaccum)
{
int32 lcv;
int32 ai, aq;
int32 ti, tq;
int32 iaccum;
int32 qaccum;
iaccum = qaccum = 0;
for(lcv = 0; lcv < _cnt; lcv++)
{
ai = _A[lcv].i;
aq = _A[lcv].q;
ti = ai*_B[lcv].i+aq*_B[lcv].nq;
tq = ai*_B[lcv].q+aq*_B[lcv].ni;
iaccum += ti;
qaccum += tq;
}
*_iaccum = iaccum;
*_qaccum = qaccum;
}
/*----------------------------------------------------------------------------------------------*/
// _A=|abs(·)|^2 overwrite the input array
void x86_gr_complex_mag(gr_complex* _A, int32 _cnt) {
float* p = (float*)_A;
for(int i=0;i<_cnt;i++) {
*p = _A[i].real()*_A[i].real() + _A[i].imag()*_A[i].imag();
p++;
}
}
/*----------------------------------------------------------------------------------------------*/
void x86_cmag(CPX *_A, int32 _cnt)
{
int32 lcv, *p;
p = (int32 *)_A;
for(lcv = 0; lcv < _cnt; lcv++)
{
*p = _A[lcv].i*_A[lcv].i + _A[lcv].q*_A[lcv].q;
p++;
}
}
/*----------------------------------------------------------------------------------------------*/
// Find the maximum float in _A[·]
void x86_float_max(float* _A, unsigned int* _index, float* _magt, unsigned int _cnt) {
unsigned int index;
float mag;
mag = index = 0;
for(unsigned int i=0; i<_cnt; i++) {
if(_A[i] > mag) {
index = i;
mag = _A[i];
}
}
*_index = index;
*_magt = mag;
}
/*----------------------------------------------------------------------------------------------*/
void x86_max(unsigned int *_A, unsigned int *_index, unsigned int *_magt, unsigned int _cnt)
{
unsigned int lcv, mag, index;
mag = index = 0;
for(lcv = 0; lcv < _cnt; lcv++)
{
if(_A[lcv] > mag)
{
index = lcv;
mag = _A[lcv];
}
}
*_index = index;
*_magt = mag;
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum) //!< This is a long story
{
CPX Ea, Pa, La;
int32 lcv;
Ea.i = 0;
Ea.q = 0;
Pa.i = 0;
Pa.q = 0;
La.i = 0;
La.q = 0;
for(lcv = 0; lcv < cnt; lcv++)
{
if(E[lcv].i < 0)
{
Ea.i -= A[lcv].i;
Ea.q -= A[lcv].q;
}
else
{
Ea.i += A[lcv].i;
Ea.q += A[lcv].q;
}
if(P[lcv].i < 0)
{
Pa.i -= A[lcv].i;
Pa.q -= A[lcv].q;
}
else
{
Pa.i += A[lcv].i;
Pa.q += A[lcv].q;
}
if(L[lcv].i < 0)
{
La.i -= A[lcv].i;
La.q -= A[lcv].q;
}
else
{
La.i += A[lcv].i;
La.q += A[lcv].q;
}
}
accum[0].i = Ea.i;
accum[0].q = Ea.q;
accum[1].i = Pa.i;
accum[1].q = Pa.q;
accum[2].i = La.i;
accum[2].q = La.q;
}
/*----------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/
void x86_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum)
{
CPX_ACCUM Ea, Pa, La;
int32 lcv;
Ea.i = 0; Ea.q = 0;
Pa.i = 0; Pa.q = 0;
La.i = 0; La.q = 0;
for(lcv = 0; lcv < cnt; lcv++)
{
Ea.i += A[lcv].i*E[lcv].i;
Ea.q += A[lcv].q*E[lcv].ni;
Pa.i += A[lcv].i*P[lcv].i;
Pa.q += A[lcv].q*P[lcv].ni;
La.i += A[lcv].i*L[lcv].i;
La.q += A[lcv].q*L[lcv].ni;
}
accum[0].i = Ea.i;
accum[0].q = Ea.q;
accum[1].i = Pa.i;
accum[1].q = Pa.q;
accum[2].i = La.i;
accum[2].q = La.q;
}
/*----------------------------------------------------------------------------------------------*/
//int32 x86_acc(int16 *_A, int32 _cnt)
//{
//
// int32 accum = 0;
// int16 *a = _A;
// int32 lcv;
//
// for(lcv = 0; lcv < _cnt; lcv++)
// accum += a[lcv];
//
// return(accum);
//}
//void x86_crot(CPX *_A, CPX *_B, int32 _cnt)
//{
//
// int32 lcv;
// int32 ai, aq;
// int32 bi, bq;
// int32 ti, tq;
//
// bi = _B->i;
// bq = _B->q;
//
// for(lcv = 0; lcv < _cnt; lcv++)
// {
//
// ai = _A[lcv].i;
// aq = _A[lcv].q;
//
// ti = ai*bi-aq*bq;
// tq = ai*bq+aq*bi;
//
// _A[lcv].i = (int16)ti;
// _A[lcv].q = (int16)tq;
// }
//}
//
//void x86_crot(CPX *_A, CPX *_B, int32 _shift, int32 _cnt)
//{
//
// int32 lcv;
// int32 ai, aq;
// int32 bi, bq;
// int32 ti, tq;
// int32 shift;
// int32 round;
//
// shift = _shift;
// round = 1 << (shift-1);
//
// bi = _B->i;
// bq = _B->q;
//
// for(lcv = 0; lcv < _cnt; lcv++)
// {
//
// ai = _A[lcv].i;
// aq = _A[lcv].q;
//
// ti = ai*bi-aq*bq;
// tq = ai*bq+aq*bi;
//
// ti += round;
// tq += round;
//
// ti >>= shift;
// tq >>= shift;
//
// _A[lcv].i = (int16)ti;
// _A[lcv].q = (int16)tq;
// }
//
//}

View File

@ -1,21 +0,0 @@
#include "gps_sdr_defines.h"
#include "gps_sdr_signal_processing.h"
#include "gr_complex.h"
void x86_add(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector addition
void x86_sub(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector difference
void x86_mul(int16 *A, int16 *B, int32 cnt); //!< Pointwise vector multiply
void x86_muls(int16 *A, int16 *B, int32 cnt, int32 shift); //!< Pointwise vector multiply
int32 x86_dot(int16 *A, int16 *B, int32 cnt); //!< Compute vector dot product
void x86_conj(CPX *A, int32 cnt); //!< Pointwise vector conjugate
void x86_cacc(CPX *A, MIX *B, int32 cnt, int32 *iaccum, int32 *baccum); //!< Compute dot product of cpx and a mix vector
void x86_cmul(CPX *A, CPX *B, int32 cnt); //!< Pointwise vector multiply
void x86_cmuls(CPX *A, CPX *B, int32 cnt, int32 shift); //!< Pointwise complex multiply with shift
void x86_cmulsc(CPX *A, CPX *B, CPX *C, int32 cnt, int32 shift); //!< Pointwise vector multiply with shift, dump results into C
void x86_cmag(CPX *A, int32 cnt); //!< Convert from complex to a power
void x86_prn_accum(CPX *A, CPX *E, CPX *P, CPX *L, int32 cnt, CPX *accum); //!< This is a long story
void x86_prn_accum_new(CPX *A, MIX *E, MIX *P, MIX *L, int32 cnt, CPX_ACCUM *accum); //!< This is a long story
void x86_max(unsigned int *_A, unsigned int *_index, unsigned int *_magt, unsigned int _cnt);
void x86_float_max(float* _A, unsigned int* _index, float* _magt, unsigned int _cnt);
void x86_gr_complex_mag(gr_complex* _A, int32 _cnt);

View File

@ -3,8 +3,8 @@ project : build-dir ../../../build ;
obj gps_sdr_signal_processing : gps_sdr_signal_processing.cc ;
obj gnss_sdr_valve : gnss_sdr_valve.cc ;
obj pass_through : pass_through.cc ;
obj gps_sdr_fft : gps_sdr_fft.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
obj gps_sdr_simd : gps_sdr_simd.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
obj gps_sdr_x86 : gps_sdr_x86.cc ;
#obj gps_sdr_fft : gps_sdr_fft.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
#obj gps_sdr_simd : gps_sdr_simd.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
#obj gps_sdr_x86 : gps_sdr_x86.cc ;

View File

@ -292,14 +292,14 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_code()
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
{
float phase, phase_step;
phase_step = (float)TWO_PI * d_carrier_doppler_hz / (float)d_fs_in;
phase_step = (float)GPS_TWO_PI * d_carrier_doppler_hz / (float)d_fs_in;
phase = d_rem_carr_phase;
for(int i = 0; i < d_current_prn_length_samples; i++)
{
d_carr_sign[i] = gr_complex(cos(phase), sin(phase));
phase += phase_step;
}
d_rem_carr_phase = fmod(phase, TWO_PI);
d_rem_carr_phase = fmod(phase, GPS_TWO_PI);
d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + phase;
}
@ -425,13 +425,13 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
}
else
{
d_FLL_discriminator_hz = fll_four_quadrant_atan(d_Prompt_prev, *d_Prompt, 0, correlation_time_s) / (float)TWO_PI;
d_FLL_discriminator_hz = fll_four_quadrant_atan(d_Prompt_prev, *d_Prompt, 0, correlation_time_s) / (float)GPS_TWO_PI;
d_Prompt_prev = *d_Prompt;
d_FLL_wait = 1;
}
// Compute PLL error
PLL_discriminator_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)TWO_PI;
PLL_discriminator_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GPS_TWO_PI;
/*
* \todo Update FLL assistance algorithm!

View File

@ -308,14 +308,14 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_carrier()
{
float phase_rad, phase_step_rad;
phase_step_rad = (float)TWO_PI*d_carrier_doppler_hz / (float)d_fs_in;
phase_step_rad = (float)GPS_TWO_PI*d_carrier_doppler_hz / (float)d_fs_in;
phase_rad = d_rem_carr_phase_rad;
for(int i = 0; i < d_current_prn_length_samples; i++)
{
d_carr_sign[i] = gr_complex(cos(phase_rad), sin(phase_rad));
phase_rad += phase_step_rad;
}
d_rem_carr_phase_rad = fmod(phase_rad, TWO_PI);
d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + d_rem_carr_phase_rad;
}
@ -436,7 +436,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
}
// Compute PLL error and update carrier NCO -
carr_error = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)TWO_PI;
carr_error = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GPS_TWO_PI;
// Implement carrier loop filter and generate NCO command
carr_nco = d_carrier_loop_filter.get_carrier_nco(carr_error);
// Modify carrier freq based on NCO command

View File

@ -39,6 +39,7 @@
const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s]
const double GPS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]
const double GPS_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E
const double GPS_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200E
const double OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s]
const double GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2]
const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)]

View File

@ -11,13 +11,10 @@ exe gnss-sdr : main.cc
../algorithms/channel/libs//gps_l1_ca_channel_fsm
../algorithms/conditioner/adapters//direct_resampler_conditioner
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_cc
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
../algorithms/libs//gps_sdr_signal_processing
../algorithms/libs//gnss_sdr_valve
../algorithms/libs//pass_through
../algorithms/libs//gps_sdr_fft
../algorithms/libs//gps_sdr_simd
../algorithms/libs//gps_sdr_x86
../algorithms/observables/adapters//gps_l1_ca_observables
../algorithms/observables/gnuradio_blocks//gps_l1_ca_observables_cc
../algorithms/PVT/libs//rinex_printer

View File

@ -12,13 +12,10 @@ exe run_tests : test_main.cc
../algorithms/channel/libs//gps_l1_ca_channel_fsm
../algorithms/conditioner/adapters//direct_resampler_conditioner
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_cc
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
../algorithms/libs//gps_sdr_signal_processing
../algorithms/libs//gnss_sdr_valve
../algorithms/libs//pass_through
../algorithms/libs//gps_sdr_fft
../algorithms/libs//gps_sdr_simd
../algorithms/libs//gps_sdr_x86
../algorithms/observables/adapters//gps_l1_ca_observables
../algorithms/observables/gnuradio_blocks//gps_l1_ca_observables_cc
../algorithms/PVT/libs//rinex_printer