Coding and error correction
WS 19/20 Wireless Communications ‐ Coding and
Error Correction 1
GENERAL CONCEPTS
Error detection
Wireless Communications - Coding and Error Correction
check bits
Image source : William Stallings, „Data and Computer Communications“, 2004
Recap „Grundlagen der Rechnernetze“:
Parity, Checksum, CRC
WS 19/20 4
Check bits, error detecting code, error detection function, detectable errors, non detectable errors
Error detection supports error control
Recall „Grundlagen der Rechnernetze“: Stop-and-Wait, Go-Back-N, Selective-Reject
Use of error detection e.g.
with wired connection (e.g., HDLC)
at IP transport level (e.g., TCP) Use in the wireless case? problems:
High bit error rate (compared to wired communication) leads to frequent retransmissions
Long latency connections (e.g., in the case of satellite communications) require large transmission windows and, in the event of an error,
retransmission of many frames Solution for wireless networks?
Error correction procedure
Wireless Communications - Coding and Error Correction
Image source: William Stallings, „Data and Computer Communications“, 2004
WS 19/20 6
FEC (Forward Error Correction); code word;
detectable and correctable errors; detectable and uncorrectable errors; unrecognized errors;
Hamming distance
Hamming distance d(v1, v2) between two n bit sequences v1 and v2
Beispiel: vier 4-Bit-Sequenzen mit einer paarweisen Hamming-Distanz von
mindestens 2
Wieviele Bit-Fehler können erkannt werden?
Example: four 4 bit sequences with a pairwise Hamming distance of at least 2
How many bit errors can be detected?
Coding gain
Wireless Communications - Coding and Error Correction
Image source : William Stallings, „Data and Computer Communications“, 2004
coding gain
WS 19/20 8
conflicting (As few redundant bits as possible to use as little bandwidth as possible) goals (As many redundant bits as possible to minimize the bit error rate)
LINEAR BLOCK CODES
In general:
Transmission procedure in case of no bit errors
(n,k) block codes: detecting bit errors
Wireless Communications - Coding and Error Correction
data block code word 00 -> 00000
01 -> 00111 10 -> 11001 11 -> 11110
Detection of bit errors: consider code {b1,...,bk} and let b be received:
Sender
Empfänger
f : data block code word
WS 19/20 10
Receiver
Correction of bit errors: Consider code {b1,...,bk} and let b be received:
(n,k) block codes: correcting bit errors
received next valid CW data data block code word
00 -> 00000 01 -> 00111 10 -> 11001 11 -> 11110
Facts for general block codes
Wireless Communications - Coding and Error Correction
code distance of dmin >= 2t+1 supports correcting of how many c bits in error?
… and detection of how many d bits in error?
Thus: code distance of dminsupports correction of how many erronous bits?
… and detection of how many erronous bits?
WS 19/20 12
A (7,4) code example
William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
Generator polynomial: P(X) = X3 + X2 + 1
Remark:
• With 7 = 2 ^ 3-1, so after previous
consideration, all 1-bit errors are correctable in principle
• Also note dmin of code words is 3, so in fact all 1-bit errors are correctable
How do you actually implement the polynomial division?
Wireless Communications - Coding and Error Correction
Example:
Xn-k + An-k-1 xn-k-1 + ... + A2 X2 + A1 X + 1
Linear-Feedback-Shift-Register (LFSR)
William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
WS 19/20 29
Concrete CRC examples
Bose-Chaudhuri-Hocquenhem (BCH)
Here no exact details how these are constructed
Only in general: suitable binary (n, k) -BCH codes for given m and t can be constructed with the following parameters
Block length: n = 2m - 1
Number of check bits: n - k <= m * t
Minimum distance of the codewords: dmin> = 2t + 1
Code can then correct all combinations of t or less erroneous bits
Examples of BCH generator polynomials
m = log (n + 1)
Reed-Solomon codes (RS) are a BCH subclass (here is just the code name, no further details) William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
CONVOLUTIONAL CODES
WS 19/20 Wireless Communications ‐ Coding and
Error Correction 51
Convolutional Codes
Idea of (n, k, K) convolutional codes
• Separate bit stream to be transferred into (very small) k-bit blocks
• Transfer every k-bit block into an n-bit block
• n-bit block is the k-bit block with additional redundancy
• In contrast to block codes:
• The last K-1 k-bit blocks to be transferred are included in the redundancy calculation of the current n-bit block
• At the receiver side k-bit blocks are corrected taking previously received k- bit blocks into account (typically a fixed window of previously received k-bit blocks
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12
example K=4
c1 c2 c3 c4 c5
…
…
Example of an (2,1,3) encoder
Wireless Communications - Coding and Error Correction William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
• Transmitter sends the output bits
• Receiver must
reconstruct the input bits
WS 19/20 53
Output bits of the sender describe a path in a trellis; example
William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
Zu senden: 1 1 0 1 0 0 0 Erzeugt: 11|01|01|00|10|11|00
Decoding: initially without errors
Wireless Communications - Coding and Error Correction William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
Gesendet: 11|01|01|00|10|11|00 Empfangen: 11|01|01|00|10|11|00 also: 1 1 0 1 0 0 0
WS 19/20 57
Decoding: now with an error
William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
Gesendet: 11|01|01|00|10|11|00 Empfangen: 11|01|01|01|10|11|00 also: 1 1 0 ?
Viterbi algorithm
Principle idea: find the path in the trellis that differs least from the received bit sequence
Distance metric allows different variants
We are looking at the Hamming distance here Algorithm for a window size b
Step 0: mark trellis start state with 0
Step i: For each trellis state, find the path(s) minimizing the following equation
Weight of predecessor state + Hamming distance between the label of the last selected edge and the received edge label
Step b: if all the paths so found have a first common edge, then the input for that edge is the result; otherwise not correctable error
An example!!!! ...
Wireless Communications - Coding and Error Correction
WS 19/20 59
Example for window size 7
William Stallings, Wireless Communications & Networks, 2nd edition, Prentice Hall, 2005
10 01 01 00 10 11 00
ERROR CORRECTION PROPERTIES OF
CONVOLUTIONAL CODES
Wireless Communications - Coding and Error Correction
WS 19/20 61
Convolutional encoder example (n=3, k=1, K=3)
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.6
The corresponding trellis diagram
Wireless Communications - Coding and Error Correction
WS 19/20 63
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.7
Distance properties discussed; distances to the all-zero path
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.10
The paths to be considered further are Path1, Path3 and Path4.
All other paths are time shifted versions or concatenations.
Hamming distances to the all-zero path:
Path1 = 6, Path3 = 8, Path4 = 6
The minimum free distance df(which is equivalent to dminin block codes) is thus 6 in this case. With maximum likelihood detection (as done by the Viterbi algorithm for sufficiently large windows) we can always detect up to df-1 bit errors and correct floor(df/2-1) bit errors.
Thus error correction capabilities of a convolutional code depend on the paths that diverge and remerge with the all-zero path
These form the basis to obtain probabilities of error bounds How to characterize all diverging and remerging paths?
Transfer functions
These are determined from the codes state diagram representing all possible transitions from the all-zero state to the all-zero state
Wireless Communications - Coding and Error Correction
WS 19/20 65
State diagram in our example
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.11
solid line = transition due to 0 bit dashed line = transition due to 1 bit
exponent of D corresponds to the Hamming distance between the code word output and the all-zero code word
D0
Representation by state equations
Wireless Communications - Coding and Error Correction
WS 19/20 67
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.11
D0
… equations representing the states’ incoming arcs
Xc = D3Xa + DXb, Xb = DXc + DXd, Xd = D2Xc + D2Xd, Xe = D2Xb
… dummy variables Xa, … , Xe are representing the partial paths
Transfer function
The transfer function
T(D) = Xe / Xa is describing the paths from state a to state e.
Solving the equation yields a form
𝑇 𝐷 𝑎 𝐷
where ad is the number of paths with Hamming distance d from the all- zero path.
In particular, we have 𝑎 paths with minimum distance.
In our example we get
𝑇 𝐷 𝐷
1 2𝐷 𝐷 2𝐷 4𝐷 ⋯
Thus, we have
• one path with minimum distance 6
• two paths with distance 8
• four paths with distance 10
• …
Conclusion: the transfer function is a convenient shorthand to enumerate the number and corresponding Hamming distance of all paths diverging and remerging with the all-zero path.
Wireless Communications - Coding and Error Correction
WS 19/20 69
Extended state diagram
Transfer function captures the number and Hamming distance of the paths to the all-zero path
To derive bit error probabilities we need to extend the diagram to
represent Hamming distance, length, and number of bit errors that correspond to each path diverging and remerging to the all-zero path.
Introduce two additional parameters
• N = multiplied to all branches associated with a 1-bit input to count the number of bits differing from the all-zero path
• J = multiplied to all branches to count the number of branches taken by any given path from a to e
The extended state diagram in our example
Wireless Communications - Coding and Error Correction
WS 19/20 72
D0
Xc = JND3Xa + JNDXb Xb = JDXc + JDXd Xd = JND2Xc + JND2Xd Xe = JD2Xb
State equations:
The transfer function for the extended state diagram
The transfer function associated with this representation T(D,N,J) = Xe / Xa
in our example yields
𝑇 𝐷, 𝑁, 𝐽 𝐽 𝑁𝐷
1 𝐽𝑁𝐷 1 𝐽
𝐽 𝑁𝐷 𝐽 𝑁 𝐷 𝐽 𝑁 𝐷 𝐽 𝑁 𝐷 ⋯ Thus, we have
• one path with minimum distance 6 of length 3 and a single bit error
• one path with Hamming distance 8 of length 4 and two bit errors
• one path with Hamming distance 8 of length 5 and two bit errors
• …
The transfer function for the extended state diagram
Conclusion: the extended transfer function is a convenient shorthand to enumerate
• Hamming distance
• path length
• number of bit errors
that correspond to each path diverging and remerging with the all-zero path.
Wireless Communications - Coding and Error Correction
WS 19/20 74
Error probability for convolutional code (n,k,K)
Convolutional codes are linear codes probability of error can be
determined by just studying the all-zero code word being transmitted We study the bit error probability under soft decoding (the typical
application for convolutional codes)
We limit our study to studying the case: coded symbols are output from the convolutional encoder and sent over an
AWGN channel
using coherent BPSK
We have to consider Ec the energy per bit transmitted by the convolutional encoder. With an energy per bit of Eb and a coding rate of Rc = k/n we get
Ec = Rc ∙ Eb
Error probability with soft decision decoding
We first consider the pairwise error probability:
assuming the all-zero sequence was sent
the probability P2(d) of receiving a sequence with a Hamming distance d away the all-zero sequence
For AWGN and coherent BPSK it can be shown
𝑃 𝑑 Q 2𝐸
𝑁 𝑑 Q 2𝛾 𝑅 𝑑
The transfer function enumerates all possible paths that diverge and remerge with the all-zero path, thus by the union bound the probability Pe to mistake the all- zero path for another is
𝑃 𝑎 𝑄 2𝛾 𝑅 𝑑
where ad is the number of paths with distance d from the all-zero path
Wireless Communications - Coding and Error Correction
WS 19/20 76
Error probability with soft decision decoding
With 𝑄 2𝛾 𝑅 𝑑 𝑒 (Chernoff upper bound) this yields
𝑃 𝑎 𝑒
which can also be expressed in short by 𝑃 𝑇 𝑒
What about the bit error probability? We can use the transfer function of the extended state diagram
𝑇 𝐷, 𝑁 𝑎 𝐷 𝑁
where f(d) = number of bit errors associated with path distance d to the all-zero path (note, we consider sufficient large sequences here, i.e. ignore J)
Error probability with soft decision decoding
For k=1 the bit error probability Pb can be upper bounded by
𝑃 𝑎 𝑓 𝑑 𝑄 2𝛾 𝑅 𝑑
and
𝑃 𝑑𝑇 𝐷, 𝑁 𝑑𝑁 evaluated at N=1 and D=𝑒
If k>1 division by k (i.e. Pb / k) yields the bit error probability
Remark, this section showed derivation for coherent BPSK. For other modulation schemes the pairwise error probability P2(d) must be recomputed.
Wireless Communications - Coding and Error Correction
WS 19/20 78
Error probability with hard decision decoding
Following a similar approach for hard decision decoding we get 𝑃 𝑇 4𝑝 1 𝑝
where p = probability of a bit error on the channel and
𝑃 𝑑𝑇 𝐷, 𝑁 𝑑𝑁 evaluated at N=1 and D= 4𝑝 1 𝑝
INTERLEAVING
Wireless Communications - Coding and Error Correction
WS 19/20 80
Coding with interleaving
Block codes and convolutional codes are designed for good performance in AWGN channels with independent bit errors
In fading channels errors tend to occur in bursts (deep fades)!
Codes may have worst performance in fading than an uncoded transmission
Interleaving: a technique to mitigate the
effects of error bursts by spreading error bursts over many codewords
Spreading is done by the interleaver, error correction is done by the code
Interleaving can be applied for block codes and convolutional codes; we consider block codes here
Block coding with interleaving
d rows and n columns for an (n,k) code codewords are read
into interleaver by rows
and read out into modulator by columns
Thus symbols in the same codeword are separated by d-1 other code words
.. Wireless Communications - Coding and Error Correction
WS 19/20 82
Image source: Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Figure 8.19