<?xml version="1.0"?>
<block>
    <name>TPC Decoder Definition</name>
    <key>variable_tpc_decoder_def</key>
    <import>from gnuradio import fec</import>
    <var_make>
#if int($ndim())==0 #
self.$(id) = $(id) = fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type); #slurp
#else if int($ndim())==1 #
self.$(id) = $(id) = map( (lambda a: fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type)), range(0,$dim1) ); #slurp
#else
self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
#end if</var_make>
    <make></make>

<!-- This definition below is weird, it seems required for the GRC to be happy, I'm confused. -->
    <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>0</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>4</value>
        <type>int</type>
        <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
    </param>

    <param>
        <name>Dimension 2</name>
        <key>dim2</key>
        <value>4</value>
        <type>int</type>
        <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
    </param>

    <param>
        <name>Row Encoder Polynomials</name>
        <key>row_poly</key>
        <value>[3]</value>
        <type>int_vector</type>
    </param>
    
    <param>
        <name>Column Encoder Polynomials</name>
        <key>col_poly</key>
        <value>[43]</value>
        <type>int_vector</type>
    </param>
    
    <param>
        <name>K Row</name>
        <key>krow</key>
        <value>26</value>
        <type>int</type>
    </param>
    
    <param>
        <name>K Col</name>
        <key>kcol</key>
        <value>6</value>
        <type>int</type>
    </param>
    
    <param>
        <name>B</name>
        <key>bval</key>
        <value>9</value>
        <type>int</type>
    </param>
    
    <param>
        <name>Q</name>
        <key>qval</key>
        <value>3</value>
        <type>int</type>
    </param>

    <param>
        <name>NUM Turbo Iterations</name>
        <key>max_iter</key>
        <value>6</value>
        <type>int</type>
    </param>

    <param>
        <name>Decoder Type</name>
        <key>decoder_type</key>
        <value></value>
        <type>enum</type>
        <option>
            <name>Linear LOG-MAP</name>
            <key>0</key>
        </option>
        <option>
            <name>MAX LOG-MAP</name>
            <key>1</key>
        </option>
        <option>
            <name>Constant LOG-MAP</name>
            <key>2</key>
        </option>
        <option>
            <name>LOG-MAP (LUT Correction Factor)</name>
            <key>3</key>
        </option>
        <option>
            <name>LOG-MAP (C Correction Factor)</name>
            <key>4</key>
        </option>
    </param>


    <doc>
        This instantiates a 1-dim array or 2-dim array fo Turbo Product Encoders (TPC).
        Restrictions: B and Q must be carefully chosen such that when the matrices are setup,
        and the first B outputs are removed, they (the first B outputs) are all 0's.
    </doc>
</block>
