EECE 445: COMMUNICATION
NETWORKS
Lec. Onim
EECE, MIST
Outline:
• Error Detection Coding
• Parity Codes
• Checksums
• CRC
Error Detection Coding
Detects error and deletes if necessary. Here we will discuss 3 types of error detection
coding. They are:
◦ Parity Codes
◦ Checksums
◦ Cyclic Redundancy Coding
Parity Codes:
• The parity bit is chosen so that the number of 1 bits in the codeword is even or
odd.
• Doing this is equivalent to computing the (even or odd) parity bit as the modulo
2 sum or XOR of the data bits.
• For example, when 1011010 is sent in even parity, a bit is added to the end to
make it 10110100.
• With odd parity 1011010 becomes 10110101.
• Since any single-bit error produces a codeword with the wrong parity, This
means that it can detect single-bit errors
Table for 4 bit parity code:
Working Block Diagram:
Syndrome ‘0’ will indicate no detectable error and ‘1’ will indicate error and the decision logic will discard the data
Detecting Burst Error with Parity:
Parity Bits Parity Bits
• Computing the parity bits over the data in a different order than
the order in which the data bits are transmitted.
• Compute a parity bit for each of the n columns and send all the
data bits as k rows, sending the rows from top to bottom and the
bits in each row from left to right in the usual manner.
• At the last row, we send the n parity bits.
Checksums:
• A group of parity bits is one example of a checksum.
• The checksum is usually placed at the end of the message.
• Errors may be detected by summing the entire received codeword, both data bits and checksum.
• If the result comes out to be zero, no error has been detected.
Example:
• Suppose that the sender wants to send 4 frames
each of 8 bits, where the frames are 11001100,
10101010, 11110000 and 11000011.
• The sender adds the bits using 1s complement
arithmetic. While adding two numbers using 1s
complement arithmetic, if there is a carry over, it is
added to the sum.
• After adding all the 4 frames, the sender
complements the sum to get the checksum,
11010011, and sends it along with the data frames.
• The receiver performs 1s complement arithmetic
sum of all the frames including the checksum. The
result is complemented and found to be 0. Hence,
the receiver assumes that no error has occurred.
Cyclic Redundancy Coding:
• In cyclic codes a codeword is cyclically shifted (rotated), the result is another codeword.
• For example, if 1011000 is a codeword and we cyclically left-shift, then 0110001 is also a codeword.
• Used in networks such as LANs and WANs.
• In the encoder, the dataword has k bits; the codeword has n bits and is written as C(n, k) code.
• The generator uses a divisor of size n − k + 1, predefined and agreed upon.
• The remainder produced by the checker is a syndrome of n − k bits, which is fed to the decision logic analyzer.
• If the syndrome bits are all 0s, intercepted as no error.
Example:
CRC Polynomials:
Degree of a Polynomial
o The degree of a polynomial is the highest power in the polynomial
o For example, the degree of the polynomial 𝑥 6 + 𝑥 + 1 is 6.
Adding and Subtracting Polynomials
o Adding or subtracting the coefficients of terms with the same power
o For example, adding 𝑥 5 + 𝑥 4 + 𝑥 2 and 𝑥 6 + 𝑥 4 + 𝑥 2 gives just 𝑥 6 + 𝑥 5
Multiplying or Dividing Terms
o Multiplying a term by another term is very simple; we just add the Powers; For example, 𝑥 3 × 𝑥 4 is x7.
o For dividing, we just subtract the power of the second term from the power of the first. For example,
𝑥 5 ÷ 𝑥 2 is 𝑥 3
Shifting
o Shifting to the left means adding extra 0s as rightmost bits; shifting to the right means deleting some
rightmost bits
o Shifting to the left is accomplished by multiplying each term of the polynomial by 𝑥 𝑚 , where m is the
number of shifted bits; shifting to the right is accomplished by dividing each term of the polynomial by
𝑥 𝑚.
Example: