Professional Documents
Culture Documents
• First section
– It introduces Types of errors and concept of redundancy
– It distinguishes between error detection and correction.
• Third section
– It discusses cyclic codes.
– It discusses a subset of cyclic code, CRC, that is very
common in the data-link layer. The section shows how
CRC can be easily implemented in hardware and
represented by polynomials.
• We know that
• The data link layer lies under the network layer in the Internet model.
• It provides services to the network layer.
• Design Issues:
1. Hop to hop delivery:
2. Packetizing (Framing) : data are sent in blocks called frames, the beginning
and end of each frame must be recognized by the receiver.
3. Addressing: on a multipoint line, such as a LAN, the identity of the two
stations involved in a transmission must be specified.
4. Error control: bit errors introduced by the transmission system should be
detected and/or corrected.
5. Flow control: the sending station must not send frames at a rate faster than
the receiving station can absorb them.
6. Medium Access Control: Transmit control information and data on the
same line
7. Some more………
• Types Of Errors
– Data are sent from one device to another in the form of
binary data(0s and 1s).
– Two types of errors may happen:
• Single-bit errors
• Burst errors
• Burst error does not necessarily mean that the errors occur in
consecutive bits.
• The length of the burst is measured from the first corrupted bit
to the last corrupted bit.
•McGraw-Hill
Some bits in between may not have been corrupted.
©The McGraw-Hill Companies, Inc., 2000
Central concept in detecting or correcting errors is
‘redundancy’.
Note:
• Error detection
– we are only looking to see if any error has occurred.
– Required answer is a simple yes or no.
– Not even interested in the number of corrupted bits.
– A single-bit error is the same for us as a burst error.
• Error correction
– we need to know the exact number and Location of Corrupted
bits in the message.
– Number of errors and the size of the message are important
factors.
1. Data compression
– (or, source coding)
2.Error correction
– (or channel coding)
3. Cryptographic coding
– for secure communication
4. Line coding
– for use within a communications system for transmitting a digital
signal down a transmission line
1. Block codes
– Linear block codes: (n, k, dmin)
• Hamming codes
• Cyclic codes
– Reed-Solomon codes
– BCH codes
– Cyclic Redundancy Check (CRC) codes
Block coding
• Dataword length k = 4
• Codeword length n = 7
• This is a (7,4) block code with code rate = 4/7
• The trick in error detection is the existence of these invalid codes (will
be discussed later)
Process of
error
detection in
block coding
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
10.2.1 Error Detection
Datawords Codewords
00 000
01 011
10 101
11 110
• Example:
– If the codeword 00000 is sent and 01101 is received.
What will be the Hamming Distance ?
• Solution:
– 3 bits are in error and the Hamming distance between
the two is d(00000, 01101) = 3.
• The Hamming distance between:
• "karolin" and "kathrin" is 3.
• "karolin" and "kerstin" is 3.
• 1011101 and 1001001 is 2.
• 2173896 and 2233796 is 3.
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Central concept :Hamming Distance
• The elements in the binary linear block codes are called codeword.
• A single-bit parity check code is one of the most common forms of detecting
transmission errors.
Solution
We first find all the Hamming distances.
10.
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Classification of codes
1. Block codes
– Linear block codes: (n, k, dmin)
• Hamming codes
• Cyclic codes
– Reed-Solomon codes
– BCH codes
– Cyclic Redundancy Check (CRC) codes
• Using more than one parity bit, an error-correction code can not only
identify a single bit error in the data unit, but also its location in the
data unit
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
• Perhaps the most familiar error-detecting code is
the parity-check code.
• This code is a linear block code.
• Encoder:
– The encoder uses a generator that takes a copy of a 4-bit
Dataword (a0, a1, a2, and a3) and generates a parity bit r0.
– Dataword bits and the parity bit create the 5-bit codeword.
• Note:
– In another words
Note:
McGraw-HillXOR is also called modulo-2 addition ©The McGraw-Hill Companies, Inc., 2000
Parity-Check Code
• Sender:
– The sender sends the codeword, which may be corrupted during
transmission.
• Receiver:
– The receiver receives a 5-bit word.
– The checker at the receiver does the same thing as the generator
in the sender with one exception.The addition is done over all 5
bits.
– The result, which is called the syndrome, is just 1 bit.
Note:
McGraw-HillXOR is also called modulo-2 addition ©The McGraw-Hill Companies, Inc., 2000
Parity-Check Code
• Note:
• In TCP/IP , the checksum
technique is mostly used at the
network and transport layer
McGraw-Hill rather than©the data-link
The McGraw-Hill layer.
Companies, Inc., 2000
Detection methods
• Three types of redundancy checks are used in the data link layer:
Parity bit
• Even
– The total number of ones should add up to an
even number
• Example
– Before parity 0101010
– After parity 01010101
Parity bit
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error Detection Capability of VRC
83
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Even parity VRC concept
• Calculate the parity bit for each column and the set of this parity bit is
also sending with original data.
Rutvi Shah 88
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
LRC
• The value of the BCC is calculated much like the Parity bit,
but for the entire message. Results in a 98% reliability rate.
90
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Note:
• Unlike VRC and LRC, which are based on addition, CRC is based on
binary division.
• A remainder indicates that the data unit has been damaged in transit
and therefore must be rejected.
• Transmitter:
– The transmitter has the message M.
– The transmitter and receiver agrees on a common polynomial (P) and data
block size (k) that will be used.
– It calculates F, appends F to M, and puts the whole thing (k+n bits) on the
wire.
• Receiver:
– On receiving the k+n bits, receiver divides them with P.
– If the polynomial based on the received k+n bits is fully divisible by P, then the
receiver is satisfied that there was no error in transmission.
• Example:
• Find 1101011001 - 0010111010 (note the leading zeros)
Sender
Receiver
(Two possibilities)
Encoder:
In the encoder, the dataword has k bits (4 here); the codeword has n bits (7
here).
The size of the dataword is augmented by adding n − k (3 here) 0s to the right-
hand side of the word.
The n-bit result is fed into the generator.
The generator uses a divisor of size n − k + 1 (4 here), predefined and agreed
upon.
The generator divides the augmented dataword by the divisor (modulo-2
division).
The quotient of the division is discarded;
The remainder (r2r1r0) is appended to the dataword to create the codeword.
CRC encoder and decoder
Decoder:
The decoder receives the codeword (possibly corrupted in
transition).
A copy of all n bits is fed to the checker, which is a replica of the
generator.
The remainder produced by the checker is a syndrome of n − k (3
here) bits, which is fed to the decision logic analyzer.
The analyzer has a simple function.
If the syndrome bits are all 0s, the 4 leftmost bits of the codeword are
accepted as the dataword (interpreted as no error);
otherwise, the 4 bits are discarded (error).
Polynomial Codes
• Treat bit strings as representations of polynomials with coefficients 1’s and 0’s.
• K-bit frame is coefficient list of polynomial with k terms (and degree k-1), from
xk-1to x0.
– Highest-order bit is coefficient of xk-1, etc.
– Example: 110001 represents x5 + x4 +x0.
• The power of each term shows the position of the bit; the coefficient shows the
value of the bit.
112
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
A polynomial representing a divisor
113
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Standard polynomials
• The idea is to simply send additional data ( for example the sum) along with the
data. At the destination, the sum is calculated and compared to the one sent.
• Note:
– Several Internet protocols (e.g. IP, TCP, UDP) use check bits to
detect errors in the header
– A checksum is calculated for header contents and included in a
special field.
• 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 message is not accepted.
• Several schemes have been designed and used in this case that is
collectively referred to as forward error correction (FEC) techniques.
– That means that if any one bit, either parity or data, gets changed in
transmission, the change in the received data can be detected and corrected .
• The simplest example of error correction is for the receiver to assume the
correct output is given by the most frequently occurring value in each
group of three.
• At the sender
– The unit is divided into k sections, each of n bits.
– All sections are added together using one’s complement to get the sum.
– The sum is complemented and becomes the checksum.
– The checksum is sent with the data
• At the receiver
– The unit is divided into k sections, each of n bits.
– All sections are added together using one’s complement to get the sum.
– The sum is complemented.
– If the result is zero, the data are accepted: otherwise, they are rejected.
• 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.
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
• Construct the base 2 representation of the
positive number, by taking all the remainders
starting from the bottom of the list
constructed above:
• 36(10) = 10 0100(2)
10.136
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
• . Divide the number repeatedly by 2, keeping track of each
remainder, until we get a quotient that is equal to zero:
– division = quotient + remainder;
– 36 ÷ 2 = 18 + 0;
– 18 ÷ 2 = 9 + 0;
– 9 ÷ 2 = 4 + 1;
– 4 ÷ 2 = 2 + 0;
– 2 ÷ 2 = 1 + 0;
– 1÷2=0+1
10.137
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000