Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Data Communication Networks 1

Data link layer FEC

Nguyn Quc Tun

Network and Communication System Department


Faculty of Electronics and Communications
UNIVERSITY OF ENGINEERING AND TECHNOLOGY

1
Ch10. Error Detection & Correction (Forouzan)

Overviews of Data Link

Role: transform the physical layer (a raw transmission facility) to a link


responsible for node-to-node communications.
Responsibilities:
Framing: divides the bit stream received from the network layer to
manageable data units (frames).
Addressing: adds a header to a frame to define the address of sender and
receiver.
Flow control: to avoid overwhelming receiver when receiving rate is smaller
than sending rate.
Error control: adds mechanisms to detect and retransmit damaged, duplicate
and lost frames.
Media access control: determines which devices get access to a shared link at
a given time the when more than 2 devices are connected with the same link

2
Error Detection & Correction

Type of Errors

- Single bit error


only 1 bit in the data unit has changed.

- Busty bit errors


means that 2 or more bits in the data unit have changed.

To detect or correct errors, we need to send extra (redundant) bits with data.
Error Detection & Correction

10.2 BLOCK CODING


Structure of encoder and decoder
- Divide the message into blocks, each of k bits, called data-words. Adding r redundant
bits to each block to make the length n = k + r. The resulting n-bit blocks are called code-
words.
- Since n > k so 2n 2k code-word are not used for correcting code-words invalid or illegal

Additional reading: Ch. 10 (Forouzan)


Error Detection & Correction
BLOCK CODING
Hamming distance

Example:
- The Hamming distance between two pairs of words.
1. The Hamming distance d(000, 011) is 2 because 000 011 is 011 (two 1s).
2. The Hamming distance d(10101, 11110) is 3 because 10101 11110 is 01011 (three 1s).
- The dmin in set of code-word is 3
d(00000, 01011) = 3 d(01011, 10101) = 4
d(00000, 10101) =3 d(01011, 11110) = 3
d(00000, 11110) = 4 d(10101, 11110) =3
Error Detection & Correction
BLOCK CODING
Hamming distance
Error Detection & Correction

BLOCK CODING
Parity-check code
- Let r be the length of the data string for a given parity check code and let r be the
number of parity checks.
- Example: k =3, r = 4 n = 7
Error Detection & Correction

BLOCK CODING
Parity-check code
Example :
- Data stream ...0101110011010110011010. mapping with k=3, r=4
To transmit .0100111111010000111011010011011101000111011011001
To receive
framing
.0100111111010000111011010011011101000111011011001
error detect
- de-map
- eliminate redundancies
...0101110011010110011010.
Error Detection & Correction
BLOCK CODING
Hamming code
- Consider a Hamming codes they were originally designed with dmin = 3, which
means that they can detect up to two errors or correct one single error.
- The relationship between n and k in a Hamming code which need to choose an
integer r 3 (the number of check bits). The values of nand k are then calculated
from r as n = 2r 1 and k = n - r
Error Detection & Correction

BLOCK CODING
Hamming code

r0 = a2 + a 1 + a0 modulo-2 so = b2+ b1 + bo + qo modulo-2


r1 = a3 + a 2 + a1 modulo-2 s1 = b3+ b2 + b1 + q1 modulo-2
r2 = a1 + a0 + a 3 modulo-2 s2 = b1+ b0 + b3 + q2 modulo-2
Error Detection & Correction

BLOCK CODING
Hamming code

Example:
The data-word 0111 becomes the code-word 0111001.
The code-word 0011001 is received.
The syndrome is 011.
According to Table 10.5, b2 is in error. After flipping b2 (changing the 1 to 0),
The final data-word is 0111.
Error Detection & Correction

BLOCK CODING
Cyclic Redundancy Checks (CRC)

- How to compute R (the check bits)?


i. Choose a generator string G of length r+1 bits
ii. Choose R such that T is a multiple of G (T = A*G, for some A)
iii. Now when T is divided by G there will be no remainder => no errors
iv. All done using T = M 2r + R = A*G => M 2r = A*G + R (mod 2 arithmetic)
v. Let R = remainder of M 2r/G and T will be a multiple of G
- Choice of G is a critical parameter for the performance of a CRC
Error Detection & Correction

BLOCK CODING
Cyclic Redundancy Checks (CRC)
- Example

- Sent T = 110101011 Received T = 110101011


check CRC G =1001 r=3 ,
correct if R = 0
incorrect if R 0
Error Detection & Correction

BLOCK CODING
Cyclic Redundancy Checks (CRC)
- Hardware design of the divisor in CRC
A CRC is implemented using a feedback shift register
Error Detection & Correction

BLOCK CODING
Check-Sum

- How to compute R (the check-sum bits)?


i. Choose a number of bits
ii. Choose R is a one's complement arithmetic of sum of T ( R = M 2 r )
iii.Now when receive get sum of T is zero => no errors
Error Detection & Correction

BLOCK CODING
Check sum
Example :
- Data stream ...010111001101011001101011. sum with k= r=4
M: sum 0101(5)1100(12)1101(13)0110(6)0110(6)1011(11). = 53~(5)
R: check-sum = -5 = 1010 + 1 = 1011
To transmit ...010111001101011001101011 1011 .
To receive
framing
...010111001101011001101011 1011 .
error detect
- de-map
- eliminate redundancies
...010111001101011001101011.
Thanks

17

You might also like