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