GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
gps_l5i_pcps_acquisition_fpga.h
Go to the documentation of this file.
1 /*!
2  * \file gps_l5i_pcps_acquisition_fpga.h
3  * \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
4  * GPS L5i signals for the FPGA
5  * \authors <ul>
6  * <li> Marc Majoral, 2019. mmajoral(at)cttc.es
7  * <li> Javier Arribas, 2019. jarribas(at)cttc.es
8  * </ul>
9  *
10  * -----------------------------------------------------------------------------
11  *
12  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
13  * This file is part of GNSS-SDR.
14  *
15  * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H
22 #define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H
23 
24 #include "acq_conf_fpga.h"
25 #include "channel_fsm.h"
26 #include "gnss_synchro.h"
27 #include "pcps_acquisition_fpga.h"
28 #include <volk_gnsssdr/volk_gnsssdr_alloc.h>
29 #include <memory>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 /** \addtogroup Acquisition
35  * \{ */
36 /** \addtogroup Acq_adapters
37  * \{ */
38 
39 
41 
42 /*!
43  * \brief This class adapts a PCPS acquisition block off-loaded on an FPGA
44  * to an AcquisitionInterface for GPS L5i signals
45  */
47 {
48 public:
49  /*!
50  * \brief Constructor
51  */
53  const ConfigurationInterface* configuration,
54  const std::string& role,
55  unsigned int in_streams,
56  unsigned int out_streams);
57 
58  /*!
59  * \brief Destructor
60  */
61  ~GpsL5iPcpsAcquisitionFpga() = default;
62 
63  /*!
64  * \brief Role
65  */
66  inline std::string role() override
67  {
68  return role_;
69  }
70 
71  /*!
72  * \brief Returns "GPS_L5i_PCPS_Acquisition_Fpga"
73  */
74  inline std::string implementation() override
75  {
76  return "GPS_L5i_PCPS_Acquisition_Fpga";
77  }
78 
79  /*!
80  * \brief Returns size of lv_16sc_t
81  */
82  inline size_t item_size() override
83  {
84  return sizeof(int16_t);
85  }
86 
87  /*!
88  * \brief Connect
89  */
90  void connect(gr::top_block_sptr top_block) override;
91 
92  /*!
93  * \brief Disconnect
94  */
95  void disconnect(gr::top_block_sptr top_block) override;
96 
97  /*!
98  * \brief Get left block
99  */
100  gr::basic_block_sptr get_left_block() override;
101 
102  /*!
103  * \brief Get right block
104  */
105  gr::basic_block_sptr get_right_block() override;
106 
107  /*!
108  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
109  * to efficiently exchange synchronization data between acquisition and
110  * tracking blocks
111  */
112  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
113 
114  /*!
115  * \brief Set acquisition channel unique ID
116  */
117  inline void set_channel(unsigned int channel) override
118  {
119  channel_ = channel;
120  acquisition_fpga_->set_channel(channel_);
121  }
122 
123  /*!
124  * \brief Set channel fsm associated to this acquisition instance
125  */
126  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
127  {
128  channel_fsm_ = std::move(channel_fsm);
129  acquisition_fpga_->set_channel_fsm(channel_fsm_);
130  }
131 
132  /*!
133  * \brief Set statistics threshold of PCPS algorithm
134  */
135  void set_threshold(float threshold) override;
136 
137  /*!
138  * \brief Set maximum Doppler off grid search
139  */
140  void set_doppler_max(unsigned int doppler_max) override;
141 
142  /*!
143  * \brief Set Doppler steps for the grid search
144  */
145  void set_doppler_step(unsigned int doppler_step) override;
146 
147  /*!
148  * \brief Set Doppler center for the grid search
149  */
150  void set_doppler_center(int doppler_center) override;
151 
152  /*!
153  * \brief Initializes acquisition algorithm.
154  */
155  void init() override;
156 
157  /*!
158  * \brief Sets local code for GPS L5 PCPS acquisition algorithm.
159  */
160  void set_local_code() override;
161 
162  /*!
163  * \brief Returns the maximum peak of grid search
164  */
165  signed int mag() override;
166 
167  /*!
168  * \brief Restart acquisition algorithm
169  */
170  void reset() override;
171 
172  /*!
173  * \brief If state = 1, it forces the block to start acquiring from the first sample
174  */
175  void set_state(int state) override;
176 
177  /*!
178  * \brief Stop running acquisition
179  */
180  void stop_acquisition() override;
181 
182  /*!
183  * \brief Set resampler latency
184  */
185  void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
186 
187 private:
188  static const uint32_t NUM_PRNs = 32;
189  static const uint32_t downsampling_factor_default = 1;
190  static const uint32_t fpga_buff_num = 1; // L5/E5a band
191  static const uint32_t fpga_blk_exp = 13; // default block exponent
192 
193  // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
194  // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
195  static const uint32_t quant_bits_local_code = 16;
196  static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word
197  static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word
198  static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
199  static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
200 
201  float calculate_threshold(float pfa);
202 
203  pcps_acquisition_fpga_sptr acquisition_fpga_;
204  std::weak_ptr<ChannelFsm> channel_fsm_;
205  volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
206  Gnss_Synchro* gnss_synchro_;
207  Acq_Conf_Fpga acq_parameters_;
208  std::string role_;
209  int64_t fs_in_;
210  int32_t doppler_center_;
211  uint32_t channel_;
212  uint32_t doppler_max_;
213  uint32_t doppler_step_;
214  unsigned int in_streams_;
215  unsigned int out_streams_;
216 };
217 
218 
219 /** \} */
220 /** \} */
221 #endif // GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
void set_doppler_step(unsigned int doppler_step) override
Set Doppler steps for the grid search.
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override
Set resampler latency.
void set_channel(unsigned int channel) override
Set acquisition channel unique ID.
~GpsL5iPcpsAcquisitionFpga()=default
Destructor.
GpsL5iPcpsAcquisitionFpga(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams)
Constructor.
void stop_acquisition() override
Stop running acquisition.
gr::basic_block_sptr get_right_block() override
Get right block.
std::string implementation() override
Returns "GPS_L5i_PCPS_Acquisition_Fpga".
Interface of the State Machine for channel.
void reset() override
Restart acquisition algorithm.
void set_doppler_max(unsigned int doppler_max) override
Set maximum Doppler off grid search.
signed int mag() override
Returns the maximum peak of grid search.
This abstract class represents an interface to an acquisition GNSS block.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
void set_doppler_center(int doppler_center) override
Set Doppler center for the grid search.
This abstract class represents an interface to configuration parameters.
std::string role() override
Role.
This class adapts a PCPS acquisition block off-loaded on an FPGA to an AcquisitionInterface for GPS L...
This class implements a Parallel Code Phase Search Acquisition for the FPGA.
void set_local_code() override
Sets local code for GPS L5 PCPS acquisition algorithm.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to efficiently exchange synchronization d...
void init() override
Initializes acquisition algorithm.
void disconnect(gr::top_block_sptr top_block) override
Disconnect.
void set_state(int state) override
If state = 1, it forces the block to start acquiring from the first sample.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
gr::basic_block_sptr get_left_block() override
Get left block.
void set_threshold(float threshold) override
Set statistics threshold of PCPS algorithm.
void connect(gr::top_block_sptr top_block) override
Connect.
size_t item_size() override
Returns size of lv_16sc_t.
Interface of the Gnss_Synchro class.