Chapter3 - Morgan Kaufmann Publishers 24 February 2015 The...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Morgan Kaufmann Publishers 24 February, 2015 Chapter 3 Arithmetic for Computers 1 C OMPUTER O RGANıZATıON AND D ESıGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Chapter 3 Arithmetic for Computers 2 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation and operations § 3.1 Introduction Sign One's Two's Magnitude Complement Complement 000 = +0 000 = +0 000 = +0 001 = +1 001 = +1 001 = +1 010 = +2 010 = +2 010 = +2 011 = +3 011 = +3 011 = +3 100 = -0 100 = -3 100 = -4 101 = -1 101 = -2 101 = -3 110 = -2 110 = -1 110 = -2 111 = -3 111 = -0 111 = -1 Issues: balance, number of zeros, ease of operations Two`s Complement is used. Possible Representations Negating a two's complement number: invert all bits and add 1 (“negate” and “invert” are quite different!) Converting n bit numbers into numbers with more than n bits: MIPS 16 bit immediate gets converted to 32 bits for arithmetic copy the most significant bit (the sign bit) into the other bits : 0010 -> 0000 0010 1010 -> 1111 1010 "sign extension" (lbu vs. lb) Two's Complement Operations
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon