summaryrefslogtreecommitdiff
path: root/gr-trellis/src/lib
diff options
context:
space:
mode:
authorAchilleas Anastasopoulos2011-02-17 23:16:01 -0500
committerAchilleas Anastasopoulos2011-02-17 23:16:01 -0500
commit2ed9e3bc58dacd41dff201d8365f7bd04fc56462 (patch)
tree1f4eace2d90786a78544ca14b0832d265d0bc8f6 /gr-trellis/src/lib
parent5a23954a11aa028a20baa905d7bbb29fe62803f6 (diff)
downloadgnuradio-2ed9e3bc58dacd41dff201d8365f7bd04fc56462.tar.gz
gnuradio-2ed9e3bc58dacd41dff201d8365f7bd04fc56462.tar.bz2
gnuradio-2ed9e3bc58dacd41dff201d8365f7bd04fc56462.zip
inital commit of turbo stuff:
added sccc encoder block + minor fixes
Diffstat (limited to 'gr-trellis/src/lib')
-rw-r--r--gr-trellis/src/lib/.gitignore18
-rw-r--r--gr-trellis/src/lib/Makefile.am3
-rw-r--r--gr-trellis/src/lib/generate_trellis.py2
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t90
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t83
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t50
6 files changed, 246 insertions, 0 deletions
diff --git a/gr-trellis/src/lib/.gitignore b/gr-trellis/src/lib/.gitignore
index 8932c3611..54d09fbb1 100644
--- a/gr-trellis/src/lib/.gitignore
+++ b/gr-trellis/src/lib/.gitignore
@@ -57,6 +57,24 @@
/trellis_viterbi_i.cc
/trellis_encoder_bb.h
/trellis_encoder_bb.i
+/trellis_sccc_encoder_bb.cc
+/trellis_sccc_encoder_bb.h
+/trellis_sccc_encoder_bb.i
+/trellis_sccc_encoder_bi.cc
+/trellis_sccc_encoder_bi.h
+/trellis_sccc_encoder_bi.i
+/trellis_sccc_encoder_bs.cc
+/trellis_sccc_encoder_bs.h
+/trellis_sccc_encoder_bs.i
+/trellis_sccc_encoder_ii.cc
+/trellis_sccc_encoder_ii.h
+/trellis_sccc_encoder_ii.i
+/trellis_sccc_encoder_si.cc
+/trellis_sccc_encoder_si.h
+/trellis_sccc_encoder_si.i
+/trellis_sccc_encoder_ss.cc
+/trellis_sccc_encoder_ss.h
+/trellis_sccc_encoder_ss.i
/trellis_metrics_s.cc
/trellis_viterbi_combined_fs.h
/trellis_viterbi_combined_fs.i
diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am
index 3e1803554..8ec4edba6 100644
--- a/gr-trellis/src/lib/Makefile.am
+++ b/gr-trellis/src/lib/Makefile.am
@@ -32,6 +32,9 @@ core_generator = \
trellis_encoder_XX.cc.t \
trellis_encoder_XX.h.t \
trellis_encoder_XX.i.t \
+ trellis_sccc_encoder_XX.cc.t \
+ trellis_sccc_encoder_XX.h.t \
+ trellis_sccc_encoder_XX.i.t \
trellis_metrics_X.cc.t \
trellis_metrics_X.h.t \
trellis_metrics_X.i.t \
diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py
index a4206d268..fd180391f 100644
--- a/gr-trellis/src/lib/generate_trellis.py
+++ b/gr-trellis/src/lib/generate_trellis.py
@@ -28,6 +28,7 @@ import re
other_roots = [
'trellis_encoder_XX',
+ 'trellis_sccc_encoder_XX',
'trellis_metrics_X',
'trellis_viterbi_X',
'trellis_viterbi_combined_XX',
@@ -35,6 +36,7 @@ other_roots = [
other_signatures = (
['bb','bs','bi','ss','si','ii'],
+ ['bb','bs','bi','ss','si','ii'],
['s','i','f','c'],
['b','s','i'],
['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'],
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
new file mode 100644
index 000000000..f94b176cd
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
@@ -0,0 +1,90 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+@SPTR_NAME@
+trellis_make_@BASE_NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (FSMo,STo,FSMi,STi,INTERLEAVER,blocklength));
+}
+
+@NAME@::@NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_FSMo (FSMo),
+ d_STo (STo),
+ d_FSMi (FSMi),
+ d_STi (STi),
+ d_INTERLEAVER (INTERLEAVER),
+ d_blocklength (blocklength)
+{
+ set_output_multiple(d_blocklength);
+ d_buffer.resize(d_blocklength);
+}
+
+
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ assert(noutput_items%d_blocklength ==0);
+ for (int b = 0 ; b<noutput_items/d_blocklength; b++) {
+ const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]+b*d_blocklength;
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]+b*d_blocklength;
+
+ int STo_tmp = d_STo;
+ for (int i = 0; i < d_blocklength; i++){
+ d_buffer[i] = d_FSMo.OS()[STo_tmp*d_FSMo.I()+in[i]];
+ STo_tmp = (int) d_FSMo.NS()[STo_tmp*d_FSMo.I()+in[i]];
+ }
+ int STi_tmp = d_STi;
+ for (int i = 0; i < d_blocklength; i++){
+ int k = d_INTERLEAVER.INTER()[i];
+ out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ }
+ }
+ return noutput_items;
+}
+
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t
new file mode 100644
index 000000000..a9e4dc454
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <vector>
+#include "fsm.h"
+#include "interleaver.h"
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+@SPTR_NAME@ trellis_make_@BASE_NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+);
+
+/*!
+ * \brief SCCC encoder.
+ * \ingroup coding_blk
+ */
+class @NAME@ : public gr_sync_block
+{
+private:
+ friend @SPTR_NAME@ trellis_make_@BASE_NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+ fsm d_FSMo;
+ int d_STo;
+ fsm d_FSMi;
+ int d_STi;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ std::vector<int> d_buffer;
+ @NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+
+public:
+ fsm FSMo () const { return d_FSMo; }
+ int STo () const { return d_STo; }
+ fsm FSMi () const { return d_FSMi; }
+ int STi () const { return d_STi; }
+ interleaver INTERLEAVER () const { return d_INTERLEAVER; }
+ int blocklength () const { return d_blocklength; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t
new file mode 100644
index 000000000..ca6b56199
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+
+@SPTR_NAME@ trellis_make_@BASE_NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+);
+
+class @NAME@ : public gr_sync_block
+{
+private:
+ @NAME@ (
+ const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+public:
+ fsm FSMo () const { return d_FSMo; }
+ int STo () const { return d_STo; }
+ fsm FSMi () const { return d_FSMi; }
+ int STi () const { return d_STi; }
+ interleaver INTERLEAVER () const { return d_INTERLEAVER; }
+ int blocklength () const { return d_blocklength; }
+};