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