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.

Download Presentation

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

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

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 Chapter 2, Representing Signed Numbers, Chapter 17, Floating-Point Representations J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems, Chapter 3.2, Integers Chapter 3.3, Real Numbers

Recommended Reading (to be covered at the next lecture) Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design Chapter 5, Basic Addition and Counting J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems, Chapter 4.1.1 Basic Algorithm Chapter 11.1 Basic AdderChapter 11.2 Carry-Chain Adder

Signed-magnitude representation of signed numbers k-1 k-2 0 magnitude sign Advantages: • conceptual simplicity • symmetric range: -(2k-1-1) .. -(2k-1-1) • simple negation Disadvantages: • addition of numbers with the same sign and with • a different sign handled differently

Biased representation with radix 2 Signed number X Representation mapping Unsigned Representation R(X) Binary mapping Bit vector (xk-1xk-2...x0.x-1...x-l)

Complement representations with radix 2 Signed number X Representation mapping Unsigned Representation R(X) Binary mapping Bit vector (xk-1xk-2...x0.x-1...x-l)

Useful dependencies 1 – xi = xi X when X 0 - X when X < 0 xi xi 1 – xi |X| = 0 1 1 0 1 0

Unsigned addition vs. signed addition Programmer Machine Unsigned mind Signed mind weight 128 64 32 16 8 4 2 1 carry 1 1 1 X Y S 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 + = x3 y3 x2 y2 x6 y6 x5 y5 x1 y1 x7 y7 x4 y4 x0 y0 FA FA FA FA FA FA FA FA c4 c3 c7 c6 c2 c8 c5 c1 s3 s2 s6 s5 s1 s7 s4 s0

Out of range flags Carry flag - C out-of-range for unsigned numbers 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 Overflow flag - V out-of-range for signed numbers 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

Representing k-bit signed binary numbers Representation for X>0 Representation for 0 Representation for X<0 Representation 0, 2k-1 Signed- magnitude 2k-1+|X| X Biased B X+B X+B typical B=2k-1 or 2k-1-ulp Complement X 0, M mod 2k M-|X|=M+X Two’s complement 0 X 2k-|X|= One’s complement 2k-ulp-|X|= 0, 2k-ulp X