number representation part 2 fixed-radix signed representations floating point representations

83
Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations Little-Endian vs. Big-Endian Representations Galois Field Representations ECE 645: Lecture 2

Upload: lilka

Post on 06-Jan-2016

43 views

Category:

Documents


2 download

DESCRIPTION

ECE 645: Lecture 2. Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations Little-Endian vs. Big-Endian Representations Galois Field Representations. Required Reading. Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Number Representation

Part 2Fixed-Radix Signed Representations

Floating Point RepresentationsLittle-Endian vs. Big-Endian Representations

Galois Field Representations

ECE 645: Lecture 2

Page 2: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Required Reading

Chapter 2, Representing Signed Numbers, Chapter 17, Floating-Point Representations

Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design

J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems,

Chapter 3.2, IntegersChapter 3.3, Real Numbers

Page 3: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Recommended Reading(to be covered at the next lecture)

Chapter 5, Basic Addition and Counting

Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design

J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems,

Chapter 4.1.1 Basic AlgorithmChapter 11.1 Basic AdderChapter 11.2 Carry-Chain Adder

Page 4: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed Number Representations

Page 5: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Representations of signed numbers

Signed-magnitude Biased Complement

Radix-complement Diminished-radix complement

(Digit complement)

Two’s complement One’s complement

r=2r=2

Page 6: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

7 0111 1111 0111 01116 0110 1110 0110 01105 0101 1101 0101 01014 0100 1100 0100 01003 0011 1011 0011 00112 0010 1010 0010 00101 0001 1001 0001 00010 0000 1000 0000 0000-0 1000 1111-1 1001 0111 1111 1110-2 1010 0110 1110 1101-3 1011 0101 1101 1100-4 1100 0100 1100 1011-5 1101 0011 1011 1010-6 1110 0010 1010 1001-7 1111 0001 1001 1000-8 0000 1000

Signed-magnitude

Biased Two’s complement

One’s complement

Page 7: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed-magnitude representation of signed numbers

Advantages:

Disadvantages:

• conceptual simplicity• symmetric range: -(2k-1-1) .. -(2k-1-1)• simple negation

• addition of numbers with the same sign and with a different sign handled differently

0k-2k-1

signmagnitude

Page 8: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Biased (excess-B) representation of signed integers

-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

B = 2k-1, k=4R(X) = X + B

-2k-1 ≤ X ≤ 2k-1-1

X

R(X)

R

Page 9: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed number X

Unsigned Representation R(X)

Bit vector (xk-1xk-2...x0.x-1...x-l)

Binary mapping

Representation mapping

ik

liixXR 2)(

1

Biased representation with radix 2

Page 10: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

ComplementSigned Number Representations

Page 11: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed number X

Unsigned Representation R(X)

Bit vector (xk-1xk-2...x0.x-1...x-l)

Binary mapping

Representation mapping

ik

liixXR 2)(

1

Complement representations with radix 2

Page 12: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

1 – xi = xi

1 – xixi xi

01

10

10

Useful dependencies

|X| = X when X 0

- X when X < 0

Page 13: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

One’s complement transformation

OC(A) = A = 2k – 2-l - A

For i

k

liiAA 2

1

0

0 OC(A) 2k – 2-l

OC(OC(A)) = A

def

k-1 k-2 ... 0 -1 -2 ... -l

1 1 ... 1 . 1 1 ... 1– Ak-1 Ak-2 … A0 . A-1 A-2 ... A-l

Ak-1 Ak-2 … A0 . A-1 A-2 ... A-l

Properties:

Page 14: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

One’s Complement Representation of Signed Numbers

R(X) =

X for X > 0

0 or OC(0) for X = 0

OC(|X|) for X < 0

For –(2k-1 – 2-l) X 2k-1 – 2-l

0 R(X) 2k – 2-l

def

Page 15: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

One’s complement representation of signed integers

-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Xk=4

X>0 0 X<0

X+2k-1 = 2k-1 - |X| 0,2k-1

Page 16: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

One’s complement representation of signed numbers

Page 17: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s complement transformation (1)

A + 2-l = 2k – A for A > 0

For ik

liiAA 2

1

0

def

Properties:

TC(A) =0 for A = 0

0 TC(A) 2k – 2-l

TC(TC(A)) = A

2k – A = 2k – A – 2-l + 2-l =

= (2k – 2-l – A)+2-l = A + 2-l

Page 18: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s complement transformation (2)

For ik

liiAA 2

1

0

A + 2-l mod 2k = 2k – A mod 2kdef

TC(A) =

Page 19: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s Complement Representation of Signed Numbers

R(X) = X for X 0

TC(|X|) for X < 0

For –2k-1 X 2k-1 – 2-l

0 R(X) 2k – 2-l

def

Page 20: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s complement representation of signed integers

-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Xk=4

X>0 0 X<0

X+2k = 2k - |X|0

Page 21: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s complement representation of signed integers

Page 22: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed-magnitude representation of signed numbers

-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Xk=4

X>0 0 X<0

| X|+2k-1 = -X+2k-1 0,2k-1

Page 23: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed-magnitude representation of signed numbers

Page 24: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Biased representation of signed numbers

-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

X+BB = 2k-1, k=4

X>0 0 X<0

X+BB

Page 25: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Biased representation of signed numbers

Page 26: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Arithmetic Operations inSigned Number Representations

Page 27: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Unsigned addition vs. signed addition

Machine Programmer

0 0 0 1 0 0 1 11 0 0 0 0 1 0 11 0 0 1 1 0 0 0

111

Unsignedmind

Signedmind128 64 32 16 8 4 2 1weight

carry

XYS

+

=

FA

x0 y0

s0

c1

FA

x1 y1

s1

c2

FA

x2 y2

s2

c3

FA

x3 y3

s3

c4FA

x4 y4

s4

c5

FA

x5 y5

s5

c6

FA

x6 y6

s6

c7

FA

x7 y7

s7

c8

Page 28: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Out of range flags

C = 1 if result > MAX_UNSIGNED or result < 0 0 otherwise

where MAX_UNSIGNED = 28-1 for 8-bit operands 216-1 for 16-bit operands

V = 1 if result > MAX_SIGNED or result < MIN_SIGNED 0 otherwise

where MAX_SIGNED = 27-1 for 8-bit operands 215-1 for 16-bit operands

MIN_SIGNED = -27 for 8-bit operands -215 for 16-bit operands

Carry flag - C

Overflow flag - V

out-of-range for unsigned numbers

out-of-range for signed numbers

Page 29: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Overflow for signed numbers

Indication of overflow

Positive+ Positive= Negative

Negative+ Negative= Positive

Formulas

Overflow2’s complement = xk-1 yk-1 sk-1 + xk-1 yk-1 sk-1 =

= ck ck-1

Page 30: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Two’s complement representation of signed integers

Page 31: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Addition and subtractionTwo’s complement

0 0 1 0 1 51 0 1 1 0 -10

-16 8 4 2 1

1 1 0 1 1 -5

Numbers of the same sign Numbers of the opposite sign

0 1 0 1 0 101 1 0 1 1 -5

-16 8 4 2 1

1 0 0 1 0 1 5

carry but not overflow

1 1 0 1 1 -51 0 1 1 0 -10

-16 8 4 2 1

1 1 0 0 0 1 -15

carry but not overflow

0 0 1 1 1 70 1 0 1 0 10

-16 8 4 2 1

1 0 0 0 1 -15

no carry but overflow

Page 32: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Can replace thiswith k xor gates

Two's Complement Adder/Subtractor Architecture

Page 33: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Arithmetic Shift

Two’s complement

Sh.L {001012 = +5} = 010102 = +10

Sh.L {110112 = -5} = 101102 = -10

Sh.L {010102 = +10} = 101002 = - 12

overflow

Sh.R {001012 = +5} = 000102 = +2 rem 1

Sh.R {110112 = -5} = 111012 = -3 rem 1

Shift left may cause overflow

Shift right requires sign extension

Page 34: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Addition and subtractionOne’s complement

Numbers of the same sign Numbers of the opposite sign

0 1 0 1 0 101 1 0 1 0 -5

-15 8 4 2 1

1 0 0 1 0 0

1 1 0 1 0 -51 0 1 0 1 -10

-15 8 4 2 1

1 0 1 1 1 1

+ 1

1 0 0 0 0 -15

end-arround carry

+

0 0 1 0 1 5

1

Disadvantage: Need another adder after the addition is complete!

Page 35: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Arithmetic Shift

One’s complement

Sh.L {001012 = +5} = 010102 = +10

Sh.L {110102 = -5} = 101012 = -10

Sh.L {010102 = +10} = 101002 = - 11

overflow

Sh.R {001012 = +5} = 000102 = +2 rem 1

Sh.R {110112 = -5} = 111012 = -2 rem -1

Shift left may cause overflow

Shift right requires sign extension

Page 36: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Addition and subtractionSigned-magnitude

Numbers of the same sign Numbers of the opposite sign

0 1 0 1 1 110 0 1 1 0 6

sign bit magnitude

+

0 1 0 0 0 1 17

carry = overflow

1 1 0 1 1 -110 0 1 1 0 6

sign bit magnitude

+

11 > 6

1 0 1 1 110 1 1 0 6–

0 1 0 1 51

Page 37: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 38: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Signed Number Representations

Summary

Page 39: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Representing k-bit signed binary numbers

Representation for X>0

Representation for X<0

Representationfor 0

Representation

Signed-magnitude

X0,2k-1 2k-1+|X|

Biased X+B B X+B

Complement X M-|X|=M+X0, M mod 2k

Two’s complement

One’scomplement

X

X

2k-|X|=

2k-ulp-|X|=

0

0, 2k-ulp

typical B=2k-1 or 2k-1-ulp

ulpX

X

Page 40: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Value of a number in the signed representations

Representation Value of(xk-1 xk-2 … x1 x0.x-1 … x-l)

Signed-magnitude

Biased

Two’s complement

One’scomplement

ik

lii

xxX k 2)1(

21

BxX ik

lii

21

ik

lii

kk xxX 22

21

1

ik

lii

kk xulpxX 2)2(

21

1

Page 41: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Extending the number of bits of a signed number

xk-1 xk-2 … x1 x0 . x-1 x-2 … x-l

yk’-1 yk’-2 … yk yk-1 yk-2 … y1 y0 . y-1 y-2 … y-l y-(l+1) … y-l’

X

Y

signed-magnitude

xk-1 0 0 0 0 0 0 0 xk-2 … x1 x0 . x-1 x-2 … x-l 0 0 0 0 0 0

two’s complement

xk-1 xk-1 xk-1 . . .xk-1 xk-2 … x1 x0 . x-1 x-2 … x-l 0 0 0 0 0 0

one’s complement

xk-1 xk-1 xk-1 . . .xk-1 xk-2 … x1 x0 . x-1 x-2 … x-l xk-1 . . . .xk-1

biased

xk-2 … x1 x0 . x-1 x-2 … x-l 0 0 0 0 0 01kx . . .xk-1 1kx

Page 42: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Generalized Complement Representation

Page 43: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Generalized complement representation of signed integers

Page 44: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Generalized complement representation of signed integers

Page 45: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Floating Point Representations

Page 46: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 47: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 48: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 49: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 50: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 51: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

The ANSI/IEEE standard floating-point number representation formats

Short (32-bit) format

Long (64-bit) format

Sign Exponent Significand

8 bits, bias = 127, –126 to 127

11 bits, bias = 1023, –1022 to 1023

52 bits for fractional part (plus hidden 1 in integer part)

23 bits for fractional part (plus hidden 1 in integer part)

IEEE 754 Standard(now being revised to yield IEEE 754R)

Page 52: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 53: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Table 17.1 Some features of the ANSI/IEEE standard floatingpoint number representation formats

Page 54: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

00 01 7F FE FF7E 800 1 127 254 255126 128

–126 0 +127–1 +1

Decimal codeHex code

Exponent value

f = 0: Representation of 0f 0: Representation of denormals, 0.f 2–126

f = 0: Representation of f 0: Representation of NaNs

Exponent encoding in 8 bits for the single/short (32-bit) ANSI/IEEE format

1.f 2e

Exponent Encoding

Page 55: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 56: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 57: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Fig. 17.4 Denormals in the IEEE single-precision format.

Page 58: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 59: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 60: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 61: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 62: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 63: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Little-Endian vs. Big-Endian Representation of

Integers

Page 64: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Little-Endian vs. Big-Endian Representation

A0 B1 C2 D3 E4 F5 67 8916

LSBMSB

MSB = A0

B1

C2D3

E4F5

67LSB = 89

Big-Endian Little-Endian

LSB = 89

0

MAX

67

F5E4

D3C2

B1MSB = A0

address

Page 65: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Little-Endian vs. Big-Endian Camps

Big-Endian Little-Endian

0

MAX

address

MSB

LSB

. . .

LSB

MSB

. . .

Motorola 68xx, 680x0 Intel

IBM

Hewlett-PackardDEC VAX

Internet TCP/IP

Sun SuperSPARC

Bi-Endian

Motorola Power PC

Silicon Graphics MIPS

RS 232

AMD

Page 66: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Origin of the termsLittle-Endian vs. Big-Endian

Jonathan Swift, Gulliver’s Travels

• A law requiring all citizens of Lilliput to break their soft-eggs

at the little ends only

• A civil war breaking between the Little Endians and

the Big-Endians, resulting in the Big Endians taking refuge on

a nearby island, the kingdom of Blefuscu

• Satire over holy wars between Protestant Church of England

and the Catholic Church of France

Page 67: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 68: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Little-Endian vs. Big-Endian

Big-Endian Little-Endian

• easier to determine a sign of the number

• easier to compare two numbers

• easier to divide two numbers

• easier to print

• easier addition and multiplication of multiprecision numbers

Advantages and Disadvantages

Page 69: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Pointers (1)

89

67

F5E4

D3C2

B1

A0

Big-Endian Little-Endian

0

MAX

address

int * iptr;

(* iptr) = 8967; (* iptr) = 6789;

iptr+1

Page 70: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Pointers (2)

89

67

F5E4

D3C2

B1

A0

Big-Endian Little-Endian

0

MAX

address

long int * lptr;

(* lptr) = 8967F5E4; (* lptr) = E4F56789;

lptr + 1

Page 71: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Polynomial Representationof the Galois Field

elements

Page 72: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Evariste Galois (1811-1832)

Page 73: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Evariste Galois (1811-1832)

Studied the problem of finding algebraic solutions for the general

equations of the degree 5, e.g.,

f(x) = a5x5+ a4x4+ a3x3+ a2x2+ a1x+ a0 = 0

Answered definitely the question which specific equations of

a given degree have algebraic solutions

On the way, he developed group theory,

one of the most important branches of modern mathematics.

Page 74: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Evariste Galois (1811-1832)

1829 Galois submits his results for the first time to the French Academy of Sciences

Reviewer 1 Augustin-Luis Cauchy forgot or lost the communication

1830 Galois submits the revised version of his manuscript,hoping to enter the competition for the Grand Prizein mathematics

Reviewer 2 Joseph Fourier – died shortly after receiving the manuscript

1831 Third submission to the French Academy of SciencesReviewer 3

Simeon-Denis Poisson – did not understand the manuscript and rejected it.

Page 75: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Evariste Galois (1811-1832)

May 1832 Galois provoked into a duel

The night before the duel he writes a letter to his friend containing the summary of his discoveries.

The letter ends with a plea: “Eventually there will be, I hope, some people who

will find it profitable to decipher this mess.”

May 30, 1832 Galois is grievously wounded in the duel and dies in the hospital the following day.

1843 Galois manuscript rediscovered by Joseph Liouville

1846 Galois manuscript published forthe first time in a mathematical journal

Page 76: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations
Page 77: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Field

Set F, and two operations typically denoted by (but not necessarily equivalent to)

+ and *

Set F, and definitions of these two operations must fulfill special conditions.

Page 78: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

{ set Zp={0, 1, 2, … , p-1}, + (mod p): addition modulo p, * (mod p): multiplication modulo p}

Examples of fieldsInfinite fields

Finite fields

{ R= set of real numbers, + addition of real numbers * multiplication of real numbers}

Page 79: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Finite Fields = Galois Fields

GF(p) GF(2m)

Polynomial basisrepresentation

Normal basisrepresentation

Fast in hardware

Arithmetic operations

presentin many libraries

Fast squaring

GF(pm)p – primepm – number of elements in the field

Most significantspecial cases

Page 80: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Elements of the Galois Field GF(2m)

Binary representation (used for storing and processing in computer systems):

Polynomial representation(used for the definition of basic arithmetic operations):

A = (am-1, am-2, …, a2, a1, a0) ai {0, 1}

A(x) = aixi = am-1xm-1 + am-2xm-2 + …+ a2x2 + a1x+a0

multiplication+ addition modulo 2 (XOR)

i=0

m-1

Page 81: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Addition and Multiplicationin the Galois Field GF(2m)

Inputs

A = (am-1, am-2, …, a2, a1, a0)B = (bm-1, bm-2, …, b2, b1, b0)

ai , bi {0, 1}

Output

C = (cm-1, cm-2, …, c2, c1, c0) ci {0, 1}

Page 82: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Addition

A A(x)B B(x)C C(x) = A(x) + B(x) = = (am-1+bm-1)xm-1 + (am-2+bm-2)xm-2+ …+ + (a2+b2)x2 + (a1+b1)x + (a0+b0) = = cm-1xm-1 + cm-2xm-2 + …+ c2x2 + c1x+c0

Addition in the Galois Field GF(2m)

multiplication+ addition modulo 2 (XOR)

ci = ai + bi = ai XOR bi

C = A XOR B

Page 83: Number Representation Part 2 Fixed-Radix Signed Representations Floating Point Representations

Multiplication

A A(x)B B(x)C C(x) = A(x) B(x) mod P(X) = cm-1xm-1 + cm-2xm-2 + …+ c2x2 + c1x+c0

Multiplication in the Galois Field GF(2m)

P(x) - irreducible polynomial of the degree m

P(x) = pmxm + pm-1xm-1 + …+ p2x2 + p1x+p0