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

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

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

EECS150 - Digital Design Lecture 21 - Design Blocks

Linear Feedback Shift Registers (LFSRs) 4-bit LFSR

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

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

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

EECS150 - Digital Design Lecture 26 Faults and Error Correction. Recap

EECS150 - Digital Design Lecture 27 - misc2

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

Information redundancy

Error Detection & Correction

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

ECE 4450:427/527 - Computer Networks Spring 2017

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

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

Error Correction and Trellis Coding

Cryptography Lecture 3. Pseudorandom generators LFSRs

Cyclic Redundancy Check Codes

ELCT201: DIGITAL LOGIC DESIGN

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

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

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec 09 Counters Outline.

Logic BIST. Sungho Kang Yonsei University

Maximum Length Linear Feedback Shift Registers

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

GF(2 m ) arithmetic: summary

EECS150 - Digital Design Lecture 23 - FSMs & Counters

VHDL Implementation of Reed Solomon Improved Encoding Algorithm

L9: Galois Fields. Reading material

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

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

Lecture 12. Block Diagram

Chapter 4 Mathematics of Cryptography

PSEUDORANDOM BINARY SEQUENCES GENERATOR

FPGA BASED DESIGN OF PARALLEL CRC GENERATION FOR HIGH SPEED APPLICATION

Fields in Cryptography. Çetin Kaya Koç Winter / 30

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

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

Modular numbers and Error Correcting Codes. Introduction. Modular Arithmetic.

Unit 1 - Digital System Design

ECE 512 Digital System Testing and Design for Testability. Model Solutions for Assignment #3

1 Introduction. 2 Calculation of the output signal

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

Cyclic codes: overview

Information Redundancy: Coding

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

Department of Electrical and Computer Engineering University of Wisconsin Madison. Fall Final Examination

Some math for embedded algorithms

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

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

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

Shift Register Counters

Physical Layer and Coding

DRAM Reliability: Parity, ECC, Chipkill, Scrubbing. Alpha Particle or Cosmic Ray. electron-hole pairs. silicon. DRAM Memory System: Lecture 13

Fault Tolerance & Reliability CDA Chapter 2 Cyclic Polynomial Codes

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

ECS455: Chapter 4 Multiple Access

Design and Implementation of High Speed CRC Generators

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

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

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

Multimedia Systems WS 2010/2011

Chapter 6. BCH Codes

Lecture 14. Outline. 1. Finish Polynomials and Secrets. 2. Finite Fields: Abstract Algebra 3. Erasure Coding

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec09 Counters Outline.

Coping with disk crashes

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

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)

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek

EECS150 - Digital Design Lecture 16 Counters. Announcements

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

ELCT201: DIGITAL LOGIC DESIGN

CSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function

FPGA accelerated multipliers over binary composite fields constructed via low hamming weight irreducible polynomials

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

Dual-Field Arithmetic Unit for GF(p) and GF(2 m ) *

Chapter 7. Sequential Circuits Registers, Counters, RAM

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Galois Field Algebra and RAID6. By David Jacob

ELCT201: DIGITAL LOGIC DESIGN

Formal Verification of the CRC Algorithm Properties

Lecture 17: Designing Sequential Systems Using Flip Flops

Topics in Computer Mathematics

Error Control Codes for Memories

Lecture 10 - MAC s continued, hash & MAC

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

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

NUMBERS AND CODES CHAPTER Numbers

A VLSI Algorithm for Modular Multiplication/Division

And for polynomials with coefficients in F 2 = Z/2 Euclidean algorithm for gcd s Concept of equality mod M(x) Extended Euclid for inverses mod M(x)

EECS 270 Midterm Exam 2 Fall 2009

COE 202: Digital Logic Design Sequential Circuits Part 4. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

VLSI Physical Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

New Implementations of the WG Stream Cipher

Exam for Physics 4051, October 31, 2008

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

Sequential Circuits Sequential circuits combinational circuits state gate delay

Transcription:

EECS150 - igital esign Lecture 26 Error Correction Codes, Linear Feedback Shift Registers (LFSRs) Nov 21, 2002 John Wawrzynek Fall 2002 EECS150 Lec26-ECC Page 1 Outline Error detection using parity Hamming code for error detection/correction Linear Feedback Shift Registers Theory and practice Fall 2002 EECS150 Lec26-ECC Page 2

Error Correction Codes (ECC) Memory systems generate errors (accidentally fliped-bits) RAMs store very little charge per bit Soft errors occur occasionally when cells are struck by alpha particles or other environmental upsets. Less frequently, hard errors can occur when chips permanently fail. Where perfect memory is required servers, spacecraft/military computers, Memories are protected against failures with ECCs Extra bits are added to each data-word extra bits are used to detect and/or correct faults in the memory system in general, each possible data word value is mapped to a unique code word. A fault changes a valid code word to an invalid one - which can be detected. Fall 2002 EECS150 Lec26-ECC Page 3 Simple Error etection Coding Parity Bit Each data value, before it is written to memory is tagged with an extra bit to force the stored word to have even parity: b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 p Each word, as it is read from memory is checked by finding its parity (including the parity bit). b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 p + c A non-zero parity indicates an error occurred: two errors (on different bits) is not detected (nor any even number of errors) odd numbers of errors are detected. Fall 2002 EECS150 Lec26-ECC Page 4 +

Hamming Error Correcting Code Use more parity bits to pinpoint bit(s) in error, so they can be corrected. Example: Single error correction (SEC) on 4-bit data use 3 parity bits, with 4-data bits results in 7-bit code word 3 parity bits sufficient to identify any one of 7 code word bits overlap the assignment of parity bits so that a single error in the 7-bit work can be corrected Group parity bits so they correspond to subsets of the 7 bits: p 1 protects bits 1,3,5,7 p 2 protects bits 2,3,6,7 p 3 protects bits 4,5,6,7 1 2 3 4 5 6 7 p 1 p 2 d 1 p 3 d 2 d 3 d 4 Bit position number 001 = 1 10 011 = 3 10 p 101 = 5 1 10 111 = 7 10 010 = 2 10 011 = 3 10 p 110 = 6 2 10 111 = 7 10 100 = 4 10 101 = 5 10 110 = 6 p 10 3 111 = 7 10 Fall 2002 EECS150 Lec26-ECC Page 5 1 2 3 4 5 6 7 p 1 p 2 d 1 p 3 d 2 d 3 d 4 Hamming Code Example Note: parity bits occupy power-oftwo bit positions in code-word. On writing to memory: parity bits are assigned to force even parity over their respective groups. On reading from memory: check bits (c 3,c 2,c 1 ) are generated by finding the parity of the group and its parity bit. If an error occurred in a group, the corresponding check bit will be 1, if no error the check bit will be 0. check bits (c 3,c 2,c 1 ) form the position of the bit in error. Example: c = c 3 c 2 c 1 = 101 error in 4,5,6, or 7 (by c 3 =1) error in 1,3,5, or 7 (by c 1 =1) no error in 2, 3, 6, or 7 (by c 2 =0) Therefore error must be in bit 5. Note the check bits point to 5 By our clever positioning and assignment of parity bits, the check bits always address the position of the error! c=000 indicates no error Fall 2002 EECS150 Lec26-ECC Page 6

Hamming Error Correcting Code Overhead involved in single error correction code: let p be the total number of parity bits and d the number of data bits in a p + d bit word. If p error correction bits are to point to the error bit (p + d cases) plus indicate that no error exists (1 case), we need: 2 p >= p + d + 1, thus p >= log(p + d + 1) for large d, p approaches log(d) Adding on extra parity bit covering the entire word can provide double error detection 1 2 3 4 5 6 7 8 p 1 p 2 d 1 p 3 d 2 d 3 d 4 p 4 On reading the C bits are computed (as usual) plus the parity over the entire word, P: C=0 P=0, no error C!=0 P=1, correctable single error C!=0 P=0, a double error occurred C=0 P=1, an error occurred in p 4 bit Typical modern codes in RAM memory systems: 64-bit data blocks (8 bytes) with 72-bit code words (9 bytes). Fall 2002 EECS150 Lec26-ECC Page 7 Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple shift-registers with a small number of xor gates. Used for: pseudo-random number generation counters error checking and correction Advantages: very little hardware high speed operation Example 4-bit LFSR: 4 3 2 1 Fall 2002 EECS150 Lec26-ECC Page 8

4-bit LFSR 4 3 2 1 0001 0010 0100 Circuit counts through 2 4-1 different 0 0 0 1 0 1000 non-zero bit patterns. 0011 Leftmost bit decides whether the 0 0 0 1 0 0 0110 10011 xor pattern is used to 1100 compute the next value or if the 0 0 1 0 0 0 1011 register just shifts left. 0101 0 1 0 0 0 0 Can build a similar circuit with any 1010 xor 1 0 0 1 1 number of FFs, may need more xor 0111 0 0 0 1 1 0 gates. 1110 In general, with n flip-flops, 2 n -1 0 0 1 1 0 0 1111 different non-zero bit patterns. 1101 0 1 1 0 0 0 1001 4 3 2 1 (Intuitively, this is a counter that xor 1 0 0 1 1 0001 wraps around many times and in a 0 1 0 1 1 strange way.) Fall 2002 EECS150 Lec26-ECC Page 9 Applications of LFSRs Performance: In general, xors are only ever 2-input and never connect in series. Therefore the minimum clock period for these circuits is: T > T 2-input-xor + clock overhead Very little latency, and independent of n! This can be used as a fast counter, if the particular sequence of count values is not important. Example: micro-code micro-pc Can be used as a random number generator. Sequence is a pseudorandom sequence: numbers appear in a random sequence repeats every 2 n -1 patterns Random numbers useful in: computer graphics cryptography automatic testing Used for error detection and correction CRC (cyclic redundancy codes) ethernet uses them Fall 2002 EECS150 Lec26-ECC Page 10

Galois Fields - The theory behind LFSRs LFSR circuits performs multiplication on a field. A field is defined as a set with the following: two operations defined on it: addition and multiplication closed under these operations associative and distributive laws hold additive and multiplicative identity elements additive inverse for every element multiplicative inverse for every non-zero element Example fields: set of rational numbers set of real numbers set of integers is not a field Finite fields are called Galois fields. Example: Binary numbers 0,1 with XOR as addition and AN as multiplication. Called GF(2). Fall 2002 EECS150 Lec26-ECC Page 11 Galois Fields - The theory behind LFSRs Consider polynomials whose coefficients come from GF(2). Each term of the form x n is either present or absent. Examples: 0, 1, x, x 2, and x 7 + x 6 + 1 With addition and multiplication these form a field: Add : XOR each element individually with no carry: x 4 + x 3 + + x + 1 + x 4 + + x 2 + x x 3 + x 2 + 1 Multiply : multiplying by x n is like shifting to the left. x 2 + x + 1 x + 1 x 2 + x + 1 x 3 + x 2 + x x 3 + 1 Fall 2002 EECS150 Lec26-ECC Page 12

Galois Fields - The theory behind LFSRs These polynomials form a Galois (finite) field if we take the results of this multiplication modulo a prime polynomial p(x). A prime polynomial is one that cannot be written as the product of two non-trivial polynomials q(x)r(x) Perform modulo operation by subtracting a (polynomial) multiple of p(x) from the result. If the multiple is 1 this corresponds to XOR-ing the result with p(x). For any degree, there exists at least one prime polynomial. With it we can form GF(2 n ) Additionally, Every Galois field has a primitive element, α, such that all non-zero elements of the field can be expressed as a power of α. By raising α to powers (modulo p(x)), all non-zero field elements can be formed. Certain choices of p(x) make the simple polynomial x the primitive element. These polynomials are called primitive, and one exists for every degree. For example, x 4 + x + 1 is primitive. So α = x is a primitive element and successive powers of α will generate all non-zero elements of GF(16). Example on next slide. Fall 2002 EECS150 Lec26-ECC Page 13 Galois Fields - The theory behind LFSRs α 0 = 1 α 1 = x α 2 = x 2 α 3 = x 3 α 4 = x + 1 α 5 = x 2 + x α 6 = x 3 + x 2 α 7 = x 3 + x + 1 α 8 = x 2 + 1 α 9 = x 3 + x α 10 = x 2 + x + 1 α 11 = x 3 + x 2 + x α 12 = x 3 + x 2 + x + 1 α 13 = x 3 + x 2 + 1 α 14 = x 3 + 1 α 15 = 1 Note this pattern of coefficients matches the bits from our 4-bit LFSR example. α 4 = x 4 mod x 4 + x + 1 = x 4 xor x 4 + x + 1 = x + 1 In general finding primitive polynomials is difficult. Most people just look them up in a table, such as: Fall 2002 EECS150 Lec26-ECC Page 14

x 2 + x +1 x 3 + x +1 x 4 + x +1 x 5 + x 2 +1 x 6 + x +1 x 7 + x 3 +1 x 8 + x 4 + x 3 + x 2 +1 x 9 + x 4 +1 x 10 + x 3 +1 x 11 + x 2 +1 Primitive Polynomials x 12 + x 6 + x 4 + x +1 x 13 + x 4 + x 3 + x +1 x 14 + x 10 + x 6 + x +1 x 15 + x +1 x 16 + x 12 + x 3 + x +1 x 17 + x 3 + 1 x 18 + x 7 + 1 x 19 + x 5 + x 2 + x+ 1 x 20 + x 3 + 1 x 21 + x 2 + 1 x 22 + x +1 x 23 + x 5 +1 x 24 + x 7 + x 2 + x +1 x 25 + x 3 +1 x 26 + x 6 + x 2 + x +1 x 27 + x 5 + x 2 + x +1 x 28 + x 3 + 1 x 29 + x +1 x 30 + x 6 + x 4 + x +1 x 31 + x 3 + 1 x 32 + x 7 + x 6 + x 2 +1 Galois Field Hardware Multiplication by x shift left Taking the result mod p(x) XOR-ing with the coefficients of p(x) when the most significant coefficient is 1. Obtaining all 2 n -1 non-zero Shifting and XOR-ing 2 n -1 times. elements by evaluating x k for k = 1,, 2 n -1 Fall 2002 EECS150 Lec26-ECC Page 15 Building an LFSR from a Primitive Polynomial For k-bit LFSR number the flip-flops with FF1 on the right. The feedback path comes from the output of the leftmost FF. Find the primitive polynomial of the form x k + + 1. The x 0 = 1 term corresponds to connecting the feedback directly to the input of FF 1. Each term of the form x n corresponds to connecting an xor between FF n and n+1. 4-bit example, uses x 4 + x + 1 x 4 FF4 s output x xor between FF1 and FF2 1 FF1 s input 4 3 2 1 To build an 8-bit LFSR, use the primitive polynomial x 8 + x 4 + x 3 + x 2 + 1 and connect xors between FF2 and FF3, FF3 and FF4, and FF4 and FF5. 8 7 6 5 4 3 2 1 Fall 2002 EECS150 Lec26-ECC Page 16

Error Correction with LFSRs 11 message bits 4 check bits bit sequence: 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 1 xor 1 0 0 1 1 0 1 0 1 0 0 xor 1 0 0 1 1 0 0 1 1 1 4 3... 1 0 1 0 2 1 serial_in Fall 2002 EECS150 Lec26-ECC Page 17 Error Correction with LFSRs XOR 4 with incoming bit sequence. Now values of shift-register don t follow a fixed pattern. ependent on input sequence. Look at the value of the register after 15 cycles: 1010 Note the length of the input sequence is 2 4-1 = 15 (same as the number of different nonzero patters for the original LFSR) Binary message occupies only 11 bits, the remaining 4 bits are 0000. They would be replaced by the final result of our LFSR: 1010 If we run the sequence back through the LFSR with the replaced bits, we would get 0000 for the final result. 4 parity bits, neutralize the sequence with respect to the LFSR. 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 If parity bits not all zero, an error occurred in transmission. If number of parity bits = log total number of bits, then single bit errors can be corrected. Using more parity bits allows more errors to be detected. Ethernet uses 32 parity bits per frame (packet) with 16-bit LFSR. Fall 2002 EECS150 Lec26-ECC Page 18