New version page

Berkeley COMPSCI 152 - Lecture 16 – Error Correcting Codes

Documents in this Course
Quiz 5

Quiz 5

9 pages

Memory

Memory

29 pages

Quiz 5

Quiz 5

15 pages

Memory

Memory

29 pages

Memory

Memory

35 pages

Memory

Memory

15 pages

Quiz

Quiz

6 pages

Midterm 1

Midterm 1

20 pages

Quiz

Quiz

12 pages

Memory

Memory

33 pages

Quiz

Quiz

6 pages

Homework

Homework

19 pages

Quiz

Quiz

5 pages

Memory

Memory

15 pages

Load more
Upgrade to remove ads

This preview shows page 1-2-3-27-28-29 out of 29 pages.

Save
View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCB2006-10-24John Lazzaro (www.cs.berkeley.edu/~lazzaro)CS 152 Computer Architecture and EngineeringLecture 16 – Error Correcting Codeswww-inst.eecs.berkeley.edu/~cs152/TAs: Udam Saini and Jue Sun 1CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBF05 TA Notes: Final Project CheckoffThe SyncMeisters had everything working besides the test file hammer. However, hammer is the hardest test, so in a sense, their project was a bug or two away from working.Writing back to the regfile when a stall occurs on the cache just before or after needing to write seems to mess up their processor. The other tests worked fine on board.2UC Regents Fall 2006 © UCBCS 152 L16: Error Correcting CodesWhen cache bugs make it to product ...(Testing our financial trading system), we found a case where our software would get a bad calculation. Once a week or so.Eventually, the problem turned out to be a failure in a CPU cache line refresh. This was a hardware design fault in the PC.The test suite included running the code for two weeks at maximum update rate without error, so this bug was found.Eric Ulevik3UC Regents Fall 2006 © UCBCS 152 L16: Error Correcting CodesToday: Computing in an imperfect worldDetecting and correcting RAM bit errorsReplacing lost network packets, recovering from disk drive failureDetecting arbitrary bit errors in network packets4CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBDRAM Challenge: Cosmic Rays ...VddBit Line+++++++Word Linep-oxiden+ n+oxide------Cosmic ray hit.Cell capacitor holds 25,000 electrons (or less). Cosmic rays that constantly bombard us can release the charge!5CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBCan this happen in SRAM?Gnd Vdd Vdd Gnd Gnd Cosmic ray discharges CVdd -> Gnd.A race: Can P1 restore middle node to Vdd before P2 flips other node?P1P26CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBPractical effect of a cosmic ray ...ADDIU R1, R0, 7SW R1, 100(R0)Address 100: 0b00...0111Address 100: 0b00...0011Cosmic ray hit.LW R1, 100(R0)After LW, R1 holds 3 but it should hold 7.Bit flips on memory holding instructions are bad too!7CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBTo “detect” errors -- add ‘P’, a parity bitAddress 100: 0b00...0011 1Cosmic ray hit.Extra “parity” bit for every word. Not seen by software. Hardware computes it on every write, so that the number of 1’s in every 33 bit word is even (even parity). On a read, count the number of 1s. If odd, a bit flipped.Address 100: 0b00...0111 1PSo, halt the program and reboot? Application may know if this bit matters, but there’s no API to ask it ... Does this work if two bits flip? If three? 8CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBError Correction: Hamming Codes ...Richard Hamming.Computing pioneer.Famous quote:“Computers are not for numbers. Computers are for understanding.”9CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBTrick: Compute parity of subsets of bitsP₂P₁P₀Add 3 parity bits.???Each parity bit computed on a subset of bitsP₀ = D₃ xor D₁ xor D₀ = 0 xor 1 xor 0 = 1 P₁ = D₃ xor D₂ xor D₀ = 0 xor 1 xor 0 = 1P₂ = D₃ xor D₂ xor D₁ = 0 xor 1 xor 1 = 00 Consider 4 bit words.1 0 1D₃D₂D₁D₀D₃D₂D₁P₂D₀P₁P₀Use this word bit arrangement0 11 0 0 1 1“Just believe” for now, we will justify later ...10CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBCase #1: No cosmic ray hitsD₃D₂D₁P₂D₀P₁P₀On readout we compute:P₀ xor D₃ xor D₁ xor D₀ = 1 xor 0 xor 1 xor 0 = 0 = C0P₁ xor D₃ xor D₂ xor D₀ = 1 xor 0 xor 1 xor 0 = 0 = C1P₂ xor D₃ xor D₂ xor D₁ = 0 xor 0 xor 1 xor 1 = 0 = C₂ 0 11 0 0 1 1We write:D₃D₂D₁P₂D₀P₁P₀0 11 0 0 1 1Later, we read:If C₂C₁C₀ = 0no errors No errors ... but how do we know that? These equations come from how we computedP₀ = D₃ xor D₁ xor D₀ = 0 xor 1 xor 0 = 1 P₁ = D₃ xor D₂ xor D₀ = 0 xor 1 xor 0 = 1P₂ = D₃ xor D₂ xor D₁ = 0 xor 1 xor 1 = 0P₂P₁P₀11CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBCase #2: A cosmic ray hits ...Cosmic ray hit D1. But how do we know that?D₃D₂D₁P₂D₀P₁P₀0 11 0 0 1 1We write:D₃D₂D₁P₂D₀P₁P₀0 01 0 0 1 1Later, we read:C₂C₁C₀ = b101 = 5What does “5” mean?0 01 0 0 1 1The position of the flipped bit!To repair, just flip it back ...D₃D₂D₁P₂D₀P₁P₀1436 57 2Note: we number the least significant bit with 1, not 0! 0 is reserved for “no errors”.On readout we compute:P₀ xor D₃ xor D₁ xor D₀ = 1 xor 0 xor 0 xor 0 = 1 = C0P₁ xor D₃ xor D₂ xor D₀ = 1 xor 0 xor 1 xor 0 = 0 = C1P₂ xor D₃ xor D₂ xor D₁ = 0 xor 0 xor 1 xor 0 = 1 = C₂ 12CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBWhy did we choose “3” parity bits?0 Consider 4 bit words.P₂P₁P₀Observation: The C₂C₁C₀ bits need to encode the “no error” condition, plus a number for each bit (both data and parity bits)Add 3 parity bits.???1 0 1D₃D₂D₁D₀For “p” parity bits and “d” data bits:d + p + 1 <= 2pA Ci inC₂C₁C₀ exists for each Pi.13CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBWhy did we arrange bits as we did?Consider 4 bit words.P₂P₁P₀Add 3 parity bits.How do we re-arrange bits?D₃D₂D₁D₀Start by numbering, 1 to 7.14 36 57 2D₃D₂D₁P₂D₀P₁P₀With this order, an odd parity means an error in 1,3,5, or 7.So, P0 is the right parity bit to use:C₂C₁C₀D₃D₂D₁P₂D₀P₁P₀An odd parity means a mistake must be in 2, 3, 6, or 7 -- the four numbers possible if C1 = 1!D₃D₂D₁P₂D₀P₁P₀Etc ... each bit narrows down the suspect bits, until it is certain.D₃D₂D₁P₂D₀P₁P₀A Ci inC₂C₁C₀ exists for each Pi.14CS 152 L16: Error Correcting Codes UC Regents Fall 2006 © UCBConsider 4 bit words.P₂P₁P₀Add 3 parity bits.P₀ = D₃ xor D₁ xor D₀ P₁ = D₃ xor D₂ xor D₀ P₂ = D₃ xor D₂ xor D₁D₃D₂D₁D₀It takes 3 bit flips to move from one legal number to another (for all 16 numbers)If only one bit flips, we can always figure out the “closest” legal number, and correct.Why did we arrange bits as we did?7 bits can code 128 numbers, but only 16 of these numbers are legal.D₃D₂D₁P₂D₀P₁P₀15CS 152 L16: Error Correcting


View Full Document
Download Lecture 16 – Error Correcting Codes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 16 – Error Correcting Codes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 16 – Error Correcting Codes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?