I have a problem of adding two numbers in base of two's complement (6 bits!!!)
1100(2's C) + 0101(2's C)
I notice that the first number is starting with 1 which means it's negative
but since it's 6 bits, I have to change those two numbers into 6 bits and I have no clue how to find those numbers in 6 bits..
I need help please
Thank You
Best Answer
1100 in four bits is -4
extending this to 6 bits, do sign extension to the left, adding 1's because the left bit above is 1, and get 111100
this is still -4 in two's complement
0101 is 5 in decimal
extending it to the left, adding 0's, because the left bit is 0, and get 000101
adding these two together:
the carry bit (first one on the left) is discarded.
The result then is just 1, which matches adding in decimal, -4 + 5 = 1.