commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 20/57: digital: correlate_access_code_tag d


From: git
Subject: [Commit-gnuradio] [gnuradio] 20/57: digital: correlate_access_code_tag d_mask was set improperly when access code len = 64.
Date: Wed, 21 May 2014 03:10:26 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit ba2951861b99f59df79022f98f51a12273fe2aa8
Author: Tom Rondeau <address@hidden>
Date:   Thu Mar 27 14:29:03 2014 -0700

    digital: correlate_access_code_tag d_mask was set improperly when access 
code len = 64.
---
 gr-digital/lib/correlate_access_code_bb_impl.cc       | 12 ++++++------
 gr-digital/lib/correlate_access_code_tag_bb_impl.cc   |  8 +++-----
 gr-digital/python/digital/qa_correlate_access_code.py | 14 +++++++-------
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/gr-digital/lib/correlate_access_code_bb_impl.cc 
b/gr-digital/lib/correlate_access_code_bb_impl.cc
index dea831d..532871a 100644
--- a/gr-digital/lib/correlate_access_code_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_bb_impl.cc
@@ -1,19 +1,19 @@
 /* -*- c++ -*- */
 /*
  * Copyright 2004,2006,2010-2012 Free Software Foundation, Inc.
- * 
+ *
  * This file is part of GNU Radio
- * 
+ *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3, or (at your option)
  * any later version.
- * 
+ *
  * GNU Radio is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with GNU Radio; see the file COPYING.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street,
@@ -97,7 +97,7 @@ namespace gr {
        t |= ((d_data_reg >> 63) & 0x1) << 0;
        t |= ((d_flag_reg >> 63) & 0x1) << 1;   // flag bit
        out[i] = t;
-    
+
        // compute hamming distance between desired access code and current data
        unsigned long long wrong_bits = 0;
        unsigned int nwrong = d_threshold+1;
@@ -128,6 +128,6 @@ namespace gr {
 
       return noutput_items;
     }
-  
+
   } /* namespace digital */
 } /* namespace gr */
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 f6574dd..31ae6d9 100644
--- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
@@ -27,7 +27,6 @@
 #include "correlate_access_code_tag_bb_impl.h"
 #include <gnuradio/io_signature.h>
 #include <stdexcept>
-//#include <gnuradio/blocks/count_bits.h>
 #include <volk/volk.h>
 #include <cstdio>
 #include <iostream>
@@ -78,8 +77,8 @@ namespace gr {
       if(d_len > 64)
         return false;
 
-      // set d_len bottom bits to 1.
-      d_mask = (1ULL << d_len) - 1;
+      // set len top bits to 1.
+      d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len);
 
       d_access_code = 0;
       for(unsigned i=0; i < d_len; i++){
@@ -113,7 +112,7 @@ namespace gr {
        wrong_bits  = (d_data_reg ^ d_access_code) & d_mask;
        volk_64u_popcnt(&nwrong, wrong_bits);
 
-       // shift in new data and new flag
+       // shift in new data
        d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
        if(nwrong <= d_threshold) {
          if(VERBOSE)
@@ -132,4 +131,3 @@ namespace gr {
 
   } /* namespace digital */
 } /* namespace gr */
-
diff --git a/gr-digital/python/digital/qa_correlate_access_code.py 
b/gr-digital/python/digital/qa_correlate_access_code.py
index 198a254..d89b457 100755
--- a/gr-digital/python/digital/qa_correlate_access_code.py
+++ b/gr-digital/python/digital/qa_correlate_access_code.py
@@ -1,24 +1,24 @@
 #!/usr/bin/env python
 #
 # Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc.
-# 
+#
 # This file is part of GNU Radio
-# 
+#
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3, or (at your option)
 # any later version.
-# 
+#
 # GNU Radio is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with GNU Radio; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 51 Franklin Street,
 # Boston, MA 02110-1301, USA.
-# 
+#
 
 from gnuradio import gr, gr_unittest, digital, blocks
 
@@ -74,7 +74,7 @@ class test_correlate_access_code(gr_unittest.TestCase):
         self.tb.run()
         result_data = dst.data()
         self.assertEqual(expected_result, result_data)
-        
+
     def test_003(self):
         code = tuple(string_to_1_0_list(default_access_code))
         access_code = to_1_0_string(code)
@@ -93,4 +93,4 @@ class test_correlate_access_code(gr_unittest.TestCase):
 
 if __name__ == '__main__':
     gr_unittest.run(test_correlate_access_code, 
"test_correlate_access_code.xml")
-        
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]