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