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.

Post on 18-Jan-2018

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Motivation DecimalBinary DecimalBinaryGray Gray As Decimal /14

Transcript

Gray Codes

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

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

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

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

Grey Code (Implementation)

6/14

Grey Code Inverse (Implementation)

7/14

8/14

CpuStreamCpuCode.c

9/14

CpuStreamKernel.maxj

10/14

CpuStreamManager.maxj

11/14

Build & Run

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

12/14

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

14/14

Professor: dr Veljko M. Milutinović

Student: Petar Ristić 32/2012

Software engineeringSchool of Electrical Engineering

University of Belgrade

Microprocessor Systems (MIPS)

top related