6. Error Detection Probabilities
Definitions
Pb : Probability of single bit error (BER)
P1 : Probability that a frame arrives with no bit
errors
P2 : While using error detection, the probability that
a frame arrives with one or more undetected
errors (也称剩余差错率 )
P3 : While using error detection, the probability that
a frame arrives with one or more detected bit errors
but no undetected bit errors
7. Error Detection Probabilities
With no error detection (如果没有差错
检测技术的话)
P = (1 − Pb )
F
1
P2 = 1 − P1
P3 = 0
F = Number of bits per frame
帧越长,单个帧中比特数越多,整个帧中包含差错
位的概率越高
10. Error Detection Process
Transmitter
For a given frame, an error-detecting code (check bits)
is calculated from data bits
Check bits are appended to data bits
Receiver
Separates incoming frame into data bits and check bits
Calculates check bits from received data bits
Compares calculated check bits against received check
bits
Detected error occurs if mismatch
12. Parity Check ( 奇偶校验)
As an option in ASCII coded data transmission
Parity bit appended to a block of data
码长度 n = k + 1
Even parity ( 能检查出来奇数个错)
Added bit ensures an even number of 1s
Odd parity ( 能检查出来奇数个错)
Added bit ensures an odd number of 1s
Example, 7-bit character [1110001]
Even parity [11100010]
Odd parity [11100011]
应对突发差错 (burst error) 能力较差
16. Cyclic Redundancy Check (CRC)
( 循环冗余校验 )
CRC 是最常用的也是功能最强大的差错检测码之一
易于电路实现编解码
检查到出错的分组 / 帧 , 利用 ARQ 方式重传
Transmitter
For a k-bit block, transmitter generates an (n-k)-bit
frame check sequence (FCS)
Resulting frame of n bits is exactly divisible by
predetermined number
Receiver
Divides incoming frame by predetermined number
If no remainder, assumes no error
18. CRC using Modulo 2 Arithmetic
Exclusive-OR (XOR) operation
Parameters:
T = n-bit frame to be transmitted
D = k-bit block of data; the first k bits of T
F = (n–k)-bit FCS; the last (n – k) bits of T
P = pattern of n–k+1 bits; this is the predetermined
divisor (除数 : 长度 n-k+1 比特)…可以称之
为样式
Q = Quotient ( 商)
R = Remainder (余数)
19. CRC using Modulo 2 Arithmetic
For T/P to have no remainder, start with
n−k
T =2 D+F
Divide 2n-kD by P gives quotient and
remainder
2 n −k D R
=Q +
P P
Use remainder as FCS( 将余数作为 FCS)
n−k
待传序列 T =2 D+R
20. CRC using Modulo 2 Arithmetic
Does R cause T/P have no remainder?
T 2n−k D + R 2n−k D R
= = +
P P P P
Substituting,
T R R R+R
=Q+ + =Q+ =Q
P P P P
No remainder, so T is exactly divisible by P
21. CRC using Polynomials
All values expressed as polynomials
X n − k D( X ) R( X )
= Q( X ) +
P( X ) P( X )
T ( X ) = X n − k D( X ) + R( X )
例 8.4: D=1010001101, 那么 D(X) = X9 +X7 +
X3+X2+1, 生成多项式 P(X)= X5 +X4 +
X2+1. 那么计算结果 R(X) = X3+X2+X
具体过程见下页
24. CRC using Digital Logic
Dividing circuit consisting of:
XOR gates
Up to n – k XOR gates
Presence of a gate corresponds to the presence of a
term in the divisor polynomial P(X)
A shift register
String of 1-bit storage devices
Register contains n – k bits, equal to the length of
the FCS
26. Wireless Transmission Errors
Error detection requires retransmission
Detection inadequate for wireless
applications
Error rate on wireless link can be high, results
in a large number of retransmissions
Long propagation delay compared to
transmission time
如卫星链路
常用的重传策略是重传出错帧及其以后的所有帧
Go-back-N ARQ, as explained later in details
27. Block Error Correction Codes
Transmitter
Forward error correction (FEC) encoder maps
each k-bit block into an n-bit block codeword
Codeword is transmitted; analog for wireless
transmission
Receiver
Incoming signal is demodulated
Block passed through an FEC decoder
29. FEC Decoder Outcomes
Four possible outcomes as follows
No errors present
Codeword produced by decoder matches original
codeword
Decoder detects and corrects bit errors
Decoder detects but cannot correct bit errors;
reports uncorrectable error
Decoder detects no bit errors, though errors are
present
30. Block Code Principles
Hamming distance ( 汉明距离 , 或称海明距离 ) – for two n-bit
binary sequences, the number of different bits
E.g., v1=011011; v2=110001; d(v1, v2)=3
Minimal Hamming distance Dmin ( 最小汉明距离 )
所有可能码字对间汉明距离最小值 ,
对于四个 5 位码字 00000,00111,11100,11011 来说最小汉明距离为 3
最小汉明距离表征了一个 block code 的总体性能
线形分组码的最小汉明距离只考虑每个码和全零码字距离即可
纠错检错能力 D min − 1
纠错能力 : t =
2
检错能力 : Dmin-1
给定 n 和 k, Dmin 越大 , 纠错检错能力越强
n-k 越小越好——降低开销,提高利用率 两者相互矛盾
n-k 越大越好——降低差错率
Redundancy – ratio of redundant bits to data bits
Code rate – ratio of data bits to total bits: k/n
Coding gain – the reduction in the required Eb/N0 to achieve a specified
BER of an error-correcting coded system
32. Hamming Code
Hamming Code is easy to analyze but is rarely used
Designed to correct single bit errors
Family of (n, k) block error-correcting codes with
parameters:
Block length: n = 2m – 1
Number of data bits: k = 2m – m – 1
Number of check bits: n – k = m
Minimum distance: dmin = 3
Single-error-correcting (SEC) code
SEC double-error-detecting (SEC-DED) code ,与 SEC 码相比
较而言多一个额外的对整个码块的校验位
33. Hamming Code Process
Encoding: k data bits + (n -k) check bits
Decoding: compares received (n -k) bits
with calculated (n -k) bits using XOR
Resulting (n -k) bits called syndrome word
Syndrome range is between 0 and 2(n-k)-1
Each bit of syndrome indicates a match (0) or
conflict (1) in that bit position ( 即:症候码的
值表示的就是出差错的比特的位置)
37. Cyclic Codes
Can be encoded and decoded using linear
feedback shift registers (LFSRs)
For cyclic codes, a valid codeword (c0, c1, …, cn-1),
shifted right one bit, is also a valid codeword (cn-1,
c0, …, cn-2)
Takes fixed-length input (k) and produces fixed-
length check code (n-k)
In contrast, CRC error-detecting code accepts arbitrary
length input for fixed-length check code
39. BCH Codes
(Bose-Chaudhuri-Hocquengham)
For positive pair of integers m and t, a (n, k)
BCH code has parameters:
Block length: n = 2m – 1
Number of check bits: n – k ≤ mt
Minimum distance: dmin ≥ 2t + 1
Correct combinations of t or fewer errors
Flexibility in choice of parameters
Block length, code rate
41. Reed-Solomon Codes
Subclass of non-binary BCH codes
Data processed in chunks of m bits, called
symbols
An (n, k) RS code has parameters:
Symbol length: m bits per symbol
Block length: n = 2m – 1 symbols = m(2m – 1) bits
Data length: k symbols
Size of check code: n – k = 2t symbols = m(2t) bits
Minimum distance: dmin = 2t + 1 symbols
42. Block Interleaving
Data written to and read from memory in different
orders
Data bits and corresponding check bits are
interspersed with bits from other blocks
At receiver, data are deinterleaved to recover
original order
A burst error that may occur is spread out over a
number of blocks, making error correction
possible
44. Convolutional Codes (卷积码)
Generates redundant bits continuously
Error checking and correcting carried out
continuously
(n, k, K) code
Input processes k bits at a time
Output produces n bits for every k input bits, code rate: k/n
K = constraint factor
k and n generally very small…in most cases, k=1
n-bit output of (n, k, K) code depends on:
Current block of k input bits
Previous K-1 blocks of k input bits
47. Decoding
Trellis diagram – expanded encoder diagram
Viterbi code – error correction algorithm
Compares received sequence with all possible
transmitted sequences
Algorithm chooses path through trellis whose coded
sequence differs from received sequence in the fewest
number of places ( 汉明距离最小 )
Once a valid path is selected as the correct path, the
decoder can recover the input data bits from the output
code bits
48. Viterbi 算法
Distance of a path =(distance of the last edge)
+ (distance of the last-but-one state)
对于一个 (n,k,K) 码字和一个解码窗口 b, 下面的步骤可以
解出第一个输出块中的 n 比特 ,
(1) 0 时刻网格图的状态为 0
(2) 时刻 i+1, 找到到达每个状态 S 的路径 ( 或路径集
合 )—— 采用第一行给出的式子。并以路径的距离标
记S
(3) 算法在时刻 b 终止。若此时所有的 active 路径的第
一条边相同,那么那条边的标记 x0x1x2…xn-1 就是我们
要找的第一码块 w0w1w2…wn-1. 如果第一条边不唯一,
那么差错不可纠正。
50. Automatic Repeat Request
Mechanism used in data link control and
transport protocols
Relies on use of an error detection code
(such as CRC)
Flow Control
Error Control
51. Flow Control
Assures that transmitting entity does not
overwhelm a receiving entity with data
Protocols with flow control mechanism allow
multiple PDUs ( 协议数据单元 ) in transit at the
same time
PDUs arrive in same order they’re sent
Sliding-window (滑动窗口) flow control
Transmitter maintains list (window) of sequence
numbers allowed to send
Receiver maintains list allowed to receive
52. Flow Control
Reasons for breaking up a block of data
before transmitting:
Limited buffer size of receiver
Retransmission of PDU due to error requires
smaller amounts of data to be retransmitted
On shared medium, larger PDUs occupy
medium for extended period, causing delays at
other sending stations
55. Error Control
Mechanisms to detect and correct
transmission errors
Types of errors:
Lost PDU : a PDU fails to arrive
Damaged PDU : PDU arrives with errors
56. Error Control Requirements
Error detection
Receiver detects errors and discards PDUs
Positive acknowledgement
Destination returns acknowledgment of received,
error-free PDUs
Retransmission after timeout
Source retransmits unacknowledged PDU
Negative acknowledgement and retransmission
Destination returns negative acknowledgment to PDUs
in error
59. 作业
For P(X)=X5+X4+X+1 and D=11100011, 求 CRC (给出过程)
Consider a convolutional encoder defined by (v n1=un⊕un-1) and
(un2=un-1⊕un-2)
Draw a shift register implementation for this encoder similar
to Figure 8.9(a)
Draw a Trellis diagram for this encoder similar to Figure 8.10
For the encoder of the above problem, assume that the shift
register is initialized to all zeros and that after the transmission
of the last information bit, two zero bits are transmitted
Why are the two extra (all-zero) bits are needed?
假定信息输入为 1101011 ,那么编码后的输出比特流是什么
? ( 最左边的比特是最先输入到编码器的比特)