7
3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP CODE 3.1 OBJECT OF THE LABORATORY In this laboratory work we shall refer to encoding and decoding circuits for one error correcting Hamming group code. 3.2 THEORETICAL APPROACH The group codes theory is based on the fact that the set of all possible code words is a group for the operation of modulo-two summation. All the possible code words (w i ) have the same length “n”. Therefor, the set of all possible code words (W) has 2 n elements. For the error correction to be possible, from the set of all the possible code words (W) a subset will be chosen (V) of the code words (words with meaning) which satisfy certain conditions: - the number of the words with meaning must be greater or equal then the number of messages which has to be transmitted. For example let N be the number of messages; therefor we have: The subset of the code words with meaning (V) must have at least 2 m elements; - the subset V will be chosen such that to form a subgroup of the group of all the possible words W . If the “n” linear independent words of the group W are written in a column matrix F: then for choosing the subset V which has 2 k words with meaning, The matrix F will be divided in two: the generator matrix G and the control matrix H . For defining the words with meaning will be used two equivalent wordings: one as being part of the of the linear space of the matrix G, the { } 1 , 0 a ] a ,..., a , a ,..., a , a [ w ij in 1 ik ik i2 i1 i = + (3.1) n m 2 N m < = + n 1 m m 2 1 W W W W W F M M = lines m - n lines m H G F

3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

  • Upload
    others

  • View
    24

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP CODE

3.1 OBJECT OF THE LABORATORY In this laboratory work we shall refer to encoding and decoding circuits for one error correcting Hamming group code. 3.2 THEORETICAL APPROACH The group codes theory is based on the fact that the set of all possible code words is a group for the operation of modulo-two summation. All the possible code words (wi) have the same length “n”.

Therefor, the set of all possible code words (W) has 2n elements. For the error correction to be possible, from the set of all the possible code words (W) a subset will be chosen (V) of the code words (words with meaning) which satisfy certain conditions:

- the number of the words with meaning must be greater or equal then the number of messages which has to be transmitted. For example let N be the

number of messages; therefor we have:

The subset of the code words with meaning (V) must have at least 2m elements; - the subset V will be chosen such that to form a subgroup of the group of all the possible words W . If the “n” linear independent words of the group W are written in a column matrix F:

then for choosing the subset V which has 2k words with meaning, The matrix F will be divided in two: the generator matrix G and the control matrix H .

For defining the words with meaning will be used two equivalent wordings: one as being part of the of the linear space of the matrix G, the

{ }1,0a ]a,...,a,a,...,a,a[w ijin1ikiki2i1i ∈= +

(3.1) n m 2N m <≤

=

+

n

1m

m

2

1

W WW WW

F

M

M

=

lines m-nlines m

HG

F

Page 2: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

other one as being part of the null space of the matrix H. The second definition is usually used in the encoding of the group codes and from a mathematical point of view it is written as it follows:

which means that the code words with meaning have the property of being orthogonal on all the lines of the matrix H. From relation (3.2) it can be obtained “k” condition for orthogonality

Therefor, from the “n” symbols which form the word vi, “m” symbols can be chosen randomly and are called information symbols and k =n-m symbols will be the result of the “k” relation for orthogonality which must be satisfied by the word vi (3.3). These symbols are called control symbols and they will assure the necessary redundancy for a good stability to noise. In the transmission process errors may occur which will transform the word with meaning vi∈V in a word without one vi’∈W-V. From a mathematical point of view it can be considered that the received word vi’ is formed from vi by adding an error word ei:

The word ei represents the effect of the noise over the transmitted words. The correction can be easily done if the error words are not words with meaning, as in the shown following relation:

(if the error word is a word with meaning ei = vj, the correction is not possible because: Therefor, the problem of correcting the received word vi’ is reduced to finding the error word ei (relation 3.5). For this, at the receiver point the syndrome zi will be calculated, as in relation (3.6): If zi=0 it means that vi’= vi∈V and if zi≠0 from the zi we must determine the error word

ei.

For a correct correspondence zi→ ei it must be a bi-univocal one, meaning that, to distinct error words correspond distinct syndromes. From the relation (3.6) results the number of

(3.2) 0vH Ti=⋅

(3.3)

0ahahah

0ahahah0ahahah

inkni2k2i1k1

in2ni222i121

in1ni212i111

=+++

=+++=+++

K

MMM

K

K

(3.4)ev'v iii

+=

(3.5) veeve'viiiiii

=++=+

V).vvvev'v kjiiii ∈=+=+=

{ }1,0z

(3.6)

z zz

eH)ev(H'vHz

ij

ik

i2

i1

Ti

Tii

Tii

==+=⋅=M

Page 3: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

distinct syndromes to be 2m. The total number of the error words if is desired an “e“ error correction is the following:

Therefor, it is necessary the following number of distinct syndromes for each error word

1.3 One Error Correcting Hamming Code The laboratory pattern shows the encoding and decoding of the group codes and it is realized for a particular case of one error correcting Hamming code. It is chosen a code capable to transmit N=16 messages. From the relation (3.1) we have the number of information symbols 2m≥N m=4 (3.8) From the relation (3.7), taking into account that is desired one error correction (e=1), results the following:

The particularity of the Hamming code is the fact that the columns of the H matrix are the binary transcriptions of their number of order. In the above example the H matrix has n=7 columns and k=3 rows.

If in the structure of the code word the control symbols will be placed in the positions 2I, where i=0,1,2 (meaning in the positions 1, 2 and 4) then the encoding operation defined at (3.2) leads us to the expression of the control symbols in relation with the informational ones:

And from ere is obtained:

∑=

eC

0k

kn

∑=

≥e

Ck20j

jn

(3.9) 3k k,m1n1CCk2 1n

0n =++=+=+≥

[ ] (3.10) hhhhhhh1 0 1 0 1 0 11 1 0 0 1 1 01 1 1 1 0 0 0

H7654321

=

=

0aaacaaacaaac

vH

(3.11) ]a a a c a c c[v

7531

7632

7654Ti

7654321i

=

+++++++++

=

=

(3.12) aaacaaacaaac

7531

7632

7654

++=++=++=

Page 4: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

At decoding the syndromes will be calculated with the relation (3.6)

Taking into consideration the fact that we have a one error correcting code, the error word ei will have only one unit on the position “i”. In these conditions, the syndrome will be the number of the erroneous position in binary form:

3.4 PRESENTATION OF THE LABORATORY PATTERN The block scheme of the laboratory pattern is presented in figure 3.1. The scheme is for an encoder-decoder in a closed circuit. The encoder and the decoder have the same clock generator and impulses distribution circuit.

Fig. 3.1 The encoder is formed by:

- the clock generator (CBA) - the feedback shift register (SR1) having the role of the impulses

distribution circuit; - the circuit SAU1 having its inputs connected through switches to the

outputs 3, 4, 5 and 7 of the SR1. With this switches the information symbols can be chosen (the circuit SAU1 together with the switches simulate the

iheHz Ti =⋅=

(3.13)

aaa c

aaa c

aaa c

zzz

eH z'7

'5

'3

'1

'7

'6

'3

'2

'7

'6

'5

'4

3

2

1Ti

+++

+++

+++

=

==

ENCODER CHANNEL DECODER

Page 5: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

information source), - the computation block for the control symbols, - The circuit SAU3 which “puts together” the code word.

The transmission channel is simulated with a modulo-two summator and the noise source with a block which introduce the errors (formed by the circuit SAU6 having the inputs connected through switches to SR1). By using the switches it is possible to simulate the error word eI which is next added modulo-two to the correct word. The decoder contains :

- the computation block for the syndromes - the decimal-binary decoder - the shift register SR2 where the received word is loaded serially and it can

be corrected. The operation can be tracked on the scheme presented in figure 3.2. The impulse distribution circuit (SR1)is made with two integrated and cascaded registers of type CDB 495. The inverted outputs of the first 6 cells are connected at the inputs of the circuit SI15, forming in this way a reaction which will allow the entrance of a symbol in the first cell once in seven clock periods of time. This impulse moves in the clock rhythm, appearing successively on the outputs 3,4,5,6,7,8 and 9. This set of seven impulses shifted in time will be used for the serial construction of the code word. The choice for the informational symbols is made with the switches from the input of the circuit SAU1 (point 13 on the pattern). The control symbols are determined as in relation (3.12). Lets follow the computation mode for the control symbol c4. At the output of the circuit SAU2 (point 10) are obtained 3 impulses in the positions of the symbols a7 a6 a5. The circuit SI1 makes the intersection between the outputs of SAU1 and SAU2 () is made the logical operation AND between the information symbols a7 a6 a5 a3 and three impulses representing 1 logic corresponding to the positions 7, 6 and 5 in the code word). At the output of the circuit SI1 (point 11) will be obtained the chosen information symbols a7 a6 and a5. The flip-flop circuit CBB1 makes their serial modulo-two summation (point 12), summation which in fact represents c4. The reading of the control symbols is made with the circuit SI4; on one of its inputs is applied an impulse from the forth position of the distribution circuit and on the other input (point 14) is applied the output of CBB1. In an analogue mode are calculated the symbols c2 and c1 (points 15 and 16). The code word is obtained at the output of the circuit SAU5 (point 17). The introduction of an error is made following the relation (3.4). The choice over the position of the error is made with the help of the switches placed at the input of the circuit SAU6. In the point 33 it can be noticed the chosen error word. The error word can be visualized in the point 18, being the result of modulo-two summation of the code word with the error word. The symbols of the received word are successively loaded in the shift register SR2, which is also realized with two CDB 495 cells. In the time of the seven clocks for the serial shift necessary for the word to be loaded in SR2 are determined the symbols of the syndrome corresponding to the received word as in relation (3.13) by using the circuits SAU7-SAU9; SI7-SI9; CBB4-CBB6; SI10-SI12. (On the pattern it can be tracked in the points 19, 20, 21 and 22 the computation of the symbol z1 of the syndrome, but also the values of the symbols z2 and z3 in the points 23 and 24). Between the clocks 7 and 8 is made the correction of the erroneous symbol and the flip-flop circuits are cleared. For the

Page 6: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

correction is formed a short impulse with MC1 controlled by the circuit SI13 (point 32). This impulse allows: the reading of the syndromes and when applied on the clock T2 input of the shift register SR2 will permit it to be serially loaded. Simultaneously with the command of CBM1, a second mono-stable CBM2 was also commanded. The impulse generated by CBM2 has a duration larger then the one generated by CBM1.

Fig. 3.2

This impulse changes the mode control of the register SR2 from 0 to 1, which will allow its parallel loading synchronous with the impulse applied on T2. This possibility of parallel loading is used for correction. The reloading of the register is made with its content (vi’) to which is add the error word (ei) obtained at the output of the decoder, the summation vi’+ei=vi representing the correct word. After the correction is done, the mono-stable is brought to zero with an impulse obtained by commanding the outputs of the two mono-stable circuits CBM1 and CBM2 in the circuit SI NU. 3.5 LABORATORY WORK OPERATIONS ORDER 1. Study the functioning of the device based on the principle scheme. 2. Chose the information symbols and then calculates the control ones. Chose the

erroneous position and calculate the syndrome. 3. Supply the device. Start the base time of the oscilloscope with the signal from point 3. 4. Follow the functioning of the circuit by visualizing and then drawing the

corresponding waveforms: - the clock generator: 2; - the distribution register: 3, 4, 5, 6, 7, 8 and 9 - introduce the information symbols by replacing the switches with flexible

girdles: 13; - observe the way the control symbols are being calculated : 10, 11, 12, 14,

Page 7: 3. ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING …ares.utcluj.ro/itc/index_files/L4_Hamming.pdf · 2007-10-12 · ENCODING-DECODING DEVICE FOR ONE ERROR CORRECTING HAMMING GROUP

15 and 16 - visualize the correct word: 17 - choose the error word by replacing the switches with flexible

girdle: 33; - visualize the error word: 18 - observe the way the received word is being corrected: 25, 26, 27, 28, 29,

30, 31 5. Draw also the waveforms of the control signals theoretically determined based on the analyses of the of the ensemble formed by SI13, CBM1, CBM2, SI-NU 14. Draw the control signals for the reading of the syndromes (The output oh CBM12 in point 32).

- the mode control of the register SR2 (the output of CBM2) - the control for the erasure of the flip-flops (the output of SI-NU).

3.6 QUESTIONS 1. In which case is justified the use of a one error correcting Hamming code? 2. Write the control matrix for a one error correcting Hamming code, which detects two

errors. 3. Modify the block scheme of the circuit such that to be able to correct one error and to

detect two errors. 4. What happens if in the transmission process two errors will occur? 5. Calculate the efficiency and the redundancy of this code. BIBLIOGRAPHY: [1] Al. Spataru, “Teoria transmisiunii informatiei”, vol.II., ET, 1971