Information redundancy

Similar documents
Error Detection & Correction

B. Cyclic Codes. Primitive polynomials are the generator polynomials of cyclic codes.

Fault Tolerance & Reliability CDA Chapter 2 Cyclic Polynomial Codes

Objective: To become acquainted with the basic concepts of cyclic codes and some aspects of encoder implementations for them.

Error Correction Review

Optical Storage Technology. Error Correction

Outline. EECS Components and Design Techniques for Digital Systems. Lec 18 Error Coding. In the real world. Our beautiful digital world.

x n k m(x) ) Codewords can be characterized by (and errors detected by): c(x) mod g(x) = 0 c(x)h(x) = 0 mod (x n 1)

ECE 4450:427/527 - Computer Networks Spring 2017

Lecture 12. Block Diagram

EECS150 - Digital Design Lecture 26 Error Correction Codes, Linear Feedback Shift Registers (LFSRs)

Cyclic codes: overview

Cyclic Redundancy Check Codes

EECS Components and Design Techniques for Digital Systems. Lec 26 CRCs, LFSRs (and a little power)

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

Error Correction and Trellis Coding

A Brief Encounter with Linear Codes

Chapter 6. BCH Codes

Chapter 5. Cyclic Codes

Error Detection, Correction and Erasure Codes for Implementation in a Cluster File-system

Fault Tolerant Computing CS 530 Information redundancy: Coding theory. Yashwant K. Malaiya Colorado State University

Generator Matrix. Theorem 6: If the generator polynomial g(x) of C has degree n-k then C is an [n,k]-cyclic code. If g(x) = a 0. a 1 a n k 1.

ECEN 604: Channel Coding for Communications

VHDL Implementation of Reed Solomon Improved Encoding Algorithm

1 Reed Solomon Decoder Final Project. Group 3 Abhinav Agarwal S Branavan Grant Elliott. 14 th May 2007

Communications II Lecture 9: Error Correction Coding. Professor Kin K. Leung EEE and Computing Departments Imperial College London Copyright reserved

Cyclic Codes. Saravanan Vijayakumaran August 26, Department of Electrical Engineering Indian Institute of Technology Bombay

Information Redundancy: Coding

Binary Primitive BCH Codes. Decoding of the BCH Codes. Implementation of Galois Field Arithmetic. Implementation of Error Correction

Fully-parallel linear error block coding and decoding a Boolean approach

Getting Connected. Chapter 2, Part 2. Networking CS 3470, Section 1 Sarah Diesburg

The Pennsylvania State University. The Graduate School. Department of Computer Science and Engineering

Math 512 Syllabus Spring 2017, LIU Post

An Enhanced (31,11,5) Binary BCH Encoder and Decoder for Data Transmission

Introduction to Wireless & Mobile Systems. Chapter 4. Channel Coding and Error Control Cengage Learning Engineering. All Rights Reserved.

Cyclic codes. Vahid Meghdadi Reference: Error Correction Coding by Todd K. Moon. February 2008

EECS150 - Digital Design Lecture 21 - Design Blocks


3. Coding theory 3.1. Basic concepts

Linear Cyclic Codes. Polynomial Word 1 + x + x x 4 + x 5 + x x + x

L9: Galois Fields. Reading material

Coding Theory: Linear-Error Correcting Codes Anna Dovzhik Math 420: Advanced Linear Algebra Spring 2014

Design and Implementation of Reed-Solomon Decoder using Decomposed Inversion less Berlekamp-Massey Algorithm by

Implementation of Galois Field Arithmetic. Nonbinary BCH Codes and Reed-Solomon Codes

Outline. EECS150 - Digital Design Lecture 26 Error Correction Codes, Linear Feedback Shift Registers (LFSRs) Simple Error Detection Coding

Dr. Cathy Liu Dr. Michael Steinberger. A Brief Tour of FEC for Serial Link Systems

ERROR CORRECTING CODES

Cyclic codes. I give an example of a shift register with four storage elements and two binary adders.

Coding Theory and Applications. Solved Exercises and Problems of Cyclic Codes. Enes Pasalic University of Primorska Koper, 2013

6.1.1 What is channel coding and why do we use it?

Linear Feedback Shift Registers (LFSRs) 4-bit LFSR

MATH3302 Coding Theory Problem Set The following ISBN was received with a smudge. What is the missing digit? x9139 9

Error Correction Methods

Combinational Logic. By : Ali Mustafa

Continuing discussion of CRC s, especially looking at two-bit errors

Systems I: Computer Organization and Architecture

UNIVERSITI TENAGA NASIONAL. College of Information Technology

9 THEORY OF CODES. 9.0 Introduction. 9.1 Noise

ECE8771 Information Theory & Coding for Digital Communications Villanova University ECE Department Prof. Kevin M. Buckley Lecture Set 2 Block Codes

ELEC3227/4247 Mid term Quiz2 Solution with explanation

Chapter 6 Reed-Solomon Codes. 6.1 Finite Field Algebra 6.2 Reed-Solomon Codes 6.3 Syndrome Based Decoding 6.4 Curve-Fitting Based Decoding

CHAPTER 7. Exercises 17/ / /2 2 0

2013/Fall-Winter Term Monday 12:50 Room# or 5F Meeting Room Instructor: Fire Tom Wada, Professor

1. How many errors may be detected (not necessarily corrected) if a code has a Hamming Distance of 6?

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

Chapter 3 Linear Block Codes

Simplification of Procedure for Decoding Reed- Solomon Codes Using Various Algorithms: An Introductory Survey

ELCT201: DIGITAL LOGIC DESIGN

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:

FPGA BASED DESIGN OF PARALLEL CRC GENERATION FOR HIGH SPEED APPLICATION

Algebraic Codes for Error Control

NUMBERS AND CODES CHAPTER Numbers

Linear Cyclic Codes. Polynomial Word 1 + x + x x 4 + x 5 + x x + x f(x) = q(x)h(x) + r(x),

Class Website:

Chapter 7. Error Control Coding. 7.1 Historical background. Mikael Olofsson 2005

MATH3302. Coding and Cryptography. Coding Theory

MATH32031: Coding Theory Part 15: Summary

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Discussion 6A Solution

channel of communication noise Each codeword has length 2, and all digits are either 0 or 1. Such codes are called Binary Codes.

Error Control Codes for Memories

Linear Algebra. F n = {all vectors of dimension n over field F} Linear algebra is about vectors. Concretely, vectors look like this:

Some math for embedded algorithms

5.0 BCH and Reed-Solomon Codes 5.1 Introduction

Error Correction Code (1)

Instruction Set Extensions for Reed-Solomon Encoding and Decoding

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

16.36 Communication Systems Engineering

Lecture 3: Error Correcting Codes

Can You Hear Me Now?

Notes 10: Public-key cryptography

Vector spaces. EE 387, Notes 8, Handout #12

Assume that the follow string of bits constitutes one of the segments we which to transmit.

1. Basics of Information

Solutions of Exam Coding Theory (2MMC30), 23 June (1.a) Consider the 4 4 matrices as words in F 16

Logic. Combinational. inputs. outputs. the result. system can

How does the computer generate observations from various distributions specified after input analysis?

Topic 3. Design of Sequences with Low Correlation

EECS150 - Digital Design Lecture 26 - Faults and Error Correction. Types of Faults in Digital Designs

Berlekamp-Massey decoding of RS code

: Error Correcting Codes. November 2017 Lecture 2

Transcription:

Information redundancy Information redundancy add information to date to tolerate faults error detecting codes error correcting codes data applications communication memory p. 2 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Code Code of length n is a set of n-tuples satisfying some well-defined set rules binary code uses only 0 and 1 symbols binary coded decimal (BCD) code uses 4 bits for each decimal digit 0000 0 0001 1 0010 2 1001 9 p. 3 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab of Code word Codeword is an element of the code satisfying the rules of the code Word is an n-tuple not satisfying the rules of the code Codewords should be a subset of all possible 2 n binary tuples to make error detection/correction possible BCD: 0110 valid; 1110 invalid any binary code: 2013 invalid The number of codewords in a code C is called the size of C p. 4 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Encoding/decoding encoding transform data into code word data encoding code word decoding recover data from code word code word decoding data p. 5 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Encoding/decoding 2 scenario if errors affect codeword: correct codeword another codeword correct codeword word p. 6 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Error detection We can define a code so that errors introduced in a codeword force it to lie outside the range of codewords basic principle of error detection p. 7 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Error detection all possible words code words p. 8 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Error correction We can define a code so that it is possible to determine the correct code word from the erroneous codeword basic principle of error correction p. 9 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Error correction all possible codewords code words p. 10 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Error detecting/correcting code Characterized by the number of bits that can be corrected double-bit detecting code can detect two single-bit errors single-bit correcting code can correct one single-bit error Hamming distance gives a measure of error detecting/correcting capabilities of a code p. 11 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Hamming distance Hamming distance is the number of bit positions in which two n-tuples differ x 0000 y 0101 δ (x,y) = 2 p. 12 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

3-dimensional space (3-bit words) 011 111 010 y z δ=1 110 001 101 000 xyz 100 x p. 13 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Error detection 010 011 111 110 If codewords are on distance 2, we can detect single-bit errors 001 101 000 100 p. 14 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Error correction 011 111 010 110 If codewords are on distance 3, we can correct single-bit errors 001 101 000 100 p. 15 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Code distance code distance is the minimum Hamming distance between any two distinct codewords C d = 2 code detects all single-bit errors code: 00, 11 invalid code words: 01 or 10 C d = 3 code corrects all single-bit errors code: 000, 111 invalid code words: 001, 010, 100, 101, 011, 110 p. 16 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Relation b/w code distance and capabilities of the code A code can correct up to c bit errors and detect up to d additional bit errors if and only if: 2c + d + 1 Cd p. 17 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Separable/non-separable code separable code codeword = data + check bits e.g. parity: 11011 = 1101 + 1 non-separable code codeword = data mixed with check bits e.g. cyclic: 1010001 -> 1101 decoding process is much easier for separable codes (remove check bits) p. 18 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Information rate The ratio k/n, where k is the number of data bits n is the number of data + check bits is called the information rate of the code Example: a code obtained by repeating data three times has the information rate 1/3 p. 19 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Next: Types of codes parity codes linear codes Hamming codes cyclic codes CRC codes Reed-Solomon codes unordered codes m-of-n codes Berger codes arithmetic codes AN-codes residue codes p. 20 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Single-bit parity code Add an extra bit to binary word so that that resulting code word has either even or odd number of 1s even parity: even # 1 odd parity: odd # 1 single bit error detection: C d = 2 separable code use: bus, memory, transmission, p. 21 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Organization of memory with singlebit parity code Parity Parity memory parity generator parity checker error Data in Data out extra HW required (parity generator, checker, extra memory) p. 22 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Parity generation and checking Data bits d0 d1 d2 d3 1 if odd d0 d1 d2 d3 Parity bit error if 1 p. 23 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Problem with single-bit parity code Multiple-bit errors (even number of bits) cannot be detected some of them are often very common failure of the individual memory chip p. 24 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Other parity codes The purpose is to provide additional error capability bit-per-word bit-per-byte bit-per-multiple-chips bit-per-chip interlaced overlapping p. 25 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Overlapping parity code (Hamming code) Overlapping parity for 4-bits of data - each data bit is assigned to multiple parity groups 3 2 1 0 P2 P1 P0 Bit in error Parity pattern 3 P2 P1 P0 2 P2 P1 1 P2 P0 0 P1 P0 P2 P2 P1 P1 P0 P0 no error p. 26 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Overlapping parity code (Hamming code) k data bits, c parity bits to have unique parity pattern per error: 2 c k+c+1 k c redundancy 2 3 150% 4 3 75% 8 4 50% 16 5 31% 32 6 19% 64 7 11% p. 27 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Background A field Z 2 is the set { 0,1} together with two operations of addition and multiplication (modulo 2) satisfying a given set of properties A vector space V n over a field Z 2 is a subset of Z 2n, with two operations of addition and multiplication (modulo 2) satisfying a given set of properties A subspace is a subset of a vector space which is itself a vector space A set of vectors {v 0,,v k-1 } is linearly independent if a 0 v 0 + a 1 v 1 + + a k-1 v k-1 = 0 implies a 0 = a 1 = = a k-1 = 0 p. 28 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Linear code: Definition A (n,k) linear code over the field Z 2 is a k- dimensional subspace of V n spanned by k linearly independent vectors any codeword c can be written as a linear combination of k basic vectors (v 0,,v k-1 ) as follows c = d 0 v 0 + d 1 v 1 + + d k-1 v k-1 (d 0,d 1,,d k-1 ) is the data to be encoded p. 29 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example: (4,2) linear code Data to be encoded are 2-bit words [00], [01], [10], [11] Suppose we select for a basis the vectors v 0 = [1000], v 1 = [0110] To find the codeword c = [c 0 c 1 c 2 c 3 ] corresponding to the data d = [d 0 d 2 ], we compute the linear combination of the basic vectors as c = d 0 v 0 + d 1 v 1 For example, data d = [11] is encoded to c = 1 [1000] + 1 [0110] = [1110] p. 30 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example (cont.) d = [00] is encoded to c = 0 [1000] + 0 [0110] = [0000] d = [01] is encoded to c = 0 [1000] + 1 [0110] = [0110] d = [10] is encoded to c = 1 [1000] + 0 [0110] = [1000] p. 31 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Generator matrix The rows of the generator matrix are the basis vectors v 0,,v k-1 For example, generator matrix for the previous example is G = 1 0 0 0 0 1 1 0 Codeword c is obtained by multiplying G by d c = d G p. 32 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: (6,3) linear code Construct the code spanned by the basic vectors [100011], [010110] and [001101] The generator matrix for this code is G = 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 For example, data d = [011] is encoded to c=0 [100011]+1 [010110]+1 [001101]=[011011] p. 33 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Parity check matrix To check for errors in a (n,k) linear code, we use an (n-k) n parity check matrix H of the code The parity check matrix is related to the generator matrix by the equation H G T = 0 where G T denotes the transponse of G This implies that, for any codeword c, the product of the parity check matrix and the encoded message should be zero H c T = 0 p. 34 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Constructing parity check matrix If a generator matrix is of the form G = [I k A], then the parity check matrix is of the form H = [A T I n-k ] p. 35 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example: (6,3) linear code If G is of the form G = Then H is of the form 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 H = 0 1 1 1 0 0 1 1 0 0 1 0 1 0 1 0 0 1 p. 36 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Syndrome Encoded data is checked for errors by multiplying it by the parity check matrix s = H c T The resulting (n-k)-bit vector is called syndrome If s = 0, no error has occurred If s matches one of the columns of H, a single-bit error has occurred. The bit position corresponds to the position of the matching column of H Otherwise, a multiple-bit error has occurred p. 37 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Constructing linear codes To be able to correct e errors, a code should have a distance of at least 2e+1 It is possible to ensure the code distance c by selecting the parity check matrix with c-1 linearly independent columns To have a code with code distance 2 (singleerror detecting), every column of H should be linearly independent, I.e. H shouldn t have a zero column p. 38 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: (4,2) linear code Parity check matrix for (4,2) linear code we have constructed before is H = 0 1 1 0 0 0 0 1 The first column is zero, therefore the columns of H are linearly dependent and code distance is 1 Let us construct a code with distance 2 p. 39 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example: (4,2) linear code, C d =2 Replace 1 st column by a column containing all 1 H = 1 1 1 0 = [A T I 2 ] 1 0 0 1 Now G can be constructed as G = [I 2 A] = 1 0 1 1 0 1 1 0 p. 40 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: (4,2) linear code, C d =2 The resulting code generated by G is data codeword d 1 d 2 c 1 c 2 c 3 c 4 0 0 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 1 1 1 0 1 p. 41 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Hamming codes Hamming codes are a family of linear codes An (n,k) Hamming code satisfies the property that the columns of its parity check matrix represent all possible non-zero vectors of length n-k Example: (7,4) Hamming code H = 1 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 1 p. 42 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Parity check matrix If the columns of H are permuted, the resulting code remains a Hamming code Example: different (7,4) Hamming code 0 0 0 1 1 1 1 H = 0 1 1 0 0 1 1 1 0 1 0 1 0 1 Such H is called lexicographic parity check matrix the corresponding code does not have a generator matrix in standard form G = [I 3 A] p. 43 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Decoding If the parity check matrix H is lexicographic, a simple procedure for syndrome decoding exists To check a codeword c for errors, calculate s = H c T If s = 0, no error has occurred If s 0, then it matches one of the columns of H, say i c is decoded assuming that a single-bit error has occurred in the i th bit of c p. 44 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: (7,4) Hamming code Construct Hamming code corresponding to parity check matrix 1 1 0 1 1 0 0 H = 1 0 1 1 0 1 0 = [A T I 3 ] 1 1 1 0 0 0 1 The corresponding G is G = [I 4 A] = 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 0 1 1 1 0 p. 45 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example (cont.) Suppose the data to be encoded is d = [1110] We multiply d by G to get c = [1110001] Suppose an error has occurred in the last bit of c c is transformed to [1110000] By multiplying [1110000] by H, we s = [001] s matches the last column of H the error has occurred in the last bit of the codeword We correct [1110000] to [1110001] and decode it to d = [1110] by taking the first 4 bits of data p. 46 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: (7,4) Hamming code, lexicographic Generator matrix corresponding to the lexicographic parity check matrix is G = 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 So, data d = [d 0 d 1 d 2 d 3 ] is encoded as c = [d 3 d 0 d 1 p 1 d 2 p 2 p 3 ] where p 1,p 2,p 3 are parity check bit defined by p 1 = d 0 + d 1 + d 2 p 2 = d 0 + d 2 + d 3 p 3 = d 1 + d 2 + d 3 p. 47 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Error correction If parity check matrix is lexicographic, the error correction can be implemented using a decoder and XOR gates The first level of XOR gates compares stored check bits with re-computed ones The result of the comparison in the syndrome [s 0 s 1 s 2 ], which is fed into the decoder For the syndrome s = i, i {0,1,,7}, i th output of the decoder is high The second level of XOR gates complements the i th bit of the word, thus correcting the error p. 48 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Code distance of Hamming codes The code distance of a Hamming code is 3, so it can correct single-bit error Often extended Hamming code is used, which can correct single-bit error and detect double-bit errors obtained by adding a parity check bit to every codeword of a Hamming code if c = [c 1 c 2 c n ] is a codeword of a Hamming code, c = [c 0 c 1 c 2 c n ] is the corresponding extended codeword, where c 0 is the parity bit p. 49 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Extended Hamming code The parity check matrix of an extended (n,k) Hamming code is obtained as follows add a zero column in front of a lexicographic parity check matrix of an (n,k) Hamming code attach a row consisting of all 1 s as n-k+1 th row of the resulting matrix Example: Extended (1,1) Hamming code H = 0 1 1 1 p. 50 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Cyclic codes Cyclic codes are special class of linear codes Used in applications where burst errors can occur a group of adjacent bits is affected digital communication, storage devices (disks, CDs) Important classes of cyclic codes: Cyclic redundancy check (CRC) used in modems and network protocols Reed-Solomon code used in CD and DVD players p. 51 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Cyclic code: Definition A linear code is called cyclic if any end-around shift of codeword produces another codeword if [c 0 c 1 c 2 c n-2 c n-1 ] is a codeword, then [c n-1 c 0 c 1 c 2 c n-2 ], is a codeword, too it is convenient to think of words as polynomials rather than vectors for example, a codeword [c 0 c 1 c n-1 ] is represented as a polynomial c 0 x 0 + c 1 x 1 + + c n-1 x n -1 p. 52 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Polynomials Since the code is binary, the coefficients are 0 and 1 For example, d(x) = 1 x 0 +0 x 1 +1 x 2 +1 x 3 represents the data (1011) We always write least significant digit on the left p. 53 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Polynomials The degree of a polynomial equals to its highest exponent e.g. the degree of 1+ x 1 + x 3 is 3 a cyclic code with the generator polynomial of degree (n-k) detects all burst errors affecting (n-k) bits or less n is the number of bits in codeword k is the number of bits in data word p. 54 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Encoding/decoding d(x) Encode c(x)=d(x) g(x) transmit Decode/Correct d(x)=c(x)/g(x) d(x) p. 55 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Encoding Multiply data polynomial by generator polynomial: c(x) = d(x).g(x) Calculations are performed in Galois Field GF(2): multiplication modulo 2 = AND operation addition modulo 2 = XOR operation in GF(2), subtraction = addition p. 56 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Properties of generator polynomial g(x) is the generator polynomial for a linear cyclic code of length n if and only if g(x) divides 1+x n without a reminder p. 57 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example of polymomial multiplication (1) d(x) = (1011) = x 3 + x 2 + 1 g(x) = x 3 + x + 1 k = 4 c(x) = d(x).g(x) = (x 3 + x 2 + 1).(x 3 + x + 1) = x 6 + x 4 + x 3 + x 5 + x 3 + x 2 + x 3 + x + 1 = x 6 + x 5 + x 4 + x 3 + x 2 + x 1 + 1 = (1111111) n = 7 p. 58 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example of polynomial multiplication (2) d(x) = (1010) = x 2 + 1 g(x) = x 3 + x + 1 k = 4 c(x) = d(x).g(x) = (x 3 + x + 1).(x 2 + 1) = x 5 + x 3 + x 3 + x + x 2 + 1 = x 5 + x 2 + x + 1 = (1110010) n = 7 p. 59 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example: (7,4) cyclic code Find a generator polynomial for a code of length n=7 for encoding of data of length k=4 g(x) should be of a degree 7-4=3 and should divide 1+x 7 without a reminder 1+x 7 can be factored as 1+x 7 = (1+x+x 3 )(1+x 2 +x 3 )(1+x) so, we can choose for g(x) either 1+x+x 3 or 1+x 2 +x 3 p. 60 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Parity check polynomial For a cyclic code with the generator polynomial g(x), the check polynomial h(x) is determined by g(x) h(x) = 1+x n Since codewords are multiples of g(x), for every codeword c(x), it is hold that c(x) h(x) = 0 mod 1+x n p. 61 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Decoding Divide received polynomial c(x) by the generator polynomial g(x): d(x) = c(x)/g(x) Division is the polynomial division in GF(2) The reminder from the division is syndrome s(x) if s(x) is zero, no error has occurred p. 62 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example of polynomial division (1) x 6 + x 5 + x 4 + x 3 + x 2 + x + 1 x 3 + x + 1 x 6 + x 4 + x 3 x 5 + x 2 + x + 1 x 5 + x 3 + x 2 x 3 + x + 1 x 3 + x + 1 0 p. 63 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab x 3 + x 2 + 1 Example of polynomial division (2) x 8 + x 5 + x 4 + x 2 + 1 x 3 + x + 1 x 8 + x 6 + x 5 x 6 + x 4 + x 2 + 1 x 6 + x 4 + x 3 x 3 + x 2 + 1 x 3 + x + 1 x 2 + x p. 64 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab x 5 + x 3 + 1

Decoding (no error) if no error occurred, then the received codeword is the correct codeword c(x) therefore, d(x) = c(x)/g(x) p. 65 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Decoding in presence of error Suppose an error has occurred, then c received (x) = c(x) + e(x), e(x) - error polynomial d received (x) = (c(x) + e(x))/g(x) Unless e(x) is a multiple of g(x), the received codeword will not be evenly dividable by g(x) p. 66 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Decoding/detecting process We detect errors by checking whether c received (x) is evenly dividable by g(x) If yes, we assume that there is no error and d received (x) = d(x) If there is a reminder, we assume that there is an error p. 67 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Undetectable errors However, if e(x) is a multiple of g(x), the reminder of e(x)/g(x) is 0 and the error will not be detected p. 68 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example of error detection d(x) = (1011) = x 3 + x 2 + 1 g(x) = x 3 + x + 1 c(x) = d(x).g(x) = x 6 + x 5 + x 4 + x 3 + x 2 + x + 1 Let e(x) = x 3 +1, then c received = x 6 + x 5 + x 4 + x 2 + x c received(x) /g(x) = (x 3 + x 2 ) + x/(x 3 + x + 1) Reminder is not 0, so the error is detected p. 69 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab HW for encoding/decoding of cyclic codes Encoding and decoding is done using linear feedback shift registers (LFSRs) LFSR implements polynomial division by generator polynomial g(x) p. 70 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

LSFR Linear feedback shift register consists of: register cells s o, s 1,, s r-1, where r = n-k is the degree of g(x) XOR-gates between the cells feedback connections to XOR, with weights clock p. 71 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab LFSR Weights g i are the coefficients of the generator polynomial g(x)=g 0 +g 1 x 1 + + g r x r g i =0 means no connection g i =1 means connection g r is always connected c(x) s 0 s 1 s r-1 + + + + d(x) g 0 g 1 g 2 g r-1 g r p. 72 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

LFSR for g(x)=1+x+x 3 Example c(x) + + s 0 s 1 s 2 d(x) g 0 g 1 g 3 s 0+ =s 2 +c(x) s 1+ =s 0 + s 2 s 2+ =s 1 p. 73 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example: decoding, no error Suppose the word to decode is [1010001], i.e c(x) = 1 + x 2 + x 6. Most significant bit is fed first. c(x) s 0 s 1 s 2 d(x) t 0 0 0 0 t 1 1 1 0 0 0 t 2 0 0 1 0 0 t 3 0 0 0 1 0 t 4 0 1 1 0 1 t 5 1 1 1 1 0 t 6 0 1 0 1 1 t 7 1 0 0 0 1 s 0+ = s 2 +c(x) s 1+ = s 0 + s 2 s 2+ = s 1 d(x) = 1 + x + x 3. Most significant bit comes out first. p. 74 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: decoding, with error Suppose an error has occurred in the 4 th bit, i.e. we received [1011001] instead of [1010001]. c(x) s 0 s 1 s 2 d(x) t 0 0 0 0 t 1 1 1 0 0 0 t 2 0 0 1 0 0 t 3 0 0 0 1 0 t 4 1 0 1 0 1 t 5 1 1 0 1 0 t 6 0 1 0 0 1 t 7 1 1 1 0 0 s 0+ = s 2 +c(x) s 1+ = s 0 + s 2 s 2+ = s 1 The syndrome [110] matches the 4 th column of the check matrix H. p. 75 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Encoding for separable cyclic codes Division can be used for encoding of a separable (n,k) cyclic code shift data by n-k positions, i.e. multiply d(x) by x n-k use LFSR to divide d(x) x n-k by g(x). The reminder r(x) is contained in the register append the check bits r(x) to the data by adding r(x) to d(x) x n-k : c(x) = d(x) x n-k + r(x) p. 76 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: encoding for (7,4) code Let d(x) = x+x 3 and g(x)=1+x+x 3 n=7, k=4 shift data by n-k=3 positions: d(x) x 3 = (x+x 3 )x 3 = x 4 +x 6 divide d(x) x n-k by g(x) to compute the r(x) x 4 +x 6 = (1+x 3 )(1+x+x 3 )+(1+x) c(x) = d(x) x n-k + r(x) c(x) = 1+x+x 4 +x 6 p. 77 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab CRC codes Cyclic Redundancy Check (CRC) codes are separable codes with specific generator polynomials, chose to provide high error detection capability for data transmission and storage Common generator polynomials are: CRC-16: 1 + x 2 + x 15 + x 16 CRC-CCITT: 1 + x 5 + x 12 + x 16 CRC-32: 1 + x + x 2 + x 4 + x 7 + x 8 + x 10 + x 11 + x 12 + x 16 + x 22 + x 23 + x 26 + x 32 p. 78 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

CRC codes CRC-16 and CRC-CCITT are widely used in modems and network protocols in the USA and Europe, respectively, and give adequate protection for most applications the number of non-zero terms in their polynomials is small (just four) LFSR required to implement encoding and decoding is simpler Applications that need extra protection, e.g. DD, use CRC-32 p. 79 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Encoding/decoding The encoding and decoding is done either in software, or in hardware using the usual procedure for separable cyclic codes To encode: shift data polynomial right by deg(g(x)) bit position divided it by the generator polynomial the coefficients of the remainder form the check bits of the CRC codeword p. 80 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Encoding/decoding The number check bits equals to the degree of the generator polynomial an CRC detects all burst error of length less or equal than deg(g(x)) CRC also detects many errors which are larger than deg(g(x)) apart from detecting all burst errors of length 16 or less, CRC-16 and CRC-CCITT are also capable to detect 99.997% of burst errors of length 17 and 99.985% burst errors of length 18 p. 81 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Reed-Solomon codes Reed-Solomon (RS) codes are a class of separable cyclic codes used to correct errors in a wide range of applications including storage devices (tapes, compact disks, DVDs, bar-codes), wireless communication (cellular telephones, microwave links), satellite communication, digital television, high-speed modems (ADSL, xdsl). p. 82 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Reed-Solomon codes The encoding for Reed-Solomon code is done the using the usual procedure codeword is computed by shifting the data right n-k positions, dividing it by the generator polynomial and then adding the obtained reminder to the shifted data A key difference is that groups of m bits rather than individual bits are used as symbols of the code. usually m = 8, i.e. a byte. the theory behind is a field Z m 2 of degree m over {0,1} p. 83 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Encoding An encoder for an RS code takes k data symbols of s bits each and computes a codeword containing n symbols of m bits each A Reed-Solomon code can correct up to nk /2 symbols that contain errors p. 84 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Example: RS(255,223) code A popular Reed-Solomon code is RS(255,223) symbols are a byte (8-bit) long each codeword contains 255 bytes, of which 223 bytes are data and 32 bytes are check symbols n = 255, k = 223, this code can correct up to 16 bytes containing errors each of these 16 bytes can have multiple bit errors. p. 85 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Decoding Decoding of Reed-Solomon codes is performed using an algorithm designed by Berlekamp popularity of RS codes is due to efficiency this algorithm to a large extent. This algorithm was used by Voyager II for transmitting pictures of the outer space back to Earth Basis for decoding CD in players p. 86 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Summary of cyclic codes Any end-around shift of a codeword produce another codeword code is characterized by its generator polynomial g(x), with a degree (n-k), n = bits in codeword, k = bits in data word detect all single errors and all multiple adjacent error affecting (n-k) bits or less p. 87 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Unordered codes Designed to detect unidirectional errors An error is unidirectional if all affected bits are changed to either 0 1 or 1 0, but not both Example: correct codeword: 010101 same codeword with unidirectional errors: 110101 000101 111101 000001 111111 000000 p. 88 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Unidirectional error detection Theorem: A code C detects all unidirectional errors if and only if every pair of codewords in C is unordered two binary n-tuples x and y are ordered if either x i y i or x i y i for all i {1,2,...,n} Examples of ordered codewords: 0110 < 0111 < 1111 0110 > 0100 > 0000 p. 89 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Unidirectional error detection A unidirectional error always changes a word x to a word y which is either smaller or greater than x A unidirectional error cannot change x to a word which is not ordered with x Therefore, if any pair of codewords are unordered, a unidirectional error will never transform a codeword to another codeword p. 90 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

m-of-n code Code words are n bits in length and contain exactly m 1 s Cd = 2, detect single-bit errors detects all unidirectional errors (+) simple to understand (-) if non-separable, encoding and decoding is difficult to organize p. 91 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab k-of-2k code Take the original k bits of information and append k bits so that the resulting 2k-bit word has exactly k 1s (-) 100% redundancy (+) separable code, so encoding and decoding are easy to organize data 3-of-6 code 000 000 111 001 001 110 010 010 101 111 111 000 p. 92 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Berger code Append c check bits to k data bits separable code c = log 2 (k+1) how to create code word: count number of 1 s in k data bits complement resulting binary number and append it to the data bits p. 93 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Example of Berger codeword data = (0111010), k = 7 c = log 2 (7+1) = 3 number of 1 s in (0111010) is 4 = (100) complement of (100) is (011) resulting codeword is (0111010011) p. 94 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Berger code capability Berger code detects all unidirectional errors for the error detection capability it provides, the Berger code uses the fewest number of check bits of the available separable unordered codes p. 95 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Arithmetic codes For checking arithmetic operations before the operation, data is encoded after the operation, code words are checked Arithmetic code is the invariant to * if: A(b*c) = A(b) * A(c) b, c - operands A(b), A(c), A(b*c) - codes for b, c and b*c p. 96 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Examples of arithmetic codes Two common types of arithmetic codes are AN codes residue codes p. 97 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab AN code AN code is formed by multiplying each data word N by some constant A AN codes are invariant to addition (and subtraction): A(b + c) = A(b) + A(c) If no error occurred, A(b+c) is evenly divisible by A p. 98 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Adder protected by 3N code 3N code for b 3N code for a b 5 b 4 b 3 b 2 b 1 b 0 a 5 a 4 a 3 a 2 a 1 a 0 6-bit adder s 5 s 4 s 3 s 2 s 1 s 0 3N code for sum = a+b Original data are 4-bit long. By multiplying them by 3, we obtain code words (6-bit long) d a ta c o d e w o rd 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 0 1 p. 99 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Addition using 3N code - fault-free Normal operation: + a = 0 1 0 0 1 0 (3N code of 6) b = 0 0 0 0 1 1 (3N code of 1) s = 0 1 0 1 0 1 (3N code of 7) p. 100 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Addition using 3N code - with faults + a = 0 1 0 0 1 0 (3N code of 6) b = 0 0 0 0 1 1 (3N code of 1) s = 0 1 0 1 1 1 (23 is not evenly divisible by 3 i.e. not a valid code word) If s 1 is stuck to 1 : p. 101 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Selecting the value of A For binary codes, the constant A shouldn t be a power of two otherwise multiplication by A results a left shift of the original data error in a single bit yields a codeword evenly divisible by A (valid), so it will not be detected 3N code is easy to encode using n+1 bit adder: create 2N by shift and add N to it p. 102 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Residue codes Residue codes are created by computing a residue for data and appending it to the data The residue is generate by dividing a data by a integer, called modulus. Decoding is done by simply removing the residue p. 103 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab Residue codes Residue codes are invariants with respect to addition, since (b + c) mod m = b mod m + c mod m where b and c are data words and m is modulus This allows us to handle residues separately from data during addition process. Value of the modulus determines the information rate and the error detection capability of the code p. 104 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab

Time redundancy Next lecture Read chapter 6 of the text book p. 105 - Design of Fault Tolerant Systems - Elena Dubrova, ESDlab