Presentation is loading. Please wait.

Presentation is loading. Please wait.

Forging new generations of engineers. Binary Addition & Subtraction.

Similar presentations


Presentation on theme: "Forging new generations of engineers. Binary Addition & Subtraction."— Presentation transcript:

1 Forging new generations of engineers

2 Binary Addition & Subtraction

3 Addition Rules 0 + 0 = 00 ( 0 with a 0 carry ) 0 + 1 = 01 ( 1 with a 0 carry ) 1 + 0 = 01 ( 1 with a 0 carry ) 1 + 1 = 10 ( 0 with a 1 carry )

4 4 Addition Rules 0 + 0 1 + 0 0 + 1 1 + 1 0 0 1 1 0

5 Addition Rules w/Carries 0+0+0 = 00 (0 WITH 0 CARRY) 0+0+1 = 01 (1 WITH 0 CARRY) 0+1+1 = 10 (0 WITH 1 CARRY) 1+1+1 = 11 (1 WITH 1 CARRY)

6 6 Adding Binary Numbers 28 + 43 71  00011100  + 00101011 1 0 0 1 1 00 10 1 0 1 0 1 0

7 7 1’S Complement Invert All Bits 01010011                10101100

8 8 2’S Complement Invert All Bits 01010011                10101100 +1 10101101 Add One

9 9 Add/Sub : 4 Combinations 9 + 5 14 9 + (-5) 4 (-9) + 5 - 4 (-9) + (-5) - 14 Positive / Positive Positive Answer Positive / Negative Positive Answer Negative / Positive Negative Answer Negative / Negative Negative Answer

10 10 Positive / Positive Combination Both Positive Numbers Use Straight Binary Addition 00001001 + 00000101 9 + 5 14   00001110 Positive / Positive Positive Answer

11 11 Positive / Negative Combination 1-Positive / 1-Negative Take 2’s Complement Of Negative Number (-5) 00001001 9 + (-5) 4   1]00000100 00000101  11111010 +1 11111011 2’s Complement Process + 11111011 Positive / Negative Positive Answer 8 th Bit = 0 : Answer is Positive Disregard 9 th Bit

12 12 Negative / Positive Combination 1-Positive / 1-Negative Take 2’s Complement Of Negative Number (-9) 11110111 (-9) + 5 - 4  11111100 00001001  11110110 +1 11110111 2’s Complement Process + 00000101 Positive / Negative Negative Answer 8 th Bit = 1 : Answer is Negative Take 2’s Complement to Check Answer 11111100  00000011 +1 00000100 2’s Complement Process

13 13 Negative / Negative Combination 2-Negative Take 2’s Complement Of Both Negative Numbers 11110111 (-9) + (-5) - 14  + 11111011 Negative / Negative Negative Answer 11110010  00001101 +1 00001110 2’s Complement Process  2’s Complement Numbers, See Conversion Process In Previous Slides 1]11110010 8 th Bit = 1 : Answer is Negative Disregard 9 th Bit Take 2’s Complement to Check Answer

14 14 2’S Complement Quick Method 1) Start at the LSB and write down all zeros moving to the left. 2) Write down the first “1” you come to. 3) Invert the rest of the bits moving to the left. Example: 11101100 00101000


Download ppt "Forging new generations of engineers. Binary Addition & Subtraction."

Similar presentations


Ads by Google