mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
implemented 64-bit global sample counter
started programming the FPGA tracking unit tests
This commit is contained in:
parent
3b154c57c2
commit
b1524a3afe
@ -223,7 +223,7 @@ void pcps_acquisition_fpga::set_active(bool active)
|
||||
// no CFAR algorithm in the FPGA
|
||||
<< ", use_CFAR_algorithm_flag: false";
|
||||
|
||||
unsigned int initial_sample;
|
||||
unsigned long int initial_sample;
|
||||
float input_power_all = 0.0;
|
||||
float input_power_computed = 0.0;
|
||||
|
||||
@ -328,7 +328,7 @@ void pcps_acquisition_fpga::set_active(bool active)
|
||||
printf("##### d_test_statistics = %f\n", d_test_statistics);
|
||||
printf("##### debug_d_max_absolute =%f\n",debug_d_max_absolute);
|
||||
printf("##### debug_d_input_power_absolute =%f\n",debug_d_input_power_absolute);
|
||||
printf("##### initial_sample = %d\n",initial_sample);
|
||||
printf("##### initial_sample = %lu\n",initial_sample);
|
||||
printf("##### debug_doppler_index = %d\n",debug_doppler_index);
|
||||
send_positive_acquisition();
|
||||
d_state = 0; // Positive acquisition
|
||||
|
@ -369,13 +369,20 @@ void fpga_acquisition::set_phase_step(unsigned int doppler_index)
|
||||
|
||||
|
||||
void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
|
||||
float *max_magnitude, unsigned *initial_sample, float *power_sum, unsigned *doppler_index)
|
||||
float *max_magnitude, unsigned long int *initial_sample, float *power_sum, unsigned *doppler_index)
|
||||
{
|
||||
unsigned long int initial_sample_tmp;
|
||||
|
||||
unsigned readval = 0;
|
||||
unsigned long int readval_long = 0;
|
||||
readval = d_map_base[1];
|
||||
*initial_sample = readval;
|
||||
initial_sample_tmp = readval;
|
||||
//*initial_sample = readval;
|
||||
//printf("read initial sample dmap 1 = %d\n", readval);
|
||||
readval = d_map_base[2];
|
||||
readval_long = d_map_base[2];
|
||||
initial_sample_tmp = initial_sample_tmp + (readval_long * (2^32));
|
||||
*initial_sample = initial_sample_tmp;
|
||||
readval = d_map_base[6];
|
||||
*max_magnitude = static_cast<float>(readval);
|
||||
//printf("read max_magnitude dmap 2 = %d\n", readval);
|
||||
readval = d_map_base[4];
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void run_acquisition(void);
|
||||
void set_phase_step(unsigned int doppler_index);
|
||||
void read_acquisition_results(uint32_t *max_index, float *max_magnitude,
|
||||
unsigned *initial_sample, float *power_sum, unsigned *doppler_index);
|
||||
unsigned long int *initial_sample, float *power_sum, unsigned *doppler_index);
|
||||
void block_samples();
|
||||
void unblock_samples();
|
||||
|
||||
|
@ -1251,14 +1251,14 @@ int dll_pll_veml_tracking_fpga::general_work (int noutput_items __attribute__((u
|
||||
{
|
||||
d_pull_in = 0;
|
||||
multicorrelator_fpga->lock_channel();
|
||||
unsigned counter_value = multicorrelator_fpga->read_sample_counter();
|
||||
unsigned long int counter_value = multicorrelator_fpga->read_sample_counter();
|
||||
//printf("333333 counter_value = %d\n", counter_value);
|
||||
//printf("333333 current_synchro_data.Acq_samplestamp_samples = %d\n", current_synchro_data.Acq_samplestamp_samples);
|
||||
//printf("333333 current_synchro_data.Acq_delay_samples = %f\n", current_synchro_data.Acq_delay_samples);
|
||||
//printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples);
|
||||
unsigned num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples)/d_correlation_length_samples);
|
||||
//printf("333333 num_frames = %d\n", num_frames);
|
||||
unsigned absolute_samples_offset = current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames*d_correlation_length_samples;
|
||||
unsigned long int absolute_samples_offset = current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames*d_correlation_length_samples;
|
||||
//printf("333333 absolute_samples_offset = %d\n", absolute_samples_offset);
|
||||
multicorrelator_fpga->set_initial_sample(absolute_samples_offset);
|
||||
d_absolute_samples_offset = absolute_samples_offset;
|
||||
|
@ -84,16 +84,22 @@
|
||||
#define LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY 0x0C000000
|
||||
#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA
|
||||
|
||||
int fpga_multicorrelator_8sc::read_sample_counter()
|
||||
unsigned long int fpga_multicorrelator_8sc::read_sample_counter()
|
||||
{
|
||||
return d_map_base[d_SAMPLE_COUNTER_REG_ADDR];
|
||||
unsigned long int sample_counter_tmp, sample_counter_msw_tmp;
|
||||
sample_counter_tmp = d_map_base[d_SAMPLE_COUNTER_REG_ADDR_LSW];
|
||||
sample_counter_msw_tmp = d_map_base[d_SAMPLE_COUNTER_REG_ADDR_MSW];
|
||||
sample_counter_tmp = sample_counter_tmp + (sample_counter_msw_tmp * (2^32));
|
||||
//return d_map_base[d_SAMPLE_COUNTER_REG_ADDR];
|
||||
return sample_counter_tmp;
|
||||
}
|
||||
|
||||
void fpga_multicorrelator_8sc::set_initial_sample(int samples_offset)
|
||||
void fpga_multicorrelator_8sc::set_initial_sample(unsigned long int samples_offset)
|
||||
{
|
||||
d_initial_sample_counter = samples_offset;
|
||||
//printf("www writing d map base %d = d_initial_sample_counter = %d\n", d_INITIAL_COUNTER_VALUE_REG_ADDR, d_initial_sample_counter);
|
||||
d_map_base[d_INITIAL_COUNTER_VALUE_REG_ADDR] = d_initial_sample_counter;
|
||||
d_map_base[d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW] = (d_initial_sample_counter & 0xFFFFFFFF);
|
||||
d_map_base[d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW] = (d_initial_sample_counter >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
//void fpga_multicorrelator_8sc::set_local_code_and_taps(int code_length_chips,
|
||||
@ -228,7 +234,8 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
|
||||
d_PHASE_STEP_RAD_REG_ADDR = 16;
|
||||
d_PROG_MEMS_ADDR = 17;
|
||||
d_DROP_SAMPLES_REG_ADDR = 18;
|
||||
d_INITIAL_COUNTER_VALUE_REG_ADDR = 19;
|
||||
d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW = 19;
|
||||
d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW = 20;
|
||||
d_START_FLAG_ADDR = 30;
|
||||
// }
|
||||
|
||||
@ -247,16 +254,16 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
|
||||
// }
|
||||
|
||||
// result 2's complement saturation value
|
||||
if (d_multicorr_type == 0)
|
||||
{
|
||||
// multicorrelator with 3 correlators (16 registers only)
|
||||
d_result_SAT_value = 1048576; // 21 bits 2's complement -> 2^20
|
||||
}
|
||||
else
|
||||
{
|
||||
// other types of multicorrelators (32 registers)
|
||||
d_result_SAT_value = 4194304; // 23 bits 2's complement -> 2^22
|
||||
}
|
||||
// if (d_multicorr_type == 0)
|
||||
// {
|
||||
// // multicorrelator with 3 correlators (16 registers only)
|
||||
// d_result_SAT_value = 1048576; // 21 bits 2's complement -> 2^20
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // other types of multicorrelators (32 registers)
|
||||
// d_result_SAT_value = 4194304; // 23 bits 2's complement -> 2^22
|
||||
// }
|
||||
|
||||
// read only registers
|
||||
d_RESULT_REG_REAL_BASE_ADDR = 1;
|
||||
@ -275,7 +282,8 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
|
||||
d_RESULT_REG_IMAG_BASE_ADDR = 7;
|
||||
d_RESULT_REG_DATA_REAL_BASE_ADDR = 6; // no pilot tracking
|
||||
d_RESULT_REG_DATA_IMAG_BASE_ADDR = 12;
|
||||
d_SAMPLE_COUNTER_REG_ADDR = 13;
|
||||
d_SAMPLE_COUNTER_REG_ADDR_LSW = 13;
|
||||
d_SAMPLE_COUNTER_REG_ADDR_MSW = 14;
|
||||
|
||||
// }
|
||||
|
||||
|
@ -68,8 +68,8 @@ public:
|
||||
float rem_code_phase_chips, float code_phase_step_chips,
|
||||
int signal_length_samples);bool free();
|
||||
void set_channel(unsigned int channel);
|
||||
void set_initial_sample(int samples_offset);
|
||||
int read_sample_counter();
|
||||
void set_initial_sample(unsigned long int samples_offset);
|
||||
unsigned long int read_sample_counter();
|
||||
void lock_channel(void);
|
||||
void unlock_channel(void);
|
||||
//void read_sample_counters(int *sample_counter, int *secondary_sample_counter, int *counter_corr_0_in, int *counter_corr_0_out); // debug
|
||||
@ -103,7 +103,7 @@ private:
|
||||
unsigned d_code_phase_step_chips_num;
|
||||
int d_rem_carr_phase_rad_int;
|
||||
int d_phase_step_rad_int;
|
||||
unsigned d_initial_sample_counter;
|
||||
unsigned long int d_initial_sample_counter;
|
||||
|
||||
// driver
|
||||
std::string d_device_name;
|
||||
@ -131,7 +131,8 @@ private:
|
||||
unsigned int d_PHASE_STEP_RAD_REG_ADDR;
|
||||
unsigned int d_PROG_MEMS_ADDR;
|
||||
unsigned int d_DROP_SAMPLES_REG_ADDR;
|
||||
unsigned int d_INITIAL_COUNTER_VALUE_REG_ADDR;
|
||||
unsigned int d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW;
|
||||
unsigned int d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW;
|
||||
unsigned int d_START_FLAG_ADDR;
|
||||
// read-write regs
|
||||
unsigned int d_TEST_REG_ADDR;
|
||||
@ -140,7 +141,8 @@ private:
|
||||
unsigned int d_RESULT_REG_IMAG_BASE_ADDR;
|
||||
unsigned int d_RESULT_REG_DATA_REAL_BASE_ADDR;
|
||||
unsigned int d_RESULT_REG_DATA_IMAG_BASE_ADDR;
|
||||
unsigned int d_SAMPLE_COUNTER_REG_ADDR;
|
||||
unsigned int d_SAMPLE_COUNTER_REG_ADDR_LSW;
|
||||
unsigned int d_SAMPLE_COUNTER_REG_ADDR_MSW;
|
||||
|
||||
// private functions
|
||||
unsigned fpga_acquisition_test_register(unsigned writeval);
|
||||
|
@ -149,6 +149,9 @@ DECLARE_string(log_dir);
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc"
|
||||
#if ENABLE_FPGA
|
||||
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc"
|
||||
#endif
|
||||
#include "unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc"
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user