How does a Full Subtractor subtract?

Thread Starter

xEnOnn

Joined Feb 2, 2011
25
In a full subtractor, why does A=0, B=1, gives outputs of a difference=1 and Borrow Out=1?

How is it being subtracted? 0-1, with Borrow In=0, is just 0 minus 1. How did the difference become 1?

Also, when A=0 and B=1, with Borrow In=1, why is the difference=0 and borrow out=1?
 

Georacer

Joined Nov 25, 2009
5,182
In the decimal system, the maximum of a digit is 9 and when that is overflowed, a unit (a 1) is added to the borrow of the next figure.
That means that 100-1 gives 9 (the maximum) in the difference's first figure and a 1 in the borrow.
Also in the subtraction picture the case 100-91. This results in 009. Here you had a case where a non-zero figure (9) given a non-zero borrow (1) subtracted from a zero figure (0) resulted in a zero (0).

In the Boolean system, things aren't so different. The maximum figure is 1 and overflow works in the same way.
0-1 works in the same way as in the decimal system. You drop 0 down a notch, resulting in the maximum figure (1 here, 9 in the decimal) and you increase the borrow by 1. If the borrow has reached the end of the operation, that hints that the result will be negative.
Additionally, when you have 0-1, with a borrow, it means that you need to decrease the resulting figure twice. That is 0 becomes 1 and gives a borrow of 1, and then it decreases again, becoming 0 with a borrow of 1. If you needed to reduce it once more, you would make it a 1 again, but increase the borrow to 10 (2).

It sound confusing, but it's actually a matter of seeing the new perspective.
 

Thread Starter

xEnOnn

Joined Feb 2, 2011
25
thanks. this works when calculating on paper but when put into a full subtractor, but i am still confused.
When...
A=0, B=1, Borrow-In=0,
Since this is the initial round, the borrow-in is zero.
But how does 0-1=1 and Borrow-Out=1 when the Borrow-In is 0 and does not "top-up" any value to input A to minus B?

Similarly, when...
A=0, B=1, Borrow-In=1,
Now, Borrow-In is equals to 1 and A=0+Borrow-In=0+1=1. So isn't the outputs Difference=A-B=0 and Borrow-Out=0 too? But the truthtable shows difference=0 and borrow out=1 instead.
 

Georacer

Joined Nov 25, 2009
5,182
I can't say that I understand the first paragraph.

Maybe you can think of it this way: When you do 0-1, you borrow one 1 in the next figure (that is two units) to do the operation (10-01=01) and then give it back in the borrow-out.

When you do 0-1-1, you also borrow only one 1to do the subtraction (10-10=00) and then give it back.

The results for both of the cases are 0-1-0: D=1, B=1
and for the second one: 0-1-1: D=0, B=1.

If you are not sure about what you should get as a result, you can read here:
http://en.wikipedia.org/wiki/Full_subtractor#Full_subtractor
 
Top