Basic concepts of linear grouping codes:
In linear grouping codes (n, k), 2 k codes are allowed. Defines the addition of linear grouping codes as modulo 2 and multiplication as binary multiplication. That is, 1 + 1 = 0, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0; 1x1 = 1, 1x0 = 0, 0x0 = 0, 0x1 = 0. The bitwise operation between the codeword and the codeword complies with the preceding binary addition operation rules.
Linear grouping codes have the following properties (n, k:
1. Closed. The sum of any two code groups is still the allowed one.
2. The minimum distance between codes is equal to the minimum weight of non-zero codes.
For Grouping codes whose length is N, whose information element is K bits, and whose supervised code element is r = n-k bits, it is often recorded as (n, k) codes. If 2r-1 is greater than or equal to N, it is possible to construct a linear code that corrects one or more errors.
In the following example, we use (7, 4) block code to illustrate how to construct this linear code. In the grouping code (n, k), k = 4. to correct an error code, R is required to be greater than or equal to 3. If R is 3, n = K + R = 7. A0ala2a3a4a5a6 is used to represent the seven code elements, and S1, S2, and S3 are used to represent the principals calculated by the three supervised equations, assume that the correspondence between the three S1, S2, and S3 correction sub-code groups and the error location is shown in Table 12.2.
Table 12.2 () Verification Code and Error Code Location
S1s2s3 |
Error location |
S1s2s3 |
Error location |
001 |
A0 |
101 |
A4 |
010 |
A1 |
110 |
A5 |
100 |
A2 |
111 |
A6 |
011 |
A3 |
000 |
No error |
|
|
As can be seen from the table, when the error code is located at A2, A4, A5, and A6, the primary node S1 = 1; otherwise, S1 = 0. Therefore, S1 = A6 %a5 %a4 %a2, and S2 = A6 %a5 %a3 %a1 and S3 = A6 %a4 %a3 %a0. During encoding, A6, A5, A4, and A3 are information elements, while A2, A1, and A0 are supervision elements. Then, the supervised code element can be uniquely determined by the following supervised equation: |
That is
|
The 16 allowable code groups shown in Table 12.3 can be obtained from the above equation. After receiving each code group, the receiving end calculates S1, S2, and S3. If the value is not all 0, an error exists. In table 12.2, the error location can be determined and corrected. For example, if the received code group is 0000011, you can calculate s1s2s3 = 011. Table 12.2 shows an error code on A3. We can see that the minimum code distance of the above () code is dmin = 3, which can correct one or detect two codes. If the error correction capability is exceeded, a new error code will appear due to "uncorrected.
Table 12.3 () allowable code groups
Information location |
Supervision position |
Information location |
Supervision position |
A6a5a4a3 |
A2a1a0 |
A6a5a4a3 |
A2a1a0 |
0000 0001 0010 0011 0100 0101 0110 0111 |
000 011 101 110 110 101 011 000 |
1000 1001 1010 1011 1100 1101 1110 1111 |
111 100 010 001 001 010 100 111 |
The linear grouping Code Constructed by the preceding method to correct a single error code is also known as the Hamming code. It has the following features: code length n = 2s-1, minimum code distance is d = 3, information code length k = 2n-s-1, error correction capability T = 1, supervised code length R = n-k = m. Here M is a positive integer ≥2. Given m, the Hamming Code (n, k) can be constructed ).
(7, 4) simulation of the compiled code of the Hamming code:
Figure 12.1 shows the schematic diagram of the optical encoder circuit of (12.2). Figure shows the schematic diagram of the decoder circuit. The simulation schematic diagram shown in Figure 12.3 can be built based on the above two figures. The simulation schematic consists of two subsystems: (7, 4) optical encoder and decoder. During the simulation, the signal source uses a prom and the user-defined data content. The data output is regularly driven by a counter, output A 4-bit data every second (the 8-bit prom uses only 4 of them). After being encoded and converted by the encoder subsystem, it becomes a 7-bit hamming code, which is transmitted after being converted by a string, the parallel string and serial parallel conversion circuit uses the time division multiplexing and shard map in extended communication library 2. the maximum time slot conversion between the merge and shard length is 16 bits, it is defined as a 7-bit time slot. In this case, because the system data rate of input and output data is different, you must reset the system sampling rate at the input of the subsystem and set the system as a multi-rate system. Because the update rate of the original 4-bit data is 1Hz, the input end of the encoder can be set to 10Hz, the time division multiplexing and shard data frame cycle is set to 1 second, the time slot digit is 7, the output sampling rate is 7 times of the input sampling rate, that is, 70Hz. If noise is to be added, the sampling rate of the noise signal source should also be set to 70Hz. Figure 12.3 shows the schematic diagram of the simulation subsystem of the (12.4) optical encoder, and figure shows the schematic diagram of the simulation subsystem of the corresponding decoder. Figure 12.5 shows the (7, 4) hamming code output waveform after String Conversion. Here, only four seconds of simulation are set, the four data output are 0, 1, 3, and 4. The corresponding (7, 4) Hamming codes are (0000000), (0001011), (0011110), (0100110 ), note that the sequence of serial transmission is the first low and later high (LSB ).
Of course, we can directly transmit and decode data in parallel without passing the parallel String Conversion. In this way, we can manually interfere with one of the 7-bit Hamming codes during parallel transmission and observe the error correction. Through simulation experiments, we can find that if there are more than two errors, the Hamming Code cannot correct them. Therefore, other encoding methods, such as BCH, RS, and convolution codes, must be used in applications that require multi-bit error correction.
Figure 12.6 Hamming output waveform of input 0, 1, 3, and 4