Full Adder modified to make Full Subtractor

  • Thread starter mm391
  • Start date
  • Tags
    Adder
In summary, if you want to make an eight bit full subtractor, you would put an inverter at the carry in input for the first full adder and then an inverter on one of each of the two inputs going into each adder.
  • #1
mm391
66
0
If I was to make a modification to an 8 bit full adder to make it a an eight bit full subtractor would I put an inverter at the carry in input for the first full adder and then an inverter on one of each of the two inputs going into each adder. eg an inverter on A3, A2, A1, A0 and leave B3, B2, B1, B0 alone? (Where 0=add, 1=subtract).

Thanks for your help.

Matt
 
Engineering news on Phys.org
  • #2
Let's see, if A and B are bit vectors A+B = A xor B + 2* A and B.
With a carry input you add it in: A+B w/C = A xor B + 2*A and B + Cin. Overflow in the 2nd addition is the carry output.

-A = not A +1, (two's complement)[edited]
B-A = Not A + B + 1 = not A xor B + 2* not A and B + 1
Invert A yes.

I'm not clear on the role of carry input for subtraction. It is a borrow, right? So it represents a -1 from the lower word and the output carry will represent a -2^4 to be borrowed from the higher bits or in the end a negative flag.

So yes I think you have it right: B - A w/C = not A xor B + 2*(not A and B) + (1-C)
1-C = not C since this is a 1-bit term.

(I'm working this out using bitwise boolean operations.)

It's been a while since I played with machine level arithmetic. What I suggest is that you work through, bit by bit a few examples and see if the result is as you expect.
 
  • #3
jambaugh said:
Let's see, if A and B are bit vectors A+B = A xor B + 2* A and B.
With a carry input you add it in: A+B w/C = A xor B + 2*A and B + Cin. Overflow in the 2nd addition is the carry output.

-A = not A +1, (two's complement)[edited]
B-A = Not A + B + 1 = not A xor B + 2* not A and B + 1
Invert A yes.

I'm not clear on the role of carry input for subtraction. It is a borrow, right?

no, it's still a carry or "borrow-not".

it's simple. say you have a full adder, where the carry-out bit of one added bit goes into the carry-in bit if the added bit that is adjacent and more significant. for the LSB, the carry in is set to 0 for simple adding, and you set it to 1 for simple subtraction.

you can make the same adder work for adding and subtracting by putting XOR gates in front of the B input bits and the same line (called the "M" input in the diagram cited) that goes into the other input of the XOR gate (that when set to 1, it complements all of the bits going into the B input) that same line goes into the carry-in of the least significant bit to be that added "1" when doing the two's complement. so it's 0 for add and 1 for subtract.

there's a simple diagram at:

http://implement-logic.blogspot.com/2011/11/binary-parallel-addersubtractor.html

and to fill in the FA block, use:

http://en.wikipedia.org/wiki/File:Full_Adder.svg
 

1. What is a Full Adder modified to make a Full Subtractor?

A Full Adder modified to make a Full Subtractor is a digital circuit that performs subtraction by taking two binary numbers as input and produces their difference as output. It is an enhanced version of a Full Adder circuit, which is typically used for addition in digital electronics.

2. How does a Full Adder modified to make a Full Subtractor work?

This circuit works by using two's complement arithmetic, where the second input (subtrahend) is first converted into its negative using a complementing circuit. The two numbers are then added using a Full Adder, and the carry-out bit is discarded. The resulting sum is the difference between the two original numbers.

3. What are the advantages of using a Full Adder modified to make a Full Subtractor?

One advantage is that it can perform both addition and subtraction using the same circuit, making it more efficient in terms of space and cost. It also allows for more complex operations, such as cascading multiple circuits to perform larger subtractions.

4. Are there any limitations of using a Full Adder modified to make a Full Subtractor?

One limitation is that it can only perform subtraction on binary numbers, so it cannot be used for other types of numbers, such as decimal numbers. It also requires some additional circuitry, such as a complementing circuit, which adds to the complexity of the overall system.

5. How is a Full Adder modified to make a Full Subtractor different from a Full Adder?

A Full Adder modified to make a Full Subtractor differs from a Full Adder in that it has one less input (carry-in) and one less output (carry-out). It also has an additional complementing circuit for the subtrahend input. Other than that, the two circuits are similar in terms of their design and operation.

Similar threads

  • Electrical Engineering
Replies
6
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
820
Replies
7
Views
34K
  • Calculus and Beyond Homework Help
Replies
1
Views
987
  • Electrical Engineering
Replies
10
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
5K
  • Linear and Abstract Algebra
Replies
5
Views
2K
  • General Math
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top