03_Arithmetic

03_Arithmetic - Computer Arithmetic Readings: 3.1-3.3, C.5...

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

View Full Document Right Arrow Icon
Computer Arithmetic Readings: 3.1-3.3, C.5 Review binary numbers, 2’s complement Develop Arithmetic Logic Units (ALUs) to perform CPU functions. Introduce shifters, multipliers, etc. 37 Binary Numbers Decimal: 471 = 4*10 2 + 7*10 1 + 1*10 0 Binary: 01101 = 1*2 3 + 1*2 2 + 0*2 1 + 1*2 0 = (13) 10 Example: 0111010111 = (?) 10 38
Background image of page 1

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

View Full DocumentRight Arrow Icon
2’s Complement Numbers Positive numbers & zero have leading 0, negative have leading 1 Negation: Flip all bits and add 1 Ex: –(01101) 2 = To interpret numbers, convert to positive version, then convert: 11010 = 01100 = 39 Sign Extension Conversion of n-bit to (n+m)-bit 2’s complement: replicate the sign bit b 3 b 2 b 1 b 0 = b 3 b 3 b 3 b 2 b 1 b 0 = b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 3 b 2 b 1 b 0 Ex - Convert to 8-bit: 01101 = (13) 10 11101 = (-3) 10 40
Background image of page 2
Arithmetic Operations 5 7 8 9 2 + 7 8 9 5 6 Decimal: 1 0 1 0 1 1 1 + 0 1 0 0 1 0 1 Binary: 1 0 1 0 0 1 1 0 - 0 0 0 1 0 1 1 1 Binary: 1 0 1 0 0 1 1 0 +_______________ 41 Overflows Operations can create a number too large for the number of bits n-bit 2’s complement can hold -2 (n-1) …2 (n-1) -1 Can detect overflow in addition when highest bit has carry-in
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

03_Arithmetic - Computer Arithmetic Readings: 3.1-3.3, C.5...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online