diff options
author | tracierenea <tracie.perez@mavs.uta.edu> | 2014-07-12 11:37:22 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-10-15 10:40:22 -0400 |
commit | 68bcd7305b51a6aa8bfdc0220da3b5ec9c2763a7 (patch) | |
tree | cfce98b848758dc42dc016bf78e5f6481077fba1 /gr-fec | |
parent | bbaa0294e50f2aab02b6413f7e2f17a23fca81b2 (diff) |
fec: LDPC: Adding 3 LDPC-related xml files for GRC.
Also changed constructor for ldpc_par_chk_mtrx to take a filename
string instead of pointer, because I think works better for GRC?
Tried adding these blocks to the example flowgraph ber_curve_gen, and
it runs, but the QT QUI Bercurve sink just displays a plot with points
at 0,0. Still troubleshooting that...
Diffstat (limited to 'gr-fec')
-rw-r--r-- | gr-fec/grc/fec_block_tree.xml | 3 | ||||
-rw-r--r-- | gr-fec/grc/variable_ldpc_R_U_encoder.xml | 73 | ||||
-rw-r--r-- | gr-fec/grc/variable_ldpc_bit_flip_decoder.xml | 80 | ||||
-rw-r--r-- | gr-fec/grc/variable_parity_check_matrix_object.xml | 38 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h | 4 | ||||
-rw-r--r-- | gr-fec/lib/ldpc_par_chk_mtrx.cc | 10 |
6 files changed, 201 insertions, 7 deletions
diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml index 65a4fc8a14..398ab8c468 100644 --- a/gr-fec/grc/fec_block_tree.xml +++ b/gr-fec/grc/fec_block_tree.xml @@ -17,6 +17,7 @@ <block>variable_dummy_decoder_def</block> <block>variable_polar_decoder_sc_def</block> <block>variable_polar_decoder_sc_list_def</block> + <block>variable_ldpc_bit_flip_decoder_def</block> </cat> <cat> <name>Encoders</name> @@ -27,6 +28,7 @@ <block>variable_tpc_encoder_def</block> <block>variable_dummy_encoder_def</block> <block>variable_polar_encoder_def</block> + <block>variable_ldpc_R_U_encoder_def</block> </cat> <block>fec_extended_encoder</block> <block>fec_extended_async_encoder</block> @@ -46,5 +48,6 @@ <block>fec_ber_bf</block> <block>fec_bercurve_generator</block> <block>variable_polar_code_configurator</block> + <block>variable_ldpc_par_chk_mtrx_def</block> </cat> </cat> diff --git a/gr-fec/grc/variable_ldpc_R_U_encoder.xml b/gr-fec/grc/variable_ldpc_R_U_encoder.xml new file mode 100644 index 0000000000..e889adc66d --- /dev/null +++ b/gr-fec/grc/variable_ldpc_R_U_encoder.xml @@ -0,0 +1,73 @@ +<?xml version="1.0"?> +<!-- +################################################### +# FEC LDPC RICHARDSON URBANKE ENCODER +################################################### + --> +<block> + <name>LDPC R. U. Encoder Definition</name> + <key>variable_ldpc_R_U_encoder_def</key> + <import>from gnuradio import fec</import> + <var_make> +#if int($ndim())==0 # +self.$(id) = $(id) = fec.ldpc_R_U_encoder_make($parity_check_matrix_object) +#else if int($ndim())==1 # +self.$(id) = $(id) = map((lambda a: fec.ldpc_R_U_encoder_make($parity_check_matrix_object)), range(0,$dim1)) #slurp +#else +self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_R_U_encoder_make($parity_check_matrix_object)), range(0,$dim2))), range(0,$dim1)) #slurp +#end if</var_make> + <make></make> + + <param> + <name>Ignore Me</name> + <key>value</key> + <value>"ok"</value> + <type>raw</type> + <hide>all</hide> + </param> + + <param> + <name>Parallelism</name> + <key>ndim</key> + <value></value> + <type>enum</type> + <option> + <name>0</name> + <key>0</key> + </option> + <option> + <name>1</name> + <key>1</key> + </option> + <option> + <name>2</name> + <key>2</key> + </option> + </param> + + <param> + <name>Dimension 1</name> + <key>dim1</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Dimension 2</name> + <key>dim2</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide> + </param> + + <param> + <name>LDPC Parity Check Matrix Object</name> + <key>parity_check_matrix_object</key> + <value></value> + <type>raw</type> + </param> + + <doc> + </doc> +</block> diff --git a/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml b/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml new file mode 100644 index 0000000000..070574b38d --- /dev/null +++ b/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml @@ -0,0 +1,80 @@ +<?xml version="1.0"?> +<!-- +################################################### +# FEC LDPC BIT FLIP DECODER +################################################### + --> +<block> + <name>LDPC Bit Flip Decoder Definition</name> + <key>variable_ldpc_bit_flip_decoder_def</key> + <import>from gnuradio import fec</import> + <var_make> +#if int($ndim())==0 # +self.$(id) = $(id) = fec.ldpc_bit_flip_decoder.make($parity_check_matrix_object, $max_iterations) +#else if int($ndim())==1 # +self.$(id) = $(id) = map((lambda a: fec.ldpc_bit_flip_decoder.make($parity_check_matrix_object, $max_iterations)), range(0,$dim1)) #slurp +#else +self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_bit_flip_decoder.make($parity_check_matrix_object, $max_iterations)), range(0,$dim2))), range(0,$dim1)) #slurp +#end if</var_make> + <make></make> + + <param> + <name>Ignore Me</name> + <key>value</key> + <value>"ok"</value> + <type>raw</type> + <hide>all</hide> + </param> + + <param> + <name>Parallelism</name> + <key>ndim</key> + <value></value> + <type>enum</type> + <option> + <name>0</name> + <key>0</key> + </option> + <option> + <name>1</name> + <key>1</key> + </option> + <option> + <name>2</name> + <key>2</key> + </option> + </param> + + <param> + <name>Dimension 1</name> + <key>dim1</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide> + </param> + + <param> + <name>Dimension 2</name> + <key>dim2</key> + <value>1</value> + <type>int</type> + <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide> + </param> + + <param> + <name>LDPC Parity Check Matrix Object</name> + <key>parity_check_matrix_object</key> + <value></value> + <type>raw</type> + </param> + + <param> + <name>Max Iterations</name> + <key>max_iterations</key> + <value>100</value> + <type>int</type> + </param> + + <doc> + </doc> +</block> diff --git a/gr-fec/grc/variable_parity_check_matrix_object.xml b/gr-fec/grc/variable_parity_check_matrix_object.xml new file mode 100644 index 0000000000..11331af837 --- /dev/null +++ b/gr-fec/grc/variable_parity_check_matrix_object.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +################################################### +# FEC LDPC PARITY CHECK MATRIX OBJECT +################################################### + --> +<block> + <name>LDPC Parity Check Matrix Object</name> + <key>variable_ldpc_par_chk_mtrx_def</key> + <import>from gnuradio import fec</import> + <var_make>self.$(id) = $(id) = fec.ldpc_par_chk_mtrx($filename, $gap)</var_make> + + <make></make> + + <param> + <name>Ignore Me</name> + <key>value</key> + <value>"ok"</value> + <type>raw</type> + <hide>all</hide> + </param> + + <param> + <name>File</name> + <key>filename</key> + <value></value> + <type>file_open</type> + </param> + + <param> + <name>Gap</name> + <key>gap</key> + <value></value> + <type>int</type> + </param> + <doc> + </doc> +</block> diff --git a/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h b/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h index 61bed6ef57..5b9efea771 100644 --- a/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h +++ b/gr-fec/include/gnuradio/fec/ldpc_par_chk_mtrx.h @@ -58,12 +58,12 @@ namespace gr { gsl_matrix *d_phi_inverse_ptr; // Read the matrix from a file in alist format - void read_matrix_from_file(const std::string *); + void read_matrix_from_file(const std::string filename); // Set the submatrix variables needed for encoding void set_parameters_for_encoding(); public: - ldpc_par_chk_mtrx(const std::string &filename, unsigned int gap); + ldpc_par_chk_mtrx(const std::string filename, unsigned int gap); // Default constructor, should not be used ldpc_par_chk_mtrx(); // Get the codeword length n diff --git a/gr-fec/lib/ldpc_par_chk_mtrx.cc b/gr-fec/lib/ldpc_par_chk_mtrx.cc index 3045b15611..56c14d6d0c 100644 --- a/gr-fec/lib/ldpc_par_chk_mtrx.cc +++ b/gr-fec/lib/ldpc_par_chk_mtrx.cc @@ -32,9 +32,9 @@ namespace gr { namespace fec { namespace code { - ldpc_par_chk_mtrx::ldpc_par_chk_mtrx(const std::string &filename, unsigned int gap) + ldpc_par_chk_mtrx::ldpc_par_chk_mtrx(const std::string filename, unsigned int gap) { - read_matrix_from_file(&filename); + read_matrix_from_file(filename); d_gap = gap; set_parameters_for_encoding(); } // Constructor @@ -110,7 +110,7 @@ namespace gr { } void - ldpc_par_chk_mtrx::read_matrix_from_file(const std::string *alist_file) + ldpc_par_chk_mtrx::read_matrix_from_file(const std::string filename) { /* This function reads in an alist file and creates the corresponding parity check matrix. The format of alist @@ -120,10 +120,10 @@ namespace gr { std::ifstream inputFile; // Open the alist file (needs a C-string) - inputFile.open((*alist_file).c_str()); + inputFile.open((filename).c_str()); if (!inputFile) { std::cout << "There was a problem opening file " - << *alist_file << " for reading.\n"; + << filename << " for reading.\n"; exit(1); } |