summaryrefslogtreecommitdiff
path: root/gr-trellis
diff options
context:
space:
mode:
Diffstat (limited to 'gr-trellis')
-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_pccc_encoder_XX.cc.t90
-rw-r--r--gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t83
-rw-r--r--gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t50
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t1
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t1
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t1
9 files changed, 249 insertions, 0 deletions
diff --git a/gr-trellis/src/lib/.gitignore b/gr-trellis/src/lib/.gitignore
index 2a544a56f..8120aad94 100644
--- a/gr-trellis/src/lib/.gitignore
+++ b/gr-trellis/src/lib/.gitignore
@@ -140,6 +140,24 @@
/trellis_sccc_decoder_i.h
/trellis_sccc_decoder_i.i
/trellis_sccc_decoder_i.cc
+/trellis_pccc_encoder_bb.cc
+/trellis_pccc_encoder_bb.h
+/trellis_pccc_encoder_bb.i
+/trellis_pccc_encoder_bi.cc
+/trellis_pccc_encoder_bi.h
+/trellis_pccc_encoder_bi.i
+/trellis_pccc_encoder_bs.cc
+/trellis_pccc_encoder_bs.h
+/trellis_pccc_encoder_bs.i
+/trellis_pccc_encoder_ii.cc
+/trellis_pccc_encoder_ii.h
+/trellis_pccc_encoder_ii.i
+/trellis_pccc_encoder_si.cc
+/trellis_pccc_encoder_si.h
+/trellis_pccc_encoder_si.i
+/trellis_pccc_encoder_ss.cc
+/trellis_pccc_encoder_ss.h
+/trellis_pccc_encoder_ss.i
/trellis_generated.i
/generate-stamp
/stamp-*
diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am
index 5b47c5a32..42ea17aca 100644
--- a/gr-trellis/src/lib/Makefile.am
+++ b/gr-trellis/src/lib/Makefile.am
@@ -35,6 +35,9 @@ core_generator = \
trellis_sccc_encoder_XX.cc.t \
trellis_sccc_encoder_XX.h.t \
trellis_sccc_encoder_XX.i.t \
+ trellis_pccc_encoder_XX.cc.t \
+ trellis_pccc_encoder_XX.h.t \
+ trellis_pccc_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 9d2c593b4..32cf54db7 100644
--- a/gr-trellis/src/lib/generate_trellis.py
+++ b/gr-trellis/src/lib/generate_trellis.py
@@ -29,6 +29,7 @@ import re
other_roots = [
'trellis_encoder_XX',
'trellis_sccc_encoder_XX',
+ 'trellis_pccc_encoder_XX',
'trellis_metrics_X',
'trellis_viterbi_X',
'trellis_viterbi_combined_XX',
@@ -39,6 +40,7 @@ other_roots = [
other_signatures = (
['bb','bs','bi','ss','si','ii'],
['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_pccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t
new file mode 100644
index 000000000..40dcd4105
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_pccc_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 &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength
+)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (FSM1,ST1,FSM2,ST2,INTERLEAVER,blocklength));
+}
+
+@NAME@::@NAME@ (
+ const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ 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_FSM1 (FSM1),
+ d_ST1 (ST1),
+ d_FSM2 (FSM2),
+ d_ST2 (ST2),
+ d_INTERLEAVER (INTERLEAVER),
+ d_blocklength (blocklength)
+{
+ assert(d_FSM1.I() == d_FSM2.I());
+ 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 ST1_tmp = d_ST1;
+ int ST2_tmp = d_ST2;
+ for (int i = 0; i < d_blocklength; i++){
+ int k = d_INTERLEAVER.INTER()[i];
+ int o1 = d_FSM1.OS()[ST1_tmp*d_FSM1.I()+in[i]];
+ ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]];
+ int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]];
+ ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]];
+ out[i] = (@O_TYPE@) (o1*d_FSM1.O() + o2);
+ }
+ }
+ return noutput_items;
+}
+
diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t
new file mode 100644
index 000000000..68ccf75db
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_pccc_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 &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ 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 &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+ fsm d_FSM1;
+ int d_ST1;
+ fsm d_FSM2;
+ int d_ST2;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ std::vector<int> d_buffer;
+ @NAME@ (
+ const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+
+public:
+ fsm FSM1 () const { return d_FSM1; }
+ int ST1 () const { return d_ST1; }
+ fsm FSM2 () const { return d_FSM2; }
+ int ST2 () const { return d_ST2; }
+ 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_pccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t
new file mode 100644
index 000000000..c02ee428a
--- /dev/null
+++ b/gr-trellis/src/lib/trellis_pccc_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 &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength
+);
+
+class @NAME@ : public gr_sync_block
+{
+private:
+ @NAME@ (
+ const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength
+ );
+public:
+ fsm FSM1 () const { return d_FSM1; }
+ int ST1 () const { return d_ST1; }
+ fsm FSM2 () const { return d_FSM2; }
+ int ST2 () const { return d_ST2; }
+ interleaver INTERLEAVER () const { return d_INTERLEAVER; }
+ int blocklength () const { return d_blocklength; }
+};
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t
index da853f2ea..4a0f471fa 100644
--- a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t
+++ b/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t
@@ -73,6 +73,7 @@ trellis_make_@BASE_NAME@ (
d_repetitions (repetitions),
d_SISO_TYPE (SISO_TYPE)
{
+ assert(d_FSMo.O() == d_FSMi.I());
set_relative_rate (1.0 / ((double) d_FSMi.O()));
set_output_multiple (d_blocklength);
}
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t
index 62532bd4e..2927e3fe3 100644
--- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t
+++ b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t
@@ -88,6 +88,7 @@ trellis_make_@BASE_NAME@ (
d_METRIC_TYPE (METRIC_TYPE),
d_scaling (scaling)
{
+ assert(d_FSMo.O() == d_FSMi.I());
set_relative_rate (1.0 / ((double) d_D));
set_output_multiple (d_blocklength);
}
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
index f94b176cd..b1a46ca60 100644
--- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
+++ b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
@@ -57,6 +57,7 @@ trellis_make_@BASE_NAME@ (
d_INTERLEAVER (INTERLEAVER),
d_blocklength (blocklength)
{
+ assert(d_FSMo.O() == d_FSMi.I());
set_output_multiple(d_blocklength);
d_buffer.resize(d_blocklength);
}