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