Assume 4 bit register are used Evaluate 0xB 0x3 using twos
Assume 4 bit register are used. Evaluate 0xB - 0x3 using twos complement arithmetic.
What is the final value in decimal.
Solution
ASCII code 8 4 2 1
0xB in binary 1 0 1 1
0x3 in binary 0 0 1 1
need to find complement for -0x3
so by changing 1\'s to 0\'s and 0\'s to 1\'s
1 1 0 0
Now adding 0xB and 0x3
0xB 1 0 1 1
0x3 + 1 1 0 0
-----------------------------
overflow -->1 0 1 1 1
overflow occurs sum of the most significant produce the carry forward. it will cancel out.
now convert 1\'s complement into real number
carry 1 1 1
0 1 1 1
+ 1
-------------
1 0 0 0
Result is 1000 == 8 (decimal)
verfiy 11 - 3 = 8
