Chapter Two: Data Representation and Basics of Computer Architecture
Chapter Two: Data Representation and Basics of Computer Architecture
1 0 1 0 1
1 1 0 1 1
1 1 0 0 0 0
04/01/2023 Natnael T. SWEG 2021 25
Binary Subtraction
• Two’s Complement
–To convert an integer to 2’s complement
Take the binary form of the number
00000110 (6 as an 8-bit representation)
Flip the bits: (Find 1’s Complement)
11111001
Add 1 11111001 +1 = 11111010 (2’s complement of 6)
Justification of representation: 6+(-6)=0?
00000110 (6)
+11111010 (2’s complement of 6)
100000000 (0)
•Addition
–Addition is performed by adding corresponding bits
00000111 ( 7)
+00000101 (+5)
00001100 (12)
•Subtraction –Subtraction is performed by adding the 2’s
complement
–Ignore End-Around-Carry
00001100 (12)
+11111011 (-5)
100000111 ( 7)
Example: