summaryrefslogtreecommitdiff
path: root/gr-trellis/include/gnuradio/trellis
diff options
context:
space:
mode:
Diffstat (limited to 'gr-trellis/include/gnuradio/trellis')
-rw-r--r--gr-trellis/include/gnuradio/trellis/CMakeLists.txt102
-rw-r--r--gr-trellis/include/gnuradio/trellis/api.h33
-rw-r--r--gr-trellis/include/gnuradio/trellis/base.h43
-rw-r--r--gr-trellis/include/gnuradio/trellis/calc_metric.h54
-rw-r--r--gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h51
-rw-r--r--gr-trellis/include/gnuradio/trellis/core_algorithms.h124
-rw-r--r--gr-trellis/include/gnuradio/trellis/encoder_XX.h.t54
-rw-r--r--gr-trellis/include/gnuradio/trellis/fsm.h193
-rw-r--r--gr-trellis/include/gnuradio/trellis/interleaver.h58
-rw-r--r--gr-trellis/include/gnuradio/trellis/metrics_X.h.t58
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t69
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t79
-rw-r--r--gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t63
-rw-r--r--gr-trellis/include/gnuradio/trellis/permutation.h55
-rw-r--r--gr-trellis/include/gnuradio/trellis/quicksort_index.h41
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t69
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t79
-rw-r--r--gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t63
-rw-r--r--gr-trellis/include/gnuradio/trellis/siso_combined_f.h68
-rw-r--r--gr-trellis/include/gnuradio/trellis/siso_f.h61
-rw-r--r--gr-trellis/include/gnuradio/trellis/siso_type.h37
-rw-r--r--gr-trellis/include/gnuradio/trellis/viterbi_X.h.t57
-rw-r--r--gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t64
23 files changed, 1575 insertions, 0 deletions
diff --git a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt
new file mode 100644
index 0000000000..b7ceea179e
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt
@@ -0,0 +1,102 @@
+# Copyright 2012 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.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_RUNTIME_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_dict2(name, sig, 'trellis')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+#######################################################################
+expand_h(encoder_XX bb bs bi ss si ii)
+expand_h(sccc_encoder_XX bb bs bi ss si ii)
+expand_h(pccc_encoder_XX bb bs bi ss si ii)
+expand_h(metrics_X s i f c)
+expand_h(viterbi_X b s i)
+expand_h(viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci)
+expand_h(sccc_decoder_X b s i)
+expand_h(sccc_decoder_combined_XX fb fs fi cb cs ci)
+expand_h(pccc_decoder_X b s i)
+expand_h(pccc_decoder_combined_XX fb fs fi cb cs ci)
+
+add_custom_target(trellis_generated_includes DEPENDS
+ ${generated_includes}
+)
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ ${generated_includes}
+ api.h
+ base.h
+ calc_metric.h
+ constellation_metrics_cf.h
+ core_algorithms.h
+ fsm.h
+ interleaver.h
+ permutation.h
+ quicksort_index.h
+ siso_type.h
+ siso_combined_f.h
+ siso_f.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/trellis
+ COMPONENT "trellis_devel"
+)
+
diff --git a/gr-trellis/include/gnuradio/trellis/api.h b/gr-trellis/include/gnuradio/trellis/api.h
new file mode 100644
index 0000000000..bdf5842864
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 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_TRELLIS_API_H
+#define INCLUDED_TRELLIS_API_H
+
+#include <gnuradio/attributes.h>
+
+#ifdef gnuradio_trellis_EXPORTS
+# define TRELLIS_API __GR_ATTR_EXPORT
+#else
+# define TRELLIS_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_TRELLIS_API_H */
diff --git a/gr-trellis/include/gnuradio/trellis/base.h b/gr-trellis/include/gnuradio/trellis/base.h
new file mode 100644
index 0000000000..c69500d0df
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/base.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2012 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_TRELLIS_BASE_H
+#define INCLUDED_TRELLIS_BASE_H
+
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief change base
+ */
+
+ bool dec2base(unsigned int num, int base, std::vector<int> &s);
+ bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s);
+ unsigned int base2dec(const std::vector<int> &s, int base);
+ unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_BASE_H */
diff --git a/gr-trellis/include/gnuradio/trellis/calc_metric.h b/gr-trellis/include/gnuradio/trellis/calc_metric.h
new file mode 100644
index 0000000000..c85fcbff69
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/calc_metric.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_CALC_METRIC_H
+#define INCLUDED_CALC_METRIC_H
+
+#include <vector>
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/digital/metric_type.h>
+
+namespace gr {
+ namespace trellis {
+
+ template <class T>
+ void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ /*
+ void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *input,
+ float *metric, digital::trellis_metric_type_t type);
+ */
+
+ void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_CALC_METRIC_H */
diff --git a/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h
new file mode 100644
index 0000000000..01bfab0140
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010-2012 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_TRELLIS_CONSTELLATION_METRICS_CF_H
+#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H
+
+#include <gnuradio/trellis/api.h>
+#include <gnuradio/block.h>
+#include <gnuradio/digital/constellation.h>
+#include <gnuradio/digital/metric_type.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Evaluate metrics for use by the Viterbi algorithm.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API constellation_metrics_cf : virtual public block
+ {
+ public:
+ // gr::trellis::constellation_metrics_cf::sptr
+ typedef boost::shared_ptr<constellation_metrics_cf> sptr;
+
+ static sptr make(digital::constellation_sptr constellation,
+ digital::trellis_metric_type_t TYPE);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H */
diff --git a/gr-trellis/include/gnuradio/trellis/core_algorithms.h b/gr-trellis/include/gnuradio/trellis/core_algorithms.h
new file mode 100644
index 0000000000..aedff120d8
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/core_algorithms.h
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_CORE_ALGORITHMS_H
+#define INCLUDED_CORE_ALGORITHMS_H
+
+#include <cmath>
+#include <vector>
+#include <gnuradio/digital/metric_type.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+
+namespace gr {
+ namespace trellis {
+
+ float min(float a, float b);
+ float min_star(float a, float b);
+
+ template <class T>
+ void viterbi_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, T *out);
+
+ template <class Ti, class To>
+ void viterbi_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const Ti *in, To *out);
+
+ void siso_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ const float *priori, const float *prioro, float *post);
+
+ template <class T>
+ void siso_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<T> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const T *observations, float *post);
+
+ template<class T>
+ void sccc_decoder(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, T *data);
+
+ template<class Ti, class To>
+ void sccc_decoder_combined(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data);
+
+ template<class T>
+ void pccc_decoder(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, T *data);
+
+ template<class Ti, class To>
+ void pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_CORE_ALGORITHMS_H */
diff --git a/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t
new file mode 100644
index 0000000000..7ece5d3f21
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/encoder_XX.h.t
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Convolutional encoder.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM, int ST);
+
+ virtual fsm FSM() const = 0;
+ virtual int ST() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/fsm.h b/gr-trellis/include/gnuradio/trellis/fsm.h
new file mode 100644
index 0000000000..cc8893f1e3
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/fsm.h
@@ -0,0 +1,193 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2011-2012 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_TRELLIS_FSM_H
+#define INCLUDED_TRELLIS_FSM_H
+
+#include <gnuradio/trellis/api.h>
+#include <vector>
+#include <iosfwd>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Finite State Machine Specification class.
+ * \ingroup trellis_coding_blk
+ *
+ * \details
+ * An instance of this class represents a finite state machine
+ * specification (FSMS) rather than the FSM itself. It particular
+ * the state of the FSM is not stored within an instance of this
+ * class.
+ */
+ class TRELLIS_API fsm
+ {
+ private:
+ // Input alphabet cardinality.
+ int d_I;
+
+ // Number of states.
+ int d_S;
+
+ // Output alphabet cardinality.
+ int d_O;
+
+ // NS means Next State.
+ // next_state = d_NS[current_state * d_I + input_symbol]
+ std::vector<int> d_NS;
+
+ // OS means Output Symbol.
+ // output_symbol = d_OS[current_state * d_I + input_symbol]
+ std::vector<int> d_OS;
+
+ // PS means Previous State.
+ std::vector< std::vector<int> > d_PS;
+
+ // PI means Previous Input Symbol.
+ // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form
+ // (previous_state, previous_input_symbol) that could have produced the
+ // current state.
+ std::vector< std::vector<int> > d_PI;
+
+ // TM means Termination matrix.
+ // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to
+ // state es.
+ std::vector<int> d_TMl;
+
+ // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest
+ // path from state s to es.
+ std::vector<int> d_TMi;
+ void generate_PS_PI ();
+ void generate_TM ();
+ bool find_es(int es);
+
+ public:
+ /*!
+ * \brief Constructor to create an uninitialized FSMS.
+ */
+ fsm();
+
+ /*!
+ * \brief Constructor to copy an FSMS.
+ */
+ fsm(const fsm &FSM);
+
+ /*!
+ * \brief Constructor to to create an FSMS.
+ *
+ * \param I The number of possible input symbols.
+ * \param S The number of possible FSM states.
+ * \param O The number of possible output symbols.
+ * \param NS A mapping from (current state, input symbol) to next state.
+ * next_state = NS[current_state * I + input_symbol]
+ * \param OS A mapping from (current state, input symbol) to output symbol.
+ * output_symbol = OS[current_state * I + input_symbol]
+ *
+ */
+ fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS);
+
+ /*!
+ * \brief Constructor to create an FSMS from file contents.
+ *
+ * \param name filename
+ *
+ */
+ fsm(const char *name);
+
+ /*!
+ * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional code.
+ *
+ * \param k ???
+ * \param n ???
+ * \param G ???
+ *
+ */
+ fsm(int k, int n, const std::vector<int> &G);
+
+ /*!
+ * \brief Creates an FSMS describing ISI.
+ *
+ * \param mod_size modulation size
+ * \param ch_length channel length
+ *
+ */
+ fsm(int mod_size, int ch_length);
+
+ /*!
+ * \brief Creates an FSMS describing the trellis for a CPM.
+ *
+ * \param P ???? h=K/P (relatively prime)
+ * \param M alphabet size
+ * \param L pulse duration
+ *
+ * This FSM is based on the paper by B. Rimoldi
+ * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988
+ * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf
+ */
+ fsm(int P, int M, int L);
+
+ /*!
+ * \brief Creates an FSMS describing the joint trellis of two FSMs.
+ *
+ * \param FSM1 first FSMS
+ * \param FSM2 second FSMS
+ */
+ fsm(const fsm &FSM1, const fsm &FSM2);
+
+ /*!
+ * \brief Creates an FSMS representing n stages through the originial FSM (AKA radix-n FSM).
+ *
+ * \param FSM Original FSMs
+ * \param n Number of stages.
+ */
+ fsm(const fsm &FSM, int n);
+ int I() const { return d_I; }
+ int S() const { return d_S; }
+ int O() const { return d_O; }
+ const std::vector<int> & NS() const { return d_NS; }
+ const std::vector<int> & OS() const { return d_OS; }
+ const std::vector< std::vector<int> > & PS() const { return d_PS; }
+ const std::vector< std::vector<int> > & PI() const { return d_PI; }
+ const std::vector<int> & TMi() const { return d_TMi; }
+ const std::vector<int> & TMl() const { return d_TMl; }
+
+ /*!
+ * \brief Creates an svg image of the trellis representation.
+ *
+ * \param filename filename
+ * \param number_stages ????
+ */
+ void write_trellis_svg(std::string filename ,int number_stages);
+
+ /*!
+ * \brief Write the FSMS to a file.
+ *
+ * \param filename filename
+ */
+ void write_fsm_txt(std::string filename);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_FSM_H */
diff --git a/gr-trellis/include/gnuradio/trellis/interleaver.h b/gr-trellis/include/gnuradio/trellis/interleaver.h
new file mode 100644
index 0000000000..2147db6600
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/interleaver.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2012 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_TRELLIS_INTERLEAVER_H
+#define INCLUDED_TRELLIS_INTERLEAVER_H
+
+#include <gnuradio/trellis/api.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief INTERLEAVER class
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API interleaver
+ {
+ private:
+ int d_K;
+ std::vector<int> d_INTER;
+ std::vector<int> d_DEINTER;
+
+ public:
+ interleaver();
+ interleaver(const interleaver & INTERLEAVER);
+ interleaver(int K, const std::vector<int> & INTER);
+ interleaver(const char *name);
+ interleaver(int K, int seed);
+ int K () const { return d_K; }
+ const std::vector<int> & INTER() const { return d_INTER; }
+ const std::vector<int> & DEINTER() const { return d_DEINTER; }
+ void write_interleaver_txt(std::string filename);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_INTERLEAVER_H */
diff --git a/gr-trellis/include/gnuradio/trellis/metrics_X.h.t b/gr-trellis/include/gnuradio/trellis/metrics_X.h.t
new file mode 100644
index 0000000000..3f650faf0e
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/metrics_X.h.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/calc_metric.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Evaluate metrics for use by the Viterbi algorithm.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual int O() const = 0;
+ virtual int D() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual void set_TABLE(const std::vector<@I_TYPE@> &table) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t
new file mode 100644
index 0000000000..affce07042
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_X.h.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+
+ virtual fsm FSM1() const = 0;
+ virtual fsm FSM2() const = 0;
+ virtual int ST10() const = 0;
+ virtual int ST1K() const = 0;
+ virtual int ST20() const = 0;
+ virtual int ST2K() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t
new file mode 100644
index 0000000000..719b0aa1e5
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_XX.h.t
@@ -0,0 +1,79 @@
+/* -*- 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/trellis/calc_metric.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+
+ virtual fsm FSM1() const = 0;
+ virtual fsm FSM2() const = 0;
+ virtual int ST10() const = 0;
+ virtual int ST1K() const = 0;
+ virtual int ST20() const = 0;
+ virtual int ST2K() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual float scaling() const = 0;
+ virtual void set_scaling(float scaling) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t
new file mode 100644
index 0000000000..5308fe275d
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/pccc_encoder_XX.h.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/sync_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief PCCC encoder.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+
+ virtual fsm FSM1() const = 0;
+ virtual int ST1() const = 0;
+ virtual fsm FSM2() const = 0;
+ virtual int ST2() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/permutation.h b/gr-trellis/include/gnuradio/trellis/permutation.h
new file mode 100644
index 0000000000..80b9fef641
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/permutation.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_TRELLIS_PERMUTATION_H
+#define INCLUDED_TRELLIS_PERMUTATION_H
+
+#include <gnuradio/trellis/api.h>
+#include <vector>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Permutation.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API permutation : virtual public sync_block
+ {
+ public:
+ // gr::trellis::permutation::sptr
+ typedef boost::shared_ptr<permutation> sptr;
+
+ static sptr make(int K, const std::vector<int> &TABLE,
+ int SYMS_PER_BLOCK, size_t NBYTES);
+
+ virtual int K() const = 0;
+ virtual const std::vector<int> & TABLE() const = 0;
+ virtual int SYMS_PER_BLOCK() const = 0;
+ virtual size_t BYTES_PER_SYMBOL() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_PERMUTATION_H */
diff --git a/gr-trellis/include/gnuradio/trellis/quicksort_index.h b/gr-trellis/include/gnuradio/trellis/quicksort_index.h
new file mode 100644
index 0000000000..402962172a
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/quicksort_index.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2012 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_QUICKSORT_INDEX_H
+#define INCLUDED_QUICKSORT_INDEX_H
+
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ template <class T>
+ void SWAP(T &a, T &b);
+
+ template <class T>
+ void quicksort_index(std::vector<T> &p, std::vector<int> &index,
+ int left, int right);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_QUICKSORT_INDEX_H */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t
new file mode 100644
index 0000000000..cc1d86b709
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_X.h.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+
+ virtual fsm FSMo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STo0() const = 0;
+ virtual int SToK() const = 0;
+ virtual int STi0() const = 0;
+ virtual int STiK() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t
new file mode 100644
index 0000000000..699de12fd8
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_XX.h.t
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/trellis/calc_metric.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+
+ virtual fsm FSMo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STo0() const = 0;
+ virtual int SToK() const = 0;
+ virtual int STi0() const = 0;
+ virtual int STiK() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual float scaling() const = 0;
+ virtual void set_scaling(float scaling) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t b/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t
new file mode 100644
index 0000000000..85fad02eeb
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/sccc_encoder_XX.h.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/interleaver.h>
+#include <gnuradio/sync_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief SCCC encoder.
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+
+ virtual fsm FSMo() const = 0;
+ virtual int STo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STi() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/siso_combined_f.h b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h
new file mode 100644
index 0000000000..47c34ea81e
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_TRELLIS_SISO_COMBINED_F_H
+#define INCLUDED_TRELLIS_SISO_COMBINED_F_H
+
+#include <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/trellis/calc_metric.h>
+#include <gnuradio/trellis/core_algorithms.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API siso_combined_f : virtual public block
+ {
+ public:
+ // gr::trellis::siso_combined_f::sptr
+ typedef boost::shared_ptr<siso_combined_f> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE,
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual bool POSTI() const = 0;
+ virtual bool POSTO() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<float> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_COMBINED_F_H */
diff --git a/gr-trellis/include/gnuradio/trellis/siso_f.h b/gr-trellis/include/gnuradio/trellis/siso_f.h
new file mode 100644
index 0000000000..60c3349e11
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/siso_f.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_TRELLIS_SISO_F_H
+#define INCLUDED_TRELLIS_SISO_F_H
+
+#include <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/siso_type.h>
+#include <gnuradio/trellis/core_algorithms.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API siso_f : virtual public block
+ {
+ public:
+ // gr::trellis::siso_f::sptr
+ typedef boost::shared_ptr<siso_f> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual bool POSTI() const = 0;
+ virtual bool POSTO() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_F_H */
diff --git a/gr-trellis/include/gnuradio/trellis/siso_type.h b/gr-trellis/include/gnuradio/trellis/siso_type.h
new file mode 100644
index 0000000000..9167381164
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/siso_type.h
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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_TRELLIS_SISO_TYPE_H
+#define INCLUDED_TRELLIS_SISO_TYPE_H
+
+namespace gr {
+ namespace trellis {
+
+ typedef enum {
+ TRELLIS_MIN_SUM = 200,
+ TRELLIS_SUM_PRODUCT
+ } siso_type_t;
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_TYPE_H */
diff --git a/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t b/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t
new file mode 100644
index 0000000000..2d72cb5e09
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/viterbi_X.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/core_algorithms.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t b/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t
new file mode 100644
index 0000000000..2becf8bf18
--- /dev/null
+++ b/gr-trellis/include/gnuradio/trellis/viterbi_combined_XX.h.t
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 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 <gnuradio/trellis/api.h>
+#include <gnuradio/trellis/fsm.h>
+#include <gnuradio/trellis/calc_metric.h>
+#include <gnuradio/trellis/core_algorithms.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup trellis_coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ virtual void set_TABLE (const std::vector<@I_TYPE@> &table) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */