Вы находитесь на странице: 1из 4

FTC Assignment 4 solutions 5.22.

Berger code for 3-bit data:


d0 0 0 0 0 1 1 1 1 data bits d1 d2 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 check bits c0 c1 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0

5.23 There are two ways to reduce the number of check bits of a Berger code for 4-bit data from 3 to 2. First, if the original data never include the word 1111. Then, the checkbits are obtained in the usual way:
d0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 data bits d1 d2 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 1 d3 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 check bits c0 c1 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0

Alternatively, we can reduce the number of check bits if the original data never include the word 0000. Then, the checkbits are obtained by computing the number of 1s in the dataword, subtracting 1 from the resulting number, and then complementing it:

d0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

data bits d1 d2 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1

d3 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

check bits c0 c1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0

5.25 (a) 3N arithmetic code for 3-bit data:


dataword d0 d1 d2 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 c0 0 0 0 0 0 0 1 1 codeword c1 c2 c3 0 0 0 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 0 1 0 c4 0 1 0 1 0 1 0 1

(b) Any single-bit error, and any multiple-bit error which changes the codeword to a word which is not a multiple of 3 is detected. For example 00000 00010. Multiple-bit errors which change the codeword to a word which is a multiple of 3 are not detected. For example 00000 00011. 5.26 (a) This code is a 5N code. (b) It is not separable. (c) The code distance is 2. (d) It detects any single-bit error, and any multiple-bit error which changes the codeword to a word which is not a multiple of 5. 2

(e) Encoding is done by multiplying the dataword by 5. Decoding is done by dividing the codeword by 5. (f) If after dividing the codeword by 5 we get a reminder, there is an error. 5.27 (a) This code is a 3N code. (b) It is not separable. (c) The code distance is 2. (d) It detects any single-bit error, and any multiple-bit error which changes the codeword to a word which is not a multiple of 3.. (e) Encoding is done by multiplying the dataword by 3. Decoding is done by dividing the codeword by 3. (f) If after dividing the codeword by 3 we get a reminder, there is an error. 5.28 (a) This code is a 3-of-6 code. (b) It is separable. (c) The code distance is 2. (d) It detects any unidirectional error. (e)
in0 in1 in2 out0 out1 out2 out3 out4 out5

(f) To detect errors, we compare the outputs out i and outi 3 pairwise for all i 0 1 2 and check whether they have different values. We can implement the comparison using 2-input XORs. IF XOR is 0, there is an error. 3

6.2. If we add to the codeword of the alternating logic an additional check bit (either even or odd parity, this does not matter), then single-bit permanent error correction can be done as follows. After receiving the non-complemented codeword X and the complemented word X , we compare them and re-compute their parity bits. If codewords X and X are complements of each other, there is not error. Otherwise, if X and X have the same values for some bit, say i, then it will always be the case that old and new parity bits disagree in either X, or X , but not in both. This is because X is a complement of X and therefore a single error cannot change the parity of both codewords. The codeword in which old and new parity bits disagree has an error. To correct it, we change its ith bit to the complemented value. Note that ith bit can be the parity bit itself. The algorithm will work for this case as well. To summarize, alternating logic tells us which bit of the codeword is erroneous. Parity tells us which of the codewords in erroneous.

Вам также может понравиться