summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-18 13:13:48 -0400
committerTom Rondeau <trondeau@vt.edu>2013-03-18 13:13:48 -0400
commit0183e3ed10c551fefdbb0ed095d896cf01699a54 (patch)
tree788ff905a1299f948ed6908d7076a7caad17c5f1 /gnuradio-core/src/lib
parentd26514b07a5d15206687b636a2a0c51ad10684c1 (diff)
blocks: removing lfsr and friends from core; now in gr-blocks.
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt4
-rw-r--r--gnuradio-core/src/lib/general/general.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc169
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h103
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc70
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i31
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h60
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr_32k.h80
10 files changed, 0 insertions, 618 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index 334bfad248..d85039fe60 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -113,8 +113,6 @@ install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h
${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h
- ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h
- ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h
${CMAKE_CURRENT_SOURCE_DIR}/malloc16.h
${CMAKE_CURRENT_SOURCE_DIR}/random.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio
@@ -139,9 +137,7 @@ endif(ENABLE_PYTHON)
set(gr_core_general_triple_threats
complex_vec_test
gr_block_gateway
- gr_check_lfsr_32k_s
gr_feval
- gr_lfsr_32k_source_s
gr_prefs
gr_test
)
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 3a32e838ea..68b963702c 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -22,8 +22,6 @@
%{
-#include <gr_lfsr_32k_source_s.h>
-#include <gr_check_lfsr_32k_s.h>
#include <gr_prefs.h>
#include <gr_constants.h>
#include <gr_test_types.h>
@@ -33,8 +31,6 @@
#include <gr_endianness.h>
%}
-%include "gr_lfsr_32k_source_s.i"
-%include "gr_check_lfsr_32k_s.i"
%include "gr_prefs.i"
%include "gr_constants.i"
%include "gr_test_types.h"
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc
deleted file mode 100644
index 088b8c38ae..0000000000
--- a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_check_lfsr_32k_s.h>
-#include <gr_io_signature.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-gr_check_lfsr_32k_s_sptr
-gr_make_check_lfsr_32k_s ()
-{
- return gnuradio::get_initial_sptr(new gr_check_lfsr_32k_s ());
-}
-
-gr_check_lfsr_32k_s::gr_check_lfsr_32k_s ()
- : gr_sync_block ("gr_check_lfsr_32k",
- gr_make_io_signature (1, 1, sizeof (short)),
- gr_make_io_signature (0, 0, 0)),
- d_state(SEARCHING), d_history (0), d_ntotal (0), d_nright (0),
- d_runlength (0), d_index(0)
-{
- gri_lfsr_32k lfsr;
-
- for (int i = 0; i < BUFSIZE; i++)
- d_buffer[i] = lfsr.next_short ();
-
- enter_SEARCHING ();
-}
-
-int
-gr_check_lfsr_32k_s::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- unsigned short *in = (unsigned short *) input_items[0];
-
- for (int i = 0; i < noutput_items; i++){
- unsigned short x = in[i];
- unsigned short expected;
-
- switch (d_state){
-
- case MATCH0:
- if (x == d_buffer[0])
- enter_MATCH1 ();
- break;
-
- case MATCH1:
- if (x == d_buffer[1])
- enter_MATCH2 ();
- else
- enter_MATCH0 ();
- break;
-
- case MATCH2:
- if (x == d_buffer[2])
- enter_LOCKED ();
- else
- enter_MATCH0 ();
- break;
-
- case LOCKED:
- expected = d_buffer[d_index];
- d_index = d_index + 1;
- if (d_index >= BUFSIZE)
- d_index = 0;
-
- if (x == expected)
- right ();
- else {
- wrong ();
- log_error (expected, x);
- if (wrong_three_times ())
- enter_SEARCHING ();
- }
- break;
-
- default:
- abort ();
- }
-
- d_ntotal++;
- }
-
- return noutput_items;
-}
-
-void
-gr_check_lfsr_32k_s::enter_SEARCHING ()
-{
- d_state = SEARCHING;
- wrong (); // reset history
- wrong ();
- wrong ();
-
- d_runlength = 0;
- d_index = 0; // reset LFSR to beginning
-
- if (0)
- fprintf (stdout, "gr_check_lfsr_32k: enter_SEARCHING at offset %8ld (0x%08lx)\n",
- d_ntotal, d_ntotal);
-
- enter_MATCH0 ();
-}
-
-void
-gr_check_lfsr_32k_s::enter_MATCH0 ()
-{
- d_state = MATCH0;
-}
-
-void
-gr_check_lfsr_32k_s::enter_MATCH1 ()
-{
- d_state = MATCH1;
-}
-
-void
-gr_check_lfsr_32k_s::enter_MATCH2 ()
-{
- d_state = MATCH2;
-}
-
-void
-gr_check_lfsr_32k_s::enter_LOCKED ()
-{
- d_state = LOCKED;
- right (); // setup history
- right ();
- right ();
-
- d_index = 3; // already matched first 3 items
-
- if (0)
- fprintf (stdout, "gr_check_lfsr_32k: enter_LOCKED at offset %8ld (0x%08lx)\n",
- d_ntotal, d_ntotal);
-}
-
-void
-gr_check_lfsr_32k_s::log_error (unsigned short expected, unsigned short actual)
-{
- if (0)
- fprintf (stdout,
- "gr_check_lfsr_32k: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n",
- expected, expected, actual, actual, d_ntotal, d_ntotal);
-}
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h
deleted file mode 100644
index 2f980b427b..0000000000
--- a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-#ifndef INCLUDED_GR_CHECK_LFSR_32K_S_H
-#define INCLUDED_GR_CHECK_LFSR_32K_S_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-#include <gri_lfsr_32k.h>
-
-
-class gr_check_lfsr_32k_s;
-typedef boost::shared_ptr<gr_check_lfsr_32k_s> gr_check_lfsr_32k_s_sptr;
-
-GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
-
-/*!
- * \brief sink that checks if its input stream consists of a lfsr_32k sequence.
- * \ingroup sink_blk
- *
- * This sink is typically used along with gr_lfsr_32k_source_s to test
- * the USRP using its digital loopback mode.
- */
-class GR_CORE_API gr_check_lfsr_32k_s : public gr_sync_block
-{
- friend GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
-
- enum state {
- SEARCHING, // searching for synchronization
- MATCH0,
- MATCH1,
- MATCH2,
- LOCKED // is locked
- };
-
- state d_state;
- unsigned int d_history; // bitmask of decisions
-
- long d_ntotal; // total number of shorts
- long d_nright; // # of correct shorts
- long d_runlength; // # of correct shorts in a row
-
- static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
- int d_index;
- unsigned short d_buffer[BUFSIZE];
-
-
- gr_check_lfsr_32k_s ();
-
- void enter_SEARCHING ();
- void enter_MATCH0 ();
- void enter_MATCH1 ();
- void enter_MATCH2 ();
- void enter_LOCKED ();
-
- void right (){
- d_history = (d_history << 1) | 0x1;
- d_nright++;
- d_runlength++;
- }
-
- void wrong (){
- d_history = (d_history << 1) | 0x0;
- d_runlength = 0;
- }
-
- bool right_three_times () { return (d_history & 0x7) == 0x7; }
- bool wrong_three_times () { return (d_history & 0x7) == 0x0; }
-
- void log_error (unsigned short expected, unsigned short actual);
-
- public:
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- long ntotal () const { return d_ntotal; }
- long nright () const { return d_nright; }
- long runlength () const { return d_runlength; }
-
-};
-
-
-#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i
deleted file mode 100644
index 34d4a0b0c1..0000000000
--- a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,check_lfsr_32k_s)
-
-gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
-
-class gr_check_lfsr_32k_s : public gr_sync_block
-{
- private:
- gr_check_lfsr_32k_s ();
-
-public:
- long ntotal () const;
- long nright () const;
- long runlength () const;
-};
diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc
deleted file mode 100644
index c9a8742486..0000000000
--- a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <gr_lfsr_32k_source_s.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-
-
-gr_lfsr_32k_source_s_sptr
-gr_make_lfsr_32k_source_s ()
-{
- return gnuradio::get_initial_sptr(new gr_lfsr_32k_source_s ());
-}
-
-
-gr_lfsr_32k_source_s::gr_lfsr_32k_source_s ()
- : gr_sync_block ("lfsr_32k_source_s",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (1, 1, sizeof (short))),
- d_index (0)
-{
- gri_lfsr_32k lfsr;
-
- for (int i = 0; i < BUFSIZE; i++)
- d_buffer[i] = lfsr.next_short ();
-}
-
-int
-gr_lfsr_32k_source_s::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- short *out = (short *) output_items[0];
- short *buf = d_buffer;
- int index = d_index;
-
- for (int i = 0; i < noutput_items; i++){
- out[i] = buf[index];
- // index = (index + 1) & (BUFSIZE - 1);
- index = index + 1;
- if (index >= BUFSIZE)
- index = 0;
- }
-
- d_index = index;
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h
deleted file mode 100644
index db107652ad..0000000000
--- a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-
-#ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H
-#define INCLUDED_GR_LFSR_32K_SOURCE_S_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-#include <gri_lfsr_32k.h>
-
-class gr_lfsr_32k_source_s;
-typedef boost::shared_ptr<gr_lfsr_32k_source_s> gr_lfsr_32k_source_s_sptr;
-
-GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
-
-/*!
- * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts)
- * \ingroup source_blk
- *
- * This source is typically used along with gr_check_lfsr_32k_s to test
- * the USRP using its digital loopback mode.
- */
-class GR_CORE_API gr_lfsr_32k_source_s : public gr_sync_block
-{
- friend GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
-
-
- static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
- int d_index;
- short d_buffer[BUFSIZE];
-
- gr_lfsr_32k_source_s ();
-
- public:
-
- virtual int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i
deleted file mode 100644
index c2dc1c61b7..0000000000
--- a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,lfsr_32k_source_s);
-
-gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
-
-class gr_lfsr_32k_source_s : public gr_sync_block
-{
- private:
- gr_lfsr_32k_source_s ();
-};
diff --git a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h
deleted file mode 100644
index 578739f7ef..0000000000
--- a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-
-#ifndef INCLUDED_GRI_LFSR_15_1_0_H
-#define INCLUDED_GRI_LFSR_15_1_0_H
-
-#include <gr_core_api.h>
-
-/*!
- * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1
- * \ingroup misc
- *
- * Generates a maximal length pseudo-random sequence of length 2^15 - 1 bits.
- */
-
-class GR_CORE_API gri_lfsr_15_1_0 {
- unsigned long d_sr; // shift register
-
- public:
-
- gri_lfsr_15_1_0 () { reset (); }
-
- void reset () { d_sr = 0x7fff; }
-
- int next_bit (){
- d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1);
- return d_sr & 0x1;
- }
-
- int next_byte (){
- int v = 0;
- for (int i = 0; i < 8; i++){
- v >>= 1;
- if (next_bit ())
- v |= 0x80;
- }
- return v;
- }
-};
-
-#endif /* INCLUDED_GRI_LFSR_15_1_0_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_lfsr_32k.h b/gnuradio-core/src/lib/general/gri_lfsr_32k.h
deleted file mode 100644
index e84512b9a6..0000000000
--- a/gnuradio-core/src/lib/general/gri_lfsr_32k.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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.
- */
-
-#ifndef INCLUDED_GRI_LFSR_32k_H
-#define INCLUDED_GRI_LFSR_32k_H
-
-#include <gr_core_api.h>
-#include <gri_lfsr_15_1_0.h>
-
-/*!
- * \brief generate pseudo-random sequence of length 32768 bits.
- * \ingroup misc
- *
- * This is based on gri_lfsr_15_1_0 with an extra 0 added at the end
- * of the sequence.
- */
-
-class GR_CORE_API gri_lfsr_32k {
- gri_lfsr_15_1_0 d_lfsr;
- unsigned int d_count;
-
- public:
- gri_lfsr_32k () { reset (); }
-
- void reset (){
- d_lfsr.reset ();
- d_count = 0;
- }
-
- int next_bit (){
- if (d_count == 32767){
- d_count = 0;
- return 0;
- }
- d_count++;
- return d_lfsr.next_bit ();
- }
-
- int next_byte (){
- int v = 0;
- for (int i = 0; i < 8; i++){
- v >>= 1;
- if (next_bit ())
- v |= 0x80;
- }
- return v;
- }
-
- int next_short (){
- int v = 0;
- for (int i = 0; i < 16; i++){
- v >>= 1;
- if (next_bit ())
- v |= 0x8000;
- }
- return v;
- }
-
-};
-
-#endif /* INCLUDED_GRI_LFSR_32k_H */