VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd,...

16
VLSI AND INTELLIGENT SYTEMS LABORATORY VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error 12 Bit Hamming Code Error Detector/Corrector Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering Florida International University Students: Ahmed Hadad Edward Lule Jaime Montenegro Major Professor: Dr. Subbarao V. Wunnava

Transcript of VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd,...

Page 1: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

VLSI AND INTELLIGENT SYTEMS VLSI AND INTELLIGENT SYTEMS LABORATORYLABORATORY

12 Bit Hamming Code Error12 Bit Hamming Code Error

Detector/CorrectorDetector/Corrector

December 2nd, 2003Department of Electrical and Computer Engineering

Florida International University

Students:Ahmed HadadEdward LuleJaime Montenegro

Major Professor:Dr. Subbarao V. Wunnava

Page 2: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

2

Hamming Code

Richard Hamming created a binary code that will correct any single error and will detect any double error (two separate errors).

The Hamming code has been used for computer RAM, and is a good choice for randomly occurring errors.

The code uses extra redundant bits to check for errors, and performs the checks with special check equations.

A parity check equation of a sequence of bits just adds the bits of the sequence and insists that the sum be even (for even parity) or odd (for odd parity).

Page 3: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

3

Hamming Code

For even parity, a simple parity check will detect if there has been an error in one bit position, since even parity will change to odd parity.

One has to force even parity by adding an extra parity bit and setting it either to 1 or to 0 to make the overall parity come out even.

The Hamming code uses parity checks over a portion of the positions in a block. Suppose there are bits in consecutive positions from 1 to n-1.

The positions whose position number is a power of 2 are used as check bits. Thus the check bits are in positions 1, 2, 4, 8, 16, ..., up to the largest power of 2 that is less than or equal to the largest bit position.

Page 4: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

4

Hamming Code

Each check bit has a corresponding check equation that covers a portion of all the bits, but always includes the check bit itself.

Page 5: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

5

Hamming Code

The table below assumes data bits values 1101101 (in black below). The check equations are employed to determine values for check bits in positions 1, 2, 4, and 8, to yield the word 11101010101 below, with check bits in red here and below.

Page 6: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

6

Hamming Code

The following table gives the result of a single error in the decimal position 11 (changed from a 1 to a 0). Three of the four parity checks fail. Adding the decimal position number of each failing check gives the position number of the error bit, decimal 11 in this case.

Page 7: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

7

Hamming Code

For this project, we decided to implement the correction of a bit on 8 bits of data.

In order to accomplish the goal of checking 8 bits of data, it is necessary to add another 4 bits of parity check to perform the Hamming code.

Therefore, the total input length of our error detector is 12 bits (Stage 1).

Once the device has performed the checking and correcting of the bits, it will output the 8 data bits (Stage 2).

Page 8: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

8

HammingDetector/Corrector(stage 1)

input_1input_3

input_5

input_7

input_9input_11

8 x 1MUX

c0 c1 c2

Q

QSET

CLR

D P

correct1

input_2input_3

input_6

input_7

input_10input_11

8 x 1MUX

c0 c1 c2

Q

QSET

CLR

D P

correct2

A

A

input_4input_5

input_6

input_7

input_12

8 x 1MUX

c0 c1 c2

Q

QSET

CLR

D P

correct3

A

input_8input_9

input_10

input_11

input_12

8 x 1MUX

c0 c1 c2

Q

QSET

CLR

D P

correct4

A

SP

3 bitCounterSP

A c0c1c2

CLKSTAGE2 STAGE2

Page 9: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

9

HammingDetector/Corrector(stage 2)

Q

QSET

CLR

DI1

Q

QSET

CLR

DI2

Q

QSET

CLR

DI3

Q

QSET

CLR

DI4

Q

QSET

CLR

DI5

Q

QSET

CLR

DI6

Q

QSET

CLR

DI7

Q

QSET

CLR

DI8

Q

QSET

CLR

DI9

Q

QSET

CLR

DI10

Q

QSET

CLR

DI11

Q

QSET

CLR

DI12

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

correct1correct2

correct3correct4

O1

O2

O3

O4

O5

O6

O7

O8

STAGE2

Page 10: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

10

Hamming Detector/Corrector (Leonardo Spectrum)

Page 11: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

11

ResultsTest 1:Original 8 bit input word: 00001101Encoded word with parity ‘1’: 0000111011011Received encoded word: 0000111011011 (No errors)Output word: 00001101

Page 12: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

12

ResultsTest 2:Original 8 bit input word: 00001101Encoded word with parity ‘1’: 0000111011011Received encoded word: 0010111011011 (One error, bit 10)Error flag output signal is asserted.Error is corrected and its position is given in output error_pos: 1010Output word: 00001101

Page 13: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

13

ResultsTest 3:Original 8 bit input word: 00001101Encoded word with parity ‘1’: 0000111011011Received encoded word: 1010111011011 (Two errors, bits 10 and 12)Repeat word output signal and Error flag output signal are asserted.No output.

Page 14: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

14

ResultsTest 4:Original 8 bit input word: 01001101Encoded word with parity ‘0’: 0100111001010Received encoded word with event parity: 0100111001010 (No errors).Output word: 01001101

Page 15: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

15

ResultsTest 5:Original 8 bit input word: 01001101Encoded word with parity ‘0’: 0100111001010Received encoded word: 0100111001011 (One error, bit 0)Error flag output signal is asserted.Error is corrected and its position is given in output error_pos: 0000Output word: 01001101

Page 16: VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.

16

ResultsTest 6:Original 8 bit input word: 01001101Encoded word with parity ‘0’: 0100111001010Received encoded word: 0110111001011 (Two errors, bits 0 and 10)Repeat word output signal and Error flag output signal are asserted.No output.