1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-14 13:54:57 +00:00

Make zero padding optional in acquisition when using the FPGA

This commit is contained in:
Marc Majoral 2024-10-10 11:42:19 +02:00
parent ef4bf2cf4f
commit 601b2ee6f2
No known key found for this signature in database
GPG Key ID: 4CC7BE8C367C596C
8 changed files with 39 additions and 41 deletions

View File

@ -81,7 +81,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
int32_t tmp2;
int32_t local_code;
int32_t fft_data;
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
{
bool cboc = false; // cboc is set to 0 when using the FPGA
@ -100,16 +99,14 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
cboc, PRN, fs_in_, 0, false);
}
for (uint32_t s = code_length; s < 2 * code_length; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = code[s - code_length];
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
// fill in zero padding
for (uint32_t s = 2 * code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(0.0, 0.0);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code

View File

@ -107,16 +107,14 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0);
for (uint32_t s = code_length; s < 2 * code_length; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = code[s - code_length];
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
// fill in zero padding
for (uint32_t s = 2 * code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(0.0, 0.0);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code

View File

@ -106,16 +106,14 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0);
for (uint32_t s = code_length; s < 2 * code_length; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = code[s - code_length];
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
// fill in zero padding
for (uint32_t s = 2 * code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(0.0, 0.0);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code

View File

@ -87,16 +87,14 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
{
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in_, 0); // generate PRN code
for (uint32_t s = code_length; s < 2 * code_length; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = code[s - code_length];
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
// fill in zero padding
for (uint32_t s = 2 * code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(0.0, 0.0);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code

View File

@ -87,11 +87,16 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
{
gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_);
// fill in zero padding
for (unsigned int s = code_length; s < nsamples_total; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = std::complex<float>(0.0, 0.0);
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values

View File

@ -88,16 +88,15 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
{
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in_);
for (uint32_t s = code_length; s < 2 * code_length; s++)
if (acq_parameters_.enable_zero_padding)
{
code[s] = code[s - code_length];
// Duplicate the code sequence
std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length);
}
for (uint32_t s = 2 * code_length; s < nsamples_total; s++)
{
// fill in zero padding
code[s] = std::complex<float>(0.0, 0.0);
}
// Fill in zero padding for the rest
std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex<float>(0.0, 0.0));
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values

View File

@ -46,9 +46,11 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura
// code length in samples
code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (chip_rate / code_length_chips)));
enable_zero_padding = configuration->property(role + ".enable_zero_padding", true);
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
samples_per_code = pow(2, nbits);
float factor = enable_zero_padding ? 2.0F : 1.0F;
samples_per_code = pow(2, ceilf(log2f(static_cast<float>(code_length) * factor)));
// repeat satellite
repeat_satellite = configuration->property(role + ".repeat_satellite", false);

View File

@ -57,6 +57,7 @@ public:
uint32_t samples_per_code{1U};
uint32_t code_length{16000U};
bool make_2_steps{false};
bool enable_zero_padding{true};
bool repeat_satellite{false};
private: