Introduction Gray code is a binary numeral system where two successive values differ in only one bit...

14
Gray Codes

description

Motivation DecimalBinary DecimalBinaryGray Gray As Decimal /14

Transcript of Introduction Gray code is a binary numeral system where two successive values differ in only one bit...

Page 1: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Gray Codes

Page 2: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Introduction

• Gray code is a binary numeral system  where two successive values differ in only one bit (binary digit).

• Today, Gray codes are widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.

• This code was originally designed to prevent spurious output from electromechanical switches.

2-bits 4-bits00011110

0000000100110010011001110101010011001101111111101010101110011000

3-bits000001011010110111101100

2/14

Page 3: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Motivation

Decimal Binary

... ...

3 011

4 100

... ...

Decimal Binary Gray

Gray As

Decimal

0 000 000 01 001 001 12 010 011 33 011 010 24 100 110 65 101 111 76 110 101 57 111 100 4

3/14

Page 4: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Grey code for 23:(23)10 = (0001 0111)2

Function: Result = Num (Num / 2) //(div 2)10 == (>> 1)2

Example

0 0 0 1 0 1 1 1

0 0 0 0 1 0 1 1

0 0 0 1 1 1 0 0 = (28)10

4/14

Page 5: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Function: an−1 = gn−1 ai = gi ⊕ ai+1, i = n − 2, . . . , 0

g: 0 0 0 1 1 1 0 0 a: 0 0 0 1 0 1 1 1 = (23)10

Example (inverse)

5/14

Page 6: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Grey Code (Implementation)

6/14

Page 7: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Grey Code Inverse (Implementation)

7/14

Page 8: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

8/14

CpuStreamCpuCode.c

Page 9: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

9/14

CpuStreamKernel.maxj

Page 10: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

10/14

CpuStreamManager.maxj

Page 11: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

11/14

Build & Run

Page 12: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

ConclusionUnfortunately, DFE algorithm implementationdoes not cause speedup in most of the cases...

12/14

Page 13: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

Referenceshttps://en.wikipedia.org/wiki/Gray_code

The Gray Code by R. W. Doran

Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007). “Section 22.3.GrayCodes”. Numerical Recipes: The Art of Scientific Computing (3rd ed.). New York: Cambridge University Press.

Wilf, Herbert S. (1989). "Chapters 1–3". Combinatorial algorithms: an update. SIAM.ISBN 0-89871-231-9.

13/14

Page 14: Introduction Gray code is a binary numeral system where two successive values differ in only one bit (binary digit). Today, Gray codes are widely used.

14/14

Professor: dr Veljko M. Milutinović

Student: Petar Ristić 32/2012

Software engineeringSchool of Electrical Engineering

University of Belgrade

Microprocessor Systems (MIPS)