Tuesday 9 October 2012

Designing subtractor using adder

If we have an adder block and we wish to design a subtractor using this block
Or we can say that if we want an adder to operate like a subtractor, we will have to understand the truth tables and interconversion of both adder as well as subtractor
Truth table of an adder
A    B    sum    carry
0      0      0          0
0      1      1          0
1      0      1          0
1      1      0          1
Truth table of a subtractor
A     B      difference      borrow
0     0             0                       0
0     1             1                       1
1     0             1                       0
1     1             0                       0
From these Truth tables we can see that for inputs A and B ,sum =difference,
and only the carry is to be changed and should be made equal to the borrow  output.
If we xor carry and input B we will get the borrow at the output and our adder will function like a subtractor.
Truth table of xor gate
A     B       output
0     0             0
0     1             1
1     0             1
1     1             0
B (xor) carry =borrow
Truth table is as shown below
B      carry     output
0          0               0
1          0               1
0          0               0
1          1               0
Hence we get the borrow at the output.
Now our adder is ready to work like a subtractor.

No comments:

Post a Comment