Mod3 Chap10 Text
Mod3 Chap10 Text
Networks must be able to transfer data from one device to another with acceptable accu-
racy. For most applications, a system must guarantee that the data received are identical to
the data transmitted. Any time data are transmitted from one node to the next, they can
ecome corrupted in passage. Many factors can alter one or more bits of a message.
applications require a mechanism for detecting and correctingerrors
Some applications can tolerate a small level of error. For example, random errors
in audio or video transmissions may be tolerable, but when we transfer text, we expect
a very high level of accuracy.
10.1 INTRODUCTION
detection and
issues related, directly or indirectly,to
error
Let us firat discuss some
correcion.
changes because of interference, Thisinterference can change the shape of the signal.
to a l or al to a 0.In a burst error, multiple bits are
In a single-bit error, a0 is changed
of impulse noise on a transmission with a data
example, a 1/100s burst
changed.For
all or some of the 12 bits of information.
rate of T200 bps might change
(A burst error is more likely to occur than a single-bit error. The duration of noise
In a single-bit error, only 1 bit in the data unit has changed. normally longer than the duration of 1
bit, which means that when noise affects
affects a set of bits. jThe number of bits
affected depends on the data rate and
data, it
10.1 shows the effect of a single-bit error on a data
Ficure unit. To understand th of noise. For example, if we are duration
sending data at 1 kbps, a noise of 1/100 s can affect
impactof change. imagine that each group
the of 8 bits is an ASCî character the 10 bits; if we are sending data at I
Mbps, the same noise can affect 10,000 bits.
added to the left In Figure 10.1, 00000010 (ASCII STX) was sent, meaning st
te, but 00001010 (ASCII LA) was received, meaninglinefeed For more informatio 1 2 Redundancy
about ASCII code, see Appendix A.)
The central concept in detecting or
correcting errors is
detect or correct erTors, we need to send some extra bits redundancy.To be able to
with
our data.
These redundant
bits are added by the sender and removed by the receiver/Their presence allows the
Figure 10.1 ngle-bit e r r o r receiver to detect or correct corrupted bits.
O changed to 1
To detect or correct errors, we need to send extra (redundant) bits with data
Sent Received
1O-3DetectionVersus Correction
Single-bit errors are the least likely type of error in serial datatransmissión.o under
LThecorrection of errors is more difficult than the detection. In error detection, we are
lookingonly if any
to see has
error
occurred The is
answer simple yes or no. We are
a
stand why. imagine data sent at 1 Mbps. This means that each bit lasts only 1/T,000,000 s, not even interested in the number of errórs-A single-bit error is the same for us as a
or 1 4s.For a single-bit error to occur, the noise musthave a duration of only 1 s, which burst errorL
is very rare; noise normally lasts much longerthan this. Inerror correction, we need to know the exact number of bits that are corrupted and
more importantly, theirlocationin the message. The number of the errorsandthe size of
(6) Burst Error the message are importantfactors f we need to corect one single error in an 8-bit data
error locations; if we need to correct two errors
he term burst error means that 2 or more bits in the data unit have changed from 1 to 0
unit, we need to consider eight possible
in a data unit of the same size, we need to consider 28 possibilities. You can imagine the
or from 0 to
1. receiver's diffñculty in finding 10 errors in a data unit of 1000 bits.
A burst error means that 2 or more bits in the data unit have changed. I Forward Error Correction Versus Retransmission
correction is the pro-
There are two main methods of error correction. Forward errorredundant
igure 10.2 shows the effect of a burst error on a data unit. In this case cess in which the receiver tries to guess the message by using bits This is
O100010001000011 was sent, but 0101110101100011 was received Note that a burs if the number of is small,{Corection by retransmission
possible, as we see later,
ermors
eror and asks the sender
eror does not necessarily mean that the errors occur in consecutive bits. h elengun is a technique in which the receiver detects the occurrence of an
until a arrives that the receiver
ne burst 1 measured from the first corrupted bit to the last corrupted biSome Dis to resend the message Resending is repeated message
between may not have been
corrupted. believes is error-free (usually, not all errors can be detected).
81 5 Coding
Figure 10.2 Burst error of length 8 redundant
Redundancy achieved through various coding schemes., The sender adds
is
between the redundant.bits and the
bIts through a pröcess that creates relationship
a
to
Length of burst checks the relationships between the two.sets of bits
eror (8 bits) actual data bits, The receiver and the robust-
Sent ratio of redundant bits to the data bits
detect or correct the errors.The the
tactors in any coding scheme. Figure 10.3 shows
ness of the process are important
Comupted bits general idea of coding schemes into two broad categories: block coding and convo-
We can divide coding we concentrate on block is
Received
lutioncoding In this book, coding: convolution coding
the scope of this book.
more complex and beyond
70 CHAPTER 10 ERROR DETECTION AND CORRECTION
Modulo-2 Arithmetic
Or
particular interest is modulo-2 arithmetic.n this arithmetic, the modulus is 2 We
an use oniy 0 and 1. Operations in this arithmetic are very simple. 1ne wing 2 Datawonds, each of &bits
shows how we can add or subtract 2
bits
Adding: 0+0 0 0+111+0 1 1 + 1 0 2 Codowonds, cach of n bits (only 2" of them arv valid)
Suburacting 0-00 0-1-1 1-0 1 1-10
AND CORRECTION
10 ERROR DETECTION SECTION 102 BLOCK cODING 273
272 CHAPTER
Sender Receiver
er Decoder error correction the receiver needs to find (or guess) the original codeword sen We can
say that we need more redundant bits for error correction than for error detection.
Datawordk bits
k bits Dataword Figure 10.7 shows the role of block coding in error corection. We can see that the idea
Extract is the same as error detection but the checker functions are much more complex.
Checker
Checker Discard
Generator
Figure
O.7 Structure of encoder and decoder in error cormection
Unreliable transmission |
n bitsCodeword Codewordn bits
Sender Receava
Decoder
Encoder
Batawordk bits
sender creates codewords out of datawords by using a generator
that applies the kbits Dataword
The
rules and procedures of encoding (discussedlater). Each codeword sent to the receiver may
Corect
as one of the valid code
change during transmission. If the received codeword is the same If the received enerator Checkes
the word is accepted; the corresponding dataword is extracted for use.
Words, transH
codeword is not valid, it is discarded. However, if the codeword corrupted during
is
Unreiabe ransmissäon
but the received word still matches a valid codeword, the error remains undetee Codewornd n bits
mission
This type of coding can detect only singlé errors. Two or more errors may remain undeecte
n bits Codeword
Example 10.2
Aus assume that k =2 and n =3. Table 10.1 shows the list of datawords and codewords. La
Erample 10.3
we will see how to derive a codeword from a dataword. without
102 to see if the receiver can corect an emor
Let usadd more redundant bits to Example bits to the 2-bit dataword to make 5-bit
Table 10.1 A code for error detection (Example 10.2) sent. We add 3 redundant
knowing what was actually chose the redundant bits. For the moment let us
codewords. Again, later we wilB show bow we codewords.
Datawords Codewords concentrate on the error correction concept.
Table
10.2 shows the daawords and to create the
000 The sender consults the table (or uses an algorithm)
00 Assume the dataword is O1. is received (eTor in
The codeword is corupted duning transmission, and 01001
011 codeword 01011. the table.
01 tinds that the received codeword is not in
the second bit from the righiu, Fist.the receiver
must come before correction.) The receiver, assuming
10 101
This means an error has occurred. (Detection
uses toe tollowing strategy to guess the corect dataword.
11 110 that there is only 1bit comuptec,
CORRECTION
ERROR
DETECTIONAND SECTION 10.2 BLOCK CODING 275
274 CHAPTER 10
00000 Solution
We first find all
01 01011 Hamming distances. apOEsibe po
10 10101 4000, 011)=2 4000, 101-2 do00,110 2 d011, 101) 2
11110 d011, 110)=2 4101, 110)=2
LComparing the received codeword with the first codeword in the table (01001 versus 00000), The dmin in this case is 2.
the receiver decides that the first codeword 1s not the one that was sent because there are two
Example 10.6
different bits
the original codeword cannot be the third or fourth one in the table Pnd the minimum Hamming distanceof the coding scheme in Table 102.P *4/
2. By the same reasoning,
codeword must be the second one in the table because this is the only one that
3 The original Solution
differs from the received codeword by I bit.
The receiver replaces O1001 with
01011 and We first find all the Hamning distances.
consults the table to find the dataword 01.
One of the central concepts in coding for eTor control is the idea of the Hamming dis- The dnin in this case is 3.
same size) is the numberof
tance. The Hamming distance between two words (of the
differences between the coresponding bits. We show the Hamming distance between
two words x and y as d(x, y) ) Three Parameters scheme
Before we continue with our díscussion, we need to mention that any coding
The Hamming distancecan easily beinfound if we apply the XOR operation (®) on the needs to have at least three parameters: the codeword size n. the dataword size k, and
and count the number of ls the result. |Note that the Hamming distance is
two words the minimum Hamming distance duinA coding scheme C is written as Ctn, k) with
a
a value greater than zero. we can call our first coding scheme C(3, 2)
separate expression for dmin- For example,
coding scheme C(S, 2) with dmin 3.
=
with =2 and
dnin our second
The Hamming distance between two words is the number
odifferences
f betweencorresponding bits ( Hanming Distance and Error
let us discuss the relationship
Before we explore the criteria for error detection or comection,
Exaple 10.4 distance and occuming during transnission. When a codeword
between the Hamming errors
distance between the sent and received code
Jet us find the Hamming distance between two pairs of words. is comupted during transmission, the Hamming
The Hamming distance d000, 011) is 2 because 000 011 is 011 (two 1s). words is the number of bits affected by the emor. In other
words the Hamming distance
. The Hamming distance d(10101, 11110) is 3 because 10101 11110 is 01011 (three 1s between the received codeword and the sent
is
codeword the number of bits that are corrupted
codeword 0000D is sent and Ol 101 is received, 3 bits
during transmissionFor example, if the he two is 00000, O1 101)=3.
between
are in error and the Hanmming distance
tb4 Minimum Hamming Distance error
Although the concept of the Hamming distance is the central point jn dealing w e Minimum Distance for Brror Detection
eection and correction codes. the measurement that is used for designing a ta the Now let us find the minimum Hamming
distance in a code if we want to be able to detect
inimum Hamming distancefTna set of words, the minímum Hamming t h e min- mumom the Hamming distance berween the
sImallest Hamming distance between all possible pairs,We use dmin toden aming up toerrorsf s erors occur during transmission.
s
the mini-
codeword i_ S: lf our code is to detect up to serros,
ne hamWA sentcodeword and receivedvaid so hat the received codeword
does
n i n g distance in coding scheme. To find this value, we find
a slayne. 0 mum distance between the oodes must beif s+ 1,
all valid
distances,between all words and select the Smallest one.,
not match a valid codeword.
In other words, the minimum distance between
for another
e lee codewords is s+1, the received codeword cannot be ermroneously mistaken it as valid. The
he
minimum Hamming distance is the smallest lamming Sexsors codeword The distances are nottoenough
(s+ l) for the receiverto accept
with dminS+l
stance between all possible pairs in a set of words cariy a point here: Although a code
error willbe detected. Weneed
AND CORRECTION
CHAPTER 10 ERROR DETECTION SECTION 10.3 LINEAR BLOCK CODES
276 277
dninS
n
igure l0.8, dmin must be an integer greater than s; that is, dmin 10.3 LINEAR BLOCK CODES
to a subset called linear block codes. The use of
Almost all block codes used today belong
a) Minimum Distance for Error Correction
nonlinear block codes for emor detection and correction is not as widespread because
a d implementation difficult. We therefore con
Error correction is more
complex than eror detection; a decIsIon 1 their structure makes theoretical analysas
evca codeword is not a valid codeword, the receiver needs to decide wh
uhich valid centrate on linear block codes.
u- codes requires the knowledge of abstract algebra
codeword was
actually sent. The decision is based on the concept ol The formal definition of linear blok
the scope of this book. We therefore give an
sive
area surrounding the codeword. Each valid codeword has its own territor
valid (particularly Galois fields, which is
beyond
a linear block code is a code in which the exclusive
we use a
geometric approach to define each territory. We assu
each
informal definition. For our purp0ses,
rd is at the valid codewords creates another valid codeword.
codeword has a circular territory with a radius of t and that the valia OR (addition modulo-2) of two
cou
CORRECTION
SECTION 10.3 LINEAR BIOCK CODES 279
DETECTION AND
CHAPTER 10 ERROR
278
Table 10.3 Simple parity-check code Ci5,4)
OR (XOR) of any
In
two
a linear block code, the exclusive
valid codewords creates another valid codeword. Datawords Codewords Datawords Codewords
0000 0O00 1000 10001
0001 00011 1001 10010
Example I0.10
0010 O0101 1010 10100
defined in Table 10.1 and Table 10.2 belong to the class f1
Ltus see if the two codes
we
0011 001 10 1011 10111
block codes. 0100
T h e scheme in Table
10.1 is a
because the result of XORing any codeword
block codeFor
linearcodeword. 01001 i100 1000
is valid example, the XORing of the second and
with any other codeword
a
0101 01010 1101 1011
third codewords creates the fourth one.
Example10.1 2. So the
Accept
In our first code the numbers of Is in the nonzero codewords are 2, 2, and
(Table10.1),
In o u r second code (Tablej I0.2), the
numbers of lsin
minimum Hamming distance is dmin=2.
the nonzero codewords are 3, 3, and 4. So in this code we have dmin3. Syndrome
Generator
103 Some Linear Block Codes
Let us now show some linear block codes. These codes are trivial because we can easily
find the encoding and decoding algorithms and check their performances. Pariry bi Unreliabic
ransmissz00
Tne
in The sender sends word. The checkeral the receiver does the same thing as the gen
Our hrst code (Table 10.1) is with k =2 and n =3.
a parity-check code receiver receives a 5-bit
akition is done over all 5 bits. The result,
Table 10.3 is also a parity-check code with k =4 and n = 5. erator in the sender with one excepaon: Ihe Is in the
sender) anda decou syudrome is O when the number of
*POSSIDIe structure
ofan encoder (at the which is called the syndrome,isJustbt. he
otherwise, it is 1.
(at thereceiver). ana received codeword is even;
encoder dataword (4o, 41"
The generator that takes a opy of a 4-bit
uses a
the $-DI o+ (modelo-2)
a3)and
generates a parity bit ro, The dataword bits and the parity blt creat.
rd even
codeword. The parity bit that is added makes the number of 1s in the coue
CORRECTION
280 CHAPTER 10 ERROR DETECTION AND
SECTION 10.3 LINEAR BLOCK CODES 281
The syndrome is passed to the decision logic analyzer. If the syndrome is 0
the received codeword; the data portion of the received codewond snere is Figure 9A1 Two-dimensional purity-check code
no errorin
as the dataword; if the syndrome i s , the data portion of the received codeoepted
carded. The dataword is not
created.
Example 10.12
et us look at some transmission scenarios. Assume the sender sends the dataword 1011. The code
word created from this dataword is 10111, which is sent to the receiver. We examine five case 011S00
ANo error occurs; the received codeword is 10111. The syndrome is 0. The dataword 1011:
is
0 0 00
created.
2 One single-bit error changes a. The received codeword is 10011. The syndrome is1. 0 10 10101T
No Column parities
dataword is created.
e s i g n of row and column parities
B One single-bit error changes ro. The received codeword is 10110. The syndrome is 1. No ata-
word is created. Note that although none of the dataword bits are corrupted, no dataword is
created because the code is not sophisticated enough to show the position of the corrupted bit
A. An error changes roand a second error changes a3. The received codeword is 00110.The syn-
drome is 0. The dataword 0011 is created at the receiver. Note that here the dataword is
wTongly created due to the syndrome value. 'The simple parity-check decoder cannot detect an
even number of errors. The errors cancel each other out and give the syndrome a value of 0.
Three bits--as, az, and a-are changed by errors. The received codeword is 01011. The 0 1 0 10 1 0
syndrome is 1. The dataword is not created. This shows that the simple parity check, guaran-
teed to detect one single error, can also find any odd number of errors. One error affects two parities AWO enTOS aitec LWO parTUes
Hamming Codes
NOw let us discuss a category of error-correcting codes called Hamming codesnes Table 10.4 Hamming code C(7. 4)
codes were originaily designed with dmin =3, which means that they can detect up to w
cor
Codewords Datawords Codewords
Datawords
emors or correct one single errorAlthough there are some Hamming codes nde 0000000 1000 1000110
ect more than one error, our discussion focuses on the single-bit error-correc 0000
to
0001 101 1001 1001011
First let us find the relationship between n and k in a Hamming codej we 0001
from m as n 1010 1010001
Cnoose an integerm >=3. The values of n and k are then calculated 0010
0010111
k
and =n-m. The number of check bits 1011 1011100
r =
m. 0011
0011010
0100
0100011 100 1100101
Al Hamming codes discussed havedmin
in this book
The relationship between m and n in these codes is n=2 0101
0101110 101 1101000
1110010
0110100 10
WIu 0110
For example, ifm =
3, then n = Hamming code C(7,4)
7 and k = 4. This is a Gmin 0111001 1111 1111111
0111
Table 10.4 shows the datawords and codewords for this code.
ERROR DETECTION AND CORRECTION CTION 10.3 LINEAR BLOCK
82 CHAPTER 10
ODES 283
hother words, each of the parity-check bits handles 3 out of the 4 bits ofthe data- Solution
word. he total pumber of 1s in each 4-bit combination (3 dataword bits and1 parity We need to make k = n -m greaterthan or equalto 7, or 2 - t-m27.
bit) must be even.|We are not saying that these three 1, If we setm=3, the resultis n =2-1andk=7-3or 4, which is not acceptable.
equations are unique, any un
equations that 3 of the 4 bits in the dataword and create independent equations
involve 2. If we set m=4, then n=2*-1 = 15 and k = 15-4= ll, which satisties the condition. So the
(a combination of two cannot create the code is C(15, 11). There are methodsto make the dataword a speciñc size, but the discussion
third) are valid.
The checker in the decoder creates a 3-bit syndrome (s2818) in whioh cach bit 1s and implementation are beyond the scope of this book.
the
parity check for 4 out of the 7 bits in the received codeword:
(C Performance
(A Hamming code can only correct a single error or detect a double errorHowever.
s0b tb1 +bo +40 modulo-2 in Figure 10.13.
s =b3+bz+h1+4 modulo-2 there is a way to make it detect a burst ermor, as shown
is burst error between several codewords, one error for each
s2b+bo+bs +42 modulo-2 The key to split a
codeword. In data cammunications, we normally send a packet or a frame of data. To
make the Hamming code respond toa burst eruor of size N, we need to make Ncodewords
out
ns used by the checker are the same as those used by the generaor
the parity-check bits added to the right-hand of our franme. Then, instead ot senchng one codewond at a time, we amange the codewords in a
side of the equationThe 3-
creates egnt ditterent bit patterns (000 to 111) that can represent eight an ondi table and send the bits in the table a colun at a tme) In Figure 1013, the bits
are sent column
tions. These conditions define celved by column (tiom the lett a each colunn, the bits äre sent trom the bottom to the top. In this
lack of error or an error in I of the7 DIi
a
four coxeworis and sent to the receiver. Figure 10.13 shows
codeword, as shown in Table 10.5. way, a trane is macle out of the
DETECTION AND CORRECTION
284 CHAPTER 10 ERROR
CTION 104 CYCLICCODES 285
error correction using Hamming code Table 10.6 shows an example of a
Figure 10.13 Burst
properties of this code. CRC code. We can see both the
linear and cyclic
Sender
Receiver
-
Table 10.6 A CRC code with
C(7, 4
o 1 oCodewod4 Codeword 4|0 Dataword Codewordy Dataword
0000 0000000
Codeword
O t o j coewond 3 Codeword 3 0 1000 1000101
0001 0001011 1001 1001110
0010 0010110
oo o Codeword 2
Codeword 2|1
0011
1010 1010011
0011101 1011 1011000
ond 0100
0101
0100111
0101100
II0O I100010
1101 1101001
0110 0110001 Ii10 1110100
0111 0111010 111111
Burst error
- - - - -
Figure 10.14 shows one possible design for the encoder and decoder.
Sender
Keceiver
Encoder Decoder
that when a burst error of size 4 corrupts the frame, only 1 bit from each codeword is cor Dataword Dataword
nupted. The comupted bit in each codeword can then easily be coected at the receiver
Accepe TT
000
SyioneSiS
10.4 CYCLIC CODES Divisor
code, if
Cyclic codes are special linear block codes with one extra property,In acyclic Generaior
a codeword is cyclically shifted (rotated), the result is another codeword For exampie
if 1011000 is a codeword and we cyclically left-shift, then 0110001 is also a codeword,
n this case, if we call the bits in the first word ag to ag, and the bits in the
second worO
areiadie
bg to bg, we can shift the bits by using the following:
Codeword
a b2=aj ba= a2 b4=a3 bs=a4 bsa5 bo46
nd
bit of the first word is wrapped arounu
has & bits (4 here); the codeword has n bits (7 here).
n
the rightmost equation, the last
becomes the first bit of the second word.
(In the encoder, the dataword adhng n k ( here) Os to the right-hand
side
The size of the dataword is augmented by
-
Divisor 1 0 1 1)10 0 1 o 0 0
Dividend:
augmented 1011 1011
0
dataword1
1011
Leftmost bit 0:
1 0 0o 1 0 1 1 11
use 0000 divisor 000 0 1 011 I11
0 0
0 0 0 00
111
1
Leftnost bit 0:
uSe O000 divisor
0 0 0 Syndrome 01Syndrome
1 10 Remainder
Datawor
Dataword
accepted
10 01 discarded
2./The divisor has n k + 1 bits which either are predefined or are all s t 2. At cach time click (arrival of 1 bit from
Words, the bits do not change from one dataword to another. In our p other following two actions: an augmented dataword), we
repeat the
were either 1011 or 0000.
The choice was baso evious exam-
ple, the divisor bits . We use the leftmost bit to make a decision about the divisor (011
bit ofthepart of
augmented
the data bits that are active in the
XOReration. b. The other 2 bits of the or CO0).
3. A closc look shows thatonly n-k bits of the divisor is needed in the XOR remainder and the next bit from the augmented
(total of 3 bits) are XORed with the 3-bit divisor to create the dataword
The leftmost bit is not necdedbecause the operation is operat
result of the alwave next
remainder.
matter what the value of this bit The reason is that the inputs to this XOR 0,no Figurc 10.18 shows this simulator, but note that this is not the final
are either both Os or both Is. In our previous example, only 3 bits, not 4, is more improvements. design; there will be
used in the XOR operation.
Using these points, we can make a fixed (hardwired) divisor that can be used fora Figure 10.18 Simulation of division in CRC encoder
code if we know the divisor pattern. Figure 10.17 shows such a design for our
example. We have also shown the XOR devices used for the operation.
previous
Aagmented dataword
Timc: 4 - 0 ,
Figure 10.17 Hardwired design of the divisor in CRC
Time: 2
Broken line:
d d Time: 4
-
this bit is always 0 XOR XOR XOR
Time: 5
--
Time: 6
Note that if the leftmost bit of the part of dividend to be used in thi_ step is 1, the
divisor bits (dd1dg) are 011; if the leftmost bit is 0, the divisor bits are
000.The design
provides the right choice based on the leftmost bit.
Ttae-
Augmented Dataword
in Final remainder
paper-and-pencil division process in Figure 10.15, we show the augmented data-
our
ord as fixed in position with the divisor bits shifting to the right, 1 bit in eacn slp
visor bits are aligned with the appropriate part of the augmented dataword. Now
At each clock tick, shown as different times, one of the bits from the augmented
at our divISor is fixed, we need instead to shift the bits of the augmented dataword to u dataword is used in the xOR process. If we look carefully at the design, we have sevén
ett jopposite direction) align the divisor bits with the appropriate part. Ine
to
néed to store the
augmented dataword bits. steps here, while in the method
paper-and-pencil we steps. The three
had only four
steps have been added here to make each step equal and to make the design for each step
first
Remainder the same. Steps 1, 2, and 3 push the first 3 bits to the remainder registers; steps 4, 5.6,
and 7 match the paper-and-pencil design. Note that the values in the remainder register
n
use
our previous example, the remainder is 3 bits (n -k bits in general) in length. wea in steps 4 to 7 exactly match the values in the paper-and-pencil design. The final remain-
tiree registers (single-bit storage devices) to hold these bits. To fina
remainder of the he der is also the same.
division, we need to modify our division process. Tne is the The above design is tor demonstration purposes only. It needs simplitication to be
1o t
sep-by-step process that can be used to simulate the division process in nau
even in software). practical. First, we do not need keep the intermediate values of of
to the remainder bits;
need only 3 registers instead 24. After the
we need only the tinal bits. We therefore
1. We assume that the remainder is originally áll Os (000 in our XOR operations,
we do not need the bit values of the previous remainder. Also, we do
exampie
290 CHAPTER 10 ERROR DETECTION AND CORRECTION
SECTION 104 CYCLIC CODES 291
not need 21 xOR devices; two are enough because the output of an XOR or the check bits are ready. This fact is
one of the criticisms of
which one of the bits is 0 is simply the value of the other bit. This other bit ration in have been designed to eliminate thís this design. Better schemes
waiting tinme (the check bits are ready after k steps),
as the output. With these
the design becomes but we leave this as a research
two
modifications, tremendoustu topíc for the reader. In the decoder, however, the entire
and less expensive, as shown in Figure 10.19. simpler codeword must be fed to the decoder before the
syndrome is ready.
Figure 10.1 The CRC encoder design using shifi registers
0-43Polynomials
A better way to understand cyclic codes and how
them as polynomials. Again, this section is optional.they
can analyzed
be is to
represent
Augmented dataword
o 0 10 00
A patterm of Os and ls can be represented polynomial with coefficients of 0 and
as a
1. The power of each term shows the
of the bit Figure 10.21 shows
position of the bit; the coefficient shows the value
ure 10.21a
binary pattern and its polynomial representation. In Fig-
a
show how to translate
we
We need, however, to make the registers shift binary pattern to polynomial; in Figure 10.21b
a a
registersyA 1-bit
shift register holde we show how the polynomial
can be shortened by removing all terms with coetfi-
zero
a bit for a duration of one clock time. At a time click, the
shift register
accepts the bit at cients and replacing x by x and *" by 1.
its input port, stores the new bit, and displays it on the output port. The content
and the
output remain the same until the next input arrives When we connect several 1-bit shift
registers together, it looks as if the contents of the register are shifting. Figure A0.21 Apolynomial to represent a binary word
General Design 6 5 4 3
1
A general design for the encoder and decoder is shown in Figure 10.20.
Figure 10.21 shows one immediate benefît; a 7-bit pattem can be replaced by three
terms. The benefit is even more conspicuous when we have a polynomial such as x +
-k-1
dsk- 4Dataword x+1. Here the bit pattern is 24 bits in length (three Is and twenty-one Os) while the
polynomial is just three terms.
Encoder
Degree ofa Polynomial
(The degree of a polynomial is the higbest power in the polynomial.
For example, the
Received degree of the polynomial r+* + l is 6. Note that the degree of apolynomial is 1 less
that the number of bits in the pattem. The bit pattem in this case has 7 bits.
n-k1 codeword
b. Decoder
Note that the coefficients of terms with the same powen in our casel the coeficients are only 0D
we have-k 1-bit shift registers in both the encoder and
n
nave up
decod and 1, and adding is in modulo-2his has two consequences. Firstaddition
and sub-
ton-kXOR
which reduces the
devices, but the divisors normally have several Os in
ther pas traction are the same Second adding or suburacting is done by combining terms and
number of devices. Also note that, instead of
we show the dataword
itself as the input because after the bits in augmentea
all re deleting pairs of idenical terns, ror example, adding r++and.++
gives
fed into the encoder, the the a e right and.ae deleted. However, note that if we add, for example,
extra bits, which all are Os, do not have just+The teras
most XOR.
Of course, the process needs to be
any before effect on ore three polynomials and we get
a" three times, we delete a
pair of them and keep
the third.
continued for another n * *
CORRECTION
CHAPTER 10 ERROR DETECTION AND
When we augmented the dataword in the encoder of Figure 10.15, we act Codeword co Generator &t)
we shift Dataword d
shifted the bits to the left. Also note that when we concatenate two bit patterns, Syndromer st) Bror el
the
first polynomial to the left and then add the second polynomial. However, if s(t) is zero, either
one or more bits is corrupted.
If s(x) is not zero, then detect errors.
9 Cyelic Code Encoder Using Polynomials or the decoder
failed to any
no bit is corrupted
a code
Now that we have discussed operations on polynomials,version
we
showofthe creation
word rom a dataword.
Figure 10.22 is the polynomial o
Figure 10,1 divisor In a cyclle code
see that the process is shorter. The dataword 1001 is represented as ahifted corupted
we have leB . I s one or more bits is
3h
the datauword 3 bits
+r+1. To find the augmented dataword, 2 a.If s t , either
dataword (multiplying by ). The result is +pivision is su he first No bit is corrupted.or
We term of the dividend, , by the first term of the divsd ubract but the decoder failed todecectthem
divide the first b. Some bits are corrupted,
term of the quotient is then , or . Then we multiply r by the divisidend, Th
tne
(according to our previous definition of subtraction) he result from
CORRECTION
DETECTION AND SECTION I0.4 CYCLIC CODES 295
CHAPTER 10 ERROR
294
Solution
we want to find the criteria that must be imposed on the
In our analysis
detect the type
ot
we especially
error want to be detected. Let u generator,
ind the
d.
Nor can be divisible by x + I. In
syndrome is nonzero. Any single-bitother words, dlx + ) always has a remainder. so une
g() to
sent codeword, error, received codeword,
and the error can be caught.
relationship among the generator b. Ifi is equal to or
greater than 3,is
divisible by The remainder of lr 1s
We can say the receiver is fooled into helieving that there is gtr).
no error. although there
Zero, anu
O nat this in
case, the might De one
corrupted bit must be in postion 4 or above. All single- Dit
Received codeword = c() +el) crrors in
positions I to 3 are
C.
caught.
Al values of i make ?
divisible by gx). No single-bit error can be caught. In addition. this
gr) Is useless because it means
In other words, the received
codeword is the sum of the sent codeword and the er the codeword is just the dataword augmented withn - k ZerOs.
The receiver divides the received codeword by s(r) to get the syndrome. We can write Twa Isolated Single-Bit Errors
this a Now imagine
there are two single-bit
isolated errors. Under can
type of error be caught? We can show this type of error as etx) = x +*. The values of
what conditions this
Received codeword C) e(x) and j define the positions of the
errors, and the difference j -
i defines the distance
8(x) 8) between the two errors, as shown in
Figure I0.23.
The first term at the right-hand side of the equality does not have a remainder Figure 10.23 Representation of two isuluted single-bit erors using
So the syndrome is actually the remainder of
poBvnomials
(according to the definition of codeword).
this term does not have a remainder (syn-
the second term on the right-hand
side. f
Difference:j
drome 0), either e(x) is 0 or elr) is divisible by g{x). We do not have to worry about
case is very important. Those errors that are
the first case (there is no error); the second
divisible by g(r) are not caught.
We can write e(x) = x r + D . If glr) has more than one tem and one tem is x". it
In a cyclic code, those etr) errors that are divisible by ga) are not caught cannot divide x, as we saw in the previous section. So if etr) is to divide et.r). it must divide
+ 1 . In other words, glr)must not divide i, where t is between 0 and n- 1. However,
t=0 is meaningless andt=lis needed as we will sae later. This means t should be between
and see how they can be caught by a well-
Let us show some specific errors
2 and n- 1.
designed g().
Ifa generator cannot dividex+ l« between &and a-b
Single-Biu Error then all isolated double errors can be detected.
error? A
What should be the structure of g(x) to guarantee the detection of a single-bit
is
bit. a single-bit
Single-bit error is e(r) =x, where i is the position of the not If
error caugnt, Example 10.16
x is not divisible by g(x). (Note that when we say divisible, we mean that there Find the status of the tollowing generators related to two isoBted, sngle-bit errs.
then
normally the case) and the coen
IS a Temainder.) If g(t) has at least two terms (which is cannot a.
Cient of r is not zero (the rightmost bit is 1), then e(x) be divided by g).
b.
e.++t
f the generator has more than one term and the coeffieient of r"181 d. +1
allsingle errors can be caught. Solution
tor a genccato. Aav two emN aext to cah oxher cant be detected.
a. This is a very por choice
can
Example 10.15 b. This generator cannut dect tw errois that are tour pusitivnn apust The wo errors
generator can detect a single eror (minimum condition for a generator), then it cannot 2 The coefficient of the term" shoald be 1.
3. It should not dívide r+1,fort between 2 andn-1
divide
x. Whatwe should worry about are thosegenerators that divide x.+1 n
other words,theremainder of ( r + + 1/x +.+1) must not be zero. Notethat 4. Itshould havethefactorx+1
the denominator is the generator polynomial. We can have three cases:
Standard Polynomials
I. If j-i<r the remainder can never be zero. We can write j
L-1, where Lis -
i
thelength oftheeror. So L-1<ror L<r+ 1 or LSr.This meansallbursterors Some standard polynomials used by popular protocois for CRC generation are shown
with length smaller than or equal to the number of check bits rwill be detected. in Table 10.7.
2. In ifj i = r, or L r + 1, the
some rare cases, -
=
syndrome is 0
and the error is unde-
Table 10.7 Standard polynomials
It
tected. can be proved that in these cases, the
of
probability undetected
length r+1is(1/2). For example, if our generatorisx4 ++1, in which r14,a
burst
error of
Name Pobynomial Application
L= 15 can slip by undetected with the probability of (1/2)or
burst eror oflength
almost 1 in 10.000.
CRC-8 x+ 1 ATM header
ATM AAL
3. In some rare cases,
if j-i>r,or L> r+ 1, the syndrome is 0 and the error 1s unde
CRC-10
tected. It can be proved that in these cases, the probability of undetected burst error CRC-16 + ++1 HDLC
oflength greater than r + l is (1/2). For example, if our generator X"**
is
CRC-32 ++B++6+++x LANs
which r= 14, a burst error of length greater than 15 can slip by undetected witn ++*+r+X+1
probability of (1/2)* or almost 1 in 16,000 cases.
45 Advantages of Cyclic Codes
All burst errors
with LSr will be detected. We have séen that cyclic codes have a very good pertormance in detecting single-bit
All
All
burst errors withL=r+1 wil be detected with probability 1 (12 errors,double errors, an odd number ot erors, and burst errors.They can easily be
burst errors withL>r+1will be detected with probability 1 0/2, implemented in hardware and sottwarethey
are especially fast when implemented in
hardware. This has made cyclie codes a ood eandidate tor many networks.
Example 10.17
Find the
sutability of the following generators in relation to burst errors of different eng" Other Cyclic Codes
a.+1 in this sectüon are very simple. The check bits and
The oyclic codes we have discussed
b.+x+x+1 syndromes can be caleulated by sample algebra.
There are, however, more powerful
c. 32 +2 ++1
polynomials that are based
on abstract algebra involving Galois tields. These are beyond
298 CHAPTER 10 ERROR DETECTION AND CORRECTION
Example 10.18
expressed in 4 bits. The exra two bits are wrapped and added with
the sum to create the
wrapped
sum value 6. În the
figure. we have shown the details in binary. The
sum is then
Suppose our data is a list of five 4-bit numbers that we want to send to a destination. In complemented, resulting in the checksum value 9 (1S-6 =9). The sender now sends
addition six data items to the receiver
to sending these numbers, we send the sum of the numbers. For
example, if the set of numbers is including the checksum9. The receiver folows the same proceduree
as the sender. It adds all data
(7. 11. 12. 0. 6). we send (7, 11, 12, 0, 6, 36), where 36 is the sum items (including the checksum): the result is 45. The sum is
receiver adds the five numbers and compares the result with the sum.the
of original
numbers. The wrapped and becomes 15. The wrapped sum is complemented and becomes 0. Since the value of
If the two are the
the receiver assumes no error, same, the checksum is 0, this means that the data is not
accepts the five numbers, and discards the sum. Otherwise, there is corrupted. The receiver drops the checksum and
an error
somewhere and the data are nol accepted. keeps the other data items. If the checksum is not zero, the entire packet is dropped.
Eydmple 10.19
Figure 8.24
W e can make the job of the receiver easier if we send the negative (complement) of the sum,
called the checksumn. In this case. we send (7, 11, 12,0,
6,-36). The receiver can add all the num- Sendersite Receiver s
bers
received (including the checksum). If the result is 0, it assumes no error; otherwise, there 1s
an
eTor.
O5-One's Complement
The previous example has one major drawback.All of our data can be written as a Sum 7.t. 12a6
word (they are less than 15) except for the checksum. One solution is to use ones
4-D Wrapped sum wrapped sun IS
arithmetic. In this co Checksun Checksum
piement
and 2"- 1
arithmetic, we can represent unsigned numbers between
using only n bits.' If the number has more than n bits, the extra bits
necd to be added to
the n rightmost bits
lettmos o1000
(wrapping) In one's complement arithmeu to
e number can be represented by inverting all bits (changing a 0 to al and
a0).This is the same as
subtracting the number from2"-1. Details ot Wrapping Detals of wrappansS
and counplencnung ani complemenungS
Example 10.20
How can we
represent the number 21 in one's bits?
complement arithmetic using Oy *
10 5:3 Internet Checksum
Although one s complement can y with l6-bit checksum. The sender calculates the
represent both positive and negative numbers, we Traditionally, the Internet has been using a
unsigned representation here. checksum by following these steps.
APIER 20 ERROR DETENTNN AND CORRECTUON
Figure 10.25
10.7 KEY TERMS
101 3 Caries 1 01 3 Carries block code eror comection
46 6 F burst error error detection
7 2 6 F
(Fo) 46 6 F (Fo)
ro) 7 26 P (ro) check bit forward error correction
7 5 1 AA (uz)
6 6 E
7 5. 7 A (uz) checksum generator polynomial
(an) 616 E (an)
0 0 0 Checksum (initial) 7 8 Checksum (received) codeword Hamming code
8FC 6
Sum (partial) FF Sum (partial) convolution code Hamming distance
8FC3 7 Sum cyelic code interterenve
FFFF Sum
10 8
Checksum (to send) 0 0 0 0 Checksum (new) oyclie redundaney check (CRC) linear block code
a.
CheckSum at the sender site minimum Hamming distanwe
b. Checksum at the recelver slte dataword
error modular arithmetie
302 CHAPTER 10 ERROR DETECTION AND CORRECTION
moduius register
one's complement retransmission
panity bit shift register
parity-check code single-bit error
polynomial syndrome
redundancy Lwo-dimensional parity
Recd-Solomon check
10.8 SUMMARY
Data can be corrupted during transmission. Some applications require that
detected and corrected.
errors be
I n a single-bit error, bit in the data unit has changed. A burst error
only one
means
that two or more bits in the data unit have changed.
To detect or correct errors, we need to send extra (redundant) bits with data.
There are two main methods of error correction: forward error correction and corec
tion by retransmission.
We can divide coding schemes into two broad categories: block coding and cowo-
lution coding.
I n coding, we need to use modulo-2 arithmetic.
Operations in this arithmetic are very
simpie: addition and subtraction give the same results. we use the XOR (exclusive
OR) operation for both addition and subtraction.
I n block coding, we divide our
message into blocks, each of k bits, called dataworts
We add rredundant bits to each block to
make the length n =k+ r. The resulting n-bt
biocks are called codewords.
I n block coding, errors be detected by using the following two conditions:
a. The receiver has (or can find) a list of valid codewords.
b. The original codeword has
changed
to an invalid one.
The
Hamming distance between two words is the number of differences Ot
coTesponding
distance between all
bits. The minimum Hamming distance is the smallest Hammung
To
ance
guarantee
in a block
thecode
detection
must be
possible pairs
of dmin
up to=S
s errors
+ 1.To
in a set of words.
in guarantee
all case the
correction
minimumor up
Hamming
L dis-
rerrors in
all
of up to
Cases, theminimum Hamming distance in a block code must be duin
Ina linear block code, the exclusive OR creates
code
Cyclic codes are special linear block codes with one exira property. Ina cyclic
if a codeword is cyclically shifted pro deword
(rotated), the result is another cou
Chap 10 previous year questions