diff options
Diffstat (limited to 'gr-digital/lib')
8 files changed, 30 insertions, 8 deletions
diff --git a/gr-digital/lib/correlate_access_code_bb_ts_impl.cc b/gr-digital/lib/correlate_access_code_bb_ts_impl.cc index 0312defe11..c9a8f6e390 100644 --- a/gr-digital/lib/correlate_access_code_bb_ts_impl.cc +++ b/gr-digital/lib/correlate_access_code_bb_ts_impl.cc @@ -90,6 +90,7 @@ unsigned long long correlate_access_code_bb_ts_impl::access_code() const inline void correlate_access_code_bb_ts_impl::enter_search() { d_state = STATE_SYNC_SEARCH; + d_data_reg_bits = 0; } inline void correlate_access_code_bb_ts_impl::enter_have_sync() @@ -137,8 +138,12 @@ int correlate_access_code_bb_ts_impl::general_work(int noutput_items, while (count < noutput_items) { // shift in new data d_data_reg = (d_data_reg << 1) | ((in[count++]) & 0x1); - - // compute hamming distance between desired access code and current data + if (d_data_reg_bits + 1 < d_len) { + d_data_reg_bits++; + continue; + } + // compute hamming distance between desired access code and current + // data uint64_t wrong_bits = 0; uint64_t nwrong = d_threshold + 1; diff --git a/gr-digital/lib/correlate_access_code_bb_ts_impl.h b/gr-digital/lib/correlate_access_code_bb_ts_impl.h index d4024703cd..bae61249f5 100644 --- a/gr-digital/lib/correlate_access_code_bb_ts_impl.h +++ b/gr-digital/lib/correlate_access_code_bb_ts_impl.h @@ -26,6 +26,7 @@ private: unsigned long long d_access_code; // access code to locate start of packet // access code is left justified in the word unsigned long long d_data_reg; // used to look for access_code + unsigned int d_data_reg_bits = 0; // used to makes sure we've seen the whole code unsigned long long d_mask; // masks access_code bits (top N bits are set where // N is the number of bits in the access code) unsigned int d_threshold; // how many bits may be wrong in sync vector diff --git a/gr-digital/lib/correlate_access_code_ff_ts_impl.cc b/gr-digital/lib/correlate_access_code_ff_ts_impl.cc index a78b924caa..1a0548cc9b 100644 --- a/gr-digital/lib/correlate_access_code_ff_ts_impl.cc +++ b/gr-digital/lib/correlate_access_code_ff_ts_impl.cc @@ -90,6 +90,7 @@ unsigned long long correlate_access_code_ff_ts_impl::access_code() const inline void correlate_access_code_ff_ts_impl::enter_search() { d_state = STATE_SYNC_SEARCH; + d_data_reg_bits = 0; } inline void correlate_access_code_ff_ts_impl::enter_have_sync() @@ -138,8 +139,12 @@ int correlate_access_code_ff_ts_impl::general_work(int noutput_items, // shift in new data d_data_reg = (d_data_reg << 1) | (gr::branchless_binary_slicer(in[count++]) & 0x1); - - // compute hamming distance between desired access code and current data + if (d_data_reg_bits + 1 < d_len) { + d_data_reg_bits++; + continue; + } + // compute hamming distance between desired access code and current + // data uint64_t wrong_bits = 0; uint64_t nwrong = d_threshold + 1; diff --git a/gr-digital/lib/correlate_access_code_ff_ts_impl.h b/gr-digital/lib/correlate_access_code_ff_ts_impl.h index ab2af2067a..b0b24de639 100644 --- a/gr-digital/lib/correlate_access_code_ff_ts_impl.h +++ b/gr-digital/lib/correlate_access_code_ff_ts_impl.h @@ -26,6 +26,7 @@ private: unsigned long long d_access_code; // access code to locate start of packet // access code is left justified in the word unsigned long long d_data_reg; // used to look for access_code + unsigned int d_data_reg_bits = 0; // used to makes sure we've seen the whole code unsigned long long d_mask; // masks access_code bits (top N bits are set where // N is the number of bits in the access code) unsigned int d_threshold; // how many bits may be wrong in sync vector diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc index 8794edbae1..82c93854a0 100644 --- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc +++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc @@ -94,8 +94,12 @@ int correlate_access_code_tag_bb_impl::work(int noutput_items, uint64_t wrong_bits = 0; uint64_t nwrong = d_threshold + 1; - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - volk_64u_popcnt(&nwrong, wrong_bits); + if (d_data_reg_bits < d_len) { + d_data_reg_bits++; + } else { + wrong_bits = (d_data_reg ^ d_access_code) & d_mask; + volk_64u_popcnt(&nwrong, wrong_bits); + } // shift in new data d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.h b/gr-digital/lib/correlate_access_code_tag_bb_impl.h index ae92a84645..904b383419 100644 --- a/gr-digital/lib/correlate_access_code_tag_bb_impl.h +++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.h @@ -22,6 +22,7 @@ private: unsigned long long d_access_code; // access code to locate start of packet // access code is left justified in the word unsigned long long d_data_reg; // used to look for access_code + unsigned int d_data_reg_bits = 0; // used to makes sure we've seen the whole code unsigned long long d_mask; // masks access_code bits (top N bits are set where // N is the number of bits in the access code) unsigned int d_threshold; // how many bits may be wrong in sync vector diff --git a/gr-digital/lib/correlate_access_code_tag_ff_impl.cc b/gr-digital/lib/correlate_access_code_tag_ff_impl.cc index ee41af6724..67d051978a 100644 --- a/gr-digital/lib/correlate_access_code_tag_ff_impl.cc +++ b/gr-digital/lib/correlate_access_code_tag_ff_impl.cc @@ -95,8 +95,12 @@ int correlate_access_code_tag_ff_impl::work(int noutput_items, uint64_t wrong_bits = 0; uint64_t nwrong = d_threshold + 1; - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - volk_64u_popcnt(&nwrong, wrong_bits); + if (d_data_reg_bits < d_len) { + d_data_reg_bits++; + } else { + wrong_bits = (d_data_reg ^ d_access_code) & d_mask; + volk_64u_popcnt(&nwrong, wrong_bits); + } // shift in new data d_data_reg = (d_data_reg << 1) | (gr::branchless_binary_slicer(in[i]) & 0x1); diff --git a/gr-digital/lib/correlate_access_code_tag_ff_impl.h b/gr-digital/lib/correlate_access_code_tag_ff_impl.h index 793e6a123f..536cef6340 100644 --- a/gr-digital/lib/correlate_access_code_tag_ff_impl.h +++ b/gr-digital/lib/correlate_access_code_tag_ff_impl.h @@ -22,6 +22,7 @@ private: unsigned long long d_access_code; // access code to locate start of packet // access code is left justified in the word unsigned long long d_data_reg; // used to look for access_code + unsigned int d_data_reg_bits = 0; // used to makes sure we've seen the whole code unsigned long long d_mask; // masks access_code bits (top N bits are set where // N is the number of bits in the access code) unsigned int d_threshold; // how many bits may be wrong in sync vector |