gr_make_io_signature (1, 1, sizeof(char)),
gr_make_io_signature (1, 1, sizeof(char))),
d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0),
gr_make_io_signature (1, 1, sizeof(char)),
gr_make_io_signature (1, 1, sizeof(char))),
d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0),
- d_threshold(threshold), d_flip(0)
{
if (!set_access_code(access_code)){
{
if (!set_access_code(access_code)){
// compute output value
unsigned int t = 0;
// compute output value
unsigned int t = 0;
- t |= d_flip ^ (((d_data_reg >> 63) & 0x1) << 0);
+ t |= ((d_data_reg >> 63) & 0x1) << 0;
t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit
out[i] = t;
t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit
out[i] = t;
wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
nwrong = gr_count_bits64(wrong_bits);
wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
nwrong = gr_count_bits64(wrong_bits);
- // test for access code with up to threshold errors or its compelement
- new_flag = (nwrong <= d_threshold) || (nwrong >= (64-d_threshold));
+ // test for access code with up to threshold errors
+ new_flag = (nwrong <= d_threshold);
d_flag_reg = (d_flag_reg << 1);
if (new_flag) {
d_flag_reg |= d_flag_bit;
d_flag_reg = (d_flag_reg << 1);
if (new_flag) {
d_flag_reg |= d_flag_bit;
- d_flip = nwrong >= (64-d_threshold); // flip bits if this is true
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
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
- unsigned int d_flip; // flip bits if 180 degress out of sync
-
protected:
gr_correlate_access_code_bb(const std::string &access_code, int threshold);
protected:
gr_correlate_access_code_bb(const std::string &access_code, int threshold);