A Complete Questionnaire-Issue on Codec
The followings are parts of the laboratory experiments and assignments.
The followings are solutions to the above questionnaire:
1. As referred to the text a normal (6,3) bit pattern is specified as:
[D1 D2 D3 P1 P2 P3]
where Di are the 3 data bits and Pi are the 3 parity check bits which are calculated using the incoming data bits. The way that these parity bits are calculated is shown in the following:
P1 = h11.D1 (+) h12.D2 (+) h13.D3
P2 = h21.D1 (+) h22.D2 (+) h23.D3
P3 = h31.D1 (+) h32.D2 (+) h33.D3
where "." stands for logical AND, and (+) for logical Exclusive OR. We have also the G matrix:
[c] = [G][.][d]
where [c] is [c1c2c3c4c5c6] = [D1 D2 D3 P1 P2 P3] and [.] is the matrix multiplication. G matrix is written as follow:
G matrix must be carried out so that the parity check bits along with the data would generate a series of code word whose Hamming distance is 3, the minimum distance required to have 1 bit error correction. A typical G matrix is shown below:
therefore:
P1 = D1 (+) D3
P2 = D2 (+) D3
P3 = D1 (+) D2
At the receiver we must multiply the received codewords with the HT in order to achieve the error syndromes. By definition H = [PIm], therefore HT is:
However the problem is, we are not transmitting our pattern as in above, rather in the following order:
[P1 P2 D1 P3 D2 D3]
therefore according to the changes in the bit patterns position we must apply to the [G] and [HT] as follow:
and
therefore according to the new order of bit transmission we suggest the following circuit to receive the 3 data bits and to produce the codeword [P1 P2 D1 P3 D2 D3].
Now we transmit our codewords on the channel, however the channel may apply some errors on the codewords. We model this effect by using the circuit labelled A. If all switches are on the 0 then we have no errors. Since each bit is EORed by 0 which permits the bit to receive with no error. However if we would like to apply an error to a specific bit all we have to do is to switch the appropriate bit to 1 which causes an arithmetic EOR addition of 1 which makes the output NOTed that models an error on that bit.
Now we must set up a circuitry to produce the syndromes for error checking. Before that we show how these syndromes look like:
[S] = [R].[HT]
where [R] is the received codeword :
S1 = P1 (+) D1 (+) D3
S2 = P2 (+) D2 (+) D3
S3 = D1 (+) P3 (+) D2
where [P1 P2 D1 P3 D2 D3] is the received code word. Now by the application of definitions of our parities, we have:
S1 = (D1 (+) D3) (+) D1 (+) D3
S2 = (D2 (+) D3) (+) D2 (+) D3
S3 = (D1 (+) D2) (+) D1 (+) D2
To design a circuit which generates these syndromes, we suggest the usage of an integrated circuit of GAL22V10 which contains six two input EORs and one three input EOR. Its pin configuration is shown in the circuit diagram B.
By using this IC the necessary syndromes are obtained according to the combination stated, shown in the circuit diagrams C and D.
Diagrams C & D
Discussion on the syndromes
Now if we assume that all the received codeword is correct therefore Di = Di and Pi = Pi and the followings are resulted:
S1 = D1 (+) D3 (+) D1 (+) D3 = 0
S2 = D2 (+) D3 (+) D2 (+) D3 = 0
S3 = D1 (+) D2 (+) D1 (+) D2 = 0
since Di (+) Di according to the law of EOR is zero.
If the following errors occur we will have:
Error |
S1 |
S2 |
S3 |
DE1 |
1 |
0 |
1 |
DE2 |
0 |
1 |
1 |
DE3 |
1 |
1 |
0 |
PE1 |
1 |
0 |
0 |
PE2 |
0 |
1 |
0 |
PE3 |
0 |
0 |
1 |
Now if we employ a 3 to 8 decoder, any of the combination of these syndromes is assigned to one out put. This has been shown in the circuit diagram C.
Forward Error Correction
We have so far considered single error conditions only. By the usage of these syndromes and the received codewords and EORs gates we may achieve forward error correction as specified in the following design. Here if we assume that one of the arrival bits is error, this will make the appropriate output bit of the 3 to 8 high therefore if we drive the appropriate outputs with the actual bits as shown in the following figure, we will have either one of the possible states. The actual bit might be correct therefore the appropriate bit from the 3 to 8 is low therefore by EORing these two bits we may have the actual bit at the output. If the actual bit is error then that bit will be high which makes the EORing of these two bits reversing of the actual bit which makes it correct again. This effect has been illustrated in the circuit diagram E.
Diagram E
One error correction and two errors detection achievement
We have so far assumed to have only one error, however it is possible to have more, up to six errors. We are not able to detect and correct more than 2 errors according to the Hamming distance. In order to achieve more error bit detection and correction we must increase the number of parity bits. But the parity bits must be fixed.
We are expecting to have up to two errors and according to the 2t + 1 and t +1 law we are able to correct one bit error or to detect two bit errors. We have designed our system so that it corrects one bit error, now we enter a discussion to enhance the designed system. There are 3 data bits and 3 parity bits, which are generated from the data bits. Therefore our codeword can have only 8 different patterns.
The following table shows these 8 different patterns, along with the possibilities of having error in any of our 6 bits. Note that PiE, DiE, state the error bit received.
D1 |
D2 |
D3 |
DE1 |
DE2 |
DE3 |
P1=D1(+)D3 |
P2=D2(+)D3 |
P3=D1(+)D2 |
PE1 |
PE2 |
PE3 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
We write different possibilities for the first syndrome (S1) according to the 8 different values of the data bits as follow:
S1 = P1 (+) D1 (+) D3 |
|||||||
P1 |
P1 |
P1 |
P1 |
PE1 |
PE1 |
PE1 |
PE1 |
D1 |
D1 |
DE1 |
DE1 |
D1 |
D1 |
DE1 |
DE1 |
D3 |
DE3 |
D3 |
DE3 |
D3 |
DE3 |
D3 |
DE3 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
Because of the similarities between the way that syndromes are generated from the arrival bits, we can derive a similar table for S2 and S3 as well.
The only reference point by which we are ensured that we have received all the bits correct is the state S1 = S2 = S3 = 0. It can be shown that up to two errors wont effect this criteria, however more than two errors may affect this criteria. That is:
Condition |
no error |
one error |
two errors |
three errors |
four errors |
S1=S2=S3=0 |
all correct |
-- |
-- |
DE1, DE2, DE3 P1, P2, P3, |
DE1, D2, DE3 P1, PE2, PE3, , |
For zero error the correct reception suits this condition fine, however there is no way to have one or two errors which result S1 = S2 = S3 = 0.
Now we focus our attention to two-bit-error and according to the structure of the syndromes we see the effects as follow:
two errors |
S1 S2 S3 |
the corresponding one bit error |
DE1, DE2 |
1 1 0 |
DE3 |
DE1, DE3 |
0 1 1 |
DE2 |
DE1, PE1 |
0 0 1 |
PE3 |
DE1, PE2 |
1 1 1 |
--- |
DE1, PE3 |
1 0 0 |
PE1 |
DE2, DE3 |
1 0 1 |
DE1 |
DE2, PE1 |
1 1 1 |
--- |
DE2, PE2 |
0 0 1 |
PE3 |
DE2, PE3 |
0 1 0 |
PE2 |
DE3, PE1 |
0 1 0 |
PE2 |
DE3, PE2 |
1 0 0 |
PE1 |
DE3, PE3 |
1 1 1 |
--- |
PE1, PE2 |
1 1 0 |
DE3 |
PE1, PE3 |
1 0 1 |
DE1 |
PE2, PE3 |
0 1 1 |
DE2 |
or in the terms of syndromes we conclude that :
S1 |
S2 |
S3 |
one error |
two errors |
dual bit |
0 |
0 |
0 |
--- |
--- |
|
0 |
0 |
1 |
PE3 |
DE1, PE1 or DE2, PE2 |
D3 |
0 |
1 |
0 |
PE2 |
DE2, PE3 or DE3, PE1 |
D1 |
0 |
1 |
1 |
DE2 |
DE1, DE3 or PE2, PE3 |
P1 |
1 |
0 |
0 |
PE1 |
DE1, PE3 or DE3, PE2 |
D2 |
1 |
0 |
1 |
DE1 |
DE2, DE3 or PE1, PE3 |
P2 |
1 |
1 |
0 |
DE3 |
DE1, DE2 or PE1, PE2 |
P3 |
1 |
1 |
1 |
--- |
DE2, PE1 or DE1, PE2 or DE3, PE3 |
--- |
Therefore, if we assume that we have two errors, we are not able to identify which set of two or three errors are responsible.
We shall note that the law of Hamming distance states that with the Hamming distance of 3 we are able to correct one error bit OR detect two error bits, that is, simultaneous operations are not possible. In the following we show, that we end with similar syndrome structure for both operations witch is not distinguishable.
Now we want to enhance our system in order to handle two errors detection. Again we assume that we have either no error or one error or two errors. We use several methods to check this out:
Method One :
We have so far designed a system that detects and correct one error bit therefore if we reproduce the syndromes from the corrected bits (from the output of the EORs) and we feed them again through another 3 to 8 decoder.
If we have two error bits therefore one of the first outputs of the first 3 to 8 decoders output except for the first and the last ones, sets high, this not only does not reduces our errors but also according to the last table, it will increase our errors. For example if we have PE1, P2, DE1, P3, D2, P3, this will produce a syndromes of S1, S2, S3 = 0 0 1. This will automatically generate the output from the first 3 to 8 decoder for PE3. Therefore we will have three errors that will affect our reference condition of S1, S2, S3 = 0 0 0. This occurs while we have two errors and according to our pre-setting one error correction circuitry we make the third error to the code word and that makes a total of three errors for the next 3 to 8 decoder.
We introduce all the bit orders of three error bits that generate S1, S2, S3 = 0 0 0 as follow:
DE1, DE2, DE3, P1, P2, P3 D1, DE2, D3, P1, PE2, PE3
DE1, D2, D3, PE1, P2, PE3 D1, D2, DE3, PE1, PE2, P3
and by a careful observation we see that all the 7 conditions will generate the state of S1, S2, S3 = 0 0 0 at the second syndrome system.
Therefore again our reference condition is under the question while if we have either one error bit or two error bits we will achieve the first decoders output at the second decoder which is ambiguous.
Second Method :
The second approach is using the dual bits stated in the last table.
Now consider if we have received the bits whether with no error or one or two. If it has no zero, there is no problem we have the first bit of the decoder high. However if we have one or two error bits we employ the dual bits, so that when we have a high on one of the first decoders output we change the appropriate dual bit as well and the final bits are fed through the second decoder. The results are stated in the following table:
S1 |
S2 |
S3 |
1 error + dual bit è 2nd decoder |
two errors + dual bit è 2nd decoder |
0 |
0 |
0 |
--- |
--- |
0 |
0 |
1 |
P3, DE3 è 7th |
DE1, PE1 or DE2, PE2 & DE3 & PE3 è 7th |
0 |
1 |
0 |
P2, DE1 è 6th |
DE2, PE3 or DE3, PE1 & DE1 & PE2 è 6th |
0 |
1 |
1 |
D2, PE1 è 5th |
DE1, DE3 or PE2, PE3 & PE1 & DE2 è 5th |
1 |
0 |
0 |
P1, DE2 è 4th |
DE1, PE3 or DE3, PE2 & DE2 & PE1 è 4th |
1 |
0 |
1 |
D1, PE2 è 3rd |
DE2, DE3 or PE1, PE3 & PE2 & DE1 è 3rd |
1 |
1 |
0 |
PE3, DE1 è 2nd |
DE1, DE2 or PE1, PE2 & DE1 & PE3 è 2nd |
1 |
1 |
1 |
--- |
DE2, PE1 or DE1, PE2 or DE3, PE3 |
We observe that due to the dualities between the one error state and two errors state we achieve the same results therefore, we are not able to distinguish between one error state and two errors state! However certain states are detectable, for example all the states that produce the syndromes of: S1, S2, S3 = 1 1 1, which are: DE2, PE1 and DE1, PE2 and DE3, PE3.
Therefore we must change our policy so that any case of two error bits can be detectable, since as observed except for the three above special two error bits, others can not be distinguished.
This situation occurs because of the effect of touching spheres in Hamming distance space structure. We propose the following method to solve this problem:
Change of codeword structure
We add another parity bit to the sending codeword structure as stated as follow:
P1 = D1 (+) D3
P2 = D2 (+) D3
P3 = D1 (+) D2
P4 = D1 (+) D2 (+) D3
therefore the codeword structure is changed as following:
C = [D1 D2 D3 P1 P2 P3 P4]
and the G matrix will have an extra column as follow :
and the HT matrix will become:
therefore there will be an extra one syndrome as stated below :
S1 = P1 (+) D1 (+) D3
S2 = P2 (+) D2 (+) D3
S3 = D1 (+) P3 (+) D2
S4 = D1 (+) D2 (+) D3 (+) P4
now we analyse the state of having one error:
Error |
S1 S2 S3 S4 |
D1 |
1 0 1 1 |
D2 |
0 1 0 1 |
D3 |
1 1 0 1 |
P1 |
1 0 0 0 |
P2 |
0 1 0 0 |
P3 |
0 0 1 0 |
P4 |
0 0 0 1 |
now we analyse the state of having two errors:
two errors |
S1 S2 S3 S4 |
the corresponding one bit error |
DE1, DE2 |
1 1 0 0 |
--- |
DE1, DE3 |
0 1 1 0 |
--- |
DE1, PE1 |
0 0 1 1 |
--- |
DE1, PE2 |
1 1 1 1 |
--- |
DE1, PE3 |
1 0 0 1 |
--- |
DE1, PE4 |
1 0 1 0 |
--- |
DE2, DE3 |
1 0 1 0 |
--- |
DE2, PE1 |
1 1 1 1 |
--- |
DE2, PE2 |
0 0 1 1 |
--- |
DE2, PE3 |
0 1 0 1 |
--- |
DE2, PE4 |
0 1 1 0 |
--- |
DE3, PE1 |
0 1 0 1 |
--- |
DE3, PE2 |
1 0 0 1 |
--- |
DE3, PE3 |
1 1 1 1 |
--- |
DE3, PE4 |
1 1 0 0 |
--- |
PE1, PE2 |
1 1 0 0 |
--- |
PE1, PE3 |
1 0 1 0 |
--- |
PE1, PE4 |
1 0 0 1 |
--- |
PE2, PE3 |
0 1 1 0 |
--- |
PE2, PE4 |
0 1 0 1 |
--- |
PE3, PE4 |
0 0 1 1 |
--- |
therefore we can distinguish between one bit error and two bit error states. Now we write them in terms of the syndromes:
S1 S2 S3 S4 |
output number |
Dedicated Error Pattern Interpretation |
0 0 0 0 |
1 |
no error |
0 0 0 1 |
2 |
P4 |
0 0 1 0 |
3 |
P3 |
0 0 1 1 |
4 |
D1, P1 or D2, P2 or P3, P4 |
0 1 0 0 |
5 |
P2 |
0 1 0 1 |
6 |
D2, P3 or P2, P4 or D3, P1 |
0 1 1 0 |
7 |
D1, D3 or P2, P3 or D2, P4 |
0 1 1 1 |
8 |
D2 |
1 0 0 0 |
9 |
P1 |
1 0 0 1 |
10 |
D1, P3 or D3, P2 or P1, P4 |
1 0 1 0 |
11 |
D1, P4 or D2, D3 or P1, P3 |
1 0 1 1 |
12 |
D1 |
1 1 0 0 |
13 |
D1, D2 or D3, P4 or P1, P2 |
1 1 0 1 |
14 |
D3 |
1 1 1 0 |
15 |
--- |
1 1 1 1 |
16 |
D1, P2 or D2, P1 or P3, D3 |
as you can see there is no over lap between the one error bit patterns and two error bit patterns, therefore, we are now able to operate both.
We can perform the operation by using a single 4 to 16 decoder, therefore, the first output is dedicated to the error free reception signal and the 2nd, 3rd, 5th, 8th, 9th, 12th, and 4th outputs are related to the one error reception signals and the 15th pin is dedicated to more than 3 bits error reception and the rest bits are for two bits error detection.
Another way to determine the one error bit case is by a careful look at the syndromes. We find out, that, in the one error bit condition we have 3 bits equal in level and one bit in another level. Either there are three one and a zero or three zero and a one, therefore by using a very simple circuit we are able to distinguish between them.
The construction of a decoder is not that sophisticated. For example, if the inverted signals of the three inputs are accessible, then by using 8 three-input-ANDs we are able to build a 3 to 8 decoder according to the following table:
and by using two 3 to 8 decoder we are able to build a 4 to 16 decoder.