Page 45
Step 6 : Decoding
It's now time to decode the DEST_CODED sequence. We need to break up the DEST_CODED
bit stream into 7-bit sequences, y, that will be converted back into 4-bit message sequences by the
decoding algorithm. In a noise-free environment, the 4 message bits are just the last 4 bits of the
7-bit code word (this is easily seen from the (7,4) Hamming code table presented in the
Introduction). But in order to take advantage of the error correction feature of this code, we must
determine if an error occurred by using the parity check matrix and if so, to correct it by using the
syndrome that results.
The decoder loop needs to perform the following for every 7-bit code, y, in the whole
DEST_CODED sequence:
First, take the 7-bit sequence and multiply it by H
T
, modulo 2. This is similar to the coding
loop that was used in Step 2. This gives us the 3-bit syndrome, s.
Next, convert the 3-bit syndrome from a binary number into an integer. Thus [0,0,0] => 0;
[0,0,1] => 1; ... ; [1,1,1]=>7.
Use this integer + 1 as an index to extract the correct row, e, from the error-pattern look-up
matrix E. Thus a syndrome of [0,0,0], or integer 0, returns the 1
st
row of E. Since this row
is all '0's, none of the original 7 bits are in error. Similarly, a syndrome of [1,1,1], or
integer 7, returns the 8
th
row of E. The '1' in the 6th column of this error vector indicates a
bit error in 6th column of the received 7-bit code, y.
Using the error vector, e, from the previous look-up we can correct the single bit error by
adding e to y, modulo 2.
Finally, concatenate or add in the last 4 bits (this is where the original message was
located) of the now corrected row vector to DEST_DECODED.
If you have trouble with the above loop, see your TA.
Verify your work by recording the first 20 bits of the DEST_DECODED sequence. These
should match fairly closely the original 20 data bits of SRC_UNCODED recorded in Step 1.
Why might some of the bits still be in error after coding and decoding with this (7,4)
Hamming code? Explain.
Step 7 : Calculate the Error Probability
Since this is a simulation, we have the original data sequence and can compare the two received
sequences to it to determine exactly how many errors occurred. This gives us an indication as to
the probability of error for the particular signal energy per bit to noise power density ratio we were
using.