Está en la página 1de 18

M KIM TRA LI CRC

Gii thiu.
Cch xc nh CRC-n
Mt s a thc sinh.
V d.
CRC-4 trong PCM-30

GII THIU

CRC l mt phng php pht hin li bng


cch gn thm mt khi bit pha sau khi d liu.
Thut ton to ra khi bit CRC l da trn php
cng modulo 2 (GF(2)).
CRC l phn d ca php chia nh phn khng
nh.

PHP TON MODULO 2 (mod 2)

Trong trng GF(2), cc h s ca a thc l cc s 1 v 0.


V d cng hai a thc:

( x 3 + x ) + ( x + 1) = x 3 + 2 x + 1 = x 3 + 1 (mod 2)

2 x = x + x = x(1 + 1) = x.0 = 0 (mod 2)

Php nhn cng vy:

( x 2 + x).( x + 1) = x 3 + 2 x 2 + x = x 3 + x (mod 2)

Chng ta cng c th chia a thc theo mod 2 tm thng


(quotient) v s d (remainder):

x3 + x 2 + x
1
1
= ( x + 1)
= ( x + 1) +
(mod 2)
x +1
x +1
x +1

CHUYN I GIA CHUI S


NH PHN V A THC
Chui bit
S bit: m

b(m-1) b(m-2)

b2

b1

b0

a thc nh phn biu din chui bit trn l:


b(m-1).x(m-1) + b(m-2).x(m-2) + + b2.x2 + b1.x1 + b0.x0

V d: Chui bit 101 c th c biu din di dng a


thc nh phn nh sau:

1. x + 0. x + 1. x = x + 1
2

CCH XC NH CRC-n

Cc bc thc hin:

Biu din chui bit thnh a thc nh phn M(x).


Nhn M(x) vi xn: M(x).xn.
Chia M(x).xn cho a thc sinh G(x) ca CRC-n.
Nh vy ta c thng Q(x) v s d R(x).
S d R(x) chnh l CRC-n.

Nh vy tng qut ta c thvit:

M ( x).x n = Q( x).G ( x) + R ( x)

MT S A THC SINH G(x)


CRC-n

G(x)

USE

CRC-1

x+1

Hardware (parity bit)

CRC-4

x4 + x + 1

PCM-30

CRC-5 - CCITT

x5 + x3+ x+1

ITU-G.704

CRC-5 USB

x5 + x2+ 1

USB token packets

CRC-7

x7 + x3+ 1

Telecom systems, MMC

CRC-8

x8 + x7 + x6 + x4 + x2 + 1

CRC-12

x12 + x11 + x3 + x2 + x + 1

CRC-32 - MPEG2

x32 + x26 + x23 + x22 + x16 + x12 + x11


+ x10 + x8 + x7 + x5 + x4 + x2 + x + 1

use: telecom systems

MT S V D TNH CRC-n

V d 1:
Tm CRC-1 ca chui s nh phn sau:
1101001010101010

MT S V D TNH CRC-n (tt)


p s v d 1:
M(x) = x15+x14+x12+x9+x7+x5+x3+x
G(x) = x+1
Q(x) = x15+x12+x11+x10+x7+x6+x3+x2
R(x) = 0
CRC-1 = 0

MT S V D TNH CRC-n (tt)

V d 2:
Tm CRC-7 ca chui s nh phn sau:
1101001010101010

MT S V D TNH CRC-n (tt)


p s v d 2:
M(x) = x15+x14+x12+x9+x7+x5+x3+x
G(x) = x7 + x3 + 1
Q(x) = x15+x14+x12+x11+x10+x9+x7+x6+x5+x4+x3
R(x) = x5+x4+x3
CRC-7 = 0111000

FRAME

CRC-4 TRONG PCM-30


FRAME

TS0

#0 C1 0

TS0

#8 C1 0

#1

#9

#2 C2 0

#10 C2 0
#11

#3
#4 C3 0

#12 C3 0
#13

#5
#6 C4 0

#7

#14 C4 0
#15

Submultiframe#1

Submultiframe#2

Multi-frame

CRC-4 TRONG PCM-30 (tt)

Gi tr CRC-4 ca a khung con #n c tnh t


cc bit tin ca a khung con #(n-1) (tr cc bit
CRC).
m tng s bit 1 trong mt a khung con #(n-1).
i s ny thnh s nh phn.
Sau tnh CRC-4 ca s nh phn ny.
Truyn CRC-4 ny a khung con #n.

V D TNH CRC-4

V d 3:
Gi s b pht PCM-30 to cc a khung con th
(n-1) c tng s bit 1 l 1210.Hy xc nh gi tr
CRC-4 ca a khung con ny?

V D TNH CRC-4 (tt)


p s v d 3:
CRC-4 = 0101

V D TNH CRC-4 (tt)

Gii v d 3:
i s 1210 ra s nh phn: 10010111010
M(x) = x10+x7+x5+x4+x3+x
G(x) = x4+x+1
Q(x) = x10+x6+x5+x4+x+1
R(x) = x2+1

V D TNH CRC-4 (tt)

V d 4:
Gi s b pht PCM-30 to cc a khung con th
(n-1) vi xc sut xut hin bit 1 l 50%. Hy xc
nh gi tr CRC-4 ca a khung con ny?

V D TNH CRC-4 (tt)


p s v d 4:
CRC-4 = 1011

V D TNH CRC-4 (tt)

Gii v d 4:
Tng s bit 1: 2048*50% = 1024.
S nh phn: 10000000000
M(x) = x10
G(x) = x4 + x + 1
Q(x) = x10 + x7 + x6+x4 + x2 + x + 1
R(x) = x3+ x + 1