Linear Block Codes: Rectangular Codes Hamming Codes
Linear Block Codes: Rectangular Codes Hamming Codes
codes
• Rectangular codes
• Hamming codes
Single Link Communication Model
End-host
Original source computers Receiving app/user
Digitize Render/display,
(if needed) etc.
Source binary
digits (“message
bits”)
Source decoding
Source coding
Bit stream
Bit stream
Channel Channel
Coding Mapper Recv
Decoding
(bit error Bit + Signals samples Bit
s s (reducing or
correction) Xmit (Voltages) +
over Demapper removing
samples
physical link bit errors)
Embedding for Structural
Separation
Encode so that the codewords are “far enough” from
each other
Likely error patterns shouldn’t transform one codeword
to another
01
Code: nodes chosen in
“0” 00 11 “1” hypercube + mapping
of message bits to nodes
single-bit error may
cause 00 to be 10 10
(or 01)
101 111 “1”
If we choose 2k out of
100 110 2n nodes, it means
we can map all k-bit
message strings in a
space of n-bit
001 011 codewords.
The code rate is k/n.
“0”
000 001100
000
Minimum Hamming Distance of
Code vs.
Detection & Correction Capabilities
If d is the minimum Hamming distance between
codewords, we can:
e.g.: d=4,
tC=1, tD=2
6.02 Fall 2012 Lecture 4, Slide
Linear Block Codes
Block code: k message bits encoded to n code bits
i.e., each of 2k messages encoded into a unique n-bit
codeword via a linear transformation.
C=D.G
message
k n-k
n
• Every linear code can be represented by an equivalent
systematic form --- ordering is not significant, direct
inclusion of k message bits in n-bit codeword is.
• Corresponds to using invertible transformations
on rows and permutations on columns of G to get
• G = [I | A] --- identity matrix in the first k columns
Example: Rectangular Parity Codes
P1 is parity bit
Parity for each row Parity check fails for Parity check only fails
and column is row #2 and column #2 for row #2
correct no errors bit D4 is incorrect bit P2 is incorrect
Rectangular Code Corrects Single
Errors
Claim: The min HD of the rectangular code with r
rows and c columns is 3. Hence, it is a single
error correction (SEC) code.
D1 D2 D3 D4 P1
Code rate = rc / (rc + r + c).
If we add an overall parity bit D5 D6 D7 D8 P2
P, we get a (rc+r+c+1, rc, 4)
code D9 D10 D11 D12 P3
D1
D4 0 1 0 0 1 0 0 1 1
D2 D3 D 1 D 2 D3 D4 P1 P3 P5
0 0 1 0 0 1 1 0 1
0 0 0 1 0 1 0 1 1
P2 P4
1×k k×n 1×n
message generator code word
vector matrix vector
The generator matrix, Gkxn =
Ak(nk )
Ik
k
Decoding Rectangular Parity Codes
Receiver gets possibly corrupted word, w.
1 0 1
0 1 0
1. Decoder
0 action:
1
0 0 0
1 1 1
1 1 2. Decoder action:
0 0 1
0 1 0
0 0 3. Decoder action:
How Many Parity Bits Do Really We
Need?
• We have n-k parity bits, which collectively can
represent 2n-k possibilities
• For single-bit error correction, parity bits need to
represent two sets of cases:
– Case 1: No error has occurred (1 possibility)
– Case 2: Exactly one of the code word bits has an
error (n possibilities, not k)
• (7,4,3)
• (15,11,3)
• (2m –1,2m -1-m,3)
Index 1 2 3 4 5 6 7
Binary 001 010 011 100 101 110 111
index
(7,4) P1 P2 D1 P3 D2 D3 D4
code
Index 1 2 3 4 5 6 7
Binar 001 010 011 100 101 110 111
y
index
(7,4) P1 P2 D1 P3 D2 D3 D4
code
1+ n ≤ 2n-k
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.