You are on page 1of 5

2/22/2012

Let’s do some rectangular parity decoding


D1 D2 P1
Received codewords
D3 D4 P2

1 0 1 P3 P4

0 1 0
1011
1. Decoded message bits: ________________
0 1

0 0 0
0011
6.02 Spring 2012 1 1 1 2. Decoded message bits: ________________
1 1 P2 parity error
Lecture #4
0 0 1
• Linear block codes – Syndrome Decoding 0 1 0 0001
3. Decoded message bits: ________________
• Handling bursts 0 0 “uncorrectable”

6.02 Spring 2012 Lecture 5, Slide #1 6.02 Spring 2012 Lecture 5, Slide #2

Towards More Efficient Codes:


(7,4,3) Hamming Code Example Logic Behind Hamming Code Construction
• Use multiple parity bits, each covering a • Idea: Use parity bits to cover each axis of the
subset of the data bits. binary vector space
– That way, all message bits will be covered with a unique
• No two message bits belong to exactly the combination of parity bits
same subsets, so a single-bit error will
generate a unique set of parity check errors. Index 1 2 3 4 5 6 7
Binary 001 010 011 100 101 110 111
Suppose we check the index
parity and discover that P1
Modulo-2 (7,4) P1 P2 D1 P3 D2 D3 D4
D1 and P3 indicate an error?
addition, P1 P2 bit D2 must have flipped
code
aka XOR
D4 What if only P2 indicates
P1 with binary index 001 covers
D3 an error?
D2
P1 = D1+D2+D4 P2 itself had the error! P1 = D1+D2+D4
P2 = D1+D3+D4 P2 = D1+D3+D4 D1 with binary index 011
P3 = D2+D3+D4 P3 P3 = D2+D3+D4 D2 with binary index 101
D4 with binary index 111
6.02 Spring 2012 Lecture 5, Slide #3 6.02 Spring 2012 Lecture 5, Slide #4

1
2/22/2012

Syndrome Decoding: Idea Matrix Notation for Linear Block Codes


• After receiving the (possibly corrupted) message, Task: given k-bit message, compute n-bit codeword. We can
compute a syndrome bit (Ei) for each parity bit use standard matrix arithmetic (modulo 2) to do the job. For
example, here’s how we would describe the (9,4,4) rectangular
E1 = D1 + D2 + D4 + P1 code that includes an overall parity bit.
P1 = D1+D2+D4
E2 = D1 + D3 + D4 + P2 P2 = D1+D3+D4
D1 D2 P1

E3 = D2 + D3 + D4 + P3 P3 = D2+D3+D4
d1xk  Gkxn  c1xn D3 D4 P2
• If all the Ei are zero: no errors
1 0 0 0 1 0 1 0 1 P3 P4 P5
• Otherwise the particular combination of the E3E2E1 0 1 0 0 1 0 0 1 1
can be used to figure out which bit to correct D1 D2 D3 D4    D1 D2 D3 D4 P1 P2 P3 P4 P5 
0 0 1 0 0 1 1 0 1
 
0 0 0 1 0 1 0 1 1
1×n
1×k k×n
Index 1 2 3 4 5 6 7 code word
message generator
Binary 001 010 011 100 101 110 111 vector

 
index vector matrix

Gkxn  I kk Ak( nk )


(7,4) P1 P2 D1 P3 D2 D3 D4
code
The generator matrix
6.02 Spring 2012 Lecture , Slide #5 6.02 Spring 2012 Lecture , Slide #6

Parity Check Matrix D1 D2 P1 Syndrome Decoding – Matrix Form


D3 D4 P2 Task: given n-bit code word, compute (n-k) syndrome bits.
For (9,4,4) example Again we can use matrix multiply to do the job.
Can restate the codeword 1xn
P3 P4 P5
generation process as a received word r1xn  c1xn  e1xn error vector
parity check
 D1  (n-k) x 1
compute Syndromes
D 
on receive word
H ( nk ) xn  r1Txn  E( nk ) x1 syndrome
 2 vector
H ( nk ) xn  c1Txn  0 1 1 0 0 1 0 0 0 0  D3 
 
0 0 1 1 0 1 0 0 0  D4  To figure out the relationship of Syndromes to errors:

1 0 1 0 0 0 1 0 0   P1   05 x1

0 1 0 1 0 0 0 1
  
0  P2  H ( nk ) xn  (c1xn  e1xn )T  E( nk ) x1 use H ( nk ) xn  c1Txn  0
1 1 1 1 0 0 0 0 1  P3 
 
The parity check matrix,  P4  H ( nk ) xn  e1Txn  E( nk ) x1 figure-out error type
(n-k) x n P  from Syndrome
 5
parity check
n×1 Knowing the error patterns we want to correct for, we can
matrix
code word compute Syndrome vectors offline and then do a lookup after
vector the Syndrome is calculated from a received word to find the
(transpose) error type that occurred
6.02 Spring 2012 Lecture , Slide #7 6.02 Spring 2012 Lecture , Slide #8

2
2/22/2012

Syndrome Decoding – Steps Spot Quiz: Hamming Syndrome Decoding

Find the error in the following received codeword


Step 1: For a given code and error patterns ei, precompute
Syndromes and store them
[D1 D2 D3 D4 P1 P2 P3] = [1 1 1 0 1 1 1]
H  ei  Ei
E1 = 1+1+0+1 = 1
E2 = 1+1+0+1 = 1
Step 2: For each received word,
compute the Syndrome
H r  E E3 = 1+1+0+1 = 1

Syndrome computation:

Step 3: Find l such that El == E and apply correction for error el E1 = D1+D2+D4+P1
E2 = D1+D3+D4+P2
c  r  el E3 = D2+D3+D4+P3

6.02 Spring 2012 Lecture , Slide #9 6.02 Spring 2012 Lecture , Slide #10

Syndrome Decoding – Steps (9,4,4) example Syndrome Decoding – Steps (9,4,4) example
Codeword generation:
1 0 0 0 1 0 1 0 1 Correction:
0 1 0 0 1 0 0 1 1
1 1 1 1   1 1 1 1 0 0 0 0 0
0 0 1 0 0 1 1 0 1 Since received word Syndrome [1 0 0 1 1]T matches the precomputed
  Syndrome of the error [0 1 0 0 0 0 0 0 0],
0 0 0 1 0 1 0 1 1
apply this error to the received word to recover the original codeword
Received word in error:
1 0 1 1 0 0 0 0 0  1 1 1 1 0 0 0 0 0  Received word
0 1 0 0 0 0 0 0 0

Syndrome computation 1 Precomputed Syndrome for 0


1 1 1 1 0 0 0 0 0  1 0 1 1 0 0 0 0 0 
for received word
0 
 
1 0 0 1 0 0 0 0 1 1
a given error pattern
1
 
1 0 0 1 0 0 0 0 0 1
0 1 0 0 0 0 0 0 0
1 1
0    
 0 1 1 0 1 0 0 0 1 0 0
 0 1 1 0 1 0 0 0 0 0 Corrected codeword
1 0 1 0 0 0 1 0 0   0   0  1 0 1 0 0 0 1 0 0   0   0 
           
0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 0 1 Error pattern from
1 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 0 1 matching Syndrome
   
0  0 
0  0 
6.02 Spring 2012   Lecture , Slide
 #11 6.02 Spring 2012 Lecture , Slide #12

3
2/22/2012

Correcting single-bit errors is nice, but

Linear Block Codes: Wrap-Up


in many situations errors come in
bursts many bits long (e.g., fading or
Burst Errors
burst of interference on wireless
channel, damage to storage media
• (n,k,d) codes have rate k/n and can correct up to etc.). How does single-bit error
floor((d-1)/2) bit errors correction help with that?

• Code words are linear operations over message


bits: sum of any two code words is a code word
P(pkt i was lost | pkt i-x was lost)
– Message + 1 parity bit: (n+1,n,2) code
• Good code rate, but only 1-bit error detection Experiment on
– Replicating each bit c times is a (c,1,c) code 802.11g network
• Simple way to get great error correction; poor code rate (static and mobile)
– Hamming single-error correcting codes are
(n, n-m, 3) where n = 2m - 1 for m > 1
• Adding an overall parity bit makes the code (n+1,n-p,4)
– Rectangular parity codes are (rc+r+c, rc, 3) codes
• Rate not as good as Hamming codes
• Syndrome decoding: general efficient approach for
decoding linear block codes Note: P(pkt lost) ≈ s*P(bit error) where s = pkt size
6.02 Spring 2012 Lecture , Slide #13 6.02 Spring 2012 Lecture , Slide #14

Coping with Burst Errors by Interleaving Framing


Well, can we think of a way to turn a B-bit error burst • Looking at a received bit stream, how do we know
into B single-bit errors? where a block of interleaved codewords begins?
• Physical indication (transmitter turns on,
beginning of disk sector, separate control channel)
• Place a unique bit pattern (frame sync sequence) in
Row-by-row Col-by-col the bit stream to mark start of a block
B transmission B transmission – Frame = sync pattern + interleaved code word block
order order – Search for sync pattern in bit stream to find start of frame
– Bit pattern can’t appear elsewhere in frame (otherwise our
search will get confused), so have to make sure no legal
combination of codeword bits can accidentally generate
Problem: Bits from a Solution: interleave bits the sync pattern (can be tricky…)
particular codeword are from B different codewords. – Sync pattern can’t be protected by ECC, so errors may
transmitted sequentially, Now a B-bit burst produces cause us to lose a frame every now and then, a problem
that will need to be addressed at some higher level of the
so a B-bit burst produces 1-bit errors in B different communication protocol.
multi-bit errors. codewords.
6.02 Spring 2012 Lecture , Slide #15 6.02 Spring 2012 Lecture , Slide #16

4
2/22/2012

Summary: example channel coding steps Summary: example error correction steps
011011101101
1. Break message stream into k-bit 1. Search through received bit 011111001111011100100001111001110
blocks. Step 1: k=4 stream for sync pattern, Step 1: sync = 0111110
2. Add redundant info in the form of 0110 extract interleaved codeword
011111110010000111101110
(n-k) parity bits to form n-bit 1110 block
1101
codeword. Goal: choose parity Step 2: (8,4,3) code
2. De-interleave the bits to form Step 2: B = 3, n = 8
bits so we can correct single-bit B n-bit codewords 01100111
01101111 11110101
errors, detect double-bit errors. 11100101 3. Check parity bits in each code 11000110
3. Interleave bits from a group of B 11010110 word to see if an error has
Step 3: (8,4,3) code
codewords to protect against B- Step 3: B = 3 occurred. If there’s a single-
bit burst errors. 011111110001100111101110
bit error, correct it. 010 110 110
4. Add unique pattern of bits to Step 4: sync = 0111110 4. Extract k message bits from 101 111 001
start of each interleaved each corrected codeword and 11 01 10
codeword block so receiver can 011111001111011100011001111001110 concatenate to form message Step 4
tell how to extract blocks from stream.
Sync pattern has five consecutive 1’s. To
received bitstream. prevent sync from appearing in message,
0110 1110 1101
5. Send new (longer) bitstream to “bit-stuff” 0’s after any sequence of four
1’s in the message. This step is easily
transmitter. reversed at receiver (just remove 0 after
any sequence of four consecutive 1’s in
the message).

6.02 Spring 2012 Lecture , Slide #17 6.02 Spring 2012 Lecture , Slide #18

You might also like