Professional Documents
Culture Documents
(EIE418)
Transmitter Receiver
Transmission medium
k bits
Fig. 3.7: Block Coding
• With k bits, we can create a combination
of 2k datawords while n bits can produce a
combination of 2n codewords.
• Since n > k, the number of possible
codewords is larger than the number of
possible datawords.
• The block coding process is one-to-one,
which implies that we have 2n − 2k
codewords that are not used, known as
invalid or illegal codewords.
• The trick in error detection is the
existence of these invalid codes.
Exercise 3.2
If k = 5 and n=6 for an even parity-check code:
i)generate the possible datawords and codewords
in a tabular form.
ii) find dmin and the number of errors s that can be
detected by the code.
3.3.1.2 Cyclic Redundancy Check (CRC)
• CRC is a special type of linear block codes
which is used in data networks such as
LANs and WANs for error detection.
• At the encoder:
The dataword has k bits while the codeword has n bits
The size of the dataword is augmented by adding
(n − k) 0s to the right-hand side of the dataword.
The outcome which is n-bit in size is fed into the
generator.
The generator uses a divisor of (n − k + 1) bits, which is
predefined and agreed upon.
The generator divides the augmented
dataword by the divisor (modulo-2 division).
The quotient of the division is discarded while
the remainder (r2 r1 r0) is the CRC bits, which is
appended to the dataword to create the
codeword.
Thus:
Codeword = Dataword + CRC bits
• At the decoder:
The decoder receives the codeword (which is possibly
corrupted in transition).
A copy of all n bits is fed to the checker(a replica of the
generator).
The remainder produced by the checker is a syndrome
of (n − k) bits, which is fed to the decision logic
analyzer.
The analyzer examines the syndrome bits. If they are all
0s, this is interpreted as no error and the 4 left-most
bits of the codeword are accepted as the dataword,
other-wise, there is an error and the 4 bits are
discarded.
Example 3.3
If a CRC code is C(7, 4), generate the corresponding
codeword for dataword 1001.
Solution
k=4
n=7
augmentation bits = (n-k) 0s = 3 0s = 000
augmented dataword = 1001000
divisor bits = (n-k+1)bits = 4bits,
Given a divisor of value 1011 (represented in
polynomial as x3 + x +1), the design of the encoder
and decoder for C(7,4) is shown in Fig. 3.10.
Fig. 3.10: A CRC Design for C(7,4)
• As shown in Fig. 3.10, the CRC bits (which is the
remainder) is computed by the generator (using
modulo-2 division) to obtain 110:
• Therefore, the codeword = 1001110
• The decoder does the same division process as the
encoder to generate a remainder, which is the
syndrome.
• For the case when the codeword is uncorrupted,
the syndrome is 000:
Class Exercises
1) If k = 3 and n = 4, generate all the possible datawords and corresponding codewords,
using odd parity. What is the number of error bits that can be detected by this scheme.
2) X = 00111 and Y = 11100, compute d(X,Y)
3) What is the polynomial for CRC-8? State the value of the divisor
3.3.1.3 Checksum
• Checksum is a block code error-detection technique
that can be applied to a message of any length.
• In the Internet, It is mostly used at the network and
transport layers rather than the data-link layer.
• At the encoder:
The message is divided into K chunks of n bit each.
The generator adds all K chunks using 1s complement
addition.
The generator takes the compliment of the result to
generate the checksum.
The result, which is the message padded with the
checksum will be sent.
• Note: In 1’s compliment addition, if the result has a
carry bit, add carry with LSB (Least Significant Bit)
of the result.
• At the decoder:
After receiving the message from the sender, the
receiver will divide the data into n bit chunks. Note that
with the appended checksum, there will be K + 1
chunks.
The checker adds all the chunks using 1’s compliment
addition.
The checker then takes the compliment of the result.
The analyzer(decision block) examines if all the bits in
result is 0, then, accept the data, otherwise, the data
will be discarded due to error.
• Fig. 3.11 illustrates these steps both at the sender and
receiver.
• At the receiver:
received message = 011100110101
since n = 4, there are 3 chunks.
The chunks are 0111 0011 0101
Adding all chunks using 1’s complement, we have:
0 1 1 1
0 0 1 1
0101
————–
1 1 1 1
————–
the compliment of 1111 = 0000, therefore, there is no error.