TCN Lec-4
TCN Lec-4
TCN Lec-4
By
Dr. Rizwan Aslam Butt
Assistant Professor
Department of Electronic Engineering
NED University of Engineering and
Technology
TCN TC-421 NED University of Engineering and Technology
CYCLIC CODES (CRC)
Cyclic codes are special linear block codes with one extra
property. In a cyclic code, if a codeword is cyclically
shifted (rotated), the result is another codeword.
Example of a CRC code with C(7, 4)
10.2
Encoding using CRC
10.4
Algorithm for Encoding using CRC
10.7
Figure 10.15 Division in CRC encoder
10.8
Figure 10.16 Division in the CRC decoder for two cases
10.9
Example -1
Data word to be sent - 100100 Key -
1101 [ Or generator polynomial x3 + Receiver Side: Code word received at the
x2 + 1] Sender Side: receiver side 100100001
10.12
Figure 10.21 A polynomial to represent a binary word
10.13
Note
10.14
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.
10.15
If the generator has more than one term
and the coefficient of x0 is 1,
all single errors can be caught.
10.16
Example 10.15
10.17
Note
10.18
Example 10.17
Solution
a. This generator can detect all burst errors with a length
less than or equal to 6 bits;
b. This generator can detect all burst errors with a length
less than or equal to 18 bits;
10.20
A good polynomial generator needs to
have the following characteristics:
1. It should have at least two terms.
2. The coefficient of the term x0 should
be 1.
3. It should not divide xt + 1, for t
between 2 and n − 1.
4. It should have the factor x + 1.
10.21
Table 10.7 Standard polynomials
10.22
10-5 CHECKSUM
10.23
Example 10.18
10.24
Example 10.19
10.25
Example 10.20
Solution
The number 21 in binary is 10101 (it needs five bits). We
can wrap the leftmost bit and add it to the four rightmost
bits. We have (0101 + 1) = 0110 or 6.
10.26
Example 10.21
Solution
In one’s complement arithmetic, the negative or
complement of a number is found by inverting all bits.
Positive 6 is 0110; negative 6 is 1001. If we consider only
unsigned numbers, this is 9 (Modulo-10 system).
In other words, the complement of 6 is 9. Another way to
find the complement of a number in one’s complement
arithmetic is to subtract the number from 2n − 1 (16 − 1
in this case).
10.27
Example 10.22
10.29
Figure 10.24 Example 10.22
36=00100100
= 0100+ 10=
0110
(Wrapped
Sum
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.
10.31
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.
10.32
Example 10.23
Let us calculate the checksum for a text of 8 characters
(“Forouzan”). The text needs to be divided into 2-byte
(16-bit) words. We use ASCII (see Appendix A) to change
each byte to a 2-digit hexadecimal number.
For example, F is represented as 0x46 and o is
represented as 0x6F. Figure 10.25 shows how the
checksum is calculated at the sender and receiver sites. In
part a of the figure, the value of partial sum for the first
column is 0x36. We keep the rightmost digit (6) and insert
the leftmost digit (3) as the carry in the second column.
The process is repeated for each column. Note that if
there is any corruption, the checksum recalculated by the
receiver is not all 0s. We leave this an exercise.
10.33
Figure 10.25 Example 10.23
10.34
Appendix A
10.35
Assignment Question
http://users.ece.cmu.edu/~koopman/rose
s/dsn04/koopman04_crc_poly_embedde
d.pdf
10.36