chap9 - William Stallings Computer Organization and...

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

View Full Document Right Arrow Icon
William Stallings Computer Organization and Architecture Chapter 9 Computer Arithmetic P283
Background image of page 1

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

View Full DocumentRight Arrow Icon
Structure - The CPU Computer CPU I/O Memory System Bus Arithmetic and Login Unit Control Unit Internal CPU Interconnection Registers CPU P11
Background image of page 2
Arithmetic & Logic Unit Does the calculations Handles integers May handle floating point (real) numbers May be separate FPU (maths co-processor) Everything else in the computer is there to  service this unit
Background image of page 3

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

View Full DocumentRight Arrow Icon
ALU Inputs and Outputs +,-, >0, =0 overflow
Background image of page 4
Integer Representation & & & & & & & & ±² 8 & & . Integer is stored in binary e.g. 41=00101001 No period Representation  Sign-Magnitude ( - ,  ( X x ‚ “ ) Two’s complement ( 2 ( Xx ‚ “ )
Background image of page 5

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

View Full DocumentRight Arrow Icon
Sign-Magnitude Left most bit is sign bit 0 means positive 1 means negative +18 =  0 0010010  -18 =  1 0010010 Problems Need to consider both sign and magnitude in  arithmetic Two representations of zero (+0 and -0)
Background image of page 6
Two’s Complement +3 = 00000011 +2 = 00000010 +1 = 00000001 +0 = 00000000  -1 = 11111111  -2 = 11111110  -3 = 11111101  Bit wise  not  Add 1 to LSB W x ‚ “ * Least significant bit d
Background image of page 7

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

View Full DocumentRight Arrow Icon
2 0 2 1 2 6 A= -2 n-1 a n-1 + 2 i a i i=0 n-2 P288 11111111 -2 7 =-128 127 -2 7 1 x2 1 1 x2 0
Background image of page 8
Benefits One representation of zero Arithmetic works easily (see later) Negating  is fairly easy ( ) 3 = 00000011 -3 =11111101  Boolean complement gives 11111100 Add 1 to LSB 11111101
Background image of page 9

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

View Full DocumentRight Arrow Icon
Negation Special Case 1  0 =                00000000 Bitwise not       11111111 Add 1 to LSB              +1 Result           1 00000000 Overflow is ignored , so: - 0 = 0 
Background image of page 10
Negation Special Case 2 -128 =            10000000 bitwise not      01111111 Add 1 to LSB +00000001 Result              1 0000000 So: -(-128) = -128   X Monitor  MSB  (sign bit)  for overflow It should change during negation
Background image of page 11

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

View Full DocumentRight Arrow Icon
Range of Numbers 8 bit 2s complement +127 = 01111111 = 2 7  -1  -128 = 10000000 = -2 7 16 bit 2s complement +32767 = 011111111 11111111 = 2 15  - 1  -32768 = 100000000 00000000 = -2 15
Background image of page 12
Conversion Between Lengths Positive number pack with leading zeros +18 =                00010010 +18 = 00000000 00010010 Negative numbers pack with leading ones -18 =                  1 1101110 -18 =  11111111  1 1101110 i.e. pack with MSB (sign bit)
Background image of page 13

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

View Full DocumentRight Arrow Icon
Addition and Subtraction +: Normal binary addition Monitor sign bit for overflow  P293 -:  Take twos complement of subtrahend and add to  minuend i.e. a - b = a + (-b) So we only need addition and complement circuits ,
Background image of page 14
Examples 00001000    11110000  (-16) 00001010 00001010 00010010 11111010 01100000 (96) 10000010  01110000 11111100 1 1010000 0 1111110 + + + + overflow
Background image of page 15

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

View Full DocumentRight Arrow Icon
Examples 00001000      11110000  11110000 (-16) 00001010    -   1010(-6)         1010 (10)
Background image of page 16
Image of page 17
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 65

chap9 - William Stallings Computer Organization and...

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

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