17
1: Computer Science CSCI 355 — Lecture 5 Computer Science CSCI 355 Digital Logic and Computer Organization Dr. Peter Walsh Department of Computer Science Vancouver Island University [email protected]

Computer Science CSCI 355 Digital Logic and Computer

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computer Science CSCI 355 Digital Logic and Computer

✪1: Computer Science CSCI 355 — Lecture 5

Computer Science CSCI 355

Digital Logic and Computer Organization

Dr. Peter Walsh

Department of Computer Science

Vancouver Island University

[email protected]

Page 2: Computer Science CSCI 355 Digital Logic and Computer

✪2: Computer Science CSCI 355 — Lecture 5

Hamming Code

© n = 4 m = 3

Page 3: Computer Science CSCI 355 Digital Logic and Computer

✪3: Computer Science CSCI 355 — Lecture 5

Hamming Code cont.

Parity bits cover sequences of data bits.

• p1 = d1⊕

d2⊕

d4

• p2 = d1⊕

d3⊕

d4

• p3 = d2⊕

d3⊕

d4

No data bits are covered by the same sequence of parity

bits.

• d1 is covered by p1, p2

• d2 is covered by p1, p3

• d3 is covered by p2, p3

• d4 is covered by p1, p2, p3

Page 4: Computer Science CSCI 355 Digital Logic and Computer

✪4: Computer Science CSCI 355 — Lecture 5

Hamming Code cont.

Page 5: Computer Science CSCI 355 Digital Logic and Computer

✪5: Computer Science CSCI 355 — Lecture 5

Transmit Bit Ordering

�������������������������������������������

��������������������������������

Page 6: Computer Science CSCI 355 Digital Logic and Computer

✪6: Computer Science CSCI 355 — Lecture 5

Example

© d1, d2, d3, d4 = 0110

Page 7: Computer Science CSCI 355 Digital Logic and Computer

✪7: Computer Science CSCI 355 — Lecture 5

Example cont.

• p1 = d1⊕

d2⊕

d4

⇒ p1 = 0⊕

1⊕

0 = 1

• p2 = d1⊕

d3⊕

d4

⇒ p2 = 0⊕

1⊕

0 = 1

• p3 = d2⊕

d3⊕

d4

⇒ p3 = 1⊕

1⊕

0 = 0

Page 8: Computer Science CSCI 355 Digital Logic and Computer

✪8: Computer Science CSCI 355 — Lecture 5

Example cont.

© Transmit

�������������������������������������������

��������������������������������

����������������������������������������������

Page 9: Computer Science CSCI 355 Digital Logic and Computer

✪9: Computer Science CSCI 355 — Lecture 5

Example cont.

© Receive

�������������������������������������������

��������������������������������

����������������������������������������������

Page 10: Computer Science CSCI 355 Digital Logic and Computer

✪10: Computer Science CSCI 355 — Lecture 5

Example cont.

• c1 = p1⊕

d1⊕

d2⊕

d4

⇒ c1 = 1⊕

0⊕

1⊕

0 = 0

• c2 = p2⊕

d1⊕

d3⊕

d4

⇒ c2 = 1⊕

0⊕

1⊕

0 = 0

• c3 = p3⊕

d2⊕

d3⊕

d4

⇒ c3 = 0⊕

1⊕

1⊕

0 = 0

• Syndrome = 000 ⇒ no bits in error

Page 11: Computer Science CSCI 355 Digital Logic and Computer

✪11: Computer Science CSCI 355 — Lecture 5

Example cont.

© Receive

Page 12: Computer Science CSCI 355 Digital Logic and Computer

✪12: Computer Science CSCI 355 — Lecture 5

Example cont.

• c1 = p1⊕

d1⊕

d2⊕

d4

⇒ c1 = 1⊕

1⊕

1⊕

0 = 1

• c2 = p2⊕

d1⊕

d3⊕

d4

⇒ c2 = 1⊕

1⊕

1⊕

0 = 1

• c3 = p3⊕

d2⊕

d3⊕

d4

⇒ c3 = 0⊕

1⊕

1⊕

0 = 0

• Syndrome = 011 ⇒ bit 3 in error = d1

Page 13: Computer Science CSCI 355 Digital Logic and Computer

✪13: Computer Science CSCI 355 — Lecture 5

Syndrome Size

• n data bits m parity bits

• range of m >= n+m

• 2m − 1 >= n+m

• e.g. m = 4 can protect a max of 11 data bits

Page 14: Computer Science CSCI 355 Digital Logic and Computer

✪14: Computer Science CSCI 355 — Lecture 5

Hamming Code cont.

Page 15: Computer Science CSCI 355 Digital Logic and Computer

✪15: Computer Science CSCI 355 — Lecture 5

Extended Hamming Code

• single bit error correction

• double bit error detection

• e.g. n = 4 add an extra parity bit p4 where

p4 = p1⊕

p2⊕

d1⊕

p3⊕

d2⊕

d3⊕

d4

c4 = p4⊕

p1⊕

p2⊕

d1⊕

p3⊕

d2⊕

d3⊕

d4

Page 16: Computer Science CSCI 355 Digital Logic and Computer

✪16: Computer Science CSCI 355 — Lecture 5

Syndrome and c4 Inference

• c4 = 0 and syndrome = 0 ⇒ no error

• c4 6= 0 and syndrome 6= 0 ⇒ single bit error

(can be corrected)

• c4 = 0 and syndrome 6= 0 ⇒ double bit error

(can not be corrected, detection only)

• c4 6= 0 and syndrome = 0 ⇒ p4 in error

Page 17: Computer Science CSCI 355 Digital Logic and Computer

✪17: Computer Science CSCI 355 — Lecture 5

Burst Errors

• form Hamming blocks on the ”vertical”

rather than the ”horizontal”