# (A+2)'s compliment of B with shift register

Discussion in 'Homework Help' started by Kelth, Apr 27, 2008.

1. ### Kelth Thread Starter Member

Mar 4, 2008
12
0
Hey all, im having a bit of problems understanding what this particular homework problem means. I have an idea but anyways here is the question:

"Show the logic diagram in order to perform A + 2's Complement of B."

It is in the portion of the book with shift registers so I must use that in my design.

Anyways, what I am having trouble understanding is A+2's complement of B. I just dont understand what it is asking. Is do I take the complement of A and then add 2 (0010)? or Do I take the compliment of B or what or do I add 2 to A then take the compliment. Any ideas?

All feedback is appreciated, thanks.

2. ### flubbo Member

Apr 21, 2008
25
0
Basically, two's compliment involves using the most significant bit as a sign bit. The counting is reversed when the number gets above 2^(nbits - 1)

3 bit signed two's compliment runs in this sequence:
0,1,2,3,-4,-3,-2,-1

the corresponding 3 bit unsigned sequence would be
0,1,2,3,4,5,6,7

To find the Two's compliment, apply a one's compliment and add 1 to the result.