Uni2 Ppt Reference Ke Liye of Remianing Topicx
Uni2 Ppt Reference Ke Liye of Remianing Topicx
Day- 4
1
Recap
• Day-1 : Concept of Layering
• Day-2 : LAN Technologies (Ethernet)
• Day-3: Basic Wifi
2
Data Link Control
3
Error Detecting & Correction
Note
4
Error Detecting & Correction
5
INTRODUCTION
Types of Errors:
Redundancy
Detection Versus Correction
Forward Error Correction Versus Retransmission
Coding
Modular Arithmetic
6
Types of Errors
Note
7
Single-bit error
8
Note
9
Burst error of length 8
10
Redundancy
Note
Detection Vs Correction
•Detection: Checking whether error occurred
•Correction: Identifying the position of the errors : no. of errors, size
12
Note
13
XORing of two single bits or two words
14
BLOCK CODING
15
The structure of encoder and decoder
16
Datawords and codewords in block coding
17
4B/5B block coding:
In this coding scheme,
k = 4 and n = 5.
2k = 16 datawords and 2n = 32 codewords.
16 out of 32 codewords are used for message transfer and
the rest are either used for other purposes or unused.
18
Process of error detection in block coding
19
Let us assume that k = 2 and n = 3.
Table shows the list of datawords and codewords.
Assume the sender encodes the dataword 01 as 011 and sends it to the receiver.
Consider the following cases:
1. The receiver receives 011. It is a valid codeword. The receiver extracts the
dataword 01 from it.
2. The codeword is corrupted during transmission, and 111 is received. This is not
a valid codeword and is discarded.
3. The codeword is corrupted during transmission, and 000 is received. This is a
valid codeword. The receiver incorrectly extracts the dataword 00. Two corrupted
bits have made the error undetectable.
20
Note
21
Structure of encoder and decoder in error correction
22
Let us add more redundant bits to Previous Example to see if the receiver can
correct an error without knowing what was actually sent. We add 3 redundant bits
to the 2-bit dataword to make 5-bit codewords. Table shows the datawords and
codewords. Assume the dataword is 01. The sender creates the codeword 01011.
The codeword is corrupted during transmission, and 01001 is received. First, the
receiver finds that the received codeword is not in the table. This means an error
has occurred. The receiver, assuming that there is only 1 bit corrupted, uses the
following strategy to guess the correct dataword.
1. Comparing the received codeword with the first codeword in the table (01001 versus
00000), the receiver decides that the first codeword is not the one that was sent because
there are two different bits.
2. By the same reasoning, the original codeword cannot be the third or fourth one in the
table.
3. The original codeword must be the second one in the table because this is the only one
that differs from the received codeword by 1 bit. The receiver replaces 01001 with
01011 and consults the table to find the dataword 01. 23
Note
24
Let us find the Hamming distance between two pairs of
words.
25
Note
26
Find the minimum Hamming distance of the coding scheme
Solution
We first find all Hamming distances.
Solution
We first find all the Hamming distances.
29
Example 10.7
32
A code scheme has a Hamming distance dmin = 4. What is
the error detection and correction capability of this
scheme?
Solution
This code guarantees the detection of up to three errors
(s = 3), but it can correct up to one error. In other words,
if this code is used for error correction, part of its capability
is wasted. Error correction codes need to have an odd
minimum distance (3, 5, 7, . . . ).
33
LINEAR BLOCK CODES
34
Note
35
The scheme in Table is a linear block code
because the result of XORing any codeword with any
other codeword is a valid codeword. For example, the
XORing of the second and third codewords creates the
fourth one.
36
Note
37
Simple parity-check code C(5, 4)
38
Encoder and decoder for simple parity-check code
39
Let us look at some transmission scenarios. Assume the sender sends the dataword 1011.
The codeword created from this dataword is 10111, which is sent to the receiver. We examine
five cases:
1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword 1011
is created.
2. One single-bit error changes a1 . The received codeword is 10011. The syndrome is 1. No
dataword is created.
3. One single-bit error changes r0 . The received codeword is 10110. The syndrome is 1. No
dataword is created.
4. An error changes r0 and a second error changes a3 . The received codeword is 00110. The
syndrome is 0. The dataword 0011 is created at the receiver. Note that here the dataword is
wrongly created due to the syndrome value.
5. Three bits—a3, a2, and a1—are changed by errors. The received codeword is 01011. The
syndrome is 1. The dataword is not created.
This shows that the simple parity check, guaranteed to detect one single error, can also find
any odd number of errors.
40
Note
41
Two-dimensional parity-check code
42
Two-dimensional parity-check code
43
Hamming Code
•The Hamming distance between two words is the number of
differences between corresponding bits.
•To guarantee the detection of up to s errors in all cases, the
minimum Hamming distance in a block code must be dmin = s+1.
•To guarantee correction of up to t errors in all cases, the
minimum Hamming distance in a block code must be dmin = 2t + 1.
• k – no. of data bits, r – no. of redundant bits, n – No. of code bits
•n=k+r
•2r ≥ k + r + 1 where, r = redundant bit, k = data bit
• Eg: k = 4; then r = 3
44
Hamming code C(7, 4)
45
r0 = a2+a1+a0 mod 2 s0 = b2+b1+b0+q0 mod 2
r1=a3+a2+a1 mod 2 s1 =b3+b2+11+q1 mod 2
r2=a1+a0+a3 mode 2 s2 =b1+b0+b3+q2 mod 2
46
Let us trace the path of three datawords from the sender to
the destination:
1. The dataword 0100 becomes the codeword 0100011.
The codeword 0100011 is received. The syndrome is
000, the final dataword is 0100.
2. The dataword 0111 becomes the codeword 0111001.
The codeword 0011001 is received. The syndrome is 011.
After flipping b2 (changing the 1 to 0), the final
dataword is 0111.
3. The dataword 1101 becomes the codeword 1101000.
The syndrome is 101. After flipping b0, we get 0000,
the wrong dataword. This shows that our code cannot
correct two errors. 47
Burst error correction using Hamming code
48
CYCLIC CODES
49
ACRC code with C(7, 4)
50
CRC encoder and decoder
51
Division in CRC encoder
52
Division in the CRC decoder for two cases
53
A polynomial to represent a binary word
54
CRC division using polynomials
55
Note
56
Note
In a cyclic code,
If s(x) ≠ 0, one or more bits is corrupted.
If s(x) = 0, either
a. No bit is corrupted. or
b. Some bits are corrupted, but the
decoder failed to detect them.
57
Note
58
Note
59
Which of the following g(x) values guarantees that a
single-bit error is caught? For each case, what is the error
that cannot be caught?
a. x + 1 b. x3 c. 1
Solution
a. No xi can be divisible by x + 1. Any single-bit error can
be caught.
b. If i is equal to or greater than 3, xi is divisible by g(x).
All single-bit errors in positions 1 to 3 are caught.
c. All values of i make xi divisible by g(x). No single-bit
error can be caught. This g(x) is useless.
60
Note
61
Note
62
Note
64
CHECKSUM
65
Suppose our data is a list of five 4-bit numbers that we
want to send to a destination. In addition to sending these
numbers, we send the sum of the numbers. For example, if
the set of numbers is (7, 11, 12, 0, 6), we send (7, 11, 12, 0,
6, 36), where 36 is the sum of the original numbers. The
receiver adds the five numbers and compares the result
with the sum. If the two are the same, the receiver assumes
no error, accepts the five numbers, and discards the sum.
Otherwise, there is an error somewhere and the data are
not accepted.
66
We can make the job of the receiver easier if we send the
negative (complement) of the sum, called the checksum. In
this case, we send (7, 11, 12, 0, 6, −36). The receiver can
add all the numbers received (including the checksum). If
the result is 0, it assumes no error; otherwise, there is an
error.
67
Note
Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to 0.
3. All words including the checksum are
added using one’s complement addition.
4. The sum is complemented and becomes the
checksum.
5. The checksum is sent with the data.
68
Note
Receiver site:
1. The message (including checksum) is
divided into 16-bit words.
2. All words are added using one’s
complement addition.
3. The sum is complemented and becomes the
new checksum.
4. If the value of checksum is 0, the message
is accepted; otherwise, it is rejected.
69
Checksum
70
Exercise
71
Exercise
72
Exercise
2. In modulo-11 arithmetic, we use only the integers in the range ______, inclusive.
A) 1 to 10
B) 0 to 10
C) 1 to 11
D) none of the above
73
Exercise
2. In modulo-11 arithmetic, we use only the integers in the range ______, inclusive.
A) 1 to 10
B) 0 to 10
C) 1 to 11
D) none of the above
74
Exercise
75
Exercise
76
Exercise
77
Exercise
78
Exercise
79
Exercise
80
Exercise
6. Which error detection method consists of just one redundant bit per data unit?
A) CRC
B) Checksum
C) Simple parity check
D) Two-dimensional parity check
81
Exercise
6. Which error detection method consists of just one redundant bit per data unit?
A) CRC
B) Checksum
C) Simple parity check
D) Two-dimensional parity check
82
Exercise
83
Exercise
84
Exercise
85
Exercise
86
Exercise
9. Let G(x) be the generator polynomial used for CRC checking. What is the condition
that should be satisfied by G(x) to detect odd number of bits in error?
(b) G(x) does not divide 1+xk, for any k not exceeding the frame length
87
Exercise
9. Let G(x) be the generator polynomial used for CRC checking. What is the condition
that should be satisfied by G(x) to detect odd number of bits in error?
(b) G(x) does not divide 1+xk, for any k not exceeding the frame length
88
Exercise
10. The message 11001001 is to be transmitted using the CRC polynomial x^3 + 1 to
protect it from errors. The message that should be transmitted is:
(a) 11001001000
(b) 11001001011
(c) 11001010
(d) 110010010011
89
Exercise
10. The message 11001001 is to be transmitted using the CRC polynomial x^3 + 1 to
protect it from errors. The message that should be transmitted is:
(a) 11001001000
(b) 11001001011
Sol : The polynomial x^3+1 corresponds to divisor
(c) 11001010 is 1001.
11001001 000 <--- input right padded by 3 bits
(d) 110010010011 1001 <--- divisor
01011001 000 <---- XOR of the above 2
1001 <--- divisor
00010001 000
1001
00000011 000
10 01
00000001 010
1 001
00000000 011 <------- remainder (3 bits) 90
Exercise
11. A computer network uses polynomials for error checking with 8 bits as
information bits and uses x3 + x + 1 as the generator polynomial to generate
the check bits. In this network, the message 01011011 is transmitted as
(a) 01011011010
(b) 01011011011
(c) 01011011101
(d) 01011011100
91
Exercise
11. A computer network uses polynomials for error checking with 8 bits as
information bits and uses x3 + x + 1 as the generator polynomial to generate
the check bits. In this network, the message 01011011 is transmitted as
(a) 01011011010
(b) 01011011011
(c) 01011011101
(d) 01011011100
92
Exercise
12. A code scheme has a Hamming distance dmin = 4. What is the error
detection and correction capability of this scheme?
(a) 3,1
(b) 4,2
(c) 4,1
(d) 3,2
93
Exercise
12. A code scheme has a Hamming distance dmin = 4. What is the error
detection and correction capability of this scheme?
(a) 3,1
(b) 4,2
(c) 4,1
(d) 3,2
94
Exercise
13. When 2 or more bits in a data unit has been changed during the
a) random error
b) burst error
c) inverted error
d) double error
95
Exercise
13. When 2 or more bits in a data unit has been changed during the
a) random error
b) burst error
c) inverted error
d) double error
96
Data Link Control: FRAMING
• Fixed-Size Framing
• Variable-Size Framing
97
A frame in a character-oriented protocol
98
Byte stuffing and unstuffing
(Point-to-Point Protocol (PPP) is a byte-oriented protocol).
99
A frame in a bit-oriented protocol (HDLC)
100
Bit stuffing and unstuffing
Bit stuffing is the process of adding one extra 0 whenever five consecutive
1s follow a 0 in the data, so that the receiver does not mistake the pattern
0111110 for a flag.
101
FLOW AND ERROR CONTROL
102
Data Link Layer Protocols
combine framing, flow control, and error control to
achieve the delivery of data from one node to another.
103
NOISELESS CHANNELS
• Simplest Protocol
• Stop-and-Wait Protocol
104
The design of the simplest protocol with no flow or error control
105
Sender-side algorithm for the simplest protocol
11.106
Design of Stop-and-Wait Protocol
107
Sender-site algorithm for Stop-and-Wait Protocol
108