mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
optimized the process of computing and writing the fft of the local code to the acquisition HW accelerator.
The writing of the local code is still performed by processor instructions in a loop. THe FPGA L2 classes were updated accordingly.
This commit is contained in:
parent
905a85670c
commit
2b46c79ba7
@ -46,6 +46,10 @@
|
||||
|
||||
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
#define SELECT_LSBits 0x0000FFFF // Select the 10 LSbits out of a 20-bit word
|
||||
#define SELECT_MSBbits 0xFFFF0000 // Select the 10 MSbits out of a 20-bit word
|
||||
#define SELECT_ALL_CODE_BITS 0xFFFFFFFF // Select a 20 bit word
|
||||
#define SHL_CODE_BITS 65536 // shift left by 10 bits
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
ConfigurationInterface* configuration,
|
||||
@ -106,8 +110,10 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * GALILEO_E1_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * GALILEO_E1_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E1_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
|
||||
{
|
||||
@ -155,10 +161,18 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
max = std::abs(fft_codes_padded[i].imag());
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// and package codes in a format that is ready to be written to the FPGA
|
||||
for (uint32_t i = 0; i < nsamples_total; i++)
|
||||
{
|
||||
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data;
|
||||
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,8 @@ private:
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ */
|
||||
|
@ -45,6 +45,10 @@
|
||||
#include <cstring> // for strcpy, memcpy
|
||||
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
#define SELECT_LSBits 0x0000FFFF // Select the 10 LSbits out of a 20-bit word
|
||||
#define SELECT_MSBbits 0xFFFF0000 // Select the 10 MSbits out of a 20-bit word
|
||||
#define SELECT_ALL_CODE_BITS 0xFFFFFFFF // Select a 20 bit word
|
||||
#define SHL_CODE_BITS 65536 // shift left by 10 bits
|
||||
|
||||
GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
@ -106,8 +110,11 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * GALILEO_E5A_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * GALILEO_E5A_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++)
|
||||
{
|
||||
@ -155,13 +162,18 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
max = std::abs(fft_codes_padded[i].imag());
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// and package codes in a format that is ready to be written to the FPGA
|
||||
for (uint32_t i = 0; i < nsamples_total; i++)
|
||||
{
|
||||
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data;
|
||||
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(256 * floor(fft_codes_padded[i].real() * (pow(2, 7 - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(256 * floor(fft_codes_padded[i].imag() * (pow(2, 7 - 1) - 1) / max)));
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,8 @@ private:
|
||||
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
|
||||
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H_ */
|
||||
|
@ -47,10 +47,12 @@
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for memcpy
|
||||
|
||||
|
||||
#define NUM_PRNs 32
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
|
||||
#define SELECT_LSBits 0x0000FFFF // Select the 10 LSbits out of a 20-bit word
|
||||
#define SELECT_MSBbits 0xFFFF0000 // Select the 10 MSbits out of a 20-bit word
|
||||
#define SELECT_ALL_CODE_BITS 0xFFFFFFFF // Select a 20 bit word
|
||||
#define SHL_CODE_BITS 65536 // shift left by 10 bits
|
||||
|
||||
GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
ConfigurationInterface* configuration,
|
||||
@ -102,8 +104,11 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max; // temporary maxima search
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max;
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
// temporary maxima search
|
||||
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
|
||||
@ -135,10 +140,18 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
max = std::abs(fft_codes_padded[i].imag());
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// and package codes in a format that is ready to be written to the FPGA
|
||||
for (uint32_t i = 0; i < nsamples_total; i++)
|
||||
{
|
||||
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data;
|
||||
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
||||
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
||||
|
||||
|
||||
#include "channel_fsm.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
@ -165,7 +166,8 @@ private:
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */
|
||||
|
@ -47,7 +47,11 @@
|
||||
#include <cstring> // for memcpy
|
||||
|
||||
#define NUM_PRNs 32
|
||||
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
#define SELECT_LSBits 0x0000FFFF // Select the 10 LSbits out of a 20-bit word
|
||||
#define SELECT_MSBbits 0xFFFF0000 // Select the 10 MSbits out of a 20-bit word
|
||||
#define SELECT_ALL_CODE_BITS 0xFFFFFFFF // Select a 20 bit word
|
||||
#define SHL_CODE_BITS 65536 // shift left by 10 bits
|
||||
|
||||
GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
ConfigurationInterface* configuration,
|
||||
@ -102,8 +106,11 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_);
|
||||
@ -127,10 +134,18 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
max = std::abs(fft_codes_padded[i].imag());
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// and package codes in a format that is ready to be written to the FPGA
|
||||
for (uint32_t i = 0; i < nsamples_total; i++)
|
||||
{
|
||||
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int>(floor(fft_codes_padded[i].real() * (pow(2, 7) - 1) / max)),
|
||||
static_cast<int>(floor(fft_codes_padded[i].imag() * (pow(2, 7) - 1) / max)));
|
||||
tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data;
|
||||
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,8 @@ private:
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
|
||||
//float calculate_threshold(float pfa);
|
||||
};
|
||||
|
@ -49,6 +49,10 @@
|
||||
|
||||
#define NUM_PRNs 32
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
#define SELECT_LSBits 0x0000FFFF // Select the 10 LSbits out of a 20-bit word
|
||||
#define SELECT_MSBbits 0xFFFF0000 // Select the 10 MSbits out of a 20-bit word
|
||||
#define SELECT_ALL_CODE_BITS 0xFFFFFFFF // Select a 20 bit word
|
||||
#define SHL_CODE_BITS 65536 // shift left by 10 bits
|
||||
|
||||
|
||||
GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
@ -104,9 +108,12 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new gr_complex[nsamples_total];
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in);
|
||||
@ -137,13 +144,18 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
max = std::abs(fft_codes_padded[i].imag());
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||
// and package codes in a format that is ready to be written to the FPGA
|
||||
for (uint32_t i = 0; i < nsamples_total; i++)
|
||||
{
|
||||
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max));
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data;
|
||||
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(128 * floor(fft_codes_padded[i].real() * (pow(2, 7 - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(128 * floor(fft_codes_padded[i].imag() * (pow(2, 7 - 1) - 1) / max)));
|
||||
// d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)),
|
||||
// static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,8 @@ private:
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
@ -62,7 +62,8 @@ typedef struct
|
||||
int32_t code_length;
|
||||
uint32_t select_queue_Fpga;
|
||||
std::string device_name;
|
||||
lv_16sc_t* all_fft_codes; // memory that contains all the code ffts
|
||||
//lv_16sc_t* all_fft_codes; // memory that contains all the code ffts
|
||||
uint32_t* all_fft_codes;
|
||||
//float downsampling_factor;
|
||||
uint32_t downsampling_factor;
|
||||
uint32_t total_block_exp;
|
||||
|
@ -86,7 +86,8 @@ Fpga_Acquisition::Fpga_Acquisition(std::string device_name,
|
||||
int64_t fs_in,
|
||||
uint32_t sampled_ms __attribute__((unused)),
|
||||
uint32_t select_queue,
|
||||
lv_16sc_t *all_fft_codes,
|
||||
//lv_16sc_t *all_fft_codes,
|
||||
uint32_t *all_fft_codes,
|
||||
uint32_t excludelimit)
|
||||
{
|
||||
uint32_t vector_length = nsamples_total;
|
||||
@ -139,12 +140,13 @@ void Fpga_Acquisition::write_local_code()
|
||||
// write local code
|
||||
for (k = 0; k < d_vector_length; k++)
|
||||
{
|
||||
tmp = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k].real();
|
||||
tmp2 = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k].imag();
|
||||
|
||||
local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
d_map_base[6] = fft_data;
|
||||
// tmp = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k].real();
|
||||
// tmp2 = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k].imag();
|
||||
//
|
||||
// local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part
|
||||
// fft_data = local_code & SELECT_ALL_CODE_BITS;
|
||||
// d_map_base[6] = fft_data;
|
||||
d_map_base[6] = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
int64_t fs_in,
|
||||
uint32_t sampled_ms,
|
||||
uint32_t select_queue,
|
||||
lv_16sc_t *all_fft_codes,
|
||||
//lv_16sc_t *all_fft_codes,
|
||||
uint32_t *all_fft_codes,
|
||||
uint32_t excludelimit);
|
||||
|
||||
~Fpga_Acquisition();
|
||||
@ -110,7 +111,8 @@ private:
|
||||
// data related to the hardware module and the driver
|
||||
int32_t d_fd; // driver descriptor
|
||||
volatile uint32_t *d_map_base; // driver memory map
|
||||
lv_16sc_t *d_all_fft_codes; // memory that contains all the code ffts
|
||||
//lv_16sc_t *d_all_fft_codes; // memory that contains all the code ffts
|
||||
uint32_t *d_all_fft_codes; // memory that contains all the code ffts
|
||||
uint32_t d_vector_length; // number of samples incluing padding and number of ms
|
||||
uint32_t d_excludelimit;
|
||||
uint32_t d_nsamples_total; // number of samples including padding
|
||||
|
Loading…
Reference in New Issue
Block a user