50 likes | 218 Views
B. V. alues represented. Sign and. b. b. b. b. magnitude. 1'. s complement. 2'. s complement. 3. 2. 1. 0. +. 7. +. 7. +. 7. 0. 1. 1. 1. +. 6. +. 6. +. 6. 0. 1. 1. 0. +. 5. +. 5. +. 5. 0. 1. 0. 1. +. 4. +. 4. +. 4. 0. 1. 0. 0. +. 3. +. 3.
E N D
B V alues represented Sign and b b b b magnitude 1' s complement 2' s complement 3 2 1 0 + 7 + 7 + 7 0 1 1 1 + 6 + 6 + 6 0 1 1 0 + 5 + 5 + 5 0 1 0 1 + 4 + 4 + 4 0 1 0 0 + 3 + 3 + 3 0 0 1 1 + 2 + 2 + 2 0 0 1 0 + 1 + 1 + 1 0 0 0 1 + 0 + 0 + 0 0 0 0 0 - 0 - 7 - 8 1 0 0 0 - 1 - 6 - 7 1 0 0 1 - 2 - 5 - 6 1 0 1 0 - 3 - 4 - 5 1 0 1 1 - 4 - 3 - 4 1 1 0 0 - 5 - 2 - 3 1 1 0 1 - 6 - 1 - 2 1 1 1 0 - 7 - 0 - 1 1 1 1 1 Study over, it should be review. We don’t do a lot with computer arithmetic, but you need to understand is for the basics of Chapter 6.
( + 4 ) 0 0 1 0 ( + 2 ) 0 1 0 0 ( ) 0 0 1 1 + 3 1 0 1 0 ( - 6 ) ( - 2 ) 0 1 0 1 ( + 5 ) 1 1 1 0 ( ) + 7 1 0 1 1 ( - 5 ) 0 1 1 1 1 1 1 0 ( - 2 ) 1 1 0 1 ( - 3 ) 1 0 0 1 ( - 7 ) 0 1 0 0 ( + 4 ) 1 1 0 1 1 1 0 1 ( - 3 ) 1 0 0 1 0 1 1 1 ( - 7 ) 0 1 0 0 ( + 4 ) 0 0 1 0 ( + 2 ) 0 0 1 0 ( ) 0 1 0 0 + 4 1 1 0 0 1 1 1 0 ( - 2 ) 0 1 1 0 0 1 1 0 ( + 6 ) ( + 3 ) 0 0 1 1 1 1 0 1 0 0 1 1 ( + 3 ) 1 0 0 1 1 0 0 1 ( - 7 ) 0 1 0 1 1 0 1 1 ( - 5 ) 1 1 1 0 ( - 2 ) 1 0 0 1 ( - 7 ) 1 0 0 1 0 0 0 1 ( + 1 ) 1 1 1 1 1 0 0 0 ( - 8 ) 0 0 1 0 0 0 1 0 ( + 2 ) 1 1 0 1 0 0 1 1 ( - 3 ) ) ( 0 1 0 1 + 5 (a) (b) + + (c) (d) + + (e) + - (f) - + (g) - + (h) - + (i) - + (j) - + Figure 2.4.2's-complement Add and Subtract operations.
n bits first word second word • • • i th word • • • last word Figure 2.5. Memory words.
Address Contents i Begin execution here Move A,R0 3-instruction i + 4 program Add B,R0 segment i + 8 Move R0,C A Data for B the program C Figure 2.8. A program for C ¬ [A] + [B]. A simple program doing the basic arithmetic expression C = A + B; Note the simple instructions: Move and Add and that data is stored with the instructions.
Move N,R1 Clear R0 LOOP Determine address of "Next" number and add "Next" number to R0 Program loop Decrement R1 Branch>0 LOOP Move R0,SUM • • • SUM N n NUM1 NUM2 • • • NUM n A branch or looping program. Two new instructions Branch and Decrement.