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