Continue to Site

# Confusion with 1's and 2's complement

Status
Not open for further replies.

#### neo_star

##### New Member
Hi

I am a college student.

I have a little confusion with these complements. Of course i know that in '+' and '-' 2's complement is used but is it limited to only '-' and '+'.

What are the places in which the 1's complement is used and what is the reason for not using the 2's complement there.

And finally why do we have 2 kinds of complements in the first place.

Twos compliment lets you add and subtract binary numbers by using adding hardware only. If you used sign-bits you would need extra hardware to deal take the sign bit into account at all stages of the math operation, and you would also need separate subtraction hardware. Using sign bits requires a lot "if-else" type stuff. With twos compliment you just add them.

Is one's compliment even used? I thought they just thought it was taught as a stepping-stone before teaching 2s compliment.

Last edited:
The answer is just a bit deeper. In a parallel adder, it is customary to use twos complement notation and do the addition or subtraction of all bits on one clock cycle.

In a serial adder which computes the sum or the difference one bit at a time it takes one clock cycle for each bit. The ones complement of a number can be computed one bit at a time with a single inverter. The carry out of the most significant position is added to the result to get the final answer. This is called the end around carry.

In the TTL logic of the 1970s we did this by using a counter for the destination register. The end-around carry would increment the counter in one clock cycle or not depending on its value. For an 8-bit ALU we had 10 clock cycles at 8 MHz. for 1.25 usec per instruction.

Status
Not open for further replies.

Replies
53
Views
8K
Replies
41
Views
7K
Replies
8
Views
2K
Replies
9
Views
3K
Replies
15
Views
1K