From 8f6be2790220af5b4628de7daee3be4b494e3b3e Mon Sep 17 00:00:00 2001 From: Achilleas Anastasopoulos Date: Wed, 31 Aug 2011 19:35:58 -0400 Subject: Added SCCC encoder/decoder grc blocksi and examples. Also moved all grc blocks related to trellis inside the gr-trellis/grc directory --- gr-trellis/src/lib/trellis_permutation.cc | 18 +++++++++--------- gr-trellis/src/lib/trellis_permutation.h | 8 ++++---- gr-trellis/src/lib/trellis_permutation.i | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'gr-trellis/src') diff --git a/gr-trellis/src/lib/trellis_permutation.cc b/gr-trellis/src/lib/trellis_permutation.cc index a32390742..416fc58ec 100644 --- a/gr-trellis/src/lib/trellis_permutation.cc +++ b/gr-trellis/src/lib/trellis_permutation.cc @@ -30,19 +30,19 @@ #include trellis_permutation_sptr -trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT) +trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) { - return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,NBYTES_INOUT)); + 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 &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT) +trellis_permutation::trellis_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL) : gr_sync_block ("permutation", - gr_make_io_signature (1, -1, NBYTES_INOUT), - gr_make_io_signature (1, -1, NBYTES_INOUT)), + 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_NBYTES_INOUT (NBYTES_INOUT) + d_BYTES_PER_SYMBOL (BYTES_PER_SYMBOL) { set_output_multiple (d_K*SYMS_PER_BLOCK); //std::cout << d_K << "\n"; @@ -72,9 +72,9 @@ trellis_permutation::work (int noutput_items, 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_NBYTES_INOUT]), - &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_NBYTES_INOUT]), - d_NBYTES_INOUT*d_SYMS_PER_BLOCK); + 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 } diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h index 5505caf89..a5c858a8b 100644 --- a/gr-trellis/src/lib/trellis_permutation.h +++ b/gr-trellis/src/lib/trellis_permutation.h @@ -30,7 +30,7 @@ class trellis_permutation; typedef boost::shared_ptr trellis_permutation_sptr; -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); +trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); /*! * \brief Permutation. @@ -39,18 +39,18 @@ trellis_permutation_sptr trellis_make_permutation (int K, const std::vector class trellis_permutation : public gr_sync_block { private: - friend trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); + friend trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); int d_K; std::vector d_TABLE; int d_SYMS_PER_BLOCK; - size_t d_NBYTES_INOUT; + size_t d_BYTES_PER_SYMBOL; trellis_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES); public: int K () const { return d_K; } const std::vector & TABLE () const { return d_TABLE; } int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t NBYTES_INOUT () const { return d_NBYTES_INOUT; } + size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-trellis/src/lib/trellis_permutation.i b/gr-trellis/src/lib/trellis_permutation.i index 834a36986..1433a6584 100644 --- a/gr-trellis/src/lib/trellis_permutation.i +++ b/gr-trellis/src/lib/trellis_permutation.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(trellis,permutation); -trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); +trellis_permutation_sptr trellis_make_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); class trellis_permutation : public gr_sync_block { @@ -30,12 +30,12 @@ private: int d_K; std::vector d_TABLE; int d_SYMS_PER_BLOCK; - size_t d_NBYTES_INOUT; - trellis_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t NBYTES_INOUT); + size_t d_BYTES_PER_SYMBOL; + trellis_permutation (int K, const std::vector &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL); public: int K () const { return d_K; } const std::vector & TABLE () const { return d_TABLE; } int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; } - size_t NBYTES_INOUT () const { return d_NBYTES_INOUT; } + size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; } }; -- cgit From ceb1aae53c56e64cb7f3ad7c1ae42a6d68d909ef Mon Sep 17 00:00:00 2001 From: Achilleas Anastasopoulos Date: Wed, 31 Aug 2011 23:01:56 -0400 Subject: Added pccc combined turbo decoder and corresponding GRC block --- gr-trellis/src/lib/Makefile.am | 23 +- gr-trellis/src/lib/Makefile.gen | 18 ++ gr-trellis/src/lib/core_algorithms.cc | 246 +++++++++++++++++++-- gr-trellis/src/lib/core_algorithms.h | 36 ++- gr-trellis/src/lib/generate_trellis.py | 6 +- .../src/lib/trellis_pccc_decoder_combined_XX.cc.t | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_XX.h.t | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_XX.i.t | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_cb.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_cb.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_cb.i | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_ci.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_ci.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_ci.i | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_cs.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_cs.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_cs.i | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_fb.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_fb.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_fb.i | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_fi.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_fi.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_fi.i | 73 ++++++ .../src/lib/trellis_pccc_decoder_combined_fs.cc | 147 ++++++++++++ .../src/lib/trellis_pccc_decoder_combined_fs.h | 124 +++++++++++ .../src/lib/trellis_pccc_decoder_combined_fs.i | 73 ++++++ 26 files changed, 2689 insertions(+), 48 deletions(-) create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.h create mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i (limited to 'gr-trellis/src') diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am index ae7f21f56..8f703c92a 100644 --- a/gr-trellis/src/lib/Makefile.am +++ b/gr-trellis/src/lib/Makefile.am @@ -40,12 +40,12 @@ core_generator = \ trellis_encoder_XX.cc.t \ trellis_encoder_XX.h.t \ trellis_encoder_XX.i.t \ - trellis_sccc_encoder_XX.cc.t \ - trellis_sccc_encoder_XX.h.t \ - trellis_sccc_encoder_XX.i.t \ - trellis_pccc_encoder_XX.cc.t \ - trellis_pccc_encoder_XX.h.t \ - trellis_pccc_encoder_XX.i.t \ + trellis_sccc_encoder_XX.cc.t \ + trellis_sccc_encoder_XX.h.t \ + trellis_sccc_encoder_XX.i.t \ + trellis_pccc_encoder_XX.cc.t \ + trellis_pccc_encoder_XX.h.t \ + trellis_pccc_encoder_XX.i.t \ trellis_metrics_X.cc.t \ trellis_metrics_X.h.t \ trellis_metrics_X.i.t \ @@ -53,14 +53,17 @@ core_generator = \ trellis_viterbi_combined_XX.h.t \ trellis_viterbi_combined_XX.i.t \ trellis_sccc_decoder_combined_XX.cc.t \ - trellis_sccc_decoder_combined_XX.h.t \ - trellis_sccc_decoder_combined_XX.i.t \ - trellis_sccc_decoder_X.cc.t \ + trellis_sccc_decoder_combined_XX.h.t \ + trellis_sccc_decoder_combined_XX.i.t \ + trellis_sccc_decoder_X.cc.t \ trellis_sccc_decoder_X.h.t \ trellis_sccc_decoder_X.i.t \ - trellis_pccc_decoder_X.cc.t \ + trellis_pccc_decoder_X.cc.t \ trellis_pccc_decoder_X.h.t \ trellis_pccc_decoder_X.i.t \ + trellis_pccc_decoder_combined_XX.cc.t \ + trellis_pccc_decoder_combined_XX.h.t \ + trellis_pccc_decoder_combined_XX.i.t \ trellis_viterbi_X.cc.t \ trellis_viterbi_X.h.t \ trellis_viterbi_X.i.t diff --git a/gr-trellis/src/lib/Makefile.gen b/gr-trellis/src/lib/Makefile.gen index 534a7466e..b9b9afb1f 100644 --- a/gr-trellis/src/lib/Makefile.gen +++ b/gr-trellis/src/lib/Makefile.gen @@ -13,6 +13,12 @@ GENERATED_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 \ @@ -64,6 +70,12 @@ GENERATED_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 \ @@ -115,6 +127,12 @@ GENERATED_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 \ diff --git a/gr-trellis/src/lib/core_algorithms.cc b/gr-trellis/src/lib/core_algorithms.cc index 91ac8fbdf..54193c818 100644 --- a/gr-trellis/src/lib/core_algorithms.cc +++ b/gr-trellis/src/lib/core_algorithms.cc @@ -784,7 +784,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -810,7 +810,7 @@ for(int k=0;k( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -909,7 +909,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -921,7 +921,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -933,7 +933,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -945,7 +945,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -957,7 +957,7 @@ template void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -973,7 +973,7 @@ template void sccc_decoder( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, T *data ) @@ -988,7 +988,7 @@ void sccc_decoder( std::vector oposti(blocklength*FSMo.I()); std::vector oposto(blocklength*FSMo.O()); - for(int rep=0;rep( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, unsigned char *data ); @@ -1084,7 +1084,7 @@ template void sccc_decoder( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, short *data ); @@ -1093,7 +1093,7 @@ template void sccc_decoder( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *iprioro, int *data ); @@ -1105,7 +1105,7 @@ template void pccc_decoder( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, T *data ) @@ -1140,7 +1140,7 @@ void pccc_decoder( } } - for(int rep=0;rep( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, unsigned char *data ); @@ -1223,7 +1221,7 @@ template void pccc_decoder( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, short *data ); @@ -1232,8 +1230,208 @@ template void pccc_decoder( const fsm &FSM1, int ST10, int ST1K, const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), const float *cprioro, 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti *observations, To *data +) +{ + + //allocate space for cprioro + std::vector cprioro(blocklength*FSM1.O()*FSM2.O(),0.0); + + //allocate space for priori, prioro and posti of FSM1 + std::vector priori1(blocklength*FSM1.I(),0.0); + std::vector prioro1(blocklength*FSM1.O()); + std::vector posti1(blocklength*FSM1.I()); + + //allocate space for priori, prioro and posti of FSM2 + std::vector priori2(blocklength*FSM2.I(),0.0); + std::vector prioro2(blocklength*FSM2.O()); + std::vector posti2(blocklength*FSM2.I()); + + // turn observations to neg-log-priors for cprioiro + int O=FSM1.O()*FSM2.O(); + for(int k=0;k 2 + for(int k=0;k 1 + for(int k=0;k &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 &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 &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 &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 &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 &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 index fdb5f398e..0ce4f3f4e 100644 --- a/gr-trellis/src/lib/core_algorithms.h +++ b/gr-trellis/src/lib/core_algorithms.h @@ -91,11 +91,21 @@ void siso_algorithm_combined(int I, int S, int O, ); +template +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 void sccc_decoder_combined( const fsm &FSMo, int STo0, int SToK, const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), int D, const std::vector &TABLE, trellis_metric_type_t METRIC_TYPE, @@ -103,26 +113,28 @@ void sccc_decoder_combined( const Ti *observations, To *data ); - template -void sccc_decoder( - const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int repetitions, +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 *iprioro, T *data + const float *cprioro, T *data ); - -template -void pccc_decoder( +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 repetitions, + const interleaver &INTERLEAVER, int blocklength, int iterations, float (*p2mymin)(float,float), - const float *cprioro, T *data + int D, const std::vector &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti *observations, To *data ); + #endif diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py index 9f845f74a..31bc44aac 100644 --- a/gr-trellis/src/lib/generate_trellis.py +++ b/gr-trellis/src/lib/generate_trellis.py @@ -33,9 +33,10 @@ other_roots = [ 'trellis_metrics_X', 'trellis_viterbi_X', 'trellis_viterbi_combined_XX', - 'trellis_sccc_decoder_combined_XX', 'trellis_sccc_decoder_X', + 'trellis_sccc_decoder_combined_XX', 'trellis_pccc_decoder_X', + 'trellis_pccc_decoder_combined_XX', ] other_signatures = ( @@ -45,9 +46,10 @@ other_signatures = ( ['s','i','f','c'], ['b','s','i'], ['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'], - ['fb','fs','fi','cb','cs','ci'], ['b','s','i'], + ['fb','fs','fi','cb','cs','ci'], ['b','s','i'], + ['fb','fs','fi','cb','cs','ci'], ) 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 new file mode 100644 index 000000000..48f68f1fe --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t @@ -0,0 +1,147 @@ +/* -*- 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 +#include +#include +#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 +#include +#include "calc_metric.h" +#include "siso_type.h" + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @SPTR_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, // 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 @NAME@ : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_buffer; + + friend @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 new file mode 100644 index 000000000..d841f67b4 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t @@ -0,0 +1,73 @@ +/* -*- 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_decoder_combined_cb.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc new file mode 100644 index 000000000..d797ce410 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_cb_sptr +trellis_make_pccc_decoder_combined_cb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_cb ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_cb::trellis_pccc_decoder_combined_cb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_cb", + gr_make_io_signature (1, 1, sizeof (gr_complex)), + gr_make_io_signature (1, 1, sizeof (unsigned char))), + 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 trellis_pccc_decoder_combined_cb::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_cb::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 +trellis_pccc_decoder_combined_cb::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 gr_complex *in = (const gr_complex *) input_items[0]; + unsigned char *out = (unsigned char *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_cb; +typedef boost::shared_ptr trellis_pccc_decoder_combined_cb_sptr; + +trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_cb : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_cb ( + 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 &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 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_cb.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i new file mode 100644 index 000000000..9ae829c55 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_cb); + +trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_cb : public gr_block +{ +private: + trellis_pccc_decoder_combined_cb ( + 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 &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 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_decoder_combined_ci.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc new file mode 100644 index 000000000..19201947e --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_ci_sptr +trellis_make_pccc_decoder_combined_ci ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_ci ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_ci::trellis_pccc_decoder_combined_ci ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_ci", + gr_make_io_signature (1, 1, sizeof (gr_complex)), + gr_make_io_signature (1, 1, sizeof (int))), + 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 trellis_pccc_decoder_combined_ci::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_ci::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 +trellis_pccc_decoder_combined_ci::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 gr_complex *in = (const gr_complex *) input_items[0]; + int *out = (int *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_ci; +typedef boost::shared_ptr trellis_pccc_decoder_combined_ci_sptr; + +trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_ci : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_ci ( + 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 &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 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_ci.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i new file mode 100644 index 000000000..5644d6992 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_ci); + +trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_ci : public gr_block +{ +private: + trellis_pccc_decoder_combined_ci ( + 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 &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 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_decoder_combined_cs.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc new file mode 100644 index 000000000..0ab818bfd --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_cs_sptr +trellis_make_pccc_decoder_combined_cs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_cs ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_cs::trellis_pccc_decoder_combined_cs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_cs", + gr_make_io_signature (1, 1, sizeof (gr_complex)), + gr_make_io_signature (1, 1, sizeof (short))), + 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 trellis_pccc_decoder_combined_cs::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_cs::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 +trellis_pccc_decoder_combined_cs::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 gr_complex *in = (const gr_complex *) input_items[0]; + short *out = (short *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_cs; +typedef boost::shared_ptr trellis_pccc_decoder_combined_cs_sptr; + +trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_cs : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_cs ( + 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 &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 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_cs.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i new file mode 100644 index 000000000..7614a81fc --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_cs); + +trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_cs : public gr_block +{ +private: + trellis_pccc_decoder_combined_cs ( + 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 &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 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_decoder_combined_fb.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc new file mode 100644 index 000000000..0122dd7e9 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_fb_sptr +trellis_make_pccc_decoder_combined_fb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fb ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_fb::trellis_pccc_decoder_combined_fb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_fb", + gr_make_io_signature (1, 1, sizeof (float)), + gr_make_io_signature (1, 1, sizeof (unsigned char))), + 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 trellis_pccc_decoder_combined_fb::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_fb::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 +trellis_pccc_decoder_combined_fb::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]; + unsigned char *out = (unsigned char *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_fb; +typedef boost::shared_ptr trellis_pccc_decoder_combined_fb_sptr; + +trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_fb : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_fb ( + 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 &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 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_fb.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i new file mode 100644 index 000000000..41e1a2f4f --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fb); + +trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_fb : public gr_block +{ +private: + trellis_pccc_decoder_combined_fb ( + 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 &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 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_decoder_combined_fi.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc new file mode 100644 index 000000000..e87487087 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_fi_sptr +trellis_make_pccc_decoder_combined_fi ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fi ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_fi::trellis_pccc_decoder_combined_fi ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_fi", + gr_make_io_signature (1, 1, sizeof (float)), + gr_make_io_signature (1, 1, sizeof (int))), + 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 trellis_pccc_decoder_combined_fi::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_fi::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 +trellis_pccc_decoder_combined_fi::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]; + int *out = (int *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_fi; +typedef boost::shared_ptr trellis_pccc_decoder_combined_fi_sptr; + +trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_fi : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_fi ( + 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 &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 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_fi.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i new file mode 100644 index 000000000..202609ace --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fi); + +trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_fi : public gr_block +{ +private: + trellis_pccc_decoder_combined_fi ( + 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 &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 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_decoder_combined_fs.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc new file mode 100644 index 000000000..bb822c699 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc @@ -0,0 +1,147 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "core_algorithms.h" + + +static const float INF = 1.0e9; + +trellis_pccc_decoder_combined_fs_sptr +trellis_make_pccc_decoder_combined_fs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) +{ + return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fs ( + FSMo, STo0, SToK, + FSMi, STi0, STiK, + INTERLEAVER, + blocklength, + repetitions, + SISO_TYPE, + D, + TABLE,METRIC_TYPE, + scaling + )); +} + +trellis_pccc_decoder_combined_fs::trellis_pccc_decoder_combined_fs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +) + : gr_block ("pccc_decoder_combined_fs", + gr_make_io_signature (1, 1, sizeof (float)), + gr_make_io_signature (1, 1, sizeof (short))), + 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 trellis_pccc_decoder_combined_fs::set_scaling(float scaling) +{ + d_scaling = scaling; +} + + +void +trellis_pccc_decoder_combined_fs::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 +trellis_pccc_decoder_combined_fs::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]; + short *out = (short *) output_items[0]; + for (int n=0;n +#include +#include "calc_metric.h" +#include "siso_type.h" + +class trellis_pccc_decoder_combined_fs; +typedef boost::shared_ptr trellis_pccc_decoder_combined_fs_sptr; + +trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +/*! + * \ingroup coding_blk + */ +class trellis_pccc_decoder_combined_fs : public gr_block +{ + fsm d_FSMo; + fsm d_FSMi; + int d_STo0; + int d_SToK; + 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 d_TABLE; + trellis_metric_type_t d_METRIC_TYPE; + float d_scaling; + std::vector d_buffer; + + friend trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling + ); + + trellis_pccc_decoder_combined_fs ( + 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 &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 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_fs.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i new file mode 100644 index 000000000..b8bbf09d6 --- /dev/null +++ b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i @@ -0,0 +1,73 @@ +/* -*- 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: this file is machine generated. Edits will be over written + +GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fs); + +trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( + 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 &TABLE, + trellis_metric_type_t METRIC_TYPE, + float scaling +); + + +class trellis_pccc_decoder_combined_fs : public gr_block +{ +private: + trellis_pccc_decoder_combined_fs ( + 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 &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 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); +}; -- cgit From 6e21a1078c833ec54a84a61c1afd2d8d21e8a8f7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 6 Sep 2011 20:26:00 -0400 Subject: trellis: removing generated files. --- .../src/lib/trellis_pccc_decoder_combined_cb.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_cb.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_cb.i | 73 ---------- .../src/lib/trellis_pccc_decoder_combined_ci.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_ci.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_ci.i | 73 ---------- .../src/lib/trellis_pccc_decoder_combined_cs.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_cs.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_cs.i | 73 ---------- .../src/lib/trellis_pccc_decoder_combined_fb.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_fb.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_fb.i | 73 ---------- .../src/lib/trellis_pccc_decoder_combined_fi.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_fi.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_fi.i | 73 ---------- .../src/lib/trellis_pccc_decoder_combined_fs.cc | 147 --------------------- .../src/lib/trellis_pccc_decoder_combined_fs.h | 124 ----------------- .../src/lib/trellis_pccc_decoder_combined_fs.i | 73 ---------- 18 files changed, 2064 deletions(-) delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.h delete mode 100644 gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i (limited to 'gr-trellis/src') diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc deleted file mode 100644 index d797ce410..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_cb_sptr -trellis_make_pccc_decoder_combined_cb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_cb ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_cb::trellis_pccc_decoder_combined_cb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_cb", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - 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 trellis_pccc_decoder_combined_cb::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_cb::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 -trellis_pccc_decoder_combined_cb::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 gr_complex *in = (const gr_complex *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_cb; -typedef boost::shared_ptr trellis_pccc_decoder_combined_cb_sptr; - -trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_cb : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_cb ( - 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 &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 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_cb.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i deleted file mode 100644 index 9ae829c55..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_cb.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_cb); - -trellis_pccc_decoder_combined_cb_sptr trellis_make_pccc_decoder_combined_cb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_cb : public gr_block -{ -private: - trellis_pccc_decoder_combined_cb ( - 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 &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 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_decoder_combined_ci.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc deleted file mode 100644 index 19201947e..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_ci_sptr -trellis_make_pccc_decoder_combined_ci ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_ci ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_ci::trellis_pccc_decoder_combined_ci ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_ci", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (int))), - 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 trellis_pccc_decoder_combined_ci::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_ci::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 -trellis_pccc_decoder_combined_ci::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 gr_complex *in = (const gr_complex *) input_items[0]; - int *out = (int *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_ci; -typedef boost::shared_ptr trellis_pccc_decoder_combined_ci_sptr; - -trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_ci : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_ci ( - 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 &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 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_ci.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i deleted file mode 100644 index 5644d6992..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_ci.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_ci); - -trellis_pccc_decoder_combined_ci_sptr trellis_make_pccc_decoder_combined_ci ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_ci : public gr_block -{ -private: - trellis_pccc_decoder_combined_ci ( - 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 &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 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_decoder_combined_cs.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc deleted file mode 100644 index 0ab818bfd..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_cs_sptr -trellis_make_pccc_decoder_combined_cs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_cs ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_cs::trellis_pccc_decoder_combined_cs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_cs", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (short))), - 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 trellis_pccc_decoder_combined_cs::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_cs::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 -trellis_pccc_decoder_combined_cs::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 gr_complex *in = (const gr_complex *) input_items[0]; - short *out = (short *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_cs; -typedef boost::shared_ptr trellis_pccc_decoder_combined_cs_sptr; - -trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_cs : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_cs ( - 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 &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 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_cs.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i deleted file mode 100644 index 7614a81fc..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_cs.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_cs); - -trellis_pccc_decoder_combined_cs_sptr trellis_make_pccc_decoder_combined_cs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_cs : public gr_block -{ -private: - trellis_pccc_decoder_combined_cs ( - 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 &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 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_decoder_combined_fb.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc deleted file mode 100644 index 0122dd7e9..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_fb_sptr -trellis_make_pccc_decoder_combined_fb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fb ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_fb::trellis_pccc_decoder_combined_fb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_fb", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - 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 trellis_pccc_decoder_combined_fb::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_fb::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 -trellis_pccc_decoder_combined_fb::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]; - unsigned char *out = (unsigned char *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_fb; -typedef boost::shared_ptr trellis_pccc_decoder_combined_fb_sptr; - -trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_fb : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_fb ( - 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 &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 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_fb.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i deleted file mode 100644 index 41e1a2f4f..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fb.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fb); - -trellis_pccc_decoder_combined_fb_sptr trellis_make_pccc_decoder_combined_fb ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_fb : public gr_block -{ -private: - trellis_pccc_decoder_combined_fb ( - 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 &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 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_decoder_combined_fi.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc deleted file mode 100644 index e87487087..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_fi_sptr -trellis_make_pccc_decoder_combined_fi ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fi ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_fi::trellis_pccc_decoder_combined_fi ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_fi", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (int))), - 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 trellis_pccc_decoder_combined_fi::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_fi::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 -trellis_pccc_decoder_combined_fi::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]; - int *out = (int *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_fi; -typedef boost::shared_ptr trellis_pccc_decoder_combined_fi_sptr; - -trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_fi : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_fi ( - 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 &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 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_fi.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i deleted file mode 100644 index 202609ace..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fi.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fi); - -trellis_pccc_decoder_combined_fi_sptr trellis_make_pccc_decoder_combined_fi ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_fi : public gr_block -{ -private: - trellis_pccc_decoder_combined_fi ( - 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 &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 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_decoder_combined_fs.cc b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc deleted file mode 100644 index bb822c699..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.cc +++ /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: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "core_algorithms.h" - - -static const float INF = 1.0e9; - -trellis_pccc_decoder_combined_fs_sptr -trellis_make_pccc_decoder_combined_fs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) -{ - return gnuradio::get_initial_sptr (new trellis_pccc_decoder_combined_fs ( - FSMo, STo0, SToK, - FSMi, STi0, STiK, - INTERLEAVER, - blocklength, - repetitions, - SISO_TYPE, - D, - TABLE,METRIC_TYPE, - scaling - )); -} - -trellis_pccc_decoder_combined_fs::trellis_pccc_decoder_combined_fs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -) - : gr_block ("pccc_decoder_combined_fs", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (short))), - 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 trellis_pccc_decoder_combined_fs::set_scaling(float scaling) -{ - d_scaling = scaling; -} - - -void -trellis_pccc_decoder_combined_fs::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 -trellis_pccc_decoder_combined_fs::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]; - short *out = (short *) output_items[0]; - for (int n=0;n -#include -#include "calc_metric.h" -#include "siso_type.h" - -class trellis_pccc_decoder_combined_fs; -typedef boost::shared_ptr trellis_pccc_decoder_combined_fs_sptr; - -trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -/*! - * \ingroup coding_blk - */ -class trellis_pccc_decoder_combined_fs : public gr_block -{ - fsm d_FSMo; - fsm d_FSMi; - int d_STo0; - int d_SToK; - 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 d_TABLE; - trellis_metric_type_t d_METRIC_TYPE; - float d_scaling; - std::vector d_buffer; - - friend trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling - ); - - trellis_pccc_decoder_combined_fs ( - 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 &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 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_fs.i b/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i deleted file mode 100644 index b8bbf09d6..000000000 --- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_fs.i +++ /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: this file is machine generated. Edits will be over written - -GR_SWIG_BLOCK_MAGIC(trellis,pccc_decoder_combined_fs); - -trellis_pccc_decoder_combined_fs_sptr trellis_make_pccc_decoder_combined_fs ( - 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 &TABLE, - trellis_metric_type_t METRIC_TYPE, - float scaling -); - - -class trellis_pccc_decoder_combined_fs : public gr_block -{ -private: - trellis_pccc_decoder_combined_fs ( - 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 &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 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); -}; -- cgit From bb98061115a2c7299fb24ed90ba48786118bf32e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 21 Sep 2011 23:38:38 -0700 Subject: trellis: performed generation re-work on gr-trellis lib --- gr-trellis/src/lib/CMakeLists.txt | 178 ++++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 86 deletions(-) (limited to 'gr-trellis/src') diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt index ff9e5b253..e9222b5fd 100644 --- a/gr-trellis/src/lib/CMakeLists.txt +++ b/gr-trellis/src/lib/CMakeLists.txt @@ -30,95 +30,96 @@ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) ######################################################################## -# Generate the makefile.gen, then extract its sources: -# This is a round-about way to extract the sources, -# but it requires minimum changed to the python utils. -# -# The recommended way to do this: -# - Make a generation macro that registers the sources command. -# - List the generation macro with each templated source file. -# - Create a python script (very generic) to perform generation. -# - This way the targets would depend only on their sources. -######################################################################## -EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c " -import os, sys +# 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.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' -os.environ['do_makefile'] = '1' -os.environ['do_sources'] = '0' -from generate_all import generate_all -generate_all() - " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +os.chdir('${CMAKE_CURRENT_BINARY_DIR}') -MACRO(GEGEN_GEN_EXTRACT outvar ext) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( - map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), - filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() - )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) - FILE(TO_CMAKE_PATH "${${outvar}}" ${outvar}) -ENDMACRO(GEGEN_GEN_EXTRACT) - -GEGEN_GEN_EXTRACT(generated_trellis_sources ".cc") -GEGEN_GEN_EXTRACT(generated_trellis_includes ".h") -GEGEN_GEN_EXTRACT(generated_trellis_swigs ".i") - -#TODO simplify this list with a triple-threat for loop -SET(generated_trellis_deps - generate_all.py - generate_trellis.py - trellis_encoder_XX.cc.t - trellis_encoder_XX.h.t - trellis_encoder_XX.i.t - trellis_sccc_encoder_XX.cc.t - trellis_sccc_encoder_XX.h.t - trellis_sccc_encoder_XX.i.t - trellis_pccc_encoder_XX.cc.t - trellis_pccc_encoder_XX.h.t - trellis_pccc_encoder_XX.i.t - trellis_metrics_X.cc.t - trellis_metrics_X.h.t - trellis_metrics_X.i.t - trellis_viterbi_combined_XX.cc.t - trellis_viterbi_combined_XX.h.t - trellis_viterbi_combined_XX.i.t - trellis_sccc_decoder_combined_XX.cc.t - trellis_sccc_decoder_combined_XX.h.t - trellis_sccc_decoder_combined_XX.i.t - trellis_sccc_decoder_X.cc.t - trellis_sccc_decoder_X.h.t - trellis_sccc_decoder_X.i.t - trellis_pccc_decoder_X.cc.t - trellis_pccc_decoder_X.h.t - trellis_pccc_decoder_X.i.t - trellis_pccc_decoder_combined_XX.cc.t - trellis_pccc_decoder_combined_XX.h.t - trellis_pccc_decoder_combined_XX.i.t - trellis_viterbi_X.cc.t - trellis_viterbi_X.h.t - trellis_viterbi_X.i.t -) +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) -ADD_CUSTOM_COMMAND( - OUTPUT - ${generated_trellis_sources} - ${generated_trellis_includes} - ${generated_trellis_swigs} - DEPENDS ${generated_trellis_deps} - COMMAND ${PYTHON_EXECUTABLE} -B -c - \"import os, sys\;sys.path.append('${GR_CORE_PYTHONPATH}')\;sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')\;os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'\;from generate_all import generate_all\;generate_all()\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "generating trellis files" -) +") -ADD_CUSTOM_TARGET(trellis_generated DEPENDS - ${generated_trellis_sources} - ${generated_trellis_includes} - ${generated_trellis_swigs} -) +######################################################################## +# 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 +######################################################################## +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i " +// +// This file is machine generated. All edits will be overwritten +// +") + +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%{\n") +FOREACH(swig_file ${generated_trellis_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME_WE) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "#include<${name}.h>\n") +ENDFOREACH(swig_file) +FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%}\n") + +FOREACH(swig_file ${generated_trellis_swigs}) + GET_FILENAME_COMPONENT(name ${swig_file} NAME) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i "%include<${name}>\n") +ENDFOREACH(swig_file) ######################################################################## # Setup library @@ -201,9 +202,14 @@ SET(GR_SWIG_INCLUDE_DIRS ) SET(GR_SWIG_LIBRARIES gnuradio-trellis) - -SET(GR_SWIG_TARGET_DEPS trellis_generated) - +FILE(GLOB GR_SWIG_SOURCE_DEPS + "${CMAKE_CURRENT_SOURCE_DIR}/*.i" + "${CMAKE_CURRENT_SOURCE_DIR}/*.h" +) +LIST(APPEND GR_SWIG_SOURCE_DEPS + ${generated_trellis_swigs} + ${generated_trellis_includes} +) GR_SWIG_MAKE(trellis trellis.i) GR_SWIG_INSTALL( -- cgit From c802032c0198c872ee09b1ec93ce7531f654715c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 23 Sep 2011 17:20:46 -0400 Subject: trellis: fixed import statements; fixed test_cpm to convert numpy stuff to types GNU Radio blocks can handle. --- gr-trellis/src/examples/fsm_utils.py | 7 ++++++- gr-trellis/src/examples/test_cpm.py | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'gr-trellis/src') diff --git a/gr-trellis/src/examples/fsm_utils.py b/gr-trellis/src/examples/fsm_utils.py index e3426637c..e9243f899 100755 --- a/gr-trellis/src/examples/fsm_utils.py +++ b/gr-trellis/src/examples/fsm_utils.py @@ -26,10 +26,15 @@ import math import sys import operator import numpy -import scipy.linalg from gnuradio import trellis +try: + import scipy.linalg +except ImportError: + print "Error: Program requires scipy (see: www.scipy.org)." + sys.exit(1) + ###################################################################### diff --git a/gr-trellis/src/examples/test_cpm.py b/gr-trellis/src/examples/test_cpm.py index ec432d4ff..b5bdaae44 100755 --- a/gr-trellis/src/examples/test_cpm.py +++ b/gr-trellis/src/examples/test_cpm.py @@ -13,10 +13,15 @@ from gnuradio.gr import firdes from grc_gnuradio import blks2 as grc_blks2 import math import numpy -import scipy.stats 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() @@ -83,7 +88,7 @@ def run_test(seed,blocksize): ################################################## # Blocks ################################################## - random_source_x_0 = gr.vector_source_b(data, False) + 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)) @@ -96,9 +101,9 @@ def run_test(seed,blocksize): # 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, N) - gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, N*(1+0)) - viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, N, constellation, trellis.TRELLIS_EUCLIDEAN) + 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, trellis.TRELLIS_EUCLIDEAN) gr_vector_sink_x_0 = gr.vector_sink_b() -- cgit