diff options
Diffstat (limited to 'gr-trellis/src')
109 files changed, 0 insertions, 17294 deletions
diff --git a/gr-trellis/src/examples/grc/CMakeLists.txt b/gr-trellis/src/examples/grc/CMakeLists.txt deleted file mode 100644 index 46b825d88..000000000 --- a/gr-trellis/src/examples/grc/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# 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. - -install( - FILES - interference_cancellation.grc - pccc1.grc - pccc.grc - sccc1.grc - sccc.grc - readme.txt - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR} - COMPONENT "trellis-examples" -) diff --git a/gr-trellis/src/examples/grc/interference_cancellation.grc b/gr-trellis/src/examples/grc/interference_cancellation.grc deleted file mode 100644 index 7674b4bf1..000000000 --- a/gr-trellis/src/examples/grc/interference_cancellation.grc +++ /dev/null @@ -1,2177 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 17:40:25 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>int_cancellation</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Superposition Coding</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>P1/P</value> - </param> - <param> - <key>value</key> - <value>0.6</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(243, 11)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>P/sigma^2 (dB)</value> - </param> - <param> - <key>value</key> - <value>16</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>20</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(447, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(637, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(988, 196)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(25, 291)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(660, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(994, 319)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1224, 244)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(1146, 369)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(536, 529)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(771, 525)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(994, 545)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_3</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 792)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(785, 779)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1005, 798)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(405, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(710, 1008)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(944, 978)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(540, 1141)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(796, 1136)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1009, 1156)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(420, 1368)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(733, 1374)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(975, 1342)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(559, 1536)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(771, 1530)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(1010, 1551)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(336, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(79, 501)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(82, 766)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(89, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>(1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(83, 1111)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(105, 1367)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_viterbi_combined_xx</key> - <param> - <key>id</key> - <value>trellis_viterbi_combined_xx_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>block_size</key> - <value>1000</value> - </param> - <param> - <key>init_state</key> - <value>-1</value> - </param> - <param> - <key>final_state</key> - <value>-1</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1)</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(75, 1495)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1400, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1533, 149)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(871, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(340, 187)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(534, 149)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(682, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(748, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 1 (raw)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1267, 410)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 2 (raw)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>0,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1260, 659)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 2 (after cancelling user 1)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,1,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1262, 1020)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER 1 (after cancelling user 2)</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(1269, 1417)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>trellis_encoder_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_1</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_1</source_block_id> - <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_0</source_block_id> - <sink_block_id>gr_short_to_float_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_0</source_block_id> - <sink_block_id>wxgui_numbersink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2</source_block_id> - <sink_block_id>gr_short_to_float_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>gr_sub_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1</source_block_id> - <sink_block_id>gr_multiply_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1</source_block_id> - <sink_block_id>gr_multiply_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_2</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_2</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_2</source_block_id> - <sink_block_id>gr_sub_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_1</source_block_id> - <sink_block_id>trellis_encoder_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_1</source_block_id> - <sink_block_id>gr_short_to_float_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_2</source_block_id> - <sink_block_id>wxgui_numbersink2_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_2</source_block_id> - <sink_block_id>gr_sub_xx_3</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_3</source_block_id> - <sink_block_id>gr_multiply_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_3</source_block_id> - <sink_block_id>gr_multiply_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_1</source_block_id> - <sink_block_id>gr_sub_xx_3</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1</source_block_id> - <sink_block_id>wxgui_numbersink2_3</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_2_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_2</source_block_id> - <sink_block_id>trellis_encoder_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_viterbi_combined_xx_0_0</source_block_id> - <sink_block_id>gr_sub_xx_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_1_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_2_0</source_block_id> - <sink_block_id>trellis_viterbi_combined_xx_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>gr_sub_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_2_0</source_block_id> - <sink_block_id>gr_sub_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/pccc.grc b/gr-trellis/src/examples/grc/pccc.grc deleted file mode 100644 index c3111c321..000000000 --- a/gr-trellis/src/examples/grc/pccc.grc +++ /dev/null @@ -1,832 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Sep 1 12:53:13 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 147)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_decoder_combined_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_decoder_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>scaling</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(196, 274)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_pccc_decoder_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_decoder_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/pccc1.grc b/gr-trellis/src/examples/grc/pccc1.grc deleted file mode 100644 index 15a63707e..000000000 --- a/gr-trellis/src/examples/grc/pccc1.grc +++ /dev/null @@ -1,857 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 20:34:39 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_pccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 147)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_pccc_decoder_x</key> - <param> - <key>id</key> - <value>trellis_pccc_decoder_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>_coordinate</key> - <value>(357, 304)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_metrics_x</key> - <param> - <key>id</key> - <value>trellis_metrics_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>card</key> - <value>16</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(58, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_metrics_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_pccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_metrics_x_0</source_block_id> - <sink_block_id>trellis_pccc_decoder_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_pccc_decoder_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/readme.txt b/gr-trellis/src/examples/grc/readme.txt deleted file mode 100644 index a5261ac0b..000000000 --- a/gr-trellis/src/examples/grc/readme.txt +++ /dev/null @@ -1,32 +0,0 @@ -These are examples of using gr-trellis in grc. - -INTERFERENCE CANCELLATION -------------------------- -Two users are transmitting simultaneously using convolutionally encoded QPSK, each with power P1=alpha*P and P2=(1-alpha)*P. -The combined signal is observed in noise and four different receivers are considered: -1) A viterbi decoder decoding user 1 assuming user 2 is noise -2) A viterbi decoder decoding user 2 assuming user 1 is noise -3) A viterbi decoder decoding user 1 first - and then reencoding this signal, subtracting it from the observation - and then running a Viterbi decoder decoding user 2 -4) A viterbi decoder decoding user 2 first - and then reencoding this signal, subtracting it from the observation - and then running a Viterbi decoder decoding user 1 - -You can change the signal to noise ratio P/sigma^2 and the allocation of power to the two users, alpha. - - -Serially Concatenated Convolutional Codes ------------------------------------------ -An SCCC can be defined by an outer and an inner FSM together with an interleaver -and a modulation type. You can change the SNR and observe the estimated BER. -In sccc.grc the decoding and metric calculation are combined; in sccc1.grc they are separate. - -Parallel Concatenated Convolutional Codes ------------------------------------------ -A PCCC can be defined by two FSMs together with an interleaver -and a modulation type. You can change the SNR and observe the estimated BER. -In pccc1.grc the decoding and metric calculation are separate. - - -Enjoy. diff --git a/gr-trellis/src/examples/grc/sccc.grc b/gr-trellis/src/examples/grc/sccc.grc deleted file mode 100644 index e8f656f63..000000000 --- a/gr-trellis/src/examples/grc/sccc.grc +++ /dev/null @@ -1,832 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 19:57:09 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(445, 517)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(228.25, 798.39170361874085)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(416, 815)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(514, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(242, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(688, 572)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_decoder_combined_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_decoder_combined_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>c</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>5</value> - </param> - <param> - <key>dim</key> - <value>2</value> - </param> - <param> - <key>table</key> - <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_SUM_PRODUCT</value> - </param> - <param> - <key>scaling</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(159, 335)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_sccc_decoder_combined_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_decoder_combined_xx_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/grc/sccc1.grc b/gr-trellis/src/examples/grc/sccc1.grc deleted file mode 100644 index 0be59d0c4..000000000 --- a/gr-trellis/src/examples/grc/sccc1.grc +++ /dev/null @@ -1,857 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Wed Aug 31 20:09:23 2011</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>sccc1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Serially Concatenated Convolutional Code</value> - </param> - <param> - <key>author</key> - <value>AA</value> - </param> - <param> - <key>description</key> - <value>gnuradio flow graph</value> - </param> - <param> - <key>window_size</key> - <value>2048, 2048</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>noisevar</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10**(-snr_db/10)</value> - </param> - <param> - <key>_coordinate</key> - <value>(389, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2</value> - </param> - <param> - <key>num_samps</key> - <value>1000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>prefix</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>"/n/harrisville/x/anastas/gnuradio_trunk/"</value> - </param> - <param> - <key>_coordinate</key> - <value>(590, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>block</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1000</value> - </param> - <param> - <key>_coordinate</key> - <value>(764, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>snr_db</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>SNR (dB)</value> - </param> - <param> - <key>value</key> - <value>5</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>10</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(229, 13)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>R</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(482, 17)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_sccc_encoder_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>interleaver_args</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>bl</key> - <value>block</value> - </param> - <param> - <key>_coordinate</key> - <value>(242, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_sccc_decoder_x</key> - <param> - <key>id</key> - <value>trellis_sccc_decoder_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> - </param> - <param> - <key>o_init_state</key> - <value>0</value> - </param> - <param> - <key>o_final_state</key> - <value>-1</value> - </param> - <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn2o3_4.fsm"</value> - </param> - <param> - <key>i_init_state</key> - <value>0</value> - </param> - <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> - </param> - <param> - <key>iterations</key> - <value>10</value> - </param> - <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> - </param> - <param> - <key>_coordinate</key> - <value>(333, 305)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sub_xx</key> - <param> - <key>id</key> - <value>gr_sub_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(217, 597)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_xx</key> - <param> - <key>id</key> - <value>gr_multiply_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(392, 591)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_short_to_float</key> - <param> - <key>id</key> - <value>gr_short_to_float_1_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(535, 609)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2_3_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>BER</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>min_value</key> - <value>0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>1.0</value> - </param> - <param> - <key>decimal_places</key> - <value>6</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>True</value> - </param> - <param> - <key>avg_alpha</key> - <value>0.001</value> - </param> - <param> - <key>show_gauge</key> - <value>True</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1,0,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(713, 426)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_metrics_x</key> - <param> - <key>id</key> - <value>trellis_metrics_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>f</value> - </param> - <param> - <key>card</key> - <value>8</value> - </param> - <param> - <key>dim</key> - <value>1</value> - </param> - <param> - <key>table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> - </param> - <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> - </param> - <param> - <key>_coordinate</key> - <value>(58, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>R</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(952, 73)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_encoder_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_xx_2_0</source_block_id> - <sink_block_id>gr_short_to_float_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_short_to_float_1_0</source_block_id> - <sink_block_id>wxgui_numbersink2_3_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sub_xx_0</source_block_id> - <sink_block_id>gr_multiply_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx_1</source_block_id> - <sink_block_id>trellis_metrics_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_metrics_x_0</source_block_id> - <sink_block_id>trellis_sccc_decoder_x_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>trellis_sccc_decoder_x_0</source_block_id> - <sink_block_id>gr_sub_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> -</flow_graph> diff --git a/gr-trellis/src/examples/python/CMakeLists.txt b/gr-trellis/src/examples/python/CMakeLists.txt deleted file mode 100644 index e2c7e70ff..000000000 --- a/gr-trellis/src/examples/python/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# 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. - -include(GrPython) - -GR_PYTHON_INSTALL( - PROGRAMS - fsm_utils.py - test_tcm.py - test_tcm_parallel.py - test_tcm_combined.py - test_sccc_hard.py - test_sccc_soft.py - test_sccc_turbo.py - test_viterbi_equalization1.py - test_viterbi_equalization.py - test_turbo_equalization.py - test_turbo_equalization1.py - test_turbo_equalization2.py - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR} - COMPONENT "trellis_examples" -) - -install( - FILES README - DESTINATION ${GR_PKG_DATA_DIR}/examples/trellis - COMPONENT "trellis_examples" -) - -install( - FILES - fsm_files/awgn1o2_128.fsm - fsm_files/awgn1o2_16.fsm - fsm_files/awgn1o2_4.fsm - fsm_files/awgn1o2_8.fsm - fsm_files/awgn2o3_16.fsm - fsm_files/awgn2o3_4.fsm - fsm_files/awgn2o3_4_msb.fsm - fsm_files/awgn2o3_4_msbG.fsm - fsm_files/awgn2o3_8.fsm - fsm_files/awgn2o4_4.fsm - fsm_files/disconnected.fsm - fsm_files/rep3.fsm - fsm_files/rep5.fsm - fsm_files/simple.fsm - DESTINATION ${GR_PKG_TRELLIS_EXAMPLES_DIR}/fsm_files - COMPONENT "trellis_examples" -) diff --git a/gr-trellis/src/examples/python/README b/gr-trellis/src/examples/python/README deleted file mode 100644 index d51f231ac..000000000 --- a/gr-trellis/src/examples/python/README +++ /dev/null @@ -1,35 +0,0 @@ -Here we have several test programs for use with the gr-trellis implementation. -Documentation can be found in -http://gnuradio.utah.edu/svn/gnuradio/trunk/gr-trellis/doc/gr-trellis.html - -fsm_utils.py contains several useful functions. - -fsm_files is a directory with some FSM definitions - -If you just want to see what these programs do run them; -in your terminal you will see something like this: - -$ ./test_tcm.py --esn0 6.0 --repetitions 1000 -100 98 9.80e-01 102400 9 8.79e-05 -200 198 9.90e-01 204800 20 9.77e-05 -300 298 9.93e-01 307200 40 1.30e-04 -400 398 9.95e-01 409600 1074 2.62e-03 -500 498 9.96e-01 512000 1081 2.11e-03 -600 598 9.97e-01 614400 1090 1.77e-03 -700 698 9.97e-01 716800 1097 1.53e-03 -800 798 9.98e-01 819200 1107 1.35e-03 -900 898 9.98e-01 921600 1120 1.22e-03 -1000 998 9.98e-01 1024000 1129 1.10e-03 -1000 998 9.98e-01 1024000 1129 1.10e-03 - -which gives you information about the: -number of transmitted packets -number of packets in error -estimated packet error rate -number of transmitted shorts (or symbols, or bits, depending on the specific program) -number of shorts (or symbols, or bits) in error -estimated short (or symbol, or bit) error rate - -for instance, the final number 1.10e-03 is the error rate estimate by sending 1000 -packets of 1024 shorts each, using an 1/2 4-state convolutional code -and QPSK modulation through an AWGN with Es/N0 = 6.0 dB diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm deleted file mode 100644 index 4b47007c5..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm +++ /dev/null @@ -1,265 +0,0 @@ -2 128 4 - -0 64 -0 64 -1 65 -1 65 -2 66 -2 66 -3 67 -3 67 -4 68 -4 68 -5 69 -5 69 -6 70 -6 70 -7 71 -7 71 -8 72 -8 72 -9 73 -9 73 -10 74 -10 74 -11 75 -11 75 -12 76 -12 76 -13 77 -13 77 -14 78 -14 78 -15 79 -15 79 -16 80 -16 80 -17 81 -17 81 -18 82 -18 82 -19 83 -19 83 -20 84 -20 84 -21 85 -21 85 -22 86 -22 86 -23 87 -23 87 -24 88 -24 88 -25 89 -25 89 -26 90 -26 90 -27 91 -27 91 -28 92 -28 92 -29 93 -29 93 -30 94 -30 94 -31 95 -31 95 -32 96 -32 96 -33 97 -33 97 -34 98 -34 98 -35 99 -35 99 -36 100 -36 100 -37 101 -37 101 -38 102 -38 102 -39 103 -39 103 -40 104 -40 104 -41 105 -41 105 -42 106 -42 106 -43 107 -43 107 -44 108 -44 108 -45 109 -45 109 -46 110 -46 110 -47 111 -47 111 -48 112 -48 112 -49 113 -49 113 -50 114 -50 114 -51 115 -51 115 -52 116 -52 116 -53 117 -53 117 -54 118 -54 118 -55 119 -55 119 -56 120 -56 120 -57 121 -57 121 -58 122 -58 122 -59 123 -59 123 -60 124 -60 124 -61 125 -61 125 -62 126 -62 126 -63 127 -63 127 - -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -0 3 -3 0 -1 2 -2 1 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 - - - -GM1o2_128=[1+D+D^2+D^5+D^7 1+D^3+D^4+D^5+D^6+D^7] - =[11100101 10011111] - =[229 159] diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm deleted file mode 100644 index cdab41359..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm +++ /dev/null @@ -1,39 +0,0 @@ -2 16 4 - -0 8 -0 8 -1 9 -1 9 -2 10 -2 10 -3 11 -3 11 -4 12 -4 12 -5 13 -5 13 -6 14 -6 14 -7 15 -7 15 - -0 3 -3 0 -1 2 -2 1 -1 2 -2 1 -0 3 -3 0 -2 1 -1 2 -3 0 -0 3 -3 0 -0 3 -2 1 -1 2 - - - -GM1o2_16=[1+D+D^4 1+D^2+D^3+D^4 ] = [25,23] (decimal) diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm deleted file mode 100644 index fb316b5ef..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm +++ /dev/null @@ -1,14 +0,0 @@ -2 4 4 - -0 2 -0 2 -1 3 -1 3 - -0 3 -3 0 -1 2 -2 1 - -AWGN CC from Proakis-Salehi pg 779 -GM1o2_4=[1+D^2, 1+D+D^2] = [5, 7] (in decimal); diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm b/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm deleted file mode 100644 index 604bac6c2..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm +++ /dev/null @@ -1,24 +0,0 @@ -2 8 4 - -0 4 -0 4 -1 5 -1 5 -2 6 -2 6 -3 7 -3 7 - - -0 3 -3 0 -1 2 -2 1 -3 0 -0 3 -2 1 -1 2 - - -1/2 8-state code (Proakis pg. 493) -GM1o2_8=[ 1+D+D^3 1+D+D^2+D^3] =[13 , 15] (decimal) diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm deleted file mode 100644 index 9630cd9af..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm +++ /dev/null @@ -1,40 +0,0 @@ -4 16 8 - -0 8 4 12 -0 8 4 12 -0 8 4 12 -0 8 4 12 -1 9 5 13 -1 9 5 13 -1 9 5 13 -1 9 5 13 -2 10 6 14 -2 10 6 14 -2 10 6 14 -2 10 6 14 -3 11 7 15 -3 11 7 15 -3 11 7 15 -3 11 7 15 - -0 1 7 6 -6 7 1 0 -3 2 4 5 -5 4 2 3 -2 3 5 4 -4 5 3 2 -1 0 6 7 -7 6 0 1 -4 5 3 2 -2 3 5 4 -7 6 0 1 -1 0 6 7 -6 7 1 0 -0 1 7 6 -5 4 2 3 -3 2 4 5 - - -2/3 code generated from the awgn 1/2 code with 16 states and puncturing the 4th bit. -d_free= - diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm deleted file mode 100644 index 3ac57be18..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm +++ /dev/null @@ -1,15 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 7 4 3 -3 4 7 0 -5 2 1 6 -6 1 2 5 - -I don't remeber how I generated this one... -it is a bit better than awgn2o3_4_msb and worse -than awgn2o3_4_msbG. diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm deleted file mode 100644 index d834c5271..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm +++ /dev/null @@ -1,46 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. -We also puncture the first (MSB) bit. -This code is worse than awgn2o3_4_msbG and slightly worse than -awgn2o3_4, BUT seems to be a good innner code for sctcm (with 8PSK natural). - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output before puncturing: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -output after punturing the MSB: - -00 11 03 12 -10 01 13 02 -13 02 10 01 -03 12 00 11 - -and in decimal: - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm deleted file mode 100644 index 8956c53da..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm +++ /dev/null @@ -1,60 +0,0 @@ -4 4 8 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - -0 4 2 6 -5 1 3 7 -3 7 5 1 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. -We also puncture the first (MSB) bit and Gray map the symbols. - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output before puncturing: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -output after punturing the MSB: - -00 11 03 12 -10 01 13 02 -13 02 10 01 -03 12 00 11 - -and in decimal: - -0 5 3 6 -4 1 7 2 -7 2 4 1 -3 6 0 5 - -After Gray mapping: -label -> phase -0 -> 0 -1 -> 0 -2 -> 7 -3 -> 2 -4 -> 5 -5 -> 4 -6 -> 6 -7 -> 3 - -0 4 2 6 -5 1 3 7 -3 7 5 1 -2 6 0 4 - diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm deleted file mode 100644 index 34deeb68c..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm +++ /dev/null @@ -1,25 +0,0 @@ -4 8 8 - -0 4 2 6 -0 4 2 6 -0 4 2 6 -0 4 2 6 -1 5 3 7 -1 5 3 7 -1 5 3 7 -1 5 3 7 - - -0 1 7 6 -6 7 1 0 -3 2 4 5 -5 4 2 3 -6 7 1 0 -0 1 7 6 -5 4 2 3 -3 2 4 5 - - - -This is generated by the 1/2 8-state AWGN code (15 17) by puncturing the fourth bit. ---> d_free=??? diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm b/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm deleted file mode 100644 index a895be896..000000000 --- a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm +++ /dev/null @@ -1,36 +0,0 @@ -4 4 16 - -0 1 2 3 -0 1 2 3 -0 1 2 3 -0 1 2 3 - - 0 13 3 14 -12 1 15 2 - 7 10 4 9 -11 6 8 5 - - -This is generated by the 1/2 AWGN code (5 7) operated twice, ie, -(xk+1 xki) [xk-1 xk-2] -> [xk+1 xki]. - -intermediate states: - -00 21 02 23 -00 21 02 23 -10 31 12 33 -10 31 12 33 - -output: - -00 31 03 32 -30 01 33 02 -13 22 10 21 -23 12 20 11 - -and in decimal: - - 0 13 3 14 -12 1 15 2 - 7 10 4 9 -11 6 8 5 diff --git a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm b/gr-trellis/src/examples/python/fsm_files/disconnected.fsm deleted file mode 100644 index 847963e7b..000000000 --- a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm +++ /dev/null @@ -1,11 +0,0 @@ -1 4 1 - -1 -0 -3 -2 - -0 -0 -0 -0 diff --git a/gr-trellis/src/examples/python/fsm_files/irregular.fsm b/gr-trellis/src/examples/python/fsm_files/irregular.fsm deleted file mode 100644 index 80b82b889..000000000 --- a/gr-trellis/src/examples/python/fsm_files/irregular.fsm +++ /dev/null @@ -1,11 +0,0 @@ -2 2 2 - -0 0 -0 1 - -0 1 -0 1 - - -useless irregular FSM for testing. state 0 has 3 incoming edges and state -1 has 1 incoming edge. diff --git a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm b/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm deleted file mode 100644 index 293ff4e7c..000000000 --- a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm +++ /dev/null @@ -1,523 +0,0 @@ -4 256 16 - -0 8 128 136 -0 8 128 136 -1 9 129 137 -1 9 129 137 -2 10 130 138 -2 10 130 138 -3 11 131 139 -3 11 131 139 -4 12 132 140 -4 12 132 140 -5 13 133 141 -5 13 133 141 -6 14 134 142 -6 14 134 142 -7 15 135 143 -7 15 135 143 -0 8 128 136 -0 8 128 136 -1 9 129 137 -1 9 129 137 -2 10 130 138 -2 10 130 138 -3 11 131 139 -3 11 131 139 -4 12 132 140 -4 12 132 140 -5 13 133 141 -5 13 133 141 -6 14 134 142 -6 14 134 142 -7 15 135 143 -7 15 135 143 -16 24 144 152 -16 24 144 152 -17 25 145 153 -17 25 145 153 -18 26 146 154 -18 26 146 154 -19 27 147 155 -19 27 147 155 -20 28 148 156 -20 28 148 156 -21 29 149 157 -21 29 149 157 -22 30 150 158 -22 30 150 158 -23 31 151 159 -23 31 151 159 -16 24 144 152 -16 24 144 152 -17 25 145 153 -17 25 145 153 -18 26 146 154 -18 26 146 154 -19 27 147 155 -19 27 147 155 -20 28 148 156 -20 28 148 156 -21 29 149 157 -21 29 149 157 -22 30 150 158 -22 30 150 158 -23 31 151 159 -23 31 151 159 -32 40 160 168 -32 40 160 168 -33 41 161 169 -33 41 161 169 -34 42 162 170 -34 42 162 170 -35 43 163 171 -35 43 163 171 -36 44 164 172 -36 44 164 172 -37 45 165 173 -37 45 165 173 -38 46 166 174 -38 46 166 174 -39 47 167 175 -39 47 167 175 -32 40 160 168 -32 40 160 168 -33 41 161 169 -33 41 161 169 -34 42 162 170 -34 42 162 170 -35 43 163 171 -35 43 163 171 -36 44 164 172 -36 44 164 172 -37 45 165 173 -37 45 165 173 -38 46 166 174 -38 46 166 174 -39 47 167 175 -39 47 167 175 -48 56 176 184 -48 56 176 184 -49 57 177 185 -49 57 177 185 -50 58 178 186 -50 58 178 186 -51 59 179 187 -51 59 179 187 -52 60 180 188 -52 60 180 188 -53 61 181 189 -53 61 181 189 -54 62 182 190 -54 62 182 190 -55 63 183 191 -55 63 183 191 -48 56 176 184 -48 56 176 184 -49 57 177 185 -49 57 177 185 -50 58 178 186 -50 58 178 186 -51 59 179 187 -51 59 179 187 -52 60 180 188 -52 60 180 188 -53 61 181 189 -53 61 181 189 -54 62 182 190 -54 62 182 190 -55 63 183 191 -55 63 183 191 -64 72 192 200 -64 72 192 200 -65 73 193 201 -65 73 193 201 -66 74 194 202 -66 74 194 202 -67 75 195 203 -67 75 195 203 -68 76 196 204 -68 76 196 204 -69 77 197 205 -69 77 197 205 -70 78 198 206 -70 78 198 206 -71 79 199 207 -71 79 199 207 -64 72 192 200 -64 72 192 200 -65 73 193 201 -65 73 193 201 -66 74 194 202 -66 74 194 202 -67 75 195 203 -67 75 195 203 -68 76 196 204 -68 76 196 204 -69 77 197 205 -69 77 197 205 -70 78 198 206 -70 78 198 206 -71 79 199 207 -71 79 199 207 -80 88 208 216 -80 88 208 216 -81 89 209 217 -81 89 209 217 -82 90 210 218 -82 90 210 218 -83 91 211 219 -83 91 211 219 -84 92 212 220 -84 92 212 220 -85 93 213 221 -85 93 213 221 -86 94 214 222 -86 94 214 222 -87 95 215 223 -87 95 215 223 -80 88 208 216 -80 88 208 216 -81 89 209 217 -81 89 209 217 -82 90 210 218 -82 90 210 218 -83 91 211 219 -83 91 211 219 -84 92 212 220 -84 92 212 220 -85 93 213 221 -85 93 213 221 -86 94 214 222 -86 94 214 222 -87 95 215 223 -87 95 215 223 -96 104 224 232 -96 104 224 232 -97 105 225 233 -97 105 225 233 -98 106 226 234 -98 106 226 234 -99 107 227 235 -99 107 227 235 -100 108 228 236 -100 108 228 236 -101 109 229 237 -101 109 229 237 -102 110 230 238 -102 110 230 238 -103 111 231 239 -103 111 231 239 -96 104 224 232 -96 104 224 232 -97 105 225 233 -97 105 225 233 -98 106 226 234 -98 106 226 234 -99 107 227 235 -99 107 227 235 -100 108 228 236 -100 108 228 236 -101 109 229 237 -101 109 229 237 -102 110 230 238 -102 110 230 238 -103 111 231 239 -103 111 231 239 -112 120 240 248 -112 120 240 248 -113 121 241 249 -113 121 241 249 -114 122 242 250 -114 122 242 250 -115 123 243 251 -115 123 243 251 -116 124 244 252 -116 124 244 252 -117 125 245 253 -117 125 245 253 -118 126 246 254 -118 126 246 254 -119 127 247 255 -119 127 247 255 -112 120 240 248 -112 120 240 248 -113 121 241 249 -113 121 241 249 -114 122 242 250 -114 122 242 250 -115 123 243 251 -115 123 243 251 -116 124 244 252 -116 124 244 252 -117 125 245 253 -117 125 245 253 -118 126 246 254 -118 126 246 254 -119 127 247 255 -119 127 247 255 - -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 - -This is the joint trellis of two trellises described in awgn1o2_16.fsm -It is useful for application of joint decoding... -It can be generated in python as follows: -> import trellis -> f1=trellis.fsm('awgn1o2_16.fsm') -> f=trellis.fsm(f1,f1) -> f.write_fsm_txt('joint_16_16.fsm') diff --git a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm b/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm deleted file mode 100644 index 427a18207..000000000 --- a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm +++ /dev/null @@ -1,141 +0,0 @@ -4 64 16 - -0 8 32 40 -0 8 32 40 -1 9 33 41 -1 9 33 41 -2 10 34 42 -2 10 34 42 -3 11 35 43 -3 11 35 43 -4 12 36 44 -4 12 36 44 -5 13 37 45 -5 13 37 45 -6 14 38 46 -6 14 38 46 -7 15 39 47 -7 15 39 47 -0 8 32 40 -0 8 32 40 -1 9 33 41 -1 9 33 41 -2 10 34 42 -2 10 34 42 -3 11 35 43 -3 11 35 43 -4 12 36 44 -4 12 36 44 -5 13 37 45 -5 13 37 45 -6 14 38 46 -6 14 38 46 -7 15 39 47 -7 15 39 47 -16 24 48 56 -16 24 48 56 -17 25 49 57 -17 25 49 57 -18 26 50 58 -18 26 50 58 -19 27 51 59 -19 27 51 59 -20 28 52 60 -20 28 52 60 -21 29 53 61 -21 29 53 61 -22 30 54 62 -22 30 54 62 -23 31 55 63 -23 31 55 63 -16 24 48 56 -16 24 48 56 -17 25 49 57 -17 25 49 57 -18 26 50 58 -18 26 50 58 -19 27 51 59 -19 27 51 59 -20 28 52 60 -20 28 52 60 -21 29 53 61 -21 29 53 61 -22 30 54 62 -22 30 54 62 -23 31 55 63 -23 31 55 63 - -0 3 12 15 -3 0 15 12 -1 2 13 14 -2 1 14 13 -1 2 13 14 -2 1 14 13 -0 3 12 15 -3 0 15 12 -2 1 14 13 -1 2 13 14 -3 0 15 12 -0 3 12 15 -3 0 15 12 -0 3 12 15 -2 1 14 13 -1 2 13 14 -12 15 0 3 -15 12 3 0 -13 14 1 2 -14 13 2 1 -13 14 1 2 -14 13 2 1 -12 15 0 3 -15 12 3 0 -14 13 2 1 -13 14 1 2 -15 12 3 0 -12 15 0 3 -15 12 3 0 -12 15 0 3 -14 13 2 1 -13 14 1 2 -4 7 8 11 -7 4 11 8 -5 6 9 10 -6 5 10 9 -5 6 9 10 -6 5 10 9 -4 7 8 11 -7 4 11 8 -6 5 10 9 -5 6 9 10 -7 4 11 8 -4 7 8 11 -7 4 11 8 -4 7 8 11 -6 5 10 9 -5 6 9 10 -8 11 4 7 -11 8 7 4 -9 10 5 6 -10 9 6 5 -9 10 5 6 -10 9 6 5 -8 11 4 7 -11 8 7 4 -10 9 6 5 -9 10 5 6 -11 8 7 4 -8 11 4 7 -11 8 7 4 -8 11 4 7 -10 9 6 5 -9 10 5 6 - -This is the joint trellis of two trellises described in awgn1o2_4.fsm and awgn1o2_16.fsm -It is useful for application of joint decoding... -It can be generated in python as follows: -> import trellis -> f1=trellis.fsm('awgn1o2_4.fsm') -> f2=trellis.fsm('awgn1o2_16.fsm') -> f=trellis.fsm(f1,f2) -> f.write_fsm_txt('joint_4_16.fsm') - diff --git a/gr-trellis/src/examples/python/fsm_files/rep3.fsm b/gr-trellis/src/examples/python/fsm_files/rep3.fsm deleted file mode 100644 index ef1bd1f02..000000000 --- a/gr-trellis/src/examples/python/fsm_files/rep3.fsm +++ /dev/null @@ -1,8 +0,0 @@ -2 1 8 - -0 0 - -0 7 - -1/3 repetition code (with binary input). -There is only one state, since this is essentially a memoryless system. diff --git a/gr-trellis/src/examples/python/fsm_files/rep5.fsm b/gr-trellis/src/examples/python/fsm_files/rep5.fsm deleted file mode 100644 index 2aa5d77cf..000000000 --- a/gr-trellis/src/examples/python/fsm_files/rep5.fsm +++ /dev/null @@ -1,7 +0,0 @@ -2 1 32 - -0 0 - -0 31 - -1/5 repetition code diff --git a/gr-trellis/src/examples/python/fsm_files/simple.fsm b/gr-trellis/src/examples/python/fsm_files/simple.fsm deleted file mode 100644 index f27f6b4b0..000000000 --- a/gr-trellis/src/examples/python/fsm_files/simple.fsm +++ /dev/null @@ -1,13 +0,0 @@ -1 4 1 - -1 -2 -3 -0 - -0 -0 -0 -0 - -essentially this fsm has no inputs and no outputs; it just cycles through all 4 states. diff --git a/gr-trellis/src/examples/python/fsm_utils.py b/gr-trellis/src/examples/python/fsm_utils.py deleted file mode 100755 index 06855ea77..000000000 --- a/gr-trellis/src/examples/python/fsm_utils.py +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - - -import re -import math -import sys -import operator -import numpy - -from gnuradio import trellis - -try: - import scipy.linalg -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - - - -###################################################################### -# Decimal to any base conversion. -# Convert 'num' to a list of 'l' numbers representing 'num' -# to base 'base' (most significant symbol first). -###################################################################### -def dec2base(num,base,l): - s=range(l) - n=num - for i in range(l): - s[l-i-1]=n%base - n=int(n/base) - if n!=0: - print 'Number ', num, ' requires more than ', l, 'digits.' - return s - - -###################################################################### -# Conversion from any base to decimal. -# Convert a list 's' of symbols to a decimal number -# (most significant symbol first) -###################################################################### -def base2dec(s,base): - num=0 - for i in range(len(s)): - num=num*base+s[i] - return num - - - - -###################################################################### -# Automatically generate the lookup table that maps the FSM outputs -# to channel inputs corresponding to a channel 'channel' and a modulation -# 'mod'. Optional normalization of channel to unit energy. -# This table is used by the 'metrics' block to translate -# channel outputs to metrics for use with the Viterbi algorithm. -# Limitations: currently supports only one-dimensional modulations. -###################################################################### -def make_isi_lookup(mod,channel,normalize): - dim=mod[0] - constellation = mod[1] - - if normalize: - p = 0 - for i in range(len(channel)): - p = p + channel[i]**2 - for i in range(len(channel)): - channel[i] = channel[i]/math.sqrt(p) - - lookup=range(len(constellation)**len(channel)) - for o in range(len(constellation)**len(channel)): - ss=dec2base(o,len(constellation),len(channel)) - ll=0 - for i in range(len(channel)): - ll=ll+constellation[ss[i]]*channel[i] - lookup[o]=ll - return (1,lookup) - - - - - - -###################################################################### -# Automatically generate the signals appropriate for CPM -# decomposition. -# This decomposition 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 -###################################################################### -def make_cpm_signals(K,P,M,L,q,frac): - - Q=numpy.size(q)/L - h=(1.0*K)/P - f0=-h*(M-1)/2 - dt=0.0; # maybe start at t=0.5 - t=(dt+numpy.arange(0,Q))/Q - qq=numpy.zeros(Q) - for m in range(L): - qq=qq + q[m*Q:m*Q+Q] - w=math.pi*h*(M-1)*t-2*math.pi*h*(M-1)*qq+math.pi*h*(L-1)*(M-1) - - X=(M**L)*P - PSI=numpy.empty((X,Q)) - for x in range(X): - xv=dec2base(x/P,M,L) - xv=numpy.append(xv, x%P) - qq1=numpy.zeros(Q) - for m in range(L): - qq1=qq1+xv[m]*q[m*Q:m*Q+Q] - psi=2*math.pi*h*xv[-1]+4*math.pi*h*qq1+w - #print psi - PSI[x]=psi - PSI = numpy.transpose(PSI) - SS=numpy.exp(1j*PSI) # contains all signals as columns - #print SS - - - # Now we need to orthogonalize the signals - F = scipy.linalg.orth(SS) # find an orthonormal basis for SS - #print numpy.dot(numpy.transpose(F.conjugate()),F) # check for orthonormality - S = numpy.dot(numpy.transpose(F.conjugate()),SS) - #print F - #print S - - # We only want to keep those dimensions that contain most - # of the energy of the overall constellation (eg, frac=0.9 ==> 90%) - # evaluate mean energy in each dimension - E=numpy.sum(numpy.absolute(S)**2,axis=1)/Q - E=E/numpy.sum(E) - #print E - Es = -numpy.sort(-E) - Esi = numpy.argsort(-E) - #print Es - #print Esi - Ecum=numpy.cumsum(Es) - #print Ecum - v0=numpy.searchsorted(Ecum,frac) - N = v0+1 - #print v0 - #print Esi[0:v0+1] - Ff=numpy.transpose(numpy.transpose(F)[Esi[0:v0+1]]) - #print Ff - Sf = S[Esi[0:v0+1]] - #print Sf - - - return (f0,SS,S,F,Sf,Ff,N) - #return f0 - - - - -###################################################################### -# A list of common modulations. -# Format: (dimensionality,constellation) -###################################################################### -pam2 = (1,[-1, 1]) -pam4 = (1,[-3, -1, 3, 1]) # includes Gray mapping -pam8 = (1,[-7, -5, -3, -1, 1, 3, 5, 7]) - -psk4=(2,[1, 0, \ - 0, 1, \ - 0, -1,\ - -1, 0]) # includes Gray mapping -psk8=(2,[math.cos(2*math.pi*0/8), math.sin(2*math.pi*0/8), \ - math.cos(2*math.pi*1/8), math.sin(2*math.pi*1/8), \ - math.cos(2*math.pi*2/8), math.sin(2*math.pi*2/8), \ - math.cos(2*math.pi*3/8), math.sin(2*math.pi*3/8), \ - math.cos(2*math.pi*4/8), math.sin(2*math.pi*4/8), \ - math.cos(2*math.pi*5/8), math.sin(2*math.pi*5/8), \ - math.cos(2*math.pi*6/8), math.sin(2*math.pi*6/8), \ - math.cos(2*math.pi*7/8), math.sin(2*math.pi*7/8)]) - -orth2 = (2,[1, 0, \ - 0, 1]) -orth4=(4,[1, 0, 0, 0, \ - 0, 1, 0, 0, \ - 0, 0, 1, 0, \ - 0, 0, 0, 1]) - -###################################################################### -# A list of channels to be tested -###################################################################### - -# C test channel (J. Proakis, Digital Communications, McGraw-Hill Inc., 2001) -c_channel = [0.227, 0.460, 0.688, 0.460, 0.227] - - - - - - - - - - -if __name__ == '__main__': - f1=trellis.fsm('fsm_files/awgn1o2_4.fsm') - #f2=trellis.fsm('fsm_files/awgn2o3_4.fsm') - #print f1.I(), f1.S(), f1.O() - #print f1.NS() - #print f1.OS() - #print f2.I(), f2.S(), f2.O() - #print f2.NS() - #print f2.OS() - ##f1.write_trellis_svg('f1.svg',4) - #f2.write_trellis_svg('f2.svg',4) - #f=fsm_concatenate(f1,f2) - #f=fsm_radix(f1,2) - - #print "----------\n" - #print f.I(), f.S(), f.O() - #print f.NS() - #print f.OS() - #f.write_trellis_svg('f.svg',4) - - q=numpy.arange(0,8)/(2.0*8) - (f0,SS,S,F,Sf,Ff,N) = make_cpm_signals(1,2,2,1,q,0.99) - diff --git a/gr-trellis/src/examples/python/test_cpm.py b/gr-trellis/src/examples/python/test_cpm.py deleted file mode 100755 index 5342e57e8..000000000 --- a/gr-trellis/src/examples/python/test_cpm.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -################################################## -# Gnuradio Python Flow Graph -# Title: CPM test -# Author: Achilleas Anastasopoulos -# Description: gnuradio flow graph -# Generated: Thu Feb 19 23:16:23 2009 -################################################## - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio.gr import firdes -from grc_gnuradio import blks2 as grc_blks2 -import math -import numpy -import fsm_utils -from gnuradio import trellis - -try: - import scipy.stats -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -def run_test(seed,blocksize): - tb = gr.top_block() - - ################################################## - # Variables - ################################################## - M = 2 - K = 1 - P = 2 - h = (1.0*K)/P - L = 3 - Q = 4 - frac = 0.99 - f = trellis.fsm(P,M,L) - - # CPFSK signals - #p = numpy.ones(Q)/(2.0) - #q = numpy.cumsum(p)/(1.0*Q) - - # GMSK signals - BT=0.3; - tt=numpy.arange(0,L*Q)/(1.0*Q)-L/2.0; - #print tt - p=(0.5*scipy.stats.erfc(2*math.pi*BT*(tt-0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0))-0.5*scipy.stats.erfc(2*math.pi*BT*(tt+0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0)))/2.0; - p=p/sum(p)*Q/2.0; - #print p - q=numpy.cumsum(p)/Q; - q=q/q[-1]/2.0; - #print q - - (f0T,SS,S,F,Sf,Ff,N) = fsm_utils.make_cpm_signals(K,P,M,L,q,frac) - #print N - #print Ff - Ffa = numpy.insert(Ff,Q,numpy.zeros(N),axis=0) - #print Ffa - MF = numpy.fliplr(numpy.transpose(Ffa)) - #print MF - E = numpy.sum(numpy.abs(Sf)**2,axis=0) - Es = numpy.sum(E)/f.O() - #print Es - - constellation = numpy.reshape(numpy.transpose(Sf),N*f.O()) - #print Ff - #print Sf - #print constellation - #print numpy.max(numpy.abs(SS - numpy.dot(Ff , Sf))) - - EsN0_db = 10.0 - N0 = Es * 10.0**(-(1.0*EsN0_db)/10.0) - #N0 = 0.0 - #print N0 - head = 4 - tail = 4 - numpy.random.seed(seed*666) - data = numpy.random.randint(0, M, head+blocksize+tail+1) - #data = numpy.zeros(blocksize+1+head+tail,'int') - for i in range(head): - data[i]=0 - for i in range(tail+1): - data[-i]=0 - - - - ################################################## - # Blocks - ################################################## - random_source_x_0 = gr.vector_source_b(data.tolist(), False) - gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1) - gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p) - gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) - - gr_add_vxx_0 = gr.add_vcc(1) - gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed)) - - gr_multiply_vxx_0 = gr.multiply_vcc(1) - gr_sig_source_x_0 = gr.sig_source_c(Q, gr.GR_COS_WAVE, -f0T, 1, 0) - # only works for N=2, do it manually for N>2... - gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate()) - gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate()) - gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, int(N)) - gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0))) - viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N), - constellation, digital.TRELLIS_EUCLIDEAN) - - gr_vector_sink_x_0 = gr.vector_sink_b() - - ################################################## - # Connections - ################################################## - tb.connect((random_source_x_0, 0), (gr_chunks_to_symbols_xx_0, 0)) - tb.connect((gr_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0)) - tb.connect((gr_interp_fir_filter_xxx_0, 0), (gr_frequency_modulator_fc_0, 0)) - tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0)) - tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1)) - tb.connect((gr_add_vxx_0, 0), (gr_multiply_vxx_0, 0)) - tb.connect((gr_sig_source_x_0, 0), (gr_multiply_vxx_0, 1)) - tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0, 0)) - tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0_0, 0)) - tb.connect((gr_fir_filter_xxx_0_0, 0), (gr_streams_to_stream_0, 0)) - tb.connect((gr_fir_filter_xxx_0_0_0, 0), (gr_streams_to_stream_0, 1)) - tb.connect((gr_streams_to_stream_0, 0), (gr_skiphead_0, 0)) - tb.connect((gr_skiphead_0, 0), (viterbi, 0)) - tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0)) - - - tb.run() - dataest = gr_vector_sink_x_0.data() - #print data - #print numpy.array(dataest) - perr = 0 - err = 0 - for i in range(blocksize): - if data[head+i] != dataest[head+i]: - #print i - err += 1 - if err != 0 : - perr = 1 - return (err,perr) - -if __name__ == '__main__': - blocksize = 1000 - ss=0 - ee=0 - for i in range(10000): - (s,e) = run_test(i,blocksize) - ss += s - ee += e - if (i+1) % 100 == 0: - print i+1,ss,ee,(1.0*ss)/(i+1)/(1.0*blocksize),(1.0*ee)/(i+1) - print i+1,ss,ee,(1.0*ss)/(i+1)/(1.0*blocksize),(1.0*ee)/(i+1) diff --git a/gr-trellis/src/examples/python/test_pccc_turbo1.py b/gr-trellis/src/examples/python/test_pccc_turbo1.py deleted file mode 100755 index 0655b972d..000000000 --- a/gr-trellis/src/examples/python/test_pccc_turbo1.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - #src = gr.vector_source_s([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],False) - enc = trellis.pccc_encoder_ss(fo,0,fi,0,interleaver,K) - code = gr.vector_sink_s() - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O()*fo.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - dec = trellis.pccc_decoder_s(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM) - - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc,mod) - #tb.connect (src,enc,mod) - #tb.connect(enc,code) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in,scale,dec,fsmi2s,dst) - - tb.run() - - #print code.data() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_pccc_turbo.py fsm_name_1 fsm_fname_2 Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.I() != fi.I(): - sys.stderr.write ('Incompatible input cardinality between two FSMs.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - #modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = 4 - constellation = [ 1, 0, 1, 0,\ - 1, 0,-1, 0,\ - 1, 0, 0, 1,\ - 1, 0, 0,-1,\ - -1, 0, 1, 0,\ - -1, 0,-1, 0,\ - -1, 0, 0, 1,\ - -1, 0, 0,-1,\ - 0, 1, 1, 0,\ - 0, 1,-1, 0,\ - 0, 1, 0, 1,\ - 0, 1, 0,-1,\ - 0,-1, 1, 0,\ - 0,-1,-1, 0,\ - 0,-1, 0, 1,\ - 0,-1, 0,-1,] # equivalent to 2 QPSK symbols - if len(constellation)/dimensionality != fi.O()*fo.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_hard.py b/gr-trellis/src/examples/python/test_sccc_hard.py deleted file mode 100755 index 4eeb94a12..000000000 --- a/gr-trellis/src/examples/python/test_sccc_hard.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - va_in = trellis.viterbi_s(fi,K,0,-1) # Put -1 if the Initial/Final states are not set. - deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),1,gr.sizeof_short) - metrics_out = trellis.metrics_s(fo.O(),1,[0,1,2,3],digital.TRELLIS_HARD_SYMBOL) # data preprocessing to generate metrics for outer Viterbi (hard decisions) - va_out = trellis.viterbi_s(fo,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in) - tb.connect (metrics_in,va_in,deinter,metrics_out,va_out,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 4: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - rep=int(args[3]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_soft.py b/gr-trellis/src/examples/python/test_sccc_soft.py deleted file mode 100755 index 10c28419a..000000000 --- a/gr-trellis/src/examples/python/test_sccc_soft.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - gnd = gr.vector_source_f([0],True); - siso_in = trellis.siso_f(fi,K,0,-1,True,False,trellis.TRELLIS_MIN_SUM) # Put -1 if the Initial/Final states are not set. - deinter = trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) - va_out = trellis.viterbi_s(fo,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics_in) - tb.connect (gnd,(siso_in,0)) - tb.connect (metrics_in,(siso_in,1)) - tb.connect (siso_in,deinter,va_out,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 4: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - rep=int(args[3]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo.py b/gr-trellis/src/examples/python/test_sccc_turbo.py deleted file mode 100755 index 762a93ba5..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - - -def make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (metrics_in,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - #(head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_SUM_PRODUCT) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_sccc_turbo.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo1.py b/gr-trellis/src/examples/python/test_sccc_turbo1.py deleted file mode 100755 index 187a75185..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo1.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - dec = trellis.sccc_decoder_combined_fs(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN,1.0) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - #tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,head) - #tb.connect (tail,fsmi2s,dst) - tb.connect (add,dec,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo2.py b/gr-trellis/src/examples/python/test_sccc_turbo2.py deleted file mode 100755 index dff1ba93c..000000000 --- a/gr-trellis/src/examples/python/test_sccc_turbo2.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality - enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - dec = trellis.sccc_decoder_s(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - #tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,head) - #tb.connect (tail,fsmi2s,dst) - tb.connect (add,metrics_in,scale,dec,fsmi2s,dst) - - tb.run() - - #print enc_out.ST(), enc_in.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 5: - fname_out=args[0] - fname_in=args[1] - esn0_db=float(args[2]) # Es/No in dB - IT=int(args[3]) - rep=int(args[4]) # number of times the experiment is run to collect enough errors - else: - sys.stderr.write ('usage: test_tcm.py fsm_name_out fsm_fname_in Es/No_db iterations repetitions\n') - sys.exit (1) - - # system parameters - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(fname_in) # get the innner FSM specification from a file - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - modulation = fsm_utils.psk8 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0): # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/src/examples/python/test_tcm.py deleted file mode 100755 index a7d6a02d0..000000000 --- a/gr-trellis/src/examples/python/test_tcm.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - - # TX - #packet = [0]*Kb - #for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 - #packet[i] = random.randint(0, 1) # random 0s and 1s - #src = gr.vector_source_s(packet,False) - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - #b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - #s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - #dst = gr.vector_sink_s(); - dst = gr.check_lfsr_32k_s() - - - tb.connect (src,src_head,s2fsmi,enc,mod) - #tb.connect (src,b2s,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - tb.connect (metrics,va,fsmi2s,dst) - #tb.connect (metrics,va,fsmi2s,s2b,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #ntotal = len(packet) - #if len(dst.data()) != ntotal: - #print "Error: not enough data\n" - #nright = 0; - #for i in range(ntotal): - #if packet[i]==dst.data()[i]: - #nright=nright+1 - #else: - #print "Error in ", i - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - # alternatively you can specify the fsm from its generator matrix - #f=trellis.fsm(1,2,[5,7]) - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() diff --git a/gr-trellis/src/examples/python/test_tcm_bit.py b/gr-trellis/src/examples/python/test_tcm_bit.py deleted file mode 100755 index 7f69c0e29..000000000 --- a/gr-trellis/src/examples/python/test_tcm_bit.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - # TX - packet = [0]*Kb - # this for loop is TOO slow!!! - for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 - packet[i] = random.randint(0, 1) # random 0s and 1s - src = gr.vector_source_s(packet,False) - #src = gr.lfsr_32k_source_s() - #src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - dst = gr.vector_sink_s(); - #dst = gr.check_lfsr_32k_s(); - - - #tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (src,b2s,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - #tb.connect (metrics,va,fsmi2s,dst) - tb.connect (metrics,va,fsmi2s,s2b,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - #ntotal = dst.ntotal () - #nright = dst.nright () - #runlength = dst.runlength () - ntotal = len(packet) - if len(dst.data()) != ntotal: - print "Error: not enough data\n" - nright = 0; - # this for loop is TOO slow!!! - for i in range(ntotal): - if packet[i]==dst.data()[i]: - nright=nright+1 - #else: - #print "Error in ", i - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%1==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() diff --git a/gr-trellis/src/examples/python/test_tcm_combined.py b/gr-trellis/src/examples/python/test_tcm_combined.py deleted file mode 100755 index d98e36e27..000000000 --- a/gr-trellis/src/examples/python/test_tcm_combined.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - - # RX - va = trellis.viterbi_combined_fs(f,K,0,-1,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,va,fsmi2s,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state.. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - - return (ntotal,ntotal-nright) - - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file (will hopefully be automated in the future...) - Kb=1024*16 # packet size in bits (make it multiple of 16) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utils.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main() - diff --git a/gr-trellis/src/examples/python/test_tcm_parallel.py b/gr-trellis/src/examples/python/test_tcm_parallel.py deleted file mode 100755 index 0372351aa..000000000 --- a/gr-trellis/src/examples/python/test_tcm_parallel.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils -from gnuradio.eng_option import eng_option -from optparse import OptionParser - - -def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16*P) # packet size in shorts - s2fsmi=gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - s2p = gr.stream_to_streams(gr.sizeof_short,P) # serial to parallel - enc = trellis.encoder_ss(f,0) # initiali state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - - # CHANNEL - add=[] - noise=[] - for i in range(P): - add.append(gr.add_ff()) - noise.append(gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - p2s = gr.streams_to_stream(gr.sizeof_short,P) # parallel to serial - fsmi2s=gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s() - - tb.connect (src,src_head,s2fsmi,s2p) - for i in range(P): - tb.connect ((s2p,i),(enc,i),(mod,i)) - tb.connect ((mod,i),(add[i],0)) - tb.connect (noise[i],(add[i],1)) - tb.connect (add[i],(metrics,i)) - tb.connect ((metrics,i),(va,i),(p2s,i)) - tb.connect (p2s,fsmi2s,dst) - - - tb.run() - - # A bit of cheating: run the program once and print the - # final encoder state. - # Then put it as the last argument in the viterbi block - #print "final state = " , enc.ST() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - - return (ntotal,ntotal-nright) - - - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)") - parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)") - parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - fname=options.fsm_file - esn0_db=float(options.esn0) - rep=int(options.repetitions) - - # system parameters - f=trellis.fsm(fname) # get the FSM specification from a file - P=4 # how many parallel streams? - Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations - dimensionality = modulation[0] - constellation = modulation[1] - if len(constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') - sys.exit (1) - # calculate average symbol energy - Es = 0 - for i in range(len(constellation)): - Es = Es + constellation[i]**2 - Es = Es / (len(constellation)/dimensionality) - N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i),P) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - -if __name__ == '__main__': - main() - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization.py b/gr-trellis/src/examples/python/test_turbo_equalization.py deleted file mode 100755 index 18bfb022a..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils - - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (metrics_in,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the iouter FSM input cardinality - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the innner FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - tb.connect (src,src_head,s2fsmi,enc_out,inter,enc_in,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #print ntotal,nright,runlength - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - print 'size = ',K - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - N0=pow(10.0,-esn0_db/10.0); # noise variance - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - print s - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization1.py b/gr-trellis/src/examples/python/test_turbo_equalization1.py deleted file mode 100755 index 17ad43023..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization1.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO - scale = gr.multiply_const_ff(1.0/N0) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_f(fi,K,0,-1,True,False,type) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (metrics_in,scale) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (scale,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (metrics_in,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); - - tb.connect (src,enc_out,inter,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - nright=0 - for i in range(ntotal): - if packet[i]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - N0=pow(10.0,-esn0_db/10.0); # noise variance - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_turbo_equalization2.py b/gr-trellis/src/examples/python/test_turbo_equalization2.py deleted file mode 100755 index 5a6c77e9d..000000000 --- a/gr-trellis/src/examples/python/test_turbo_equalization2.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): - scale = gr.multiply_const_ff(math.sqrt(1.0/N0)) - gnd = gr.vector_source_f([0],True); - - inter=[] - deinter=[] - siso_in=[] - siso_out=[] - - # generate all blocks - for it in range(IT): - inter.append( trellis.permutation(interleaver.K(),interleaver.INTER(),fi.I(),gr.sizeof_float) ) - siso_in.append( trellis.siso_combined_f(fi,K,0,-1,True,False,type,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) ) - deinter.append( trellis.permutation(interleaver.K(),interleaver.DEINTER(),fi.I(),gr.sizeof_float) ) - if it < IT-1: - siso_out.append( trellis.siso_f(fo,K,0,-1,False,True,type) ) - else: - siso_out.append( trellis.viterbi_s(fo,K,0,-1) ) # no soft outputs needed - - # connect first stage - tb.connect (gnd,inter[0]) - tb.connect (scale,(siso_in[0],1)) - - # connect the rest - for it in range(IT): - if it < IT-1: - tb.connect (scale,(siso_in[it+1],1)) - tb.connect (siso_in[it],deinter[it],(siso_out[it],1)) - tb.connect (gnd,(siso_out[it],0)) - tb.connect (siso_out[it],inter[it+1]) - tb.connect (inter[it],(siso_in[it],0)) - else: - tb.connect (siso_in[it],deinter[it],siso_out[it]) - tb.connect (inter[it],(siso_in[it],0)) - - return (scale,siso_out[IT-1]) - - -def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,Es,N0,IT,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - src = gr.vector_source_s(packet,False) - enc_out = trellis.encoder_ss(fo,0) # initial state = 0 - inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) - dst = gr.vector_sink_s(); - - tb.connect (src,enc_out,inter,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,head) - tb.connect (tail,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - nright=0 - for i in range(ntotal): - if packet[i]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 3: - fname_out=args[0] - esn0_db=float(args[1]) - rep=int(args[2]) - else: - sys.stderr.write ('usage: test_turbo_equalization.py fsm_name_out Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=64*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - fo=trellis.fsm(fname_out) # get the outer FSM specification from a file - fi=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - if fo.O() != fi.I(): - sys.stderr.write ('Incompatible cardinality between outer and inner FSM.\n') - sys.exit (1) - bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - interleaver=trellis.interleaver(K,666) # construct a random interleaver - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - N0=pow(10.0,-esn0_db/10.0); # noise variance - tot_constellation =[0]*len(tot_channel[1]) - for i in range(len(tot_channel[1])): - tot_constellation[i] = tot_channel[1][i] * math.sqrt(1.0/N0) - if len(tot_constellation)/dimensionality != fi.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - IT = 3 # number of turbo iterations - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,1,N0,IT,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%10==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization.py b/gr-trellis/src/examples/python/test_viterbi_equalization.py deleted file mode 100755 index 9f3f7e391..000000000 --- a/gr-trellis/src/examples/python/test_viterbi_equalization.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): - tb = gr.top_block () - - # TX - src = gr.lfsr_32k_source_s() - src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality - enc = trellis.encoder_ss(f,0) # initial state = 0 - # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) - - # CHANNEL - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts - dst = gr.check_lfsr_32k_s(); - - tb.connect (src,src_head,s2fsmi,enc,mod) - tb.connect (mod,(add,0)) - tb.connect (noise,(add,1)) - tb.connect (add,metrics) - tb.connect (metrics,va,fsmi2s,dst) - - tb.run() - - ntotal = dst.ntotal () - nright = dst.nright () - runlength = dst.runlength () - #print ntotal,nright,runlength - - return (ntotal,ntotal-nright) - - - - -def main(args): - nargs = len (args) - if nargs == 2: - esn0_db=float(args[0]) - rep=int(args[1]) - else: - sys.stderr.write ('usage: test_viterbi_equalization.py Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=128*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - N0=pow(10.0,-esn0_db/10.0); # noise variance - if len(tot_constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) - diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization1.py b/gr-trellis/src/examples/python/test_viterbi_equalization1.py deleted file mode 100755 index 90eb4790e..000000000 --- a/gr-trellis/src/examples/python/test_viterbi_equalization1.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import trellis, digital -from gnuradio import eng_notation -import math -import sys -import random -import fsm_utils - -def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): - tb = gr.top_block () - L = len(channel) - - # TX - # this for loop is TOO slow in python!!! - packet = [0]*(K+2*L) - random.seed(seed) - for i in range(len(packet)): - packet[i] = random.randint(0, 2**bitspersymbol - 1) # random symbols - for i in range(L): # first/last L symbols set to 0 - packet[i] = 0 - packet[len(packet)-i-1] = 0 - src = gr.vector_source_s(packet,False) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) - - # CHANNEL - isi = gr.fir_filter_fff(1,channel) - add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols - #metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi - #va = trellis.viterbi_s(f,K+L,-1,0) # Put -1 if the Initial/Final states are not set. - va = trellis.viterbi_combined_fs(f,K+L,0,0,dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # using viterbi_combined_fs instead of metrics_f/viterbi_s allows larger packet lengths because metrics_f is complaining for not being able to allocate large buffers. This is due to the large f.O() in this application... - dst = gr.vector_sink_s() - - tb.connect (src,mod) - tb.connect (mod,isi,(add,0)) - tb.connect (noise,(add,1)) - #tb.connect (add,metrics) - #tb.connect (metrics,va,dst) - tb.connect (add,skip,va,dst) - - tb.run() - - data = dst.data() - ntotal = len(data) - L - nright=0 - for i in range(ntotal): - if packet[i+L]==data[i]: - nright=nright+1 - #else: - #print "Error in ", i - - return (ntotal,ntotal-nright) - - -def main(args): - nargs = len (args) - if nargs == 2: - esn0_db=float(args[0]) - rep=int(args[1]) - else: - sys.stderr.write ('usage: test_viterbi_equalization1.py Es/No_db repetitions\n') - sys.exit (1) - - # system parameters - Kb=128*16 # packet size in bits (multiple of 16) - modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations - channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels - f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - K=Kb/bitspersymbol # packet size in trellis steps - - tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1) - dimensionality = tot_channel[0] - tot_constellation = tot_channel[1] - N0=pow(10.0,-esn0_db/10.0); # noise variance - if len(tot_constellation)/dimensionality != f.O(): - sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n') - sys.exit (1) - - tot_s=0 # total number of transmitted shorts - terr_s=0 # total number of shorts in error - terr_p=0 # total number of packets in error - - for i in range(rep): - (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations - tot_s=tot_s+s - terr_s=terr_s+e - terr_p=terr_p+(terr_s!=0) - if ((i+1)%100==0) : # display progress - print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or symbol) error rate - print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s) - - - -if __name__ == '__main__': - main (sys.argv[1:]) diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt deleted file mode 100644 index e2abf0238..000000000 --- a/gr-trellis/src/lib/CMakeLists.txt +++ /dev/null @@ -1,226 +0,0 @@ -# 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. - -include(GrPython) - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${GR_TRELLIS_INCLUDE_DIRS} - ${GR_DIGITAL_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${Boost_LIBRARY_DIRS}) - -######################################################################## -# generate the python helper script which calls into the build utils -######################################################################## -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') -sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.chdir('${CMAKE_CURRENT_BINARY_DIR}') - -if __name__ == '__main__': - import build_utils, generate_trellis - root, inp = sys.argv[1:3] - for sig in sys.argv[3:]: - name = re.sub ('X+', sig, root) - d = generate_trellis.standard_dict(name, sig) - build_utils.expand_template(d, inp) - -") - -######################################################################## -# generation helper macro to generate various files from template -######################################################################## -macro(expand_h_cc_i root) - - foreach(ext h cc i) - #make a list of all the generated files - unset(expanded_files_${ext}) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext}) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_${ext}} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.${ext}.t ${ARGN} - ) - endforeach(ext) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc, h, and i files - list(APPEND generated_trellis_sources ${expanded_files_cc}) - list(APPEND generated_trellis_includes ${expanded_files_h}) - list(APPEND generated_trellis_swigs ${expanded_files_i}) - -endmacro(expand_h_cc_i) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_h_cc_i(trellis_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_sccc_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_pccc_encoder_XX bb bs bi ss si ii) -expand_h_cc_i(trellis_metrics_X s i f c) -expand_h_cc_i(trellis_viterbi_X b s i) -expand_h_cc_i(trellis_viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci) -expand_h_cc_i(trellis_sccc_decoder_X b s i) -expand_h_cc_i(trellis_sccc_decoder_combined_XX fb fs fi cb cs ci) -expand_h_cc_i(trellis_pccc_decoder_X b s i) -expand_h_cc_i(trellis_pccc_decoder_combined_XX fb fs fi cb cs ci) - -######################################################################## -# Create the master trellis swig include files -######################################################################## -set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i.in) -file(WRITE ${generated_index} " -// -// This file is machine generated. All edits will be overwritten -// -") - -file(APPEND ${generated_index} "%{\n") -foreach(swig_file ${generated_trellis_swigs}) - get_filename_component(name ${swig_file} NAME_WE) - file(APPEND ${generated_index} "#include<${name}.h>\n") -endforeach(swig_file) -file(APPEND ${generated_index} "%}\n") - -foreach(swig_file ${generated_trellis_swigs}) - get_filename_component(name ${swig_file} NAME) - file(APPEND ${generated_index} "%include<${name}>\n") -endforeach(swig_file) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i -) - -######################################################################## -# Setup library -######################################################################## -list(APPEND gr_trellis_sources - fsm.cc - quicksort_index.cc - base.cc - interleaver.cc - calc_metric.cc - core_algorithms.cc - trellis_permutation.cc - trellis_siso_f.cc - trellis_siso_combined_f.cc - trellis_constellation_metrics_cf.cc - ${generated_trellis_sources} -) - -list(APPEND trellis_libs - gnuradio-core - ${Boost_LIBRARIES} -) - -add_library(gnuradio-trellis SHARED ${gr_trellis_sources}) -target_link_libraries(gnuradio-trellis ${trellis_libs}) -GR_LIBRARY_FOO(gnuradio-trellis RUNTIME_COMPONENT "trellis_runtime" DEVEL_COMPONENT "trellis_devel") - -######################################################################## -# Handle the generated sources + a few non-generated ones -######################################################################## -install(FILES - ${generated_trellis_includes} - trellis_api.h - fsm.h - quicksort_index.h - base.h - interleaver.h - calc_metric.h - core_algorithms.h - trellis_permutation.h - siso_type.h - trellis_siso_f.h - trellis_siso_combined_f.h - trellis_constellation_metrics_cf.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "trellis_devel" -) - -if(ENABLE_PYTHON) - install(FILES - trellis.i - ${generated_trellis_swigs} - fsm.i - interleaver.i - trellis_permutation.i - trellis_siso_f.i - trellis_siso_combined_f.i - trellis_constellation_metrics_cf.i - ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i - ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "trellis_swig" - ) - -######################################################################## -# Setup swig generation -######################################################################## -include(GrPython) -include(GrSwig) - -set(GR_SWIG_SOURCE_DEPS - ${generated_trellis_includes} - ${generated_trellis_swigs} -) -set(GR_SWIG_INCLUDE_DIRS - ${GR_TRELLIS_INCLUDE_DIRS} - ${GR_DIGITAL_SWIG_INCLUDE_DIRS} - ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - -set(GR_SWIG_LIBRARIES gnuradio-trellis) -GR_SWIG_MAKE(trellis trellis.i) - -GR_SWIG_INSTALL( - TARGETS trellis - DESTINATION ${GR_PYTHON_DIR}/gnuradio - COMPONENT "trellis_python" -) - -endif(ENABLE_PYTHON) diff --git a/gr-trellis/src/lib/Makefile.gen b/gr-trellis/src/lib/Makefile.gen deleted file mode 100644 index b9b9afb1f..000000000 --- a/gr-trellis/src/lib/Makefile.gen +++ /dev/null @@ -1,174 +0,0 @@ -# -# This file is machine generated. All edits will be overwritten -# -GENERATED_H = \ - trellis_encoder_bb.h \ - trellis_encoder_bi.h \ - trellis_encoder_bs.h \ - trellis_encoder_ii.h \ - trellis_encoder_si.h \ - trellis_encoder_ss.h \ - trellis_metrics_c.h \ - trellis_metrics_f.h \ - trellis_metrics_i.h \ - trellis_metrics_s.h \ - trellis_pccc_decoder_b.h \ - trellis_pccc_decoder_combined_cb.h \ - trellis_pccc_decoder_combined_ci.h \ - trellis_pccc_decoder_combined_cs.h \ - trellis_pccc_decoder_combined_fb.h \ - trellis_pccc_decoder_combined_fi.h \ - trellis_pccc_decoder_combined_fs.h \ - trellis_pccc_decoder_i.h \ - trellis_pccc_decoder_s.h \ - trellis_pccc_encoder_bb.h \ - trellis_pccc_encoder_bi.h \ - trellis_pccc_encoder_bs.h \ - trellis_pccc_encoder_ii.h \ - trellis_pccc_encoder_si.h \ - trellis_pccc_encoder_ss.h \ - trellis_sccc_decoder_b.h \ - trellis_sccc_decoder_combined_cb.h \ - trellis_sccc_decoder_combined_ci.h \ - trellis_sccc_decoder_combined_cs.h \ - trellis_sccc_decoder_combined_fb.h \ - trellis_sccc_decoder_combined_fi.h \ - trellis_sccc_decoder_combined_fs.h \ - trellis_sccc_decoder_i.h \ - trellis_sccc_decoder_s.h \ - trellis_sccc_encoder_bb.h \ - trellis_sccc_encoder_bi.h \ - trellis_sccc_encoder_bs.h \ - trellis_sccc_encoder_ii.h \ - trellis_sccc_encoder_si.h \ - trellis_sccc_encoder_ss.h \ - trellis_viterbi_b.h \ - trellis_viterbi_combined_cb.h \ - trellis_viterbi_combined_ci.h \ - trellis_viterbi_combined_cs.h \ - trellis_viterbi_combined_fb.h \ - trellis_viterbi_combined_fi.h \ - trellis_viterbi_combined_fs.h \ - trellis_viterbi_combined_ib.h \ - trellis_viterbi_combined_ii.h \ - trellis_viterbi_combined_is.h \ - trellis_viterbi_combined_sb.h \ - trellis_viterbi_combined_si.h \ - trellis_viterbi_combined_ss.h \ - trellis_viterbi_i.h \ - trellis_viterbi_s.h - -GENERATED_I = \ - trellis_encoder_bb.i \ - trellis_encoder_bi.i \ - trellis_encoder_bs.i \ - trellis_encoder_ii.i \ - trellis_encoder_si.i \ - trellis_encoder_ss.i \ - trellis_metrics_c.i \ - trellis_metrics_f.i \ - trellis_metrics_i.i \ - trellis_metrics_s.i \ - trellis_pccc_decoder_b.i \ - trellis_pccc_decoder_combined_cb.i \ - trellis_pccc_decoder_combined_ci.i \ - trellis_pccc_decoder_combined_cs.i \ - trellis_pccc_decoder_combined_fb.i \ - trellis_pccc_decoder_combined_fi.i \ - trellis_pccc_decoder_combined_fs.i \ - trellis_pccc_decoder_i.i \ - trellis_pccc_decoder_s.i \ - trellis_pccc_encoder_bb.i \ - trellis_pccc_encoder_bi.i \ - trellis_pccc_encoder_bs.i \ - trellis_pccc_encoder_ii.i \ - trellis_pccc_encoder_si.i \ - trellis_pccc_encoder_ss.i \ - trellis_sccc_decoder_b.i \ - trellis_sccc_decoder_combined_cb.i \ - trellis_sccc_decoder_combined_ci.i \ - trellis_sccc_decoder_combined_cs.i \ - trellis_sccc_decoder_combined_fb.i \ - trellis_sccc_decoder_combined_fi.i \ - trellis_sccc_decoder_combined_fs.i \ - trellis_sccc_decoder_i.i \ - trellis_sccc_decoder_s.i \ - trellis_sccc_encoder_bb.i \ - trellis_sccc_encoder_bi.i \ - trellis_sccc_encoder_bs.i \ - trellis_sccc_encoder_ii.i \ - trellis_sccc_encoder_si.i \ - trellis_sccc_encoder_ss.i \ - trellis_viterbi_b.i \ - trellis_viterbi_combined_cb.i \ - trellis_viterbi_combined_ci.i \ - trellis_viterbi_combined_cs.i \ - trellis_viterbi_combined_fb.i \ - trellis_viterbi_combined_fi.i \ - trellis_viterbi_combined_fs.i \ - trellis_viterbi_combined_ib.i \ - trellis_viterbi_combined_ii.i \ - trellis_viterbi_combined_is.i \ - trellis_viterbi_combined_sb.i \ - trellis_viterbi_combined_si.i \ - trellis_viterbi_combined_ss.i \ - trellis_viterbi_i.i \ - trellis_viterbi_s.i - -GENERATED_CC = \ - trellis_encoder_bb.cc \ - trellis_encoder_bi.cc \ - trellis_encoder_bs.cc \ - trellis_encoder_ii.cc \ - trellis_encoder_si.cc \ - trellis_encoder_ss.cc \ - trellis_metrics_c.cc \ - trellis_metrics_f.cc \ - trellis_metrics_i.cc \ - trellis_metrics_s.cc \ - trellis_pccc_decoder_b.cc \ - trellis_pccc_decoder_combined_cb.cc \ - trellis_pccc_decoder_combined_ci.cc \ - trellis_pccc_decoder_combined_cs.cc \ - trellis_pccc_decoder_combined_fb.cc \ - trellis_pccc_decoder_combined_fi.cc \ - trellis_pccc_decoder_combined_fs.cc \ - trellis_pccc_decoder_i.cc \ - trellis_pccc_decoder_s.cc \ - trellis_pccc_encoder_bb.cc \ - trellis_pccc_encoder_bi.cc \ - trellis_pccc_encoder_bs.cc \ - trellis_pccc_encoder_ii.cc \ - trellis_pccc_encoder_si.cc \ - trellis_pccc_encoder_ss.cc \ - trellis_sccc_decoder_b.cc \ - trellis_sccc_decoder_combined_cb.cc \ - trellis_sccc_decoder_combined_ci.cc \ - trellis_sccc_decoder_combined_cs.cc \ - trellis_sccc_decoder_combined_fb.cc \ - trellis_sccc_decoder_combined_fi.cc \ - trellis_sccc_decoder_combined_fs.cc \ - trellis_sccc_decoder_i.cc \ - trellis_sccc_decoder_s.cc \ - trellis_sccc_encoder_bb.cc \ - trellis_sccc_encoder_bi.cc \ - trellis_sccc_encoder_bs.cc \ - trellis_sccc_encoder_ii.cc \ - trellis_sccc_encoder_si.cc \ - trellis_sccc_encoder_ss.cc \ - trellis_viterbi_b.cc \ - trellis_viterbi_combined_cb.cc \ - trellis_viterbi_combined_ci.cc \ - trellis_viterbi_combined_cs.cc \ - trellis_viterbi_combined_fb.cc \ - trellis_viterbi_combined_fi.cc \ - trellis_viterbi_combined_fs.cc \ - trellis_viterbi_combined_ib.cc \ - trellis_viterbi_combined_ii.cc \ - trellis_viterbi_combined_is.cc \ - trellis_viterbi_combined_sb.cc \ - trellis_viterbi_combined_si.cc \ - trellis_viterbi_combined_ss.cc \ - trellis_viterbi_i.cc \ - trellis_viterbi_s.cc - diff --git a/gr-trellis/src/lib/base.cc b/gr-trellis/src/lib/base.cc deleted file mode 100644 index 002c964cd..000000000 --- a/gr-trellis/src/lib/base.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdio> -#include <stdexcept> -#include <cmath> -#include "base.h" - - -bool dec2base(unsigned int num, int base, std::vector<int> &s) -{ - int l = s.size(); - unsigned int n=num; - for(int i=0;i<l;i++) { - s[l-i-1] = n % base; //MSB first - n /= base; - } - if(n!=0) { - printf("Number %d requires more than %d digits.",num,l); - return false; - } - else - return true; -} - - -unsigned int base2dec(const std::vector<int> &s, int base) -{ - int l = s.size(); - unsigned int num=0; - for(int i=0;i<l;i++) - num=num*base+s[i]; - return num; -} - - -bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s) -{ - int l = s.size(); - unsigned int n=num; - for(int i=0;i<l;i++) { - s[l-i-1] = n % bases[l-i-1]; - n /= bases[l-i-1]; - } - if(n!=0) { - printf("Number %d requires more than %d digits.",num,l); - return false; - } - else - return true; -} - - - -unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases) -{ - int l = s.size(); - unsigned int num=0; - for(int i=0;i<l;i++) - num = num * bases[i] + s[i]; - return num; -} - - - - - - - - - - - diff --git a/gr-trellis/src/lib/base.h b/gr-trellis/src/lib/base.h deleted file mode 100644 index aa407cbec..000000000 --- a/gr-trellis/src/lib/base.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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> - -/*! - * \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); - -#endif diff --git a/gr-trellis/src/lib/calc_metric.cc b/gr-trellis/src/lib/calc_metric.cc deleted file mode 100644 index ce628209b..000000000 --- a/gr-trellis/src/lib/calc_metric.cc +++ /dev/null @@ -1,250 +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. - */ - -#include <float.h> -#include <stdexcept> -#include "calc_metric.h" - - - -template <class T> -void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - T s=in[m]-TABLE[o*D+m]; - //gr_complex sc(1.0*s,0); - //metric[o]+=(sc*conj(sc)).real(); - metric[o]+= s * s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - T s=in[m]-TABLE[o*D+m]; - //gr_complex sc(1.0*s,0); - //metric[o]+=(sc*conj(sc)).real(); - metric[o]+= s * s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - - -template -void calc_metric<short>(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type); - -template -void calc_metric<int>(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type); - -template -void calc_metric<float>(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type); - - -/* -void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - -void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} - - - -void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - float s=in[m]-TABLE[o*D+m]; - metric[o]+=s*s; - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} -*/ - - - - - -void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type) -{ - float minm = FLT_MAX; - int minmi = 0; - - - switch (type){ - case TRELLIS_EUCLIDEAN: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - gr_complex s=in[m]-TABLE[o*D+m]; - metric[o]+=s.real()*s.real()+s.imag()*s.imag(); - } - } - break; - case TRELLIS_HARD_SYMBOL: - for(int o=0;o<O;o++) { - metric[o]=0.0; - for (int m=0;m<D;m++) { - gr_complex s=in[m]-TABLE[o*D+m]; - metric[o]+=s.real()*s.real()+s.imag()*s.imag(); - } - if(metric[o]<minm) { - minm=metric[o]; - minmi=o; - } - } - for(int o=0;o<O;o++) { - metric[o] = (o==minmi?0.0:1.0); - } - break; - case TRELLIS_HARD_BIT: - throw std::runtime_error ("Invalid metric type (not yet implemented)."); - break; - default: - throw std::runtime_error ("Invalid metric type."); - } -} diff --git a/gr-trellis/src/lib/calc_metric.h b/gr-trellis/src/lib/calc_metric.h deleted file mode 100644 index 7cad6160a..000000000 --- a/gr-trellis/src/lib/calc_metric.h +++ /dev/null @@ -1,46 +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_CALC_METRIC_H -#define INCLUDED_CALC_METRIC_H - -#include <vector> -#include <gr_complex.h> -#include <digital_metric_type.h> - - -template <class T> -void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in, float *metric, trellis_metric_type_t type); - -/* -void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, trellis_metric_type_t type); - -void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, trellis_metric_type_t type); - -void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, trellis_metric_type_t type); -*/ - -void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in, float *metric, trellis_metric_type_t type); - - - -#endif diff --git a/gr-trellis/src/lib/core_algorithms.cc b/gr-trellis/src/lib/core_algorithms.cc deleted file mode 100644 index 3ed912c08..000000000 --- a/gr-trellis/src/lib/core_algorithms.cc +++ /dev/null @@ -1,1437 +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. - */ - -#include <cstring> -#include <stdexcept> -//#include <cstdio> -#include <iostream> -#include "core_algorithms.h" -#include "calc_metric.h" - -static const float INF = 1.0e9; - -float min(float a, float b) -{ - return a <= b ? a : b; -} - -float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - - - - -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)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (T) PI[st][i0]; - st=PS[st][i0]; - } - -} - - -template -void viterbi_algorithm<unsigned char>(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, unsigned char *out); - - -template -void viterbi_algorithm<short>(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, short *out); - -template -void viterbi_algorithm<int>(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, int *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, - trellis_metric_type_t TYPE, - const Ti *in, To *out -) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (To) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - -// Ti = s i f c -// To = b s i - -//--------------- - -template -void viterbi_algorithm_combined<short,unsigned char>(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<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<int,unsigned char>(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<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<float,unsigned char>(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<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, unsigned char *out -); - -template -void viterbi_algorithm_combined<gr_complex,unsigned char>(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<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, unsigned char *out -); - -//--------------- - -template -void viterbi_algorithm_combined<short,short>(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<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, short *out -); - -template -void viterbi_algorithm_combined<int,short>(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<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, short *out -); - -template -void viterbi_algorithm_combined<float,short>(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<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, short *out -); - -template -void viterbi_algorithm_combined<gr_complex,short>(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<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, short *out -); - -//-------------- - -template -void viterbi_algorithm_combined<short,int>(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<short> &TABLE, - trellis_metric_type_t TYPE, - const short *in, int *out -); - -template -void viterbi_algorithm_combined<int,int>(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<int> &TABLE, - trellis_metric_type_t TYPE, - const int *in, int *out -); - -template -void viterbi_algorithm_combined<float,int>(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<float> &TABLE, - trellis_metric_type_t TYPE, - const float *in, int *out -); - -template -void viterbi_algorithm_combined<gr_complex,int>(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<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const gr_complex *in, int *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//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - -if (POSTI && POSTO) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } -} -else if(POSTI) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } -} -else if(POSTO) -{ - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } -} -else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - -} - - -//=========================================================== - -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, - trellis_metric_type_t TYPE, - const float *priori, const T *observations, float *post -) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - float *prioro = new float[O*K]; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - - if (POSTI && POSTO) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } - } - else if(POSTI) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } - } - else if(POSTO) - { - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } - } - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - delete [] prioro; - -} - -//--------- - -template -void siso_algorithm_combined<short>(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<short> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const short *observations, float *post -); - -template -void siso_algorithm_combined<int>(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<int> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const int *observations, float *post -); - -template -void siso_algorithm_combined<float>(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<float> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const float *observations, float *post -); - -template -void siso_algorithm_combined<gr_complex>(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<gr_complex> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const gr_complex *observations, float *post -); - -//========================================================= - -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, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -) -{ - -//allocate space for priori, prioro and posti of inner FSM -std::vector<float> ipriori(blocklength*FSMi.I(),0.0); -std::vector<float> iprioro(blocklength*FSMi.O()); -std::vector<float> iposti(blocklength*FSMi.I()); - -//allocate space for priori, prioro and posto of outer FSM -std::vector<float> opriori(blocklength*FSMo.I(),0.0); -std::vector<float> oprioro(blocklength*FSMo.O()); -std::vector<float> oposti(blocklength*FSMo.I()); -std::vector<float> oposto(blocklength*FSMo.O()); - -// turn observations to neg-log-priors -for(int k=0;k<blocklength;k++) { - calc_metric(FSMi.O(), D, TABLE, &(observations[k*D]), &(iprioro[k*FSMi.O()]),METRIC_TYPE); - iprioro[k*FSMi.O()] *= scaling; -} - -for(int rep=0;rep<iterations;rep++) { - // run inner SISO - siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), - FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), - blocklength, - STi0,STiK, - true, false, - p2mymin, - &(ipriori[0]), &(iprioro[0]), &(iposti[0]) - ); - - //interleave soft info inner -> outer - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float)); - } - - // run outer SISO - - if(rep<iterations-1) { // do not produce posti - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - false, true, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposto[0]) - ); - - //interleave soft info outer --> inner - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float)); - } - } - else // produce posti but not posto - - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - true, false, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposti[0]) - ); - - /* - viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - &(oprioro[0]), data - ); - */ - -} - - -// generate hard decisions -for(int k=0;k<blocklength;k++) { - float min=INF; - int mini=0; - for(int i=0;i<FSMo.I();i++) { - if(oposti[k*FSMo.I()+i]<min) { - min=oposti[k*FSMo.I()+i]; - mini=i; - } - } - data[k]=(To)mini; -} - - - -} - -//------- - -template -void sccc_decoder_combined<float,unsigned char>( - 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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, unsigned char *data -); - -template -void sccc_decoder_combined<float,short>( - 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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, short *data -); - -template -void sccc_decoder_combined<float,int>( - 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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, int *data -); - -template -void sccc_decoder_combined<gr_complex,unsigned char>( - 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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, unsigned char *data -); - -template -void sccc_decoder_combined<gr_complex,short>( - 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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, short *data -); - -template -void sccc_decoder_combined<gr_complex,int>( - 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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, int *data -); - - - -//========================================================= - -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 -) -{ - //allocate space for priori, and posti of inner FSM - std::vector<float> ipriori(blocklength*FSMi.I(),0.0); - std::vector<float> iposti(blocklength*FSMi.I()); - - //allocate space for priori, prioro and posto of outer FSM - std::vector<float> opriori(blocklength*FSMo.I(),0.0); - std::vector<float> oprioro(blocklength*FSMo.O()); - std::vector<float> oposti(blocklength*FSMo.I()); - std::vector<float> oposto(blocklength*FSMo.O()); - - for(int rep=0;rep<iterations;rep++) { - // run inner SISO - siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(), - FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(), - blocklength, - STi0,STiK, - true, false, - p2mymin, - &(ipriori[0]), &(iprioro[0]), &(iposti[0]) - ); - - //interleave soft info inner -> outer - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float)); - } - - // run outer SISO - - if(rep<iterations-1) { // do not produce posti - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - false, true, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposto[0]) - ); - - //interleave soft info outer --> inner - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.DEINTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float)); - } - } - else {// produce posti but not posto - - siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - true, false, - p2mymin, - &(opriori[0]), &(oprioro[0]), &(oposti[0]) - ); - - /* - viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(), - FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(), - blocklength, - STo0,SToK, - &(oprioro[0]), data - ); - */ - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - float min=INF; - int mini=0; - for(int i=0;i<FSMo.I();i++) { - if(oposti[k*FSMo.I()+i]<min) { - min=oposti[k*FSMo.I()+i]; - mini=i; - } - } - data[k]=(T)mini; - } - - - -} - -//------- - -template -void sccc_decoder<unsigned char>( - 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, unsigned char *data -); - -template -void sccc_decoder<short>( - 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, short *data -); - -template -void sccc_decoder<int>( - 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, int *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 -) -{ - - //allocate space for priori, prioro and posti of FSM1 - std::vector<float> priori1(blocklength*FSM1.I(),0.0); - std::vector<float> prioro1(blocklength*FSM1.O()); - std::vector<float> posti1(blocklength*FSM1.I()); - - //allocate space for priori, prioro and posti of FSM2 - std::vector<float> priori2(blocklength*FSM2.I(),0.0); - std::vector<float> prioro2(blocklength*FSM2.O()); - std::vector<float> posti2(blocklength*FSM2.I()); - - //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...) - for (int k=0;k<blocklength;k++) { - //std::cout << k << std::endl; - for(int i=0;i<FSM1.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0]; - for(int j=1;j<FSM2.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]); - prioro1[k*FSM1.O()+i]=x; - //std::cout << prioro1[k*FSM1.O()+i] << ", "; - } - //std::cout << std::endl; - for(int i=0;i<FSM2.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i]; - for(int j=1;j<FSM1.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]); - prioro2[k*FSM2.O()+i]=x; - } - } - - for(int rep=0;rep<iterations;rep++) { - // run SISO 1 - siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), - FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), - blocklength, - ST10,ST1K, - true, false, - p2mymin, - &(priori1[0]), &(prioro1[0]), &(posti1[0]) - ); - - //for(int k=0;k<blocklength;k++){ - //for(int i=0;i<FSM1.I();i++) - //std::cout << posti1[k*FSM1.I()+i] << ", "; - //std::cout << std::endl; - //} - - //interleave soft info 1 -> 2 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float)); - } - - // run SISO 2 - siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(), - FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(), - blocklength, - ST20,ST2K, - true, false, - p2mymin, - &(priori2[0]), &(prioro2[0]), &(posti2[0]) - ); - - //interleave soft info 2 --> 1 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - for(int i=0;i<FSM1.I();i++) - posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]); - float min=INF; - int mini=0; - for(int i=0;i<FSM1.I();i++) { - if(posti1[k*FSM1.I()+i]<min) { - min=posti1[k*FSM1.I()+i]; - mini=i; - } - } - data[k]=(T)mini; - //std::cout << data[k] << ", "<< std::endl; - } - //std::cout << std::endl; - -} - -//---------------- - -template -void pccc_decoder<unsigned char>( - 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, unsigned char *data -); - -template -void pccc_decoder<short>( - 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, short *data -); - -template -void pccc_decoder<int>( - 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, int *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, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -) -{ - - //allocate space for cprioro - std::vector<float> cprioro(blocklength*FSM1.O()*FSM2.O(),0.0); - - //allocate space for priori, prioro and posti of FSM1 - std::vector<float> priori1(blocklength*FSM1.I(),0.0); - std::vector<float> prioro1(blocklength*FSM1.O()); - std::vector<float> posti1(blocklength*FSM1.I()); - - //allocate space for priori, prioro and posti of FSM2 - std::vector<float> priori2(blocklength*FSM2.I(),0.0); - std::vector<float> prioro2(blocklength*FSM2.O()); - std::vector<float> posti2(blocklength*FSM2.I()); - - // turn observations to neg-log-priors for cprioiro - int O=FSM1.O()*FSM2.O(); - for(int k=0;k<blocklength;k++) { - calc_metric(O, D, TABLE, &(observations[k*D]), &(cprioro[k*O]),METRIC_TYPE); - cprioro[k*O] *= scaling; - } - - //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...) - for (int k=0;k<blocklength;k++) { - //std::cout << k << std::endl; - for(int i=0;i<FSM1.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0]; - for(int j=1;j<FSM2.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]); - prioro1[k*FSM1.O()+i]=x; - //std::cout << prioro1[k*FSM1.O()+i] << ", "; - } - //std::cout << std::endl; - for(int i=0;i<FSM2.O();i++) { - float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i]; - for(int j=1;j<FSM1.O();j++) - x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]); - prioro2[k*FSM2.O()+i]=x; - } - } - - for(int rep=0;rep<iterations;rep++) { - // run SISO 1 - siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(), - FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(), - blocklength, - ST10,ST1K, - true, false, - p2mymin, - &(priori1[0]), &(prioro1[0]), &(posti1[0]) - ); - - //for(int k=0;k<blocklength;k++){ - //for(int i=0;i<FSM1.I();i++) - //std::cout << posti1[k*FSM1.I()+i] << ", "; - //std::cout << std::endl; - //} - - //interleave soft info 1 -> 2 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i]; - //} - memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float)); - } - - // run SISO 2 - siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(), - FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(), - blocklength, - ST20,ST2K, - true, false, - p2mymin, - &(priori2[0]), &(prioro2[0]), &(posti2[0]) - ); - - //interleave soft info 2 --> 1 - for(int k=0;k<blocklength;k++) { - int ki = INTERLEAVER.INTER()[k]; - //for(int i=0;i<FSMi.I();i++) { - //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i]; - //} - memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float)); - } - - } // end iterations - - // generate hard decisions - for(int k=0;k<blocklength;k++) { - for(int i=0;i<FSM1.I();i++) - posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]); - float min=INF; - int mini=0; - for(int i=0;i<FSM1.I();i++) { - if(posti1[k*FSM1.I()+i]<min) { - min=posti1[k*FSM1.I()+i]; - mini=i; - } - } - data[k]=(To)mini; - //std::cout << data[k] << ", "<< std::endl; - } - //std::cout << std::endl; - -} - - -template -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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, unsigned char *data -); - - -template -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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, short *data -); - - -template -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<float> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const float *observations, int *data -); - - -template -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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, unsigned char *data -); - - -template -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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, short *data -); - - -template -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<gr_complex> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const gr_complex *observations, int *data -); diff --git a/gr-trellis/src/lib/core_algorithms.h b/gr-trellis/src/lib/core_algorithms.h deleted file mode 100644 index a8765225b..000000000 --- a/gr-trellis/src/lib/core_algorithms.h +++ /dev/null @@ -1,140 +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_CORE_ALGORITHMS_H -#define INCLUDED_CORE_ALGORITHMS_H - -#include <cmath> -#include <vector> -//#include <gr_complex.h> -#include "digital_metric_type.h" -#include "fsm.h" -#include "interleaver.h" - - -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, - 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, - 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, - 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, - trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data -); - - - - -#endif diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc deleted file mode 100644 index fb2b4d2c9..000000000 --- a/gr-trellis/src/lib/fsm.cc +++ /dev/null @@ -1,548 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdio> -#include <string> -#include <iostream> -#include <fstream> -#include <stdexcept> -#include <cmath> -#include <stdlib.h> -#include "base.h" -#include "fsm.h" - - -fsm::fsm() -{ - d_I=0; - d_S=0; - d_O=0; - d_NS.resize(0); - d_OS.resize(0); - d_PS.resize(0); - d_PI.resize(0); - d_TMi.resize(0); - d_TMl.resize(0); -} - -fsm::fsm(const fsm &FSM) -{ - d_I=FSM.I(); - d_S=FSM.S(); - d_O=FSM.O(); - d_NS=FSM.NS(); - d_OS=FSM.OS(); - d_PS=FSM.PS(); // is this going to make a deep copy? - d_PI=FSM.PI(); - d_TMi=FSM.TMi(); - d_TMl=FSM.TMl(); -} - -fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS) -{ - d_I=I; - d_S=S; - d_O=O; - d_NS=NS; - d_OS=OS; - - generate_PS_PI(); - generate_TM(); -} - -//###################################################################### -//# Read an FSM specification from a file. -//# Format (hopefully will become more flexible in the future...): -//# I S O (in the first line) -//# blank line -//# Next state matrix (S lines, each with I integers separated by spaces) -//# blank line -//# output symbol matrix (S lines, each with I integers separated by spaces) -//# optional comments -//###################################################################### -fsm::fsm(const char *name) -{ - FILE *fsmfile; - - if((fsmfile=fopen(name,"r"))==NULL) - throw std::runtime_error ("fsm::fsm(const char *name): file open error\n"); - //printf("file open error in fsm()\n"); - - if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) { - if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - } - } - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) { - if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) { - if(ferror(fsmfile) != 0) - throw std::runtime_error ("fsm::fsm(const char *name): file read error\n"); - } - } - } - - fclose(fsmfile); - - generate_PS_PI(); - generate_TM(); -} - - - -//###################################################################### -//# Automatically generate the FSM from the generator matrix -//# of a (n,k) binary convolutional code -//###################################################################### -fsm::fsm(int k, int n, const std::vector<int> &G) -{ - - // calculate maximum memory requirements for each input stream - std::vector<int> max_mem_x(k,-1); - int max_mem = -1; - for(int i=0;i<k;i++) { - for(int j=0;j<n;j++) { - int mem = -1; - if(G[i*n+j]!=0) - mem=(int)(log(double(G[i*n+j]))/log(2.0)); - if(mem>max_mem_x[i]) - max_mem_x[i]=mem; - if(mem>max_mem) - max_mem=mem; - } - } - -//printf("max_mem_x\n"); -//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n"); - - // calculate total memory requirements to set S - int sum_max_mem = 0; - for(int i=0;i<k;i++) - sum_max_mem += max_mem_x[i]; - -//printf("sum_max_mem = %d\n",sum_max_mem); - - d_I=1<<k; - d_S=1<<sum_max_mem; - d_O=1<<n; - - // binary representation of the G matrix - std::vector<std::vector<int> > Gb(k*n); - for(int j=0;j<k*n;j++) { - Gb[j].resize(max_mem+1); - dec2base(G[j],2,Gb[j]); -//printf("Gb\n"); -//for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n"); - } - - // alphabet size of each shift register - std::vector<int> bases_x(k); - for(int j=0;j<k ;j++) - bases_x[j] = 1 << max_mem_x[j]; -//printf("bases_x\n"); -//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n"); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - std::vector<int> sx(k); - std::vector<int> nsx(k); - std::vector<int> tx(k); - std::vector<std::vector<int> > tb(k); - for(int j=0;j<k;j++) - tb[j].resize(max_mem+1); - std::vector<int> inb(k); - std::vector<int> outb(n); - - - for(int s=0;s<d_S;s++) { - dec2bases(s,bases_x,sx); // split s into k values, each representing one of the k shift registers -//printf("state = %d \nstates = ",s); -//for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n"); - for(int i=0;i<d_I;i++) { - dec2base(i,2,inb); // input in binary -//printf("input = %d \ninputs = ",i); -//for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n"); - - // evaluate next state - for(int j=0;j<k;j++) - nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift register) MSB first - d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new state - - // evaluate transitions - for(int j=0;j<k;j++) - tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift register)MSB first - for(int j=0;j<k;j++) { - dec2base(tx[j],2,tb[j]); // transition in binary -//printf("transition = %d \ntransitions = ",tx[j]); -//for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n"); - } - - // evaluate outputs - for(int nn=0;nn<n;nn++) { - outb[nn] = 0; - for(int j=0;j<k;j++) { - for(int m=0;m<max_mem+1;m++) - outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: polynomial 1+D ir represented as 110, not as 011 -//printf("output %d equals %d\n",nn,outb[nn]); - } - } - d_OS[s*d_I+i] = base2dec(outb,2); - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# ISI for a channel -//# of length ch_length and a modulation of size mod_size -//###################################################################### -fsm::fsm(int mod_size, int ch_length) -{ - d_I=mod_size; - d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5); - d_O=d_S*d_I; - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int t=i*d_S+s; - d_NS[s*d_I+i] = t/d_I; - d_OS[s*d_I+i] = t; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# the trellis for a CPM with h=K/P (relatively prime), -//# alphabet size M, and frequency pulse duration L symbols -//# -//# 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::fsm(int P, int M, int L) -{ - d_I=M; - d_S=(int)(pow(1.0*M,1.0*L-1)+0.5)*P; - d_O=(int)(pow(1.0*M,1.0*L)+0.5)*P; - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - int nv; - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int s1=s/P; - int v=s%P; - int ns1= (i*(int)(pow(1.0*M,1.0*(L-1))+0.5)+s1)/M; - if (L==1) - nv=(i+v)%P; - else - nv=(s1%M+v)%P; - d_NS[s*d_I+i] = ns1*P+nv; - d_OS[s*d_I+i] = i*d_S+s; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - - - - - - - -//###################################################################### -//# Automatically generate an FSM specification describing the -//# the joint trellis of fsm1 and fsm2 -//###################################################################### -fsm::fsm(const fsm &FSM1, const fsm &FSM2) -{ - d_I=FSM1.I()*FSM2.I(); - d_S=FSM1.S()*FSM2.S(); - d_O=FSM1.O()*FSM2.O(); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++) { - for(int i=0;i<d_I;i++) { - int s1=s/FSM2.S(); - int s2=s%FSM2.S(); - int i1=i/FSM2.I(); - int i2=i%FSM2.I(); - d_NS[s*d_I+i] = FSM1.NS()[s1 * FSM1.I() + i1] * FSM2.S() + FSM2.NS()[s2 * FSM2.I() + i2]; - d_OS[s*d_I+i] = FSM1.OS()[s1 * FSM1.I() + i1] * FSM2.O() + FSM2.OS()[s2 * FSM2.I() + i2]; - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - -//###################################################################### -//# Generate a new FSM representing n stages through the original FSM -//# AKA radix-n FSM -//###################################################################### -fsm::fsm(const fsm &FSM, int n) -{ - d_I=(int) (pow(1.0*FSM.I(),1.0*n)+0.5); - d_S=FSM.S(); - d_O=(int) (pow(1.0*FSM.O(),1.0*n)+0.5); - - d_NS.resize(d_I*d_S); - d_OS.resize(d_I*d_S); - - for(int s=0;s<d_S;s++ ) { - for(int i=0;i<d_I;i++ ) { - std::vector<int> ii(n); - dec2base(i,FSM.I(),ii); - std::vector<int> oo(n); - int ns=s; - for(int k=0;k<n;k++) { - oo[k]=FSM.OS()[ns*FSM.I()+ii[k]]; - ns=FSM.NS()[ns*FSM.I()+ii[k]]; - } - d_NS[s*d_I+i]=ns; - d_OS[s*d_I+i]=base2dec(oo,FSM.O()); - } - } - - generate_PS_PI(); - generate_TM(); -} - - - - - - - - - -//###################################################################### -//# generate the PS and PI tables for later use -//###################################################################### -void fsm::generate_PS_PI() -{ - d_PS.resize(d_S); - d_PI.resize(d_S); - - for(int i=0;i<d_S;i++) { - d_PS[i].resize(d_I*d_S); // max possible size - d_PI[i].resize(d_I*d_S); - int j=0; - for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) { - if(d_NS[ii*d_I+jj]!=i) continue; - d_PS[i][j]=ii; - d_PI[i][j]=jj; - j++; - } - d_PS[i].resize(j); - d_PI[i].resize(j); - } -} - - -//###################################################################### -//# generate the termination matrices TMl and TMi for later use -//###################################################################### -void fsm::generate_TM() -{ - d_TMi.resize(d_S*d_S); - d_TMl.resize(d_S*d_S); - - for(int i=0;i<d_S*d_S;i++) { - d_TMi[i] = -1; // no meaning - d_TMl[i] = d_S; //infinity: you need at most S-1 steps - if (i/d_S == i%d_S) - d_TMl[i] = 0; - } - - for(int s=0;s<d_S;s++) { - bool done = false; - int attempts = 0; - while (done == false && attempts < d_S-1) { - done = find_es(s); - attempts ++; - } - if (done == false && d_S > 1) { - //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be disconnected\n"); - printf("fsm::generate_TM(): FSM appears to be disconnected\n"); - printf("state %d cannot be reached from all other states\n",s); - } - } -} - - -// find a path from any state to the ending state "es" -bool fsm::find_es(int es) -{ - bool done = true; - for(int s=0;s<d_S;s++) { - if(d_TMl[s*d_S+es] < d_S) - continue; - int minl=d_S; - int mini=-1; - for(int i=0;i<d_I;i++) { - if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) { - minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es]; - mini = i; - } - } - if (mini != -1) { - d_TMl[s*d_S+es]=minl; - d_TMi[s*d_S+es]=mini; - } - else - done = false; - } - return done; -} - - - - - -//###################################################################### -//# generate trellis representation of FSM as an SVG file -//###################################################################### -void fsm::write_trellis_svg( std::string filename ,int number_stages) -{ - std::ofstream trellis_fname (filename.c_str()); - if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - const int TRELLIS_Y_OFFSET = 30; - const int TRELLIS_X_OFFSET = 20; - const int STAGE_LABEL_Y_OFFSET = 25; - const int STAGE_LABEL_X_OFFSET = 20; - const int STATE_LABEL_Y_OFFSET = 30; - const int STATE_LABEL_X_OFFSET = 5; - const int STAGE_STATE_OFFSETS = 10; -// std::cout << "################## BEGIN SVG TRELLIS PIC #####################" << std::endl; - trellis_fname << "<svg viewBox = \"0 0 200 200\" version = \"1.1\">" << std::endl; - - for( int stage_num = 0;stage_num < number_stages;stage_num ++){ - // draw states - for ( int state_num = 0;state_num < d_S ; state_num ++ ) { - trellis_fname << "<circle cx = \"" << stage_num * STAGE_STATE_OFFSETS + TRELLIS_X_OFFSET << - "\" cy = \"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" r = \"1\"/>" << std::endl; - //draw branches - if(stage_num != number_stages-1){ - for( int branch_num = 0;branch_num < d_I; branch_num++){ - trellis_fname << "<line x1 =\"" << STAGE_STATE_OFFSETS * stage_num+ TRELLIS_X_OFFSET << "\" "; - trellis_fname << "y1 =\"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET<< "\" "; - trellis_fname << "x2 =\"" << STAGE_STATE_OFFSETS *stage_num + STAGE_STATE_OFFSETS+ TRELLIS_X_OFFSET << "\" "; - trellis_fname << "y2 =\"" << d_NS[d_I * state_num + branch_num] * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" "; - trellis_fname << " stroke-dasharray = \"3," << branch_num << "\" "; - trellis_fname << " stroke = \"black\" stroke-width = \"0.3\"/>" << std::endl; - } - } - } - } - // label the stages - trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl; - for( int stage_num = 0;stage_num < number_stages ;stage_num ++){ - trellis_fname << "<text x = \"" << stage_num * STAGE_STATE_OFFSETS + STAGE_LABEL_X_OFFSET << - "\" y = \"" << STAGE_LABEL_Y_OFFSET << "\" >" << std::endl; - trellis_fname << stage_num << std::endl; - trellis_fname << "</text>" << std::endl; - } - trellis_fname << "</g>" << std::endl; - - // label the states - trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl; - for( int state_num = 0;state_num < d_S ; state_num ++){ - trellis_fname << "<text y = \"" << state_num * STAGE_STATE_OFFSETS + STATE_LABEL_Y_OFFSET << - "\" x = \"" << STATE_LABEL_X_OFFSET << "\" >" << std::endl; - trellis_fname << state_num << std::endl; - trellis_fname << "</text>" << std::endl; - } - trellis_fname << "</g>" << std::endl; - - - trellis_fname << "</svg>" << std::endl; -// std::cout << "################## END SVG TRELLIS PIC ##################### " << std::endl; - trellis_fname.close(); -} - - - - - - -//###################################################################### -//# Write trellis specification to a text file, -//# in the same format used when reading FSM files -//###################################################################### -void fsm::write_fsm_txt(std::string filename) -{ - std::ofstream trellis_fname (filename.c_str()); - if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - trellis_fname << d_I << ' ' << d_S << ' ' << d_O << std::endl; - trellis_fname << std::endl; - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) trellis_fname << d_NS[i*d_I+j] << ' '; - trellis_fname << std::endl; - } - trellis_fname << std::endl; - for(int i=0;i<d_S;i++) { - for(int j=0;j<d_I;j++) trellis_fname << d_OS[i*d_I+j] << ' '; - trellis_fname << std::endl; - } - trellis_fname << std::endl; - trellis_fname.close(); -} - diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h deleted file mode 100644 index 47e467898..000000000 --- a/gr-trellis/src/lib/fsm.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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_FSM_H -#define INCLUDED_TRELLIS_FSM_H - -#include <trellis_api.h> -#include <vector> -#include <iosfwd> - -/*! - * \brief Finite State Machine Specification class. - * - * 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); -}; - -#endif diff --git a/gr-trellis/src/lib/fsm.i b/gr-trellis/src/lib/fsm.i deleted file mode 100644 index 1e9c7ad8f..000000000 --- a/gr-trellis/src/lib/fsm.i +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -class fsm { -private: - int d_I; - int d_S; - int d_O; - std::vector<int> d_NS; - std::vector<int> d_OS; - std::vector< std::vector<int> > d_PS; - std::vector< std::vector<int> > d_PI; - std::vector<int> d_TMi; - std::vector<int> d_TMl; - void generate_PS_PI (); - void generate_TM (); -public: - fsm(); - fsm(const fsm &FSM); - fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS); - fsm(const char *name); - fsm(int k, int n, const std::vector<int> &G); - fsm(int mod_size, int ch_length); - fsm(int P, int M, int L); - fsm(const fsm &FSM1, const fsm &FSM2); - 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; } - // disable these accessors until we find out how to swig them - //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; } - void fsm::write_trellis_svg(std::string filename ,int number_stages); - void fsm::write_fsm_txt(std::string filename); -}; - diff --git a/gr-trellis/src/lib/generate_all.py b/gr-trellis/src/lib/generate_all.py deleted file mode 100644 index 78e36270c..000000000 --- a/gr-trellis/src/lib/generate_all.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,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 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. -# - -from build_utils import output_glue - -import generate_trellis - -def generate_all (): - generate_trellis.generate () - output_glue ('trellis') - -if __name__ == '__main__': - generate_all () diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py deleted file mode 100644 index 60a81f77a..000000000 --- a/gr-trellis/src/lib/generate_trellis.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,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 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. -# - -from build_utils import expand_template, copyright, open_and_log_name -from build_utils_codes import * -import re - -# regular blocks - -other_roots = [ - 'trellis_encoder_XX', - 'trellis_sccc_encoder_XX', - 'trellis_pccc_encoder_XX', - 'trellis_metrics_X', - 'trellis_viterbi_X', - 'trellis_viterbi_combined_XX', - 'trellis_sccc_decoder_X', - 'trellis_sccc_decoder_combined_XX', - 'trellis_pccc_decoder_X', - 'trellis_pccc_decoder_combined_XX', - ] - -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'], - ['b','s','i'], - ['fb','fs','fi','cb','cs','ci'], - ['b','s','i'], - ['fb','fs','fi','cb','cs','ci'], - ) - - -def is_byte (code3): - if i_code (code3) == 'b' or o_code (code3) == 'b': - return '1' - else: - return '0' - - -def is_short (code3): - if i_code (code3) == 's' or o_code (code3) == 's': - return '1' - else: - return '0' - - -def is_int (code3): - if i_code (code3) == 'i' or o_code (code3) == 'i': - return '1' - else: - return '0' - - -def is_float (code3): - if i_code (code3) == 'f' or o_code (code3) == 'f': - return '1' - else: - return '0' - - -def is_complex (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c': - return '1' - else: - return '0' - - -def standard_dict (name, code3): - d = {} - d['NAME'] = name - d['GUARD_NAME'] = 'INCLUDED_%s_H' % name.upper () - d['BASE_NAME'] = re.sub ('^trellis_', '', name) - d['SPTR_NAME'] = '%s_sptr' % name - d['WARNING'] = 'WARNING: this file is machine generated. Edits will be over written' - d['COPYRIGHT'] = copyright - d['TYPE'] = i_type (code3) - d['I_TYPE'] = i_type (code3) - d['O_TYPE'] = o_type (code3) - d['TAP_TYPE'] = tap_type (code3) - d['IS_BYTE'] = is_byte (code3) - d['IS_SHORT'] = is_short (code3) - d['IS_INT'] = is_int (code3) - d['IS_FLOAT'] = is_float (code3) - d['IS_COMPLEX'] = is_complex (code3) - return d - - -def expand_h_cc_i (root, sig): - # root looks like 'gr_vector_sink_X' - name = re.sub ('X+', sig, root) - d = standard_dict (name, sig) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - - -def generate (): - i=0 - for r in other_roots : - for s in other_signatures[i]: - expand_h_cc_i (r, s) - i=i+1 - - -if __name__ == '__main__': - generate () diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc deleted file mode 100644 index 740f33ab3..000000000 --- a/gr-trellis/src/lib/interleaver.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -#include <cstdlib> -#include <cstdio> -#include <iostream> -#include <string> -#include <fstream> -#include <stdexcept> -#include <cmath> -#include "quicksort_index.h" -#include "interleaver.h" - - - - -interleaver::interleaver() -{ - d_K=0; - d_INTER.resize(0); - d_DEINTER.resize(0); -} - -interleaver::interleaver(const interleaver &INTERLEAVER) -{ - d_K=INTERLEAVER.K(); - d_INTER=INTERLEAVER.INTER(); - d_DEINTER=INTERLEAVER.DEINTER(); -} - -interleaver::interleaver(int K, const std::vector<int> &INTER) -{ - d_K=K; - d_INTER=INTER; - d_DEINTER.resize(d_K); - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - -//###################################################################### -//# Read an INTERLEAVER specification from a file. -//# Format (hopefully will become more flexible in the future...): -//# K -//# blank line -//# list of space separated K integers from 0 to K-1 in appropriate order -//# optional comments -//###################################################################### -interleaver::interleaver(const char *name) -{ - FILE *interleaverfile; - - if((interleaverfile=fopen(name,"r"))==NULL) - throw std::runtime_error ("file open error in interleaver()"); - //printf("file open error in interleaver()\n"); - - if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) { - if(ferror(interleaverfile) != 0) - throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); - } - - d_INTER.resize(d_K); - d_DEINTER.resize(d_K); - - for(int i=0;i<d_K;i++) { - if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) { - if(ferror(interleaverfile) != 0) - throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n"); - } - } - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - -//###################################################################### -//# Generate a random interleaver -//###################################################################### -interleaver::interleaver(int K, int seed) -{ - d_K=K; - d_INTER.resize(d_K); - d_DEINTER.resize(d_K); - - if(seed>=0) srand((unsigned int)seed); - std::vector<int> tmp(d_K); - for(int i=0;i<d_K;i++) { - d_INTER[i]=i; - tmp[i] = rand(); - } - quicksort_index <int> (tmp,d_INTER,0,d_K-1); - - // generate DEINTER table - for(int i=0;i<d_K;i++) { - d_DEINTER[d_INTER[i]]=i; - } -} - - - - - -//###################################################################### -//# Write an INTERLEAVER specification to a file. -//# Format -//# K -//# blank line -//# list of space separated K integers from 0 to K-1 in appropriate order -//# optional comments -//###################################################################### -void interleaver::write_interleaver_txt(std::string filename) -{ - std::ofstream interleaver_fname (filename.c_str()); - if (!interleaver_fname) {std::cout << "file not found " << std::endl ; exit(-1);} - interleaver_fname << d_K << std::endl; - interleaver_fname << std::endl; - for(int i=0;i<d_K;i++) - interleaver_fname << d_INTER[i] << ' '; - interleaver_fname << std::endl; - interleaver_fname.close(); -} diff --git a/gr-trellis/src/lib/interleaver.h b/gr-trellis/src/lib/interleaver.h deleted file mode 100644 index fbd378d62..000000000 --- a/gr-trellis/src/lib/interleaver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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 <trellis_api.h> -#include <vector> - -/*! - * \brief INTERLEAVER class - */ -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); -}; - -#endif diff --git a/gr-trellis/src/lib/interleaver.i b/gr-trellis/src/lib/interleaver.i deleted file mode 100644 index bb9078b1b..000000000 --- a/gr-trellis/src/lib/interleaver.i +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ - -class 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); -}; diff --git a/gr-trellis/src/lib/quicksort_index.cc b/gr-trellis/src/lib/quicksort_index.cc deleted file mode 100644 index cf37e862e..000000000 --- a/gr-trellis/src/lib/quicksort_index.cc +++ /dev/null @@ -1,68 +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. - */ - -#include "quicksort_index.h" - -template <class T> -void -SWAP -(T & a, T & b) -{ - T temp = a; - a = b; - b = temp; -} - -template <class T> -void -quicksort_index -(std::vector<T> & p, std::vector<int> & index, int left, int right) -{ - if (left < right) { - int i = left; - int j = right + 1; - T pivot = p[left]; - do { - do - i++; - while ((p[i] < pivot) && (i < right)); - do - j--; - while ((p[j] > pivot) && (j > left)); - if (i < j) { - SWAP <T> (p[i],p[j]); - SWAP <int> (index[i],index[j]); - } - } while (i < j); - SWAP <T> (p[left], p[j]); - SWAP <int> (index[left], index[j]); - quicksort_index <T> (p,index, left, j-1); - quicksort_index <T> (p,index, j+1, right); - } -} - -// instantiate an <int> version of the quicksort_index -//template <int> void SWAP (int & a, int & b); -template -void -quicksort_index<int> -(std::vector<int> & p, std::vector<int> & index, int left, int right); diff --git a/gr-trellis/src/lib/quicksort_index.h b/gr-trellis/src/lib/quicksort_index.h deleted file mode 100644 index 9583955db..000000000 --- a/gr-trellis/src/lib/quicksort_index.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 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> - -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); - -#endif diff --git a/gr-trellis/src/lib/siso_type.h b/gr-trellis/src/lib/siso_type.h deleted file mode 100644 index 3a7163d02..000000000 --- a/gr-trellis/src/lib/siso_type.h +++ /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. - */ - -#ifndef INCLUDED_TRELLIS_SISO_TYPE_H -#define INCLUDED_TRELLIS_SISO_TYPE_H - -typedef enum { - TRELLIS_MIN_SUM = 200, TRELLIS_SUM_PRODUCT -} trellis_siso_type_t; - -#endif - diff --git a/gr-trellis/src/lib/trellis.i b/gr-trellis/src/lib/trellis.i deleted file mode 100644 index 0debf5e5d..000000000 --- a/gr-trellis/src/lib/trellis.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -%include "gnuradio.i" // the common stuff - -//load generated python docstrings -%include "trellis_swig_doc.i" - -%{ -#include "fsm.h" -#include "interleaver.h" -#include "trellis_permutation.h" -#include "trellis_siso_f.h" -#include "trellis_siso_combined_f.h" -#include "trellis_constellation_metrics_cf.h" -#include "digital_constellation.h" -%} - - -// ---------------------------------------------------------------- - -%include "fsm.i" -%include "interleaver.i" -%include "trellis_permutation.i" -%include "trellis_siso_f.i" -%include "trellis_siso_combined_f.i" - -%include "siso_type.h" - -%include "trellis_constellation_metrics_cf.i" - -%include "trellis_generated.i" - -%import "digital_metric_type.h" -%import "digital_constellation.i" - - //%pythoncode %{ - // from gnuradio.gr import TRELLIS_EUCLIDEAN, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT - // %} diff --git a/gr-trellis/src/lib/trellis_api.h b/gr-trellis/src/lib/trellis_api.h deleted file mode 100644 index c09b340d6..000000000 --- a/gr-trellis/src/lib/trellis_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 <gruel/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/src/lib/trellis_constellation_metrics_cf.cc b/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc deleted file mode 100644 index 6e6aa2dd0..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <trellis_constellation_metrics_cf.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - - -trellis_constellation_metrics_cf_sptr -trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new trellis_constellation_metrics_cf (constellation, TYPE)); -} - - - -trellis_constellation_metrics_cf::trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE) - : gr_block ("constellation_metrics_cf", - gr_make_io_signature (1, -1, sizeof (gr_complex)), - gr_make_io_signature (1, -1, sizeof (float))), - d_constellation (constellation), - d_TYPE (TYPE), - d_O (constellation->arity()), - d_D (constellation->dimensionality()) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - -void -trellis_constellation_metrics_cf::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - unsigned int input_required = d_D * noutput_items / d_O; - unsigned int ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -trellis_constellation_metrics_cf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - unsigned int nstreams = input_items.size(); - -for (unsigned int m=0;m<nstreams;m++) { - const gr_complex *in = (gr_complex *) input_items[m]; - float *out = (float *) output_items[m]; - - for (unsigned int i = 0; i < noutput_items / d_O ; i++){ - d_constellation->calc_metric(&(in[i*d_D]), &(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h b/gr-trellis/src/lib/trellis_constellation_metrics_cf.h deleted file mode 100644 index 2c2070522..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,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_CONSTELLATION_METRICS_CF_H -#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H - -#include <trellis_api.h> -#include <gr_block.h> -#include <digital_constellation.h> -#include <digital_metric_type.h> - -class trellis_constellation_metrics_cf; -typedef boost::shared_ptr<trellis_constellation_metrics_cf> trellis_constellation_metrics_cf_sptr; - -TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup coding_blk - */ -class TRELLIS_API trellis_constellation_metrics_cf : public gr_block -{ - public: - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - protected: - trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - - private: - digital_constellation_sptr d_constellation; - trellis_metric_type_t d_TYPE; - unsigned int d_O; - unsigned int d_D; - friend TRELLIS_API trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i b/gr-trellis/src/lib/trellis_constellation_metrics_cf.i deleted file mode 100644 index c17522b11..000000000 --- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -// WARNING: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,constellation_metrics_cf); - -trellis_constellation_metrics_cf_sptr trellis_make_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); - -class trellis_constellation_metrics_cf : public gr_block -{ -private: - trellis_constellation_metrics_cf (digital_constellation_sptr constellation, trellis_metric_type_t TYPE); -}; diff --git a/gr-trellis/src/lib/trellis_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_encoder_XX.cc.t deleted file mode 100644 index dca92b08f..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.cc.t +++ /dev/null @@ -1,76 +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. - */ - -// @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 &FSM, int ST) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,ST)); -} - -@NAME@::@NAME@ (const fsm &FSM, int ST) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@))), - d_FSM (FSM), - d_ST (ST) -{ -} - - - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ST_tmp=0; - - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - ST_tmp = d_ST; - - // per stream processing - for (int i = 0; i < noutput_items; i++){ - out[i] = (@O_TYPE@) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time? - ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]]; - } - // end per stream processing - } - d_ST = ST_tmp; - - return noutput_items; -} - diff --git a/gr-trellis/src/lib/trellis_encoder_XX.h.t b/gr-trellis/src/lib/trellis_encoder_XX.h.t deleted file mode 100644 index 7c4250a92..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.h.t +++ /dev/null @@ -1,58 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - -/*! - * \brief Convolutional encoder. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - fsm d_FSM; - int d_ST; - @NAME@ (const fsm &FSM, int ST); - -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } - - 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_encoder_XX.i.t b/gr-trellis/src/lib/trellis_encoder_XX.i.t deleted file mode 100644 index 29c9c4db3..000000000 --- a/gr-trellis/src/lib/trellis_encoder_XX.i.t +++ /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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST); - -class @NAME@ : public gr_sync_block -{ -private: - @NAME@ (const fsm &FSM, int ST); -public: - fsm FSM () const { return d_FSM; } - int ST () const { return d_ST; } -}; diff --git a/gr-trellis/src/lib/trellis_metrics_X.cc.t b/gr-trellis/src/lib/trellis_metrics_X.cc.t deleted file mode 100644 index 77eb8c81b..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.cc.t +++ /dev/null @@ -1,97 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <iostream> - - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new @NAME@ (O,D,TABLE,TYPE)); -} - - - -@NAME@::@NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (float))), - d_O (O), - d_D (D), - d_TYPE (TYPE), - d_TABLE (TABLE) -{ - set_relative_rate (1.0 * d_O / ((double) d_D)); - set_output_multiple ((int)d_O); -} - -void @NAME@::set_TABLE (const std::vector<@I_TYPE@> &table) -{ - d_TABLE = table; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_O == 0); - int input_required = d_D * noutput_items / d_O; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - - assert (noutput_items % d_O == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - -for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m]; - float *out = (float *) output_items[m]; - - for (int i = 0; i < noutput_items / d_O ; i++){ - calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE); - } -} - - consume_each (d_D * noutput_items / d_O); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_metrics_X.h.t b/gr-trellis/src/lib/trellis_metrics_X.h.t deleted file mode 100644 index ab406c51e..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.h.t +++ /dev/null @@ -1,66 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <gr_block.h> -#include "calc_metric.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -/*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - int d_O; - int d_D; - trellis_metric_type_t d_TYPE; - std::vector<@I_TYPE@> d_TABLE; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gr-trellis/src/lib/trellis_metrics_X.i.t b/gr-trellis/src/lib/trellis_metrics_X.i.t deleted file mode 100644 index 50aa7a767..000000000 --- a/gr-trellis/src/lib/trellis_metrics_X.i.t +++ /dev/null @@ -1,40 +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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -class @NAME@ : public gr_block -{ -private: - @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE, trellis_metric_type_t TYPE); - -public: - int O () const { return d_O; } - int D () const { return d_D; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } -}; diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t deleted file mode 100644 index d79192491..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t +++ /dev/null @@ -1,124 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSM1, ST10, ST1K, - FSM2, ST20, ST2K, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE - )); -} - -@NAME@::@NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSM1 (FSM1), d_ST10 (ST10), d_ST1K (ST1K), - d_FSM2 (FSM2), d_ST20 (ST20), d_ST2K (ST2K), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE) -{ - assert(d_FSM1.I() == d_FSM2.I()); - set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O())); - set_output_multiple (d_blocklength); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const float *in = (const float *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - pccc_decoder( - d_FSM1, d_ST10, d_ST1K, - d_FSM2, d_ST20, d_ST2K, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - &(in[n*d_blocklength*d_FSM1.O()*d_FSM2.O()]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_FSM1.O() * d_FSM2.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t deleted file mode 100644 index e9bc94681..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t +++ /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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM1; - int d_ST10; - int d_ST1K; - fsm d_FSM2; - int d_ST20; - int d_ST2K; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - - @NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSM1 () const { return d_FSM1; } - fsm FSM2 () const { return d_FSM2; } - int ST10 () const { return d_ST10; } - int ST1K () const { return d_ST1K; } - int ST20 () const { return d_ST20; } - int ST2K () const { return d_ST2K; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t deleted file mode 100644 index 83d7fe969..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t +++ /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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSM1 () const { return d_FSM1; } - fsm FSM2 () const { return d_FSM2; } - int ST10 () const { return d_ST10; } - int ST1K () const { return d_ST1K; } - int ST20 () const { return d_ST20; } - int ST2K () const { return d_ST2K; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t deleted file mode 100644 index 03e21de1f..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t +++ /dev/null @@ -1,147 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_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_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - d_METRIC_TYPE (METRIC_TYPE), - d_scaling (scaling) -{ - assert(d_FSMo.I() == d_FSMi.I()); - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_blocklength); -} - -void @NAME@::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_D * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - pccc_decoder_combined( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - d_D,d_TABLE, - d_METRIC_TYPE, - d_scaling, - &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t deleted file mode 100644 index 6e45ea10a..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t +++ /dev/null @@ -1,125 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "calc_metric.h" -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSM1 () const { return d_FSMo; } - fsm FSM2 () const { return d_FSMi; } - int ST10 () const { return d_STo0; } - int ST1K () const { return d_SToK; } - int ST20 () const { return d_STi0; } - int ST2K () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling () const { return d_scaling; } - void set_scaling (float scaling); - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t deleted file mode 100644 index d841f67b4..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t +++ /dev/null @@ -1,73 +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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSM1 () const { return d_FSMo; } - fsm FSM2 () const { return d_FSMi; } - int ST10 () const { return d_STo0; } - int ST1K () const { return d_SToK; } - int ST20 () const { return d_STi0; } - int ST2K () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling() const { return d_scaling; } - void set_scaling (float scaling); -}; diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t deleted file mode 100644 index 6cab858cd..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t +++ /dev/null @@ -1,90 +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. - */ - -// @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 deleted file mode 100644 index 75a22b829..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t +++ /dev/null @@ -1,84 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <vector> -#include "fsm.h" -#include "interleaver.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @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 TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @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 deleted file mode 100644 index c02ee428a..000000000 --- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t +++ /dev/null @@ -1,50 +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. - */ - -// @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_permutation.cc b/gr-trellis/src/lib/trellis_permutation.cc deleted file mode 100644 index 57c6d2693..000000000 --- a/gr-trellis/src/lib/trellis_permutation.cc +++ /dev/null @@ -1,82 +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 <trellis_permutation.h> -#include <gr_io_signature.h> -#include <iostream> -#include <string.h> - -trellis_permutation_sptr -trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) -{ - return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,BYTES_PER_SYMBOL)); -} - -trellis_permutation::trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) - : gr_sync_block ("permutation", - gr_make_io_signature (1, -1, BYTES_PER_SYMBOL), - gr_make_io_signature (1, -1, BYTES_PER_SYMBOL)), - d_K (K), - d_TABLE (TABLE), - d_SYMS_PER_BLOCK (SYMS_PER_BLOCK), - d_BYTES_PER_SYMBOL (BYTES_PER_SYMBOL) -{ - set_output_multiple (d_K*SYMS_PER_BLOCK); - //std::cout << d_K << "\n"; -} - - - -int -trellis_permutation::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int nstreams = input_items.size(); - assert (input_items.size() == output_items.size()); - assert (noutput_items % d_K ==0); - - for (int m=0;m<nstreams;m++) { - const char *in = (const char *) input_items[m]; - char *out = (char *) output_items[m]; - - // per stream processing - for (int i = 0; i < noutput_items/d_SYMS_PER_BLOCK; i++){ - // Index i refers to blocks. - // Begining of packet (in blocks) - int i0 = d_K*(i/d_K); - // position of block within packet (in blocks) - int j0 = i%d_K; - // new position of block within packet (in blocks) - int k0 = d_TABLE[j0]; - memcpy(&(out[i*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), - &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]), - d_BYTES_PER_SYMBOL*d_SYMS_PER_BLOCK); - } - // end per stream processing - } - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h deleted file mode 100644 index cc40518c2..000000000 --- a/gr-trellis/src/lib/trellis_permutation.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_TRELLIS_PERMUTATION_H -#define INCLUDED_TRELLIS_PERMUTATION_H - -#include <trellis_api.h> -#include <vector> -#include <gr_sync_block.h> - -class trellis_permutation; -typedef boost::shared_ptr<trellis_permutation> trellis_permutation_sptr; - -TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -/*! - * \brief Permutation. - * \ingroup coding_blk - */ -class TRELLIS_API trellis_permutation : public gr_sync_block -{ -private: - friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - int d_K; - std::vector<int> d_TABLE; - int d_SYMS_PER_BLOCK; - size_t d_BYTES_PER_SYMBOL; - trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES); - -public: - int K () const { return d_K; } - const std::vector<int> & TABLE () const { return d_TABLE; } - int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } - - 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_permutation.i b/gr-trellis/src/lib/trellis_permutation.i deleted file mode 100644 index fdfaa44d3..000000000 --- a/gr-trellis/src/lib/trellis_permutation.i +++ /dev/null @@ -1,41 +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(trellis,permutation); - -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -class trellis_permutation : public gr_sync_block -{ -private: - int d_K; - std::vector<int> d_TABLE; - int d_SYMS_PER_BLOCK; - size_t d_BYTES_PER_SYMBOL; - trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); - -public: - int K () const { return d_K; } - const std::vector<int> & TABLE () const { return d_TABLE; } - int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } -}; diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t deleted file mode 100644 index c9b78aa8f..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t +++ /dev/null @@ -1,124 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - 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); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_FSMi.O() * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const float *in = (const float *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - sccc_decoder( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - &(in[n*d_blocklength*d_FSMi.O()]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_FSMi.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t deleted file mode 100644 index d6fb72f68..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t +++ /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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t deleted file mode 100644 index a4392ee6f..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t +++ /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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; 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 deleted file mode 100644 index 4508ca5cb..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t +++ /dev/null @@ -1,147 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new @NAME@ ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -@NAME@::@NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_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_STo0 (STo0), d_SToK (SToK), - d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK), - d_INTERLEAVER (INTERLEAVER), - d_blocklength (blocklength), - d_repetitions (repetitions), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - 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); -} - -void @NAME@::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_blocklength == 0); - int input_required = d_D * noutput_items ; - ninput_items_required[0] = input_required; -} - - - -//=========================================================== - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_blocklength == 0); - int nblocks = noutput_items / d_blocklength; - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - for (int n=0;n<nblocks;n++) { - sccc_decoder_combined( - d_FSMo, d_STo0, d_SToK, - d_FSMi, d_STi0, d_STiK, - d_INTERLEAVER, d_blocklength, d_repetitions, - p2min, - d_D,d_TABLE, - d_METRIC_TYPE, - d_scaling, - &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength]) - ); - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t deleted file mode 100644 index 3fdc53c62..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t +++ /dev/null @@ -1,125 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include "interleaver.h" -#include <gr_block.h> -#include <vector> -#include "calc_metric.h" -#include "siso_type.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSMo; - int d_STo0; - int d_SToK; - fsm d_FSMi; - int d_STi0; - int d_STiK; - interleaver d_INTERLEAVER; - int d_blocklength; - int d_repetitions; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector<float> d_buffer; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling () const { return d_scaling; } - void set_scaling (float scaling); - - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t deleted file mode 100644 index 84f2eb07d..000000000 --- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t +++ /dev/null @@ -1,73 +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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - -public: - fsm FSMo () const { return d_FSMo; } - fsm FSMi () const { return d_FSMi; } - int STo0 () const { return d_STo0; } - int SToK () const { return d_SToK; } - int STi0 () const { return d_STi0; } - int STiK () const { return d_STiK; } - interleaver INTERLEAVER () const { return d_INTERLEAVER; } - int blocklength () const { return d_blocklength; } - int repetitions () const { return d_repetitions; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - float scaling() const { return d_scaling; } - void set_scaling (float scaling); -}; diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t deleted file mode 100644 index 8054909db..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t +++ /dev/null @@ -1,91 +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. - */ - -// @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) -{ - assert(d_FSMo.O() == d_FSMi.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 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 deleted file mode 100644 index b16d7ffca..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t +++ /dev/null @@ -1,84 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include <vector> -#include "fsm.h" -#include "interleaver.h" -#include <gr_sync_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @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 TRELLIS_API @NAME@ : public gr_sync_block -{ -private: - friend TRELLIS_API @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 deleted file mode 100644 index ca6b56199..000000000 --- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t +++ /dev/null @@ -1,50 +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. - */ - -// @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; } -}; diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.cc b/gr-trellis/src/lib/trellis_siso_combined_f.cc deleted file mode 100644 index d27fe4425..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.cc +++ /dev/null @@ -1,357 +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 <trellis_siso_combined_f.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_siso_combined_f_sptr -trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr(new trellis_siso_combined_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE,D,TABLE,TYPE)); -} - -trellis_siso_combined_f::trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("siso_combined_f", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_POSTI (POSTI), - d_POSTO (POSTO), - d_SISO_TYPE (SISO_TYPE), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_alpha(FSM.S()*(K+1)), - //d_beta(FSM.S()*(K+1)) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("constructor: Multiple = %d\n",multiple); - set_output_multiple (d_K*multiple); - //what is the meaning of relative rate for a block with 2 inputs? - //set_relative_rate ( multiple / ((double) d_FSM.I()) ); - // it turns out that the above gives problems in the scheduler, so - // let's try (assumption O>I) - //set_relative_rate ( multiple / ((double) d_FSM.O()) ); - // I am tempted to automate like this - if(d_FSM.I() <= d_D) - set_relative_rate ( multiple / ((double) d_D) ); - else - set_relative_rate ( multiple / ((double) d_FSM.I()) ); -} - - -void -trellis_siso_combined_f::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("forecast: Multiple = %d\n",multiple); - assert (noutput_items % (d_K*multiple) == 0); - int input_required1 = d_FSM.I() * (noutput_items/multiple) ; - int input_required2 = d_D * (noutput_items/multiple) ; - //printf("forecast: Output requirements: %d\n",noutput_items); - //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2); - unsigned ninputs = ninput_items_required.size(); - assert(ninputs % 2 == 0); - for (unsigned int i = 0; i < ninputs/2; i++) { - ninput_items_required[2*i] = input_required1; - ninput_items_required[2*i+1] = input_required2; - } -} - - - - - -/* - - -inline float min(float a, float b) -{ - return a <= b ? a : b; -} - -inline float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - -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<float> &TABLE, - trellis_metric_type_t TYPE, - const float *priori, const float *observations, float *post//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - float *prioro = new float[O*K]; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - - if (POSTI && POSTO) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } - } - else if(POSTI) - { - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } - } - else if(POSTO) - { - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } - } - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - delete [] prioro; - -} - -*/ - - - - -int -trellis_siso_combined_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == 2*output_items.size()); - int nstreams = output_items.size(); - //printf("general_work:Streams: %d\n",nstreams); - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - assert (noutput_items % (d_K*multiple) == 0); - int nblocks = noutput_items / (d_K*multiple); - //printf("general_work:Blocks: %d\n",nblocks); - //for(int i=0;i<ninput_items.size();i++) - //printf("general_work:Input items available: %d\n",ninput_items[i]); - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - for (int m=0;m<nstreams;m++) { - const float *in1 = (const float *) input_items[2*m]; - const float *in2 = (const float *) input_items[2*m+1]; - float *out = (float *) output_items[m]; - for (int n=0;n<nblocks;n++) { - siso_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(), - d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(), - d_K,d_S0,d_SK, - d_POSTI,d_POSTO, - p2min, - d_D,d_TABLE,d_TYPE, - &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_D]), - &(out[n*d_K*multiple])//, - //d_alpha,d_beta - ); - } - } - - for (unsigned int i = 0; i < input_items.size()/2; i++) { - consume(2*i,d_FSM.I() * noutput_items / multiple ); - consume(2*i+1,d_D * noutput_items / multiple ); - } - - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.h b/gr-trellis/src/lib/trellis_siso_combined_f.h deleted file mode 100644 index 4b28e8de4..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.h +++ /dev/null @@ -1,112 +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_TRELLIS_SISO_COMBINED_F_H -#define INCLUDED_TRELLIS_SISO_COMBINED_F_H - -#include <trellis_api.h> -#include "fsm.h" -#include "siso_type.h" -#include "calc_metric.h" -#include "core_algorithms.h" -#include <gr_block.h> - -class trellis_siso_combined_f; -typedef boost::shared_ptr<trellis_siso_combined_f> trellis_siso_combined_f_sptr; - -TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, // underlying FSM - int K, // block size in trellis steps - int S0, // initial state (put -1 if not specified) - int SK, // final state (put -1 if not specified) - bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output - bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output - trellis_siso_type_t d_SISO_TYPE, // perform "min-sum" or "sum-product" combining - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE -); - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API trellis_siso_combined_f : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - bool d_POSTI; - bool d_POSTO; - trellis_siso_type_t d_SISO_TYPE; - int d_D; - std::vector<float> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<float> d_alpha; - //std::vector<float> d_beta; - - friend TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - - trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.i b/gr-trellis/src/lib/trellis_siso_combined_f.i deleted file mode 100644 index 781280d89..000000000 --- a/gr-trellis/src/lib/trellis_siso_combined_f.i +++ /dev/null @@ -1,64 +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(trellis,siso_combined_f); - -trellis_siso_combined_f_sptr trellis_make_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - - -class trellis_siso_combined_f : public gr_block -{ -private: - trellis_siso_combined_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE, - int D, - const std::vector<float> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - int D () const { return d_D; } - std::vector<float> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_siso_f.cc b/gr-trellis/src/lib/trellis_siso_f.cc deleted file mode 100644 index ffebf1928..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.cc +++ /dev/null @@ -1,338 +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 <trellis_siso_f.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -trellis_siso_f_sptr -trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE) -{ - return gnuradio::get_initial_sptr(new trellis_siso_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE)); -} - -trellis_siso_f::trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE) - : gr_block ("siso_f", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_POSTI (POSTI), - d_POSTO (POSTO), - d_SISO_TYPE (SISO_TYPE)//, - //d_alpha(FSM.S()*(K+1)), - //d_beta(FSM.S()*(K+1)) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("constructor: Multiple = %d\n",multiple); - set_output_multiple (d_K*multiple); - //what is the meaning of relative rate for a block with 2 inputs? - //set_relative_rate ( multiple / ((double) d_FSM.I()) ); - // it turns out that the above gives problems in the scheduler, so - // let's try (assumption O>I) - //set_relative_rate ( multiple / ((double) d_FSM.O()) ); - // I am tempted to automate like this - if(d_FSM.I() <= d_FSM.O()) - set_relative_rate ( multiple / ((double) d_FSM.O()) ); - else - set_relative_rate ( multiple / ((double) d_FSM.I()) ); -} - - -void -trellis_siso_f::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("forecast: Multiple = %d\n",multiple); - assert (noutput_items % (d_K*multiple) == 0); - int input_required1 = d_FSM.I() * (noutput_items/multiple) ; - int input_required2 = d_FSM.O() * (noutput_items/multiple) ; - //printf("forecast: Output requirements: %d\n",noutput_items); - //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2); - unsigned ninputs = ninput_items_required.size(); - assert(ninputs % 2 == 0); - for (unsigned int i = 0; i < ninputs/2; i++) { - ninput_items_required[2*i] = input_required1; - ninput_items_required[2*i+1] = input_required2; - } -} - - - - -/* Moved it to "core_algorithms.cc" */ -/* -inline float min(float a, float b) -{ - return a <= b ? a : b; -} - -inline float min_star(float a, float b) -{ - return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); -} - -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//, - //std::vector<float> &alpha, - //std::vector<float> &beta - ) -{ - float norm,mm,minm; - std::vector<float> alpha(S*(K+1)); - std::vector<float> beta(S*(K+1)); - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - for(int k=0;k<K;k++) { // forward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]]; - minm=(*p2mymin)(minm,mm); - } - alpha[(k+1)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode - } - - if(SK<0) { // final state not specified - for(int i=0;i<S;i++) beta[K*S+i]=0; - } - else { - for(int i=0;i<S;i++) beta[K*S+i]=INF; - beta[K*S+SK]=0.0; - } - - for(int k=K-1;k>=0;k--) { // backward recursion - norm=INF; - for(int j=0;j<S;j++) { - minm=INF; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]]; - minm=(*p2mymin)(minm,mm); - } - beta[k*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - beta[k*S+j]-=norm; // normalize total metrics so they do not explode - } - - -if (POSTI && POSTO) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*(I+O)+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*(I+O)+i]-=norm; // normalize metrics - } - - - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*(I+O)+I+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*(I+O)+I+n]-=norm; // normalize metrics - } -} -else if(POSTI) -{ - for(int k=0;k<K;k++) { // input combining - norm=INF; - for(int i=0;i<I;i++) { - minm=INF; - for(int j=0;j<S;j++) { - mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]]; - minm=(*p2mymin)(minm,mm); - } - post[k*I+i]=minm; - if(minm<norm) norm=minm; - } - for(int i=0;i<I;i++) - post[k*I+i]-=norm; // normalize metrics - } -} -else if(POSTO) -{ - for(int k=0;k<K;k++) { // output combining - norm=INF; - for(int n=0;n<O;n++) { - minm=INF; - for(int j=0;j<S;j++) { - for(int i=0;i<I;i++) { - mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF); - minm=(*p2mymin)(minm,mm); - } - } - post[k*O+n]=minm; - if(minm<norm) norm=minm; - } - for(int n=0;n<O;n++) - post[k*O+n]-=norm; // normalize metrics - } -} -else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - -} - -*/ - - - - -int -trellis_siso_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == 2*output_items.size()); - int nstreams = output_items.size(); - //printf("general_work:Streams: %d\n",nstreams); - int multiple; - if (d_POSTI && d_POSTO) - multiple = d_FSM.I()+d_FSM.O(); - else if(d_POSTI) - multiple = d_FSM.I(); - else if(d_POSTO) - multiple = d_FSM.O(); - else - throw std::runtime_error ("Not both POSTI and POSTO can be false."); - - assert (noutput_items % (d_K*multiple) == 0); - int nblocks = noutput_items / (d_K*multiple); - //printf("general_work:Blocks: %d\n",nblocks); - //for(int i=0;i<ninput_items.size();i++) - //printf("general_work:Input items available: %d\n",ninput_items[i]); - - float (*p2min)(float, float) = NULL; - if(d_SISO_TYPE == TRELLIS_MIN_SUM) - p2min = &min; - else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) - p2min = &min_star; - - - for (int m=0;m<nstreams;m++) { - const float *in1 = (const float *) input_items[2*m]; - const float *in2 = (const float *) input_items[2*m+1]; - float *out = (float *) output_items[m]; - for (int n=0;n<nblocks;n++) { - siso_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(), - d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(), - d_K,d_S0,d_SK, - d_POSTI,d_POSTO, - p2min, - &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]), - &(out[n*d_K*multiple])//, - //d_alpha,d_beta - ); - } - } - - for (unsigned int i = 0; i < input_items.size()/2; i++) { - consume(2*i,d_FSM.I() * noutput_items / multiple ); - consume(2*i+1,d_FSM.O() * noutput_items / multiple ); - } - - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_siso_f.h b/gr-trellis/src/lib/trellis_siso_f.h deleted file mode 100644 index 9341f2468..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.h +++ /dev/null @@ -1,97 +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_TRELLIS_SISO_F_H -#define INCLUDED_TRELLIS_SISO_F_H - -#include <trellis_api.h> -#include "fsm.h" -#include "siso_type.h" -#include "core_algorithms.h" -#include <gr_block.h> - -class trellis_siso_f; -typedef boost::shared_ptr<trellis_siso_f> trellis_siso_f_sptr; - -TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, // underlying FSM - int K, // block size in trellis steps - int S0, // initial state (put -1 if not specified) - int SK, // final state (put -1 if not specified) - bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output - bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output - trellis_siso_type_t d_SISO_TYPE // perform "min-sum" or "sum-product" combining -); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API trellis_siso_f : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - bool d_POSTI; - bool d_POSTO; - trellis_siso_type_t d_SISO_TYPE; - //std::vector<float> d_alpha; - //std::vector<float> d_beta; - - friend TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE); - - - trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t d_SISO_TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_siso_f.i b/gr-trellis/src/lib/trellis_siso_f.i deleted file mode 100644 index 63bfb48c8..000000000 --- a/gr-trellis/src/lib/trellis_siso_f.i +++ /dev/null @@ -1,55 +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(trellis,siso_f); - -trellis_siso_f_sptr trellis_make_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE); - - -class trellis_siso_f : public gr_block -{ -private: - trellis_siso_f ( - const fsm &FSM, - int K, - int S0, - int SK, - bool POSTI, - bool POSTO, - trellis_siso_type_t SISO_TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - bool POSTI () const { return d_POSTI; } - bool POSTO () const { return d_POSTO; } - trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_X.cc.t b/gr-trellis/src/lib/trellis_viterbi_X.cc.t deleted file mode 100644 index cadb89d57..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.cc.t +++ /dev/null @@ -1,183 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK)); -} - -@NAME@::@NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (@TYPE@))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_FSM.O())); - set_output_multiple (d_K); -} - - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_FSM.O() * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - -/* -template -void viterbi_algorithm<@O_TYPE@>(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, @O_TYPE@ *out); -*/ - - - -/* Moved it to "core_algorithms.cc" */ -/* -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, @TYPE@ *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - int alphai; - float norm,mm,minm; - int minmi; - int st; - - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (@TYPE@) PI[st][i0]; - st=PS[st][i0]; - } - -} - -*/ - - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const float *in = (const float *) input_items[m]; - @TYPE@ *out = (@TYPE@ *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_FSM.O() * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_X.h.t b/gr-trellis/src/lib/trellis_viterbi_X.h.t deleted file mode 100644 index c0400d341..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.h.t +++ /dev/null @@ -1,91 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_block.h> -#include "core_algorithms.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - //std::vector<int> d_trace; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<int> trace () const { return d_trace; } - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - - - - - - - - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_X.i.t b/gr-trellis/src/lib/trellis_viterbi_X.i.t deleted file mode 100644 index 063f4a1b3..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_X.i.t +++ /dev/null @@ -1,49 +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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - //std::vector<short> trace () const { return d_trace; } -}; diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t deleted file mode 100644 index 74611ab8f..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t +++ /dev/null @@ -1,191 +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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> - -static const float INF = 1.0e9; - -@SPTR_NAME@ -trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE) -{ - return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK,D,TABLE,TYPE)); -} - -@NAME@::@NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@))), - d_FSM (FSM), - d_K (K), - d_S0 (S0), - d_SK (SK), - d_D (D), - d_TABLE (TABLE), - d_TYPE (TYPE)//, - //d_trace(FSM.S()*K) -{ - set_relative_rate (1.0 / ((double) d_D)); - set_output_multiple (d_K); -} - - -void @NAME@::set_TABLE(const std::vector<@I_TYPE@> &table) -{ - d_TABLE = table; -} - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_K == 0); - int input_required = d_D * noutput_items ; - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = input_required; - } -} - - - - -/* -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<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE, - const @I_TYPE@ *in, @O_TYPE@ *out)//, - //std::vector<int> &trace) -{ - std::vector<int> trace(S*K); - std::vector<float> alpha(S*2); - float *metric = new float[O]; - int alphai; - float norm,mm,minm; - int minmi; - int st; - - if(S0<0) { // initial state not specified - for(int i=0;i<S;i++) alpha[0*S+i]=0; - } - else { - for(int i=0;i<S;i++) alpha[0*S+i]=INF; - alpha[0*S+S0]=0.0; - } - - alphai=0; - for(int k=0;k<K;k++) { - calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics - norm=INF; - for(int j=0;j<S;j++) { // for each next state do ACS - minm=INF; - minmi=0; - for(unsigned int i=0;i<PS[j].size();i++) { - //int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm) - minm=mm,minmi=i; - } - trace[k*S+j]=minmi; - alpha[((alphai+1)%2)*S+j]=minm; - if(minm<norm) norm=minm; - } - for(int j=0;j<S;j++) - alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode - alphai=(alphai+1)%2; - } - - if(SK<0) { // final state not specified - minm=INF; - minmi=0; - for(int i=0;i<S;i++) - if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i; - st=minmi; - } - else { - st=SK; - } - - for(int k=K-1;k>=0;k--) { // traceback - int i0=trace[k*S+st]; - out[k]= (@O_TYPE@) PI[st][i0]; - st=PS[st][i0]; - } - - delete [] metric; - -} - - -*/ - - - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - assert (noutput_items % d_K == 0); - int nblocks = noutput_items / d_K; - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - for (int n=0;n<nblocks;n++) { - viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace); - } - } - - consume_each (d_D * noutput_items ); - return noutput_items; -} diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t deleted file mode 100644 index c7e468e73..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t +++ /dev/null @@ -1,99 +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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <trellis_api.h> -#include "fsm.h" -#include <gr_block.h> -#include "calc_metric.h" -#include "core_algorithms.h" - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -/*! - * \ingroup coding_blk - */ -class TRELLIS_API @NAME@ : public gr_block -{ - fsm d_FSM; - int d_K; - int d_S0; - int d_SK; - int d_D; - std::vector<@I_TYPE@> d_TABLE; - trellis_metric_type_t d_TYPE; - //std::vector<int> d_trace; - - friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<int> trace () const { return d_trace; } - void set_TABLE (const std::vector<@I_TYPE@> &table); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t deleted file mode 100644 index 633ded770..000000000 --- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t +++ /dev/null @@ -1,59 +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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@); - -@SPTR_NAME@ trellis_make_@BASE_NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - - -class @NAME@ : public gr_block -{ -private: - @NAME@ ( - const fsm &FSM, - int K, - int S0, - int SK, - int D, - const std::vector<@I_TYPE@> &TABLE, - trellis_metric_type_t TYPE); - -public: - fsm FSM () const { return d_FSM; } - int K () const { return d_K; } - int S0 () const { return d_S0; } - int SK () const { return d_SK; } - int D () const { return d_D; } - std::vector<@I_TYPE@> TABLE () const { return d_TABLE; } - trellis_metric_type_t TYPE () const { return d_TYPE; } - //std::vector<short> trace () const { return d_trace; } - void set_TABLE (const std::vector<@I_TYPE@> &table); -}; diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-trellis/src/python/CMakeLists.txt deleted file mode 100644 index f8e4d9532..000000000 --- a/gr-trellis/src/python/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 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. - -######################################################################## -# Handle the unit tests -######################################################################## -if(ENABLE_TESTING) - -list(APPEND GR_TEST_PYTHON_DIRS - ${CMAKE_BINARY_DIR}/gr-digital/swig - ${CMAKE_BINARY_DIR}/gr-trellis/src/lib -) -list(APPEND GR_TEST_TARGET_DEPS gnuradio-digital gnuradio-trellis) - -include(GrPython) -include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) -endif(ENABLE_TESTING) diff --git a/gr-trellis/src/python/awgn1o2_4.fsm b/gr-trellis/src/python/awgn1o2_4.fsm deleted file mode 100644 index 9245c69ac..000000000 --- a/gr-trellis/src/python/awgn1o2_4.fsm +++ /dev/null @@ -1,15 +0,0 @@ -2 4 4 - -0 2 -0 2 -1 3 -1 3 - -0 3 -3 0 -1 2 -2 1 - -AWGN CC from Proakis-Salehi pg 779 - - diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py deleted file mode 100755 index fcc651ec6..000000000 --- a/gr-trellis/src/python/qa_trellis.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -import math - - -from gnuradio import gr, gr_unittest, blks2 -# It's pretty ugly that we can't import trellis from gnuradio in this test -# but because it runs on the non-installed python code it's all a mess. -import trellis - -import os -import digital_swig - -fsm_args = {"awgn1o2_4": (2, 4, 4, - (0, 2, 0, 2, 1, 3, 1, 3), - (0, 3, 3, 0, 1, 2, 2, 1), - ), - "rep2": (2, 1, 4, (0, 0), (0, 3)), - "nothing": (2, 1, 2, (0, 0), (0, 1)), - } - -constells = {2: digital_swig.constellation_bpsk(), - 4: digital_swig.constellation_qpsk(), - } - -class test_trellis (gr_unittest.TestCase): - - def test_001_fsm (self): - f = trellis.fsm(*fsm_args["awgn1o2_4"]) - self.assertEqual(fsm_args["awgn1o2_4"],(f.I(),f.S(),f.O(),f.NS(),f.OS())) - - def test_002_fsm (self): - f = trellis.fsm(*fsm_args["awgn1o2_4"]) - g = trellis.fsm(f) - self.assertEqual((g.I(),g.S(),g.O(),g.NS(),g.OS()),(f.I(),f.S(),f.O(),f.NS(),f.OS())) - - def test_003_fsm (self): - # FIXME: no file "awgn1o2_4.fsm" - #f = trellis.fsm("awgn1o2_4.fsm") - #self.assertEqual(fsm_args["awgn1o2_4"],(f.I(),f.S(),f.O(),f.NS(),f.OS())) - pass - - def test_004_fsm(self): - """ Test to make sure fsm works with a single state fsm.""" - # Just checking that it initializes properly. - f = trellis.fsm(*fsm_args["rep2"]) - - def test_001_interleaver (self): - K = 5 - IN = (1,2,3,4,0) - DIN = (4,0,1,2,3) - i = trellis.interleaver(K,IN) - self.assertEqual((K,IN,DIN),(i.K(),i.INTER(),i.DEINTER())) - - def test_001_viterbi(self): - """ - Runs some coding/decoding tests with a few different FSM - specs. - """ - for name, args in fsm_args.items(): - constellation = constells[args[2]] - fsms = trellis.fsm(*args) - noise = 0.1 - tb = trellis_tb(constellation, fsms, noise) - tb.run() - # Make sure all packets succesfully transmitted. - self.assertEqual(tb.dst.ntotal(), tb.dst.nright()) - - -class trellis_tb(gr.top_block): - """ - A simple top block for use testing gr-trellis. - """ - def __init__(self, constellation, f, N0=0.25, seed=-666L): - """ - constellation - a constellation object used for modulation. - f - a finite state machine specification used for coding. - N0 - noise level - seed - random seed - """ - super(trellis_tb, self).__init__() - # packet size in bits (make it multiple of 16 so it can be packed in a short) - packet_size = 1024*16 - # bits per FSM input symbol - bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol - # packet size in trellis steps - K = packet_size/bitspersymbol - - # TX - src = gr.lfsr_32k_source_s() - # packet size in shorts - src_head = gr.head (gr.sizeof_short, packet_size/16) - # unpack shorts to symbols compatible with the FSM input cardinality - s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol, gr.GR_MSB_FIRST) - # initial FSM state = 0 - enc = trellis.encoder_ss(f, 0) - mod = gr.chunks_to_symbols_sc(constellation.points(), 1) - - # CHANNEL - add = gr.add_cc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - - # RX - # data preprocessing to generate metrics for Viterbi - metrics = trellis.constellation_metrics_cf(constellation.base(), digital_swig.TRELLIS_EUCLIDEAN) - # Put -1 if the Initial/Final states are not set. - va = trellis.viterbi_s(f, K, 0, -1) - # pack FSM input symbols to shorts - fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol, gr.GR_MSB_FIRST) - # check the output - self.dst = gr.check_lfsr_32k_s() - - self.connect (src, src_head, s2fsmi, enc, mod) - self.connect (mod, (add, 0)) - self.connect (noise, (add, 1)) - self.connect (add, metrics, va, fsmi2s, self.dst) - - -if __name__ == '__main__': - gr_unittest.run(test_trellis, "test_trellis.xml") |