# chap9 - William Stallings Computer Organization and...

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

William Stallings Computer Organization and Architecture Chapter 9 Computer Arithmetic P283

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

View Full Document
Structure - The CPU Computer CPU I/O Memory System Bus Arithmetic and Login Unit Control Unit Internal CPU Interconnection Registers CPU P11
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

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

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

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

View Full Document
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)
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

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

View Full Document
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
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

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

View Full Document
Negation Special Case 1  0 =                00000000 Bitwise not       11111111 Add 1 to LSB              +1 Result           1 00000000 Overflow is ignored , so: - 0 = 0
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

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

View Full Document
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
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)

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

View Full Document
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 ,
Examples 00001000    11110000  (-16) 00001010 00001010 00010010 11111010 01100000 (96) 10000010  01110000 11111100 1 1010000 0 1111110 + + + + overflow

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

View Full Document
Examples 00001000      11110000  11110000 (-16) 00001010    -   1010(-6)         1010 (10)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online