340 likes | 864 Views
Hamming Code. 이근용. Error Control. Error Detection Parity Check CRC Check Error Correction Hamming Code. 오류 검출과 교정. 송신측에서 원래의 데이터에 여분의 메시지를 추가하여 수신측에서 메시지의 에러를 검출하거나 교정할 수 있도록 하는 것. Symbol Original Code Code with redundant A 0 0 0 0 0 0 0 B 0 0 1 0 0 1 1 C 0 1 0 0 1 0 1
E N D
Hamming Code 이근용
Error Control • Error Detection • Parity Check • CRC Check • Error Correction • Hamming Code
오류 검출과 교정 • 송신측에서 원래의 데이터에 여분의 메시지를 추가하여 수신측에서 메시지의 에러를 검출하거나 교정할 수 있도록 하는 것
Symbol Original Code Code with redundant A 0 0 0 0 0 0 0 B 0 0 1 0 0 1 1 C 0 1 0 0 1 0 1 D 0 1 1 0 1 1 0 E 1 0 0 1 0 0 1 F 1 0 1 1 0 1 0 G 1 1 0 1 1 0 0 H 1 1 1 1 1 1 1 If 1bit error 0011 (B) 0101 (C) 1001 (E) 0000 0001 0010 0100 1000
BER(Bit Error Rate) • 에러가 없이 전송될 확률 : p • 전송할 때 에러 발생확률 : q = 1-p • 3digit의 메시지 • 에러 없이 전송될 확률 : p3 • 에러가 하나 발생 : 3p2q • 000 001, 010, 100 • 에러가 두개 발생 : 3pq2 • 에러가 세개 발생 : q3
BER • n binary digit에서 r개의 오류가 발생할 확률 -
Hamming Code (1) • 오류 검출 및 정정이 가능한 코드 • Parity Digit라고 불리는 여분의 코드를 가지고 있음 • Message 길이가 n digits long이고 정보를 표현하는데 m digits(m < n)라면, • 검출과, 정정을 위해서 사용된 코드 • K = n-m
Hamming Code (2) • Single error detection • n-1까지 message • n번째 parity • Hamming은 parity check에 기초하여 검출및 정정이 가능한 코드를 만들었음 • 에러가 발생한 위치 파악 가능
Hamming Code (3) • Definition 1 • Let x=<x1,x2,…,xn> and y = <y1,y2,…,yn> be n-tuples representing messages x1x2,…,xn and y1,y2,…,yn respectively, where xi, yi in {0,1}, The Hamming distance between x and y, denoted by H(x,y), is the number of coordinates for which all xi and yi are different. • Cleary
Hamming Code (4) • For example • <1,1,1,0,1> and <0,1,1,1,0> is 3 • x, y, z in Sn • H(x,y) >= 9 • H(x,y) = 0 x = y • H(x,y) = H(y,x) • H(x,y) + H(y,z) >= H(x,z)
Hamming Code(5) • Definition 2 • The minimum distance of a code, whose words are n-tuples, is the minimum of the Hamming distance between all pairs of code words in the code. • Example • X = <1,0,0,1> H(x,y)=3 • Y = <0,1,0,0> H(y,z)=2 • Z = <1,0,0,0> H(x,z)=1 • Minimum distance in this code is 1
Hamming code(6) • Theorem 1 • A code can detect all combinations of k or fewer errors if and only if the minimum distance between any two code words is at least k+1
Hamming code (7) • Theorem 2 • A code can correct all combinations of k or fewer errors if and if the minimum distance between any two code words is at least 2k+1
Hamming code 설계 • 1개 또는 2개의 오류 검출 • 1개의 오류 정정 • m = 4, k = 3 • x1+x2+x3+x5 = 0 (1), x5 = -(x1+x2+x3), x5 = (x1+x2+x3) • x1+x2+x4+x6 = 0 (2), x6 = -(x1+x2+x4), x6 = (x1+x2+x4) • x1+x3+x4+x7 = 0 (3), x7 = -(x1+x3+x4), x7 = (x1+x3+x4) • All mod 2
x1 x2 x3 x4 x5 x6 x7 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 x5 = (x1+x2+x3) x6 = (x1+x2+x4) x7 = (x1+x3+x4) All mod 2
Hamming codeError Detect • (1),(2),(3)을 각각 P1, P2, P3를 true로 만들면 Error 발생 • 1000011 • P1 = (1+0+0+0) mod 2 = 1Error • P2 = (1+0+0+1) mod 2 = 0 • P3 = (1+0+0+1) mod 2 = 0 • Error 위치 x5 • 0111111 • P1, P2, P3 Errorx1 Error
Error Position Detect S1 S2 (1),(2),(3)을 각각 S1,S2,S3라하면 5 S1 and ~S2 and ~S3 2 S1 and S2 and ~S3 6 ~S1 and S2 and ~S3 3 S1 and ~S2 and S3 7 ~S1 and ~S2 and S3 1 S1 and S2 and S3 4 ~S1 and S2 and S3 5 2 6 1 3 4 7 S3
Error Position Detect Proposition P1 P2 P3 Incorrect Digit None X x5 X x6 X x7 X X x2 X X x3 X X x4 X X X x1
참고도서 • Discrete Mathmatical Structures with Applications to Computer Science • J.P. TREMBLAY, R. MANOHAR • McGRAW-HILL BOOK COMPANY, 1975 • Data and Computer Communications fourth edition • William Stallings, PH.D. • MACMILLAN PUBLISHING COMPANY, 1994