commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4606 - in gnuradio/branches/developers/jcorgan/glfsr/


From: jcorgan
Subject: [Commit-gnuradio] r4606 - in gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src: lib/general lib/gengen python/gnuradio/gr
Date: Fri, 23 Feb 2007 01:05:13 -0700 (MST)

Author: jcorgan
Date: 2007-02-23 01:05:12 -0700 (Fri, 23 Feb 2007)
New Revision: 4606

Added:
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
Modified:
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/Makefile.am
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/general.i
   
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/gengen/Makefile.gen
Log:
Work in progress.

Modified: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/Makefile.am
        2007-02-23 05:58:50 UTC (rev 4605)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/Makefile.am
        2007-02-23 08:05:12 UTC (rev 4606)
@@ -1,5 +1,5 @@
 #
-# Copyright 2001,2002,2004,2006 Free Software Foundation, Inc.
+# Copyright 2001,2002,2004,2006,2007 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -76,6 +76,7 @@
        gr_frequency_modulator_fc.cc    \
        gr_fxpt.cc                      \
        gr_framer_sink_1.cc             \
+       gr_glfsr_source_b.cc            \
        gr_head.cc                      \
        gr_interleave.cc                \
        gr_interleaved_short_to_complex.cc \
@@ -196,6 +197,7 @@
        gr_fxpt.h                       \
        gr_fxpt_nco.h                   \
        gr_fxpt_vco.h                   \
+       gr_glfsr_source_b.h             \
        gr_head.h                       \
        gr_interleave.h                 \
        gr_interleaved_short_to_complex.h \
@@ -323,6 +325,7 @@
        gr_float_to_uchar.i             \
        gr_frequency_modulator_fc.i     \
        gr_framer_sink_1.i              \
+       gr_glfsr_source_b.i             \
        gr_head.i                       \
        gr_interleave.i                 \
        gr_interleaved_short_to_complex.i \

Modified: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/general.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/general.i
  2007-02-23 05:58:50 UTC (rev 4605)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/general.i
  2007-02-23 08:05:12 UTC (rev 4606)
@@ -109,6 +109,7 @@
 #include <gr_ctcss_squelch_ff.h>
 #include <gr_feedforward_agc_cc.h>
 #include <gr_bin_statistics_f.h>
+#include <gr_glfsr_source_b.h>
 %}
 
 %include "gr_nop.i"
@@ -198,3 +199,4 @@
 %include "gr_ctcss_squelch_ff.i"
 %include "gr_feedforward_agc_cc.i"
 %include "gr_bin_statistics_f.i"
+%include "gr_glfsr_source_b.i"

Added: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
                               (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
       2007-02-23 08:05:12 UTC (rev 4606)
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_glfsr_source_b.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_glfsr_source_b_sptr 
+gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed)
+{
+  return gr_glfsr_source_b_sptr(new gr_glfsr_source_b(degree, repeat, mask, 
seed));
+}
+
+gr_glfsr_source_b::gr_glfsr_source_b(int degree, bool repeat, int mask, int 
seed)
+  : gr_sync_block ("glfsr_source_b",
+                  gr_make_io_signature (0, 0, 0),
+                  gr_make_io_signature (1, 1, sizeof(unsigned char))),
+    d_degree(degree),
+    d_repeat(repeat),
+    d_mask(mask),
+    d_shift_register(seed),
+    d_index(0)
+{
+  if (degree < 1 || degree > 31)
+    throw std::out_of_range("gr_glfsr_source_b: degree must be between 1 and 
31 inclusive");
+  d_length = (int)(1ULL << degree)-1;
+}
+
+gr_glfsr_source_b::~gr_glfsr_source_b()
+{
+  /* NOP */
+}
+
+int
+gr_glfsr_source_b::work(int noutput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items)
+{
+  char *out = (char *) output_items[0];
+  if ((d_index > d_length) && d_repeat == false)
+    return -1; /* once through the sequence */
+
+  int i;
+  for (i = 0; i < noutput_items; i++) {
+    out[i] = 0; /* (char)d_glfsr.next_bit(); */
+    d_index++;
+    if (d_index > d_length && d_repeat == false)
+      break;
+  }
+
+  return i;
+}


Property changes on: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
                                (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
        2007-02-23 08:05:12 UTC (rev 4606)
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_GLFSR_SOURCE_B_H
+#define INCLUDED_GR_GLFSR_SOURCE_B_H
+
+#include <gr_sync_block.h>
+
+class gr_glfsr_source_b;
+typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr;
+
+gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, 
int mask=0, int seed=1);
+
+/*!
+ * \brief Galois LFSR pseudo-random source
+ * \ingroup source
+ */
+class gr_glfsr_source_b : public gr_sync_block 
+{
+ private:
+  friend gr_glfsr_source_b_sptr
+  gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+  
+  int d_degree;
+  bool d_repeat;
+  int d_mask;
+  int d_shift_register;
+  unsigned int d_index;
+  unsigned int d_length;
+  
+  gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+ public:
+
+  ~gr_glfsr_source_b();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */


Property changes on: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
                                (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
        2007-02-23 08:05:12 UTC (rev 4606)
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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,glfsr_source_b);
+
+gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, 
int mask=0, int seed=1);
+
+class gr_glfsr_source_b : public gr_sync_block 
+{
+ protected:
+  gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+};


Property changes on: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/gengen/Makefile.gen
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/gengen/Makefile.gen
        2007-02-23 05:58:50 UTC (rev 4605)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/lib/gengen/Makefile.gen
        2007-02-23 08:05:12 UTC (rev 4606)
@@ -1,3 +1,6 @@
+#
+# This file is machine generated.  All edits will be overwritten
+#
 GENERATED_H = \
        gr_add_cc.h \
        gr_add_const_cc.h \

Added: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
===================================================================
--- 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
                                (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
        2007-02-23 08:05:12 UTC (rev 4606)
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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
+
+class test_glfsr_source_b(gr_unittest.TestCase):
+
+    def setUp (self):
+        self.fg = gr.flow_graph ()
+
+    def tearDown (self):
+        self.fg = None
+
+    def test_glfsr_source_b(self):
+        src = gr.glfsr_source_b(5, False)
+        expected_result = (0,)*31
+        dst = gr.vector_sink_b()
+        self.fg.connect(src, dst)
+        self.fg.run()
+        dst_data = dst.data()
+        self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+    gr_unittest.main ()


Property changes on: 
gnuradio/branches/developers/jcorgan/glfsr/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

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