Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Forging new generations of engineers Binary Addition & Subtraction 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 ) Addition Rules 0 +0 0 0 1 +0 0 1 0 +1 0 1 1 +1 1 0 4 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) Adding Binary Numbers 0 1 1 1 0 0 0 28 + 43 71 00011100 + 00101011 01000111 6 1’S Complement 01010011 Invert All Bits 10101100 7 2’S Complement 01010011 Invert All Bits Add One 10101100 +1 10101101 8 Add/Sub : 4 Combinations Positive / Positive Positive Answer 9 + 5 14 Positive / Negative Positive Answer 9 + (-5) 4 Negative / Positive Negative Answer (-9) + 5 -4 Negative / Negative Negative Answer (-9) + (-5) - 14 9 Positive / Positive Combination Positive / Positive Positive Answer 9 + 5 14 00001001 + 00000101 00001110 Both Positive Numbers Use Straight Binary Addition 10 Positive / Negative Combination Positive / Negative Positive Answer 9 + (-5) 4 1-Positive / 1-Negative Take 2’s Complement Of Negative Number (-5) 00001001 + 11111011 1]00000100 8th Bit = 0 : Answer is Positive Disregard 9th Bit 00000101 11111010 +1 11111011 2’s Complement Process 11 Negative / Positive Combination Positive / Negative Negative Answer (-9) + 5 - 4 1-Positive / 1-Negative Take 2’s Complement Of Negative Number (-9) 11111100 2’s Complement Process 00000011 +1 00000100 11110111 + 00000101 11111100 8th Bit = 1 : Answer is Negative Take 2’s Complement to Check Answer 00001001 11110110 +1 11110111 2’s Complement Process 12 Negative / Negative Combination Negative / Negative Negative Answer (-9) + (-5) - 14 2-Negative Take 2’s Complement Of Both Negative Numbers 11110111 + 11111011 2’s Complement Numbers, See Conversion Process In Previous Slides 1]11110010 8th Bit = 1 : Answer is Negative Disregard 9th Bit Take 2’s Complement to Check Answer 11110010 2’s Complement Process 00001101 +1 00001110 13 2’S Complement Quick Method Example: 11101100 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. 0 001 0 1 0 0 14