Turbo product code (TPC) encoder
Communications Toolbox / Error Detection and Correction / Block
The TPC Encoder block performs 2-D turbo product code (TPC) encoding of an input message. The product code is a 2-D concatenation of linear block codes. The linear block codes can be a parity check code, a Hamming code, or a BCH code capable of correcting two errors. Extended and shortened codes can be applied independently on each dimension. For a description of 2-D TPC encoding, see Turbo Product Code Construction.
For information about valid code pairs and the error-correcting capability for each valid code pair, see Component Code Pairs.
In
— Message to encodeInput message bits to encode, specified as a column vector.
For full-length input messages, the length of the column vector must be the product of Number of rows in message, Kr and Number of columns in message, Kc.
For shortened input messages, the length of the column vector must be the product of Number of rows in shortened message, Sr and Number of columns in shortened message, Sc.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
Out
— TPC-encoded messageTPC-encoded message, returned as a column vector with the same data type as the input signal.
For full-length input messages, the length of the column vector is the product of Number of rows in code, Nr and Number of columns in code, Nc.
For shortened input messages, the length of the column vector is the product of (NR–KR+SR) and (NC–KC+SC), where:
NR is the value of Number of rows in code, Nr.
KR is the value of Number of rows in message, Kr.
SR is the value of Number of rows in shortened message, Sr.
NC is the value of Number of columns in code, Nc.
KC is the value of Number of columns in message, Kc.
SC is the value of Number of columns in shortened message, Sc.
Extended codes
— Extended codes indicator for TPC row parameterson
(default) | off
When Extended codes is selected, the lists for Number of rows in code, Nr and Number of rows in message, Kr contain the valid values for extended individual code pairs (NR,KR).
When Extended codes is cleared, the lists for Number of rows in code, Nr and Number of rows in message, Kr contain the valid values for nonextended individual code pairs (NR,KR).
Number of rows in code, Nr
— Number of rows in product code matrix16
(default) | integerNumber of rows in the product code matrix, NR. The list of integer values varies depending on the setting for Extended codes.
Number of rows in message, Kr
— Number of rows in message matrix11
(default) | integerNumber of rows in the message matrix, KR. The list of integer values varies depending on the setting for Extended codes and Number of rows in code, Nr.
Specify shortened message length
— Specify shortened message length for rowsoff
(default) | on
Select Specify shortened message length to specify a value for Number of rows in shortened message, Sr.
Number of rows in shortened message, Sr
— Number of rows in shortened message matrix9
(default) | integerNumber of rows in the shortened message matrix, SR, specified as an integer less than or equal to KR. When you specify this parameter, provide full-length NR and KR values to specify the (NR,KR) code pair. This code pair is then shortened to the (NR–KR+SR,SR) code pair, where:
NR is the value of Number of rows in code, Nr.
KR is the value of Number of rows in message, Kr.
SR is the value of Number of rows in shortened message, Sr.
To enable this parameter, select Specify shortened message length.
Data Types: double
Extended codes
— Extended codes indicator for TPC column parameterson
(default) | off
When Extended codes is selected, the lists for Number of columns in code, Nc and Number of columns in message, Kc contain the valid values for extended individual code pairs (NC,KC).
When Extended codes is cleared, the lists for Number of columns in code, Nc and Number of columns in message, Kc contain the valid values for nonextended individual code pairs (NC,KC).
Number of columns in code, Nc
— Number of columns in product code matrix32
(default) | integerNumber of columns in the product code matrix, NC. The list of integer values varies depending on the setting for Extended codes.
Number of columns in message, Kc
— Number of columns in message matrix26
(default) | integerNumber of columns in the message matrix, KC. The list of integer values varies depending on the setting for Extended codes and Number of columns in code, Nc.
Specify shortened message length
— Specify shortened message length for columnsoff
(default) | on
Select Specify shortened message length to specify a value for Number of columns in shortened message, Sc.
Number of columns in shortened message, Sc
— Number of columns in shortened message matrix22
(default) | integerNumber of columns in the shortened message matrix, SC, specified as an integer. When you specify this parameter, provide full-length NC and KC values to specify the (NC,KC) code pair. This code pair is then shortened to the (NC–KC+SC, SC) code pair, where:
NC is the value of Number of columns in code, Nc.
KC is the value of Number of columns in message, Kc.
SC is the value of Number of columns in shortened message, Sc.
To enable this parameter, select Specify shortened message length.
Data Types: double
Simulate using
— Type of simulation to runCode generation
(default) | Interpreted execution
Type of simulation to run, specified as Code generation
or
Interpreted execution
.
Code generation
–– Simulate the model by using
generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for
subsequent simulations unless the model changes. This option requires
additional startup time, but the speed of the subsequent simulations is
faster than Interpreted execution
.
Interpreted execution
–– Simulate the model by
using the MATLAB® interpreter. This option requires less startup time than the
Code generation
method, but the speed of
subsequent simulations is slower. In this mode, you can debug the source
code of the block.
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
This table lists the supported component code pairs for the row (NR,KR) and column (NC,KC) parameters.
NR and KR represent the number of rows in the product code matrix and message matrix, respectively.
NC and KC represent the number of columns in the product code matrix and message matrix, respectively.
Within each code type, any two component code pairs can form a 2-D TPC code. The table also includes the error-correction capability for each code pair.
Code type | Component Code Pairs(NR,KR) and (NC,KC) | Error-Correction Capability (T) |
Hamming code | (255,247) | 1 |
(127,120) | 1 | |
(63,57) | 1 | |
(31,26) | 1 | |
(15,11) | 1 | |
(7,4) | 1 | |
Extended Hamming code | (256,247) | 1 |
(128,120) | 1 | |
(64,57) | 1 | |
(32,26) | 1 | |
(16,11) | 1 | |
(8,4) | 1 | |
BCH code | (255,239) | 2 |
(127,113) | 2 | |
(63,51) | 2 | |
(31,21) | 2 | |
(15,7) | 2 | |
Extended BCH code | (256,239) | 2 |
(128,113) | 2 | |
(64,51) | 2 | |
(32,21) | 2 | |
(16,7) | 2 | |
Parity check code | (256,255) | - |
(128,127) | - | |
(64,63) | - | |
(32,31) | - | |
(16,15) | - | |
(8,7) | - | |
(4,3) | - |
Turbo product codes (TPC) are a form of concatenated codes used as forward error-correcting (FEC) codes. Two or more component block codes, such as systematic linear block codes, are used to construct TPCs. This encoder implements 2-D product code encoding, as described in [1], using two Linear Block Codes.
The TPC encoder accepts either full-length or shortened messages.
Construction of Full-Length Message Product Codes
Full-length input messages are encoded using specified 2-D TPC code pairs. Row-wise encoding uses the (NC,KC) code pair and column-wise encoding uses the (NR,KR) code pair. The input vector length must be KR · KC. The input message bits vector is arranged into a KR-by-KC matrix.
Row-wise encoding uses an (NC,KC) systematic linear block encoder with KC bits per row. The row-wise encoding results in a KR-by-NC matrix that includes parity bits added to each row.
Next, column-wise encoding uses an (NR,KR) systematic linear block encoder on each of the NC columns. Applying this 2-D TPC encoding to the initial KR-by-KC matrix results in an NR-by-NC matrix that includes parity bits added to each row and column.
The 2-D TPC full-code matrix is reshaped into a column vector of length NR · NC and returned as the TPC-encoded output.
Construction of Shortened Message Product Codes
Shortened input messages are encoded using specified 2-D TPC code pairs. Row-wise encoding uses the (NC,KC) code pair and column-wise encoding uses an (NR,KR) code pair. The input vector length must be SR · SC. The input shortened message bits vector is arranged into an SR-by-SC matrix. The shortened message matrix prepends two dimensions by padding the beginning of the message matrix with zeros. The resulting matrix is a KR-by-KC matrix.
Row-wise encoding uses an (NC,KC) systematic linear block encoder with KC bits per row. The row-wise encoding results in a KR-by-NC matrix that includes parity bits added to each row.
Next, the column-wise encoding uses an (NR,KR) systematic linear block encoder on each of the NC columns.
Applying this 2-D TPC encoding to the initial KR-by-KC matrix and excluding the zero-padded bits from the output results in an (NR–KR+SR)-by-(NC–KC+SC) matrix. This matrix includes parity bits added to each row and column.
The 2-D TPC shortened-code matrix is reshaped into a column vector of length (NR–KR+SR) · (NC–KC+SC) and returned as the TPC-encoded output.
[1] Pyndiah, R. M. "Near-Optimum Decoding of Product Codes: Block Turbo Codes." IEEE Transactions on Communications. Vol. 46, Number 8, August 1998, pp. 1003–1010.