Documentation |
This model shows how to configure Reed-Solomon (RS) codes to perform block coding with erasures, punctures, and shortening.
RS decoders can correct both errors and erasures. The erasures can be generated by a receiver that identifies the most unreliable symbols in a given codeword. When a receiver erases a symbol, it replaces the symbol with a zero and passes a flag to the decoder indicating that the symbol is an erasure, not a valid code symbol.
In addition, an encoder can generate punctures for which specific parity symbols are always removed from its output. The decoder, which knows the puncture pattern, inserts zeros in the puncture positions and treats those symbols as erasures. The decoder treats encoder-generated punctures and receiver-generated erasures in exactly the same way when it decodes.
Puncturing has the added benefit of making the code rate a bit more flexible, at the expense of some error correction capability. Shortened codes achieve the same code rate flexibility without degrading the error correction performance, given the same demodulator input E_{b}/N_{0}. Note that puncturing is the removal of parity symbols from a codeword, and shortening is the removal of message symbols from a codeword.
This example shows a (63,53) RS code operating in concert with a 64-QAM modulation scheme. Since the code can correct (63-53)/2 = 5 errors, it can alternatively correct (63-53) = 10 erasures. For each demodulated codeword, the receiver determines the six least reliable symbols by finding the symbols within a decision region that are nearest to a decision boundary. It then erases those symbols. We first open the model RSCodingErasuresExampleRSCodingErasuresExample.
We then define system simulation parameters:
RS_TsUncoded = 1; % Sample time (s) RS_n = 63; % Codeword length RS_k = 53; % Message length RS_MQAM = 64; % QAM order RS_numBitsPerSymbol = ... % 6 bits per symbol log2(RS_MQAM); RS_sigPower = 42; % Assume points at +/-1, +/-3, +/-5, +/-7 RS_numErasures = 6; % Number of erasures RS_EbNoUncoded = 15; % In dB
The system is simulated at an uncoded E_{b}/N_{0} of 15 dB. However, the coded E_{b}/N_{0} is reduced because of the redundant symbols added by the RS Encoder. Also, the period of each frame in the model remains constant at 53 seconds, corresponding to a sample time of 1 second at the output of the Random Integer Generator. Moreover, the symbol time at the output of the RS Encoder is reduced by a factor of the code rate, because 63 symbols are output over the frame time of 53 seconds. The AWGN Channel block accounts for this by using the following parameters:
RS_EbNoCoded = RS_EbNoUncoded + 10*log10(RS_k/RS_n); RS_TsymCoded = RS_TsUncoded * (RS_k/RS_n);
The receiver determines which symbols to erase by finding the 64-QAM symbols, per codeword, that are closest to a decision boundary. It deletes the six least reliable code symbols, which still allows the RS Decoder to correct (10-6)/2 = 2 errors per codeword.
We simulate the system, showing the received symbols and those symbols that were erased:
Now let's examine the BER performance at the output of the decoder. We set the stop time of the simulation to inf, then simulate until 100 bit errors are collected out of the RS Decoder. The 64-QAM BER is shown below, followed by the RS BER. This convention is followed for the remainder of this example.
BER_eras = 1.7049e-03 2.5906e-06
In addition to decoding receiver-generated erasures, the RS Decoder can correct encoder-generated punctures. The decoding algorithm is identical for the two cases, but the per-codeword sum of the punctures and erasures cannot exceed twice the error-correcting capability of the code. Consider the following model that performs decoding for both erasures and punctures.
The same puncture vector is specified in both the encoder and decoder blocks. This example punctures two symbols from each codeword. Vector values of "1" indicate nonpunctured symbols, while values of "0" indicate punctured symbols. In the erasures vector, however, values of "1" indicate erased symbols, while values of "0" indicate nonerased symbols.
Several of the parameters for the AWGN Channel block are now slightly different, because the length of the codeword is now different from the previous example. The block accounts for the size difference with the following code:
RS_EbNoCoded = RS_EbNoUncoded + 10*log10( RS_k / (RS_n - RS_numPuncs) ); RS_TsymCoded = RS_TsUncoded * ( RS_k / (RS_n - RS_numPuncs) );
We simulate the model, RSCodingErasuresPunctExample.mdl, collecting 1000 errors out of the RS Decoder block. Due to puncturing, the signal dimensions out of the encoder are 61-by-1, rather than 63-by-1 in the model with no puncturing. The Create Erasures Vector subsystem must also account for the size differences as it creates a 61-by-1 erasures vector. Open the model RSCodingErasuresPunctExampleRSCodingErasuresPunctExample.
Let's compare the BERs for erasures decoding with and without puncturing.
The BER out of the 64-QAM Demodulator is slightly better in the punctured case, because the E_{b}/N_{0} into the demodulator is slightly higher. However, the BER out of the RS Decoder is much worse in the punctured case, because the two punctures reduce the error correcting capability of the code by one, leaving it able to correct only (10-6-2)/2 = 1 error per codeword.
BER_eras = 1.7049e-03 2.5906e-06 BER_eras_punc = 1.4767e-03 6.1103e-05
Shortening a block code removes symbols from its message portion, where puncturing removes symbols from its parity portion. You can incorporate both techniques with the RS encoder and decoder blocks.
For example, to shorten a (63,53) code to a (53,43) code, you can simply enter 53 and 43 for n and k, respectively, in the encoder and decoder block masks. However, if you want to shorten it by 35 symbols to a (28,18) code, you must explicitly specify the field of GF(2^{6}). Otherwise, the RS blocks will assume that the code is shortened from a (31,21) code.
To specify the field of GF(2^{6}), you must use a nondefault primitive polynomial. The following model, RSCodingErasuresPunctShortExample, which incorporates erasures, punctures, and shortening, does precisely that. Examine how the polynomial is specified in the RS blocks. Open the model RSCodingErasuresPunctShortExampleRSCodingErasuresPunctShortExample.
Because shortening alters the code rate much like puncturing does, the AWGN parameters must be changed again. The AWGN Channel block accounts for this with the following code:
RS_EbNoCoded = RS_EbNoUncoded + 10*log10( (RS_k - RS_shortenLength) / (RS_n - RS_shortenLength - RS_numPuncs) ); RS_TsymCoded = RS_TsUncoded * (RS_k - RS_shortenLength) / (RS_n - RS_shortenLength - RS_numPuncs);
We simulate the model, once again collecting 1000 errors out of the RS Decoder block. Note that the signal dimensions out of the RS Encoder are 26x1, due to 35 symbols of shortening and 2 symbols of puncturing. Once again, the Create Erasures Vector subsystem must also account for the size difference caused by the shortened code.
Let's compare the BER performance for decoding with erasures only, with erasures and punctures, and with erasures, punctures, and shortening.
The BER out of the 64-QAM Demodulator is worse with shortening than it is without shortening. This is because the code rate of the shortened code is much lower than the code rate of the non-shortened code and therefore the coded E_{b}/N_{0} into the demodulator is worse with shortening. A shortened code has the same error correcting capability as non-shortened code for the same E_{b}/N_{0}, but the reduction in E_{b}/N_{0} manifests in the form of a higher BER out of the RS Decoder with shortening than without.
BER_eras = 1.7049e-03 2.5906e-06 BER_eras_punc = 1.4767e-03 6.1103e-05 BER_eras_punc_short = 3.5975e-03 9.1940e-05
You can experiment with these systems by running them over a loop of E_{b}/N_{0} values and generating a BER curve for them. You can then compare their performance against a theoretical 64-QAM/RS system without erasures, punctures, or shortening. Use BERTool to generate the theoretical BER curves.