Beruflich Dokumente
Kultur Dokumente
Modulo-2 Arithmetic
Modulo 2 arithmetic is performed digit by digit on binary numbers.
Each digit is considered independently from its neighbours.
Numbers are not carried or borrowed.
Error Control
Why Error data sent from one computer to another should be transferred
reliably unfortunately, the physical link cannot guarantee
Control?
that all bits, in each frame, will be transferred without errors
fibre optics:
1 0 0 1 1 0 1 0
pb=10-9
information bits
Recalculate
check bits
k bits
Channel
Calculate
check bits
n-k
check
bits
1 0 0 1 1 0 1 0
f(S)
1 0
received
check bits
1 0 0 1 1 0 1 0 1 0
Compare
information
accepted if
check bits
match
1 0 0 1 1 0 1 0
f(S)
1 0
comp
0 0
Hamming Distance
11011
11111
dmin = s + 1
dmin = 2t + 1
10
Single Parity Check take k information bits and append a single check
bit so that overall number of 1s is even !
(Even Parity)
Info Bits:
b 1, b2, b3, , bk
Check Bit:
Codeword:
[b
(b 1, b2, b3, , bk , bk+1 ]
11
Information (7 bits):
[0, 1, 0, 1, 1, 0, 0]
Parity Bit:
Codeword (8 bits):
[0, 1, 0, 1, 1, 0, 0, 1]
[0, 1, 1, 1, 1, 0, 0, 1]
If errors in bit 3, 5, 6 :
# of 1s = 5, odd
Error detected !
b8 = 0 + 1 + 0 + 1 +1 + 0 mod 2 = 1
[0, 1, 1, 1, 0, 1, 0, 1]
12
Single Parity Check Codes for ALL parity check codes, dmin = 2
and Minimum Hamming
Distance (dmin)
13
b = [b1 b 2 b3 ... bn ]
1 0 0 1 1 0 0 1
1 1 0 1 1 1 0 1
e = [e1 e 2 e3 ... en ]
0 1 0 0 0 1 0 0
error vector:
1, if bk bk'
ek =
0, if bk = bk'
(1) Random Error Vector there are 2n possible error (e) vectors
all error are equally likely
Channel Model
e.g. e=[0 0 0 0 0 0 0 0] and e=[1 1 1 1 1 1 1 1]
14
15
(2) Random Bit Error bit errors occur independently of each other
pb = prob. of error in a single-bit transmission
Channel Model
position
1 0 0 1 1 0 0 0
1 0 1 1 1 0 0 0
e1=0
e2=0 e3=1
P( w(e) = 1) = (1 pb ) (1 pb ) pb ... (1 pb ) (1 pb ) (1 pb )
probability of correctly
transmitted bit
P( w(e) = 1) = (1 pb )n-1 pb
n- 2
(pb ) = (1 pb ) pb
1 pb
2
n-1
p
P( w(e) = 2) = P( w(e) = 1) b < P( w(e) = 1)
1 pb
k 1
= P( w(e) = 1) (a)
k 1
16
17
n
n!
(# of k bit errors) = =
k k! (n k)!
1 0 0 1 1 0 1 0
1 1 0 0 1 1 0 0
n
n
n
P(error detection failure) = pb2 (1 pb )n2 + pb4 (1 pb )n4 + pb6 (1 pb )n6 + ...
2
4
6
progressively smaller components
18
1
2000
19
0
0
0
20
21
1010100
0011100
1101110
1110011
1
1
1
1
1010101 0
1010001
1000100
1101110
1110011
1
1
1
1
1010101 0
22
23
(Internet) Checksum error detection method used by IP, TCP, UDP !!!
checksum calculation:
IP/TCP/UDP packet is divided into n-bit sections
n-bit sections are added using 1-s complement
arithmetic the sum is also n-bits long!
the sum is complemented to produce checksum
(complement of a number in 1-s arithmetic is the
negative of the number)
advantages:
relatively small packet overhead is required
n bits added regardless of packet size
easy / fast to implement in software
disadvantages:
weak protection compared to CRC e.g. will NOT
detect misordered bytes/words !!!
detects all errors involving an odd number of bits
and most errors involving an even number of bits
sum
checksum
24
Receiver:
25
10110
0110
1
1-s complement addition:
checksum:
1-s
1-s complement
complement addition:
addition:
Perform
Perform standard
standard binary
binary addition.
addition.
th
IfIf aa carry-out
carry-out (>n
(>nth)) bit
bit itit produced,
produced,
swing
swing that
that bits
bits around
around and
and
add
add itit back
back into
into the
the summation.
summation.
0111 (7)
1000 (-7)
Negative
Negative binary
binary numbers:
numbers:
Negative
Negative binary
binary numbers
numbers are
are
bit-wise
bit-wise complement
complement of
of
corresponding
corresponding positive
positive numbers.
numbers.
26
11110
1111
0000
When the receiver adds the three blocks, it will get all 1s, which,
after complementing, is all 0s and shows that there is no error.
IfIf one
one or
or more
more bits
bits of
of aa segment
segment are
are damaged,
damaged, and
and the
the corresponding
corresponding bit
bit of
of
opposite
opposite value
value in
in aa second
second segment
segment is
is also
also damaged,
damaged,
the
the sums
sums of
of those
those columns
columns will
will not
not change
change and
and the
the receiver
receiver will
will not
not
detect
detect the
the problem.
problem.
27
28
Sum
Checksum
10101001
00111001
00000000
------------11100010
00011101
11111111
00000000 means that the pattern is OK.
1 11000101
Checksum
11000110
Complement
00111001
29