mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into newsatdispatcher
This commit is contained in:
commit
61d320fb05
@ -32,17 +32,20 @@
|
||||
|
||||
#include "beidou_b1i_signal_processing.h"
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
|
||||
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||
|
||||
void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
|
||||
{
|
||||
const uint32_t _code_length = 2046;
|
||||
std::array<bool, _code_length> G1{};
|
||||
std::array<bool, _code_length> G2{};
|
||||
std::bitset<_code_length> G1{};
|
||||
std::bitset<_code_length> G2{};
|
||||
|
||||
std::bitset<11> G1_register(std::string("01010101010"));
|
||||
std::bitset<11> G2_register(std::string("01010101010"));
|
||||
|
||||
std::array<bool, 11> G1_register{false, true, false, true, false, true, false, true, false, true, false};
|
||||
std::array<bool, 11> G2_register{false, true, false, true, false, true, false, true, false, true, false};
|
||||
bool feedback1, feedback2;
|
||||
bool aux;
|
||||
uint32_t lcv, lcv2;
|
||||
|
@ -32,85 +32,90 @@
|
||||
|
||||
#include "beidou_b3i_signal_processing.h"
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
|
||||
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
||||
|
||||
void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int _chip_shift)
|
||||
{
|
||||
const unsigned int _code_length = 10230;
|
||||
std::array<bool, _code_length> G1{};
|
||||
std::array<bool, _code_length> G2{};
|
||||
std::array<bool, 13> G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
|
||||
std::array<bool, 13> G2_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
|
||||
std::array<bool, 13> G1_register_reset = {{false, false, true, true, true, true, true, true, true, true, true, true, true}};
|
||||
std::bitset<_code_length> G1{};
|
||||
std::bitset<_code_length> G2{};
|
||||
auto G1_register = std::move(std::bitset<13>{}.set()); // All true
|
||||
auto G2_register = std::move(std::bitset<13>{}.set()); // All true
|
||||
auto G1_register_reset = std::move(std::bitset<13>{}.set());
|
||||
G1_register_reset.reset(0);
|
||||
G1_register_reset.reset(1); // {false, false, true, true, true, true, true, true, true, true, true, true, true};
|
||||
|
||||
bool feedback1, feedback2, aux;
|
||||
uint32_t lcv, lcv2, delay;
|
||||
int32_t prn_idx = _prn - 1;
|
||||
|
||||
std::array<std::array<bool, 13>, 63> G2_register_shifted =
|
||||
{{{{true, false, true, false, true, true, true, true, true, true, true, true, true}},
|
||||
{{true, true, true, true, false, false, false, true, false, true, false, true, true}},
|
||||
{{true, false, true, true, true, true, false, false, false, true, false, true, false}},
|
||||
{{true, true, true, true, true, true, true, true, true, true, false, true, true}},
|
||||
{{true, true, false, false, true, false, false, false, true, true, true, true, true}},
|
||||
{{true, false, false, true, false, false, true, true, false, false, true, false, false}},
|
||||
{{true, true, true, true, true, true, true, false, true, false, false, true, false}},
|
||||
{{true, true, true, false, true, true, true, true, true, true, true, false, true}},
|
||||
{{true, false, true, false, false, false, false, false, false, false, false, true, false}},
|
||||
{{false, false, true, false, false, false, false, false, true, true, false, true, true}},
|
||||
{{true, true, true, false, true, false, true, true, true, false, false, false, false}},
|
||||
{{false, false, true, false, true, true, false, false, true, true, true, true, false}},
|
||||
{{false, true, true, false, false, true, false, false, true, false, true, false, true}},
|
||||
{{false, true, true, true, false, false, false, true, false, false, true, true, false}},
|
||||
{{true, false, false, false, true, true, false, false, false, true, false, false, true}},
|
||||
{{true, true, true, false, false, false, true, true, true, true, true, false, false}},
|
||||
{{false, false, true, false, false, true, true, false, false, false, true, false, true}},
|
||||
{{false, false, false, false, false, true, true, true, false, true, true, false, false}},
|
||||
{{true, false, false, false, true, false, true, false, true, false, true, true, true}},
|
||||
{{false, false, false, true, false, true, true, false, true, true, true, true, false}},
|
||||
{{false, false, true, false, false, false, false, true, false, true, true, false, true}},
|
||||
{{false, false, true, false, true, true, false, false, false, true, false, true, false}},
|
||||
{{false, false, false, true, false, true, true, false, false, true, true, true, true}},
|
||||
{{false, false, true, true, false, false, true, true, false, false, false, true, false}},
|
||||
{{false, false, true, true, true, false, true, false, false, true, false, false, false}},
|
||||
{{false, true, false, false, true, false, false, true, false, true, false, false, true}},
|
||||
{{true, false, true, true, false, true, true, false, true, false, false, true, true}},
|
||||
{{true, false, true, false, true, true, true, true, false, false, false, true, false}},
|
||||
{{false, false, false, true, false, true, true, true, true, false, true, false, true}},
|
||||
{{false, true, true, true, true, true, true, true, true, true, true, true, true}},
|
||||
{{false, true, true, false, true, true, false, false, false, true, true, true, true}},
|
||||
{{true, false, true, false, true, true, false, false, false, true, false, false, true}},
|
||||
{{true, false, false, true, false, true, false, true, false, true, false, true, true}},
|
||||
{{true, true, false, false, true, true, false, true, false, false, true, false, true}},
|
||||
{{true, true, false, true, false, false, true, false, true, true, true, false, true}},
|
||||
{{true, true, true, true, true, false, true, true, true, false, true, false, false}},
|
||||
{{false, false, true, false, true, false, true, true, false, false, true, true, true}},
|
||||
{{true, true, true, false, true, false, false, false, true, false, false, false, false}},
|
||||
{{true, true, false, true, true, true, false, false, true, false, false, false, false}},
|
||||
{{true, true, false, true, false, true, true, false, false, true, true, true, false}},
|
||||
{{true, false, false, false, false, false, false, true, true, false, true, false, false}},
|
||||
{{false, true, false, true, true, true, true, false, true, true, false, false, true}},
|
||||
{{false, true, true, false, true, true, false, true, true, true, true, false, false}},
|
||||
{{true, true, false, true, false, false, true, true, true, false, false, false, true}},
|
||||
{{false, false, true, true, true, false, false, true, false, false, false, true, false}},
|
||||
{{false, true, false, true, false, true, true, false, false, false, true, false, true}},
|
||||
{{true, false, false, true, true, true, true, true, false, false, true, true, false}},
|
||||
{{true, true, true, true, true, false, true, false, false, true, false, false, false}},
|
||||
{{false, false, false, false, true, false, true, false, false, true, false, false, true}},
|
||||
{{true, false, false, false, false, true, false, true, false, true, true, false, false}},
|
||||
{{true, true, true, true, false, false, true, false, false, true, true, false, false}},
|
||||
{{false, true, false, false, true, true, false, false, false, true, true, true, true}},
|
||||
{{false, false, false, false, false, false, false, false, true, true, false, false, false}},
|
||||
{{true, false, false, false, false, false, false, false, false, false, true, false, false}},
|
||||
{{false, false, true, true, false, true, false, true, false, false, true, true, false}},
|
||||
{{true, false, true, true, false, false, true, false, false, false, true, true, false}},
|
||||
{{false, true, true, true, false, false, true, true, true, true, false, false, false}},
|
||||
{{false, false, true, false, true, true, true, false, false, true, false, true, false}},
|
||||
{{true, true, false, false, true, true, true, true, true, false, true, true, false}},
|
||||
{{true, false, false, true, false, false, true, false, false, false, true, false, true}},
|
||||
{{false, true, true, true, false, false, false, true, false, false, false, false, false}},
|
||||
{{false, false, true, true, false, false, true, false, false, false, false, true, false}},
|
||||
{{false, false, true, false, false, false, true, false, false, true, true, true, false}}}};
|
||||
const std::array<std::bitset<13>, 63> G2_register_shifted =
|
||||
{std::bitset<13>(std::string("1010111111111")),
|
||||
std::bitset<13>(std::string("1111000101011")),
|
||||
std::bitset<13>(std::string("1011110001010")),
|
||||
std::bitset<13>(std::string("1111111111011")),
|
||||
std::bitset<13>(std::string("1100100011111")),
|
||||
std::bitset<13>(std::string("1001001100100")),
|
||||
std::bitset<13>(std::string("1111111010010")),
|
||||
std::bitset<13>(std::string("1110111111101")),
|
||||
std::bitset<13>(std::string("1010000000010")),
|
||||
std::bitset<13>(std::string("0010000011011")),
|
||||
std::bitset<13>(std::string("1110101110000")),
|
||||
std::bitset<13>(std::string("0010110011110")),
|
||||
std::bitset<13>(std::string("0110010010101")),
|
||||
std::bitset<13>(std::string("0111000100110")),
|
||||
std::bitset<13>(std::string("1000110001001")),
|
||||
std::bitset<13>(std::string("1110001111100")),
|
||||
std::bitset<13>(std::string("0010011000101")),
|
||||
std::bitset<13>(std::string("0000011101100")),
|
||||
std::bitset<13>(std::string("1000101010111")),
|
||||
std::bitset<13>(std::string("0001011011110")),
|
||||
std::bitset<13>(std::string("0010000101101")),
|
||||
std::bitset<13>(std::string("0010110001010")),
|
||||
std::bitset<13>(std::string("0001011001111")),
|
||||
std::bitset<13>(std::string("0011001100010")),
|
||||
std::bitset<13>(std::string("0011101001000")),
|
||||
std::bitset<13>(std::string("0100100101001")),
|
||||
std::bitset<13>(std::string("1011011010011")),
|
||||
std::bitset<13>(std::string("1010111100010")),
|
||||
std::bitset<13>(std::string("0001011110101")),
|
||||
std::bitset<13>(std::string("0111111111111")),
|
||||
std::bitset<13>(std::string("0110110001111")),
|
||||
std::bitset<13>(std::string("1010110001001")),
|
||||
std::bitset<13>(std::string("1001010101011")),
|
||||
std::bitset<13>(std::string("1100110100101")),
|
||||
std::bitset<13>(std::string("1101001011101")),
|
||||
std::bitset<13>(std::string("1111101110100")),
|
||||
std::bitset<13>(std::string("0010101100111")),
|
||||
std::bitset<13>(std::string("1110100010000")),
|
||||
std::bitset<13>(std::string("1101110010000")),
|
||||
std::bitset<13>(std::string("1101011001110")),
|
||||
std::bitset<13>(std::string("1000000110100")),
|
||||
std::bitset<13>(std::string("0101111011001")),
|
||||
std::bitset<13>(std::string("0110110111100")),
|
||||
std::bitset<13>(std::string("1101001110001")),
|
||||
std::bitset<13>(std::string("0011100100010")),
|
||||
std::bitset<13>(std::string("0101011000101")),
|
||||
std::bitset<13>(std::string("1001111100110")),
|
||||
std::bitset<13>(std::string("1111101001000")),
|
||||
std::bitset<13>(std::string("0000101001001")),
|
||||
std::bitset<13>(std::string("1000010101100")),
|
||||
std::bitset<13>(std::string("1111001001100")),
|
||||
std::bitset<13>(std::string("0100110001111")),
|
||||
std::bitset<13>(std::string("0000000011000")),
|
||||
std::bitset<13>(std::string("1000000000100")),
|
||||
std::bitset<13>(std::string("0011010100110")),
|
||||
std::bitset<13>(std::string("1011001000110")),
|
||||
std::bitset<13>(std::string("0111001111000")),
|
||||
std::bitset<13>(std::string("0010111001010")),
|
||||
std::bitset<13>(std::string("1100111110110")),
|
||||
std::bitset<13>(std::string("1001001000101")),
|
||||
std::bitset<13>(std::string("0111000100000")),
|
||||
std::bitset<13>(std::string("0011001000010")),
|
||||
std::bitset<13>(std::string("0010001001110"))};
|
||||
|
||||
// A simple error check
|
||||
if ((prn_idx < 0) || (prn_idx > 63))
|
||||
@ -120,7 +125,6 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
|
||||
|
||||
// Assign shifted G2 register based on prn number
|
||||
G2_register = G2_register_shifted[prn_idx];
|
||||
std::reverse(G2_register.begin(), G2_register.end());
|
||||
|
||||
// Generate G1 and G2 Register
|
||||
for (lcv = 0; lcv < _code_length; lcv++)
|
||||
@ -128,7 +132,6 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
|
||||
G1[lcv] = G1_register[0];
|
||||
G2[lcv] = G2_register[0];
|
||||
|
||||
//feedback1 = (test_G1_register[0]+test_G1_register[2]+test_G1_register[3]+test_G1_register[12]) & 0x1;
|
||||
feedback1 = G1_register[0] xor G1_register[9] xor G1_register[10] xor G1_register[12];
|
||||
feedback2 = G2_register[0] xor G2_register[1] xor G2_register[3] xor G2_register[4] xor
|
||||
G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[12];
|
||||
@ -145,7 +148,7 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
|
||||
// Reset G1 register if sequence found
|
||||
if (G1_register == G1_register_reset)
|
||||
{
|
||||
G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}};
|
||||
G1_register = std::move(std::bitset<13>{}.set()); // All true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,16 +32,17 @@
|
||||
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
|
||||
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||
|
||||
void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
|
||||
{
|
||||
const uint32_t _code_length = 1023;
|
||||
std::array<bool, _code_length> G1{};
|
||||
std::array<bool, _code_length> G2{};
|
||||
std::array<bool, 10> G1_register{};
|
||||
std::array<bool, 10> G2_register{};
|
||||
std::bitset<_code_length> G1{};
|
||||
std::bitset<_code_length> G2{};
|
||||
std::bitset<10> G1_register{};
|
||||
std::bitset<10> G2_register{};
|
||||
bool feedback1, feedback2;
|
||||
bool aux;
|
||||
uint32_t lcv, lcv2;
|
||||
|
@ -181,7 +181,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
||||
|
||||
// vars for Viterbi decoder
|
||||
int32_t max_states = 1 << mm; // 2^mm
|
||||
int32_t max_states = 1U << static_cast<uint32_t>(mm); // 2^mm
|
||||
g_encoder[0] = 121; // Polynomial G1
|
||||
g_encoder[1] = 91; // Polynomial G2
|
||||
out0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||
|
@ -145,18 +145,18 @@ bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword)
|
||||
// up bits which are to be XOR'ed together to implement the GPS parity
|
||||
// check algorithm described in IS-GPS-200E. This avoids lengthy shift-
|
||||
// and-xor loops.
|
||||
d1 = gpsword & 0xFBFFBF00;
|
||||
d2 = _rotl(gpsword, 1) & 0x07FFBF01;
|
||||
d3 = _rotl(gpsword, 2) & 0xFC0F8100;
|
||||
d4 = _rotl(gpsword, 3) & 0xF81FFE02;
|
||||
d5 = _rotl(gpsword, 4) & 0xFC00000E;
|
||||
d6 = _rotl(gpsword, 5) & 0x07F00001;
|
||||
d7 = _rotl(gpsword, 6) & 0x00003000;
|
||||
d1 = gpsword & 0xFBFFBF00U;
|
||||
d2 = _rotl(gpsword, 1U) & 0x07FFBF01U;
|
||||
d3 = _rotl(gpsword, 2U) & 0xFC0F8100U;
|
||||
d4 = _rotl(gpsword, 3U) & 0xF81FFE02U;
|
||||
d5 = _rotl(gpsword, 4U) & 0xFC00000EU;
|
||||
d6 = _rotl(gpsword, 5U) & 0x07F00001U;
|
||||
d7 = _rotl(gpsword, 6U) & 0x00003000U;
|
||||
t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
|
||||
// Now XOR the 5 6-bit fields together to produce the 6-bit final result.
|
||||
parity = t ^ _rotl(t, 6) ^ _rotl(t, 12) ^ _rotl(t, 18) ^ _rotl(t, 24);
|
||||
parity = parity & 0x3F;
|
||||
if (parity == (gpsword & 0x3F))
|
||||
parity = t ^ _rotl(t, 6U) ^ _rotl(t, 12U) ^ _rotl(t, 18U) ^ _rotl(t, 24U);
|
||||
parity = parity & 0x3FU;
|
||||
if (parity == (gpsword & 0x3FU))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -230,19 +230,19 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
// Bits 0 to 29 = the GPS data word
|
||||
// Bits 30 to 31 = 2 LSBs of the GPS word ahead.
|
||||
// prepare the extended frame [-2 -1 0 ... 30]
|
||||
if (d_prev_GPS_frame_4bytes & 0x00000001)
|
||||
if (d_prev_GPS_frame_4bytes & 0x00000001U)
|
||||
{
|
||||
GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000;
|
||||
GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000U;
|
||||
}
|
||||
if (d_prev_GPS_frame_4bytes & 0x00000002)
|
||||
if (d_prev_GPS_frame_4bytes & 0x00000002U)
|
||||
{
|
||||
GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000;
|
||||
GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000U;
|
||||
}
|
||||
// Check that the 2 most recently logged words pass parity. Have to first
|
||||
// invert the data bits according to bit 30 of the previous word.
|
||||
if (GPS_frame_4bytes & 0x40000000)
|
||||
if (GPS_frame_4bytes & 0x40000000U)
|
||||
{
|
||||
GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR)
|
||||
GPS_frame_4bytes ^= 0x3FFFFFC0U; // invert the data bits (using XOR)
|
||||
}
|
||||
// check parity. If ANY word inside the subframe fails the parity, set subframe_synchro_confirmation = false
|
||||
if (not gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(GPS_frame_4bytes))
|
||||
@ -258,7 +258,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
}
|
||||
else
|
||||
{
|
||||
GPS_frame_4bytes <<= 1; // shift 1 bit left the telemetry word
|
||||
GPS_frame_4bytes <<= 1U; // shift 1 bit left the telemetry word
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user