Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
1.
Introduction
2.
Half Subtractor
3.
Full Subtractor
3.1.
Logical expression for Full Subtractor
4.
Parallel Subtractor
5.
N-bit Parallel Subtractor
5.1.
4 - bit Parallel Subtractor
6.
FAQs
7.
Key Takeaways
Last Updated: Mar 27, 2024

Subtractor

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

Combinational Circuits (CC) are circuits made of several logic gates: decoder, encoder, multiplexer, Demultiplexer, etc. In any electronic circuit, we have a basic block called logic gates. At a given time, the value of input tells the output of the combined circuit. The circuits do not use any memory or storage device. There are two types of combinational circuits -

• Subtractor

Here in this blog, we will focus on Subtractors. For subtracting one number from another, we use subtractors. We also use 1's and 2's complement for this purpose as we are dealing with binary numbers. For basic subtraction, we have three bits which are -

• Minuend (A): It is a number from which another number gets subtracted.
• Subtrahend (B): It is a Number that gets subtracted.
• Borrow (Bi): We get it from the last bit as input.

The outputs are -

• Difference (D)
• Borrow bit (Bout)

Half Subtractor

We use a half subtractor when we have to do subtraction between two bits. Also, it gives two outputs, which are the difference and borrow. In the following image, half subtractor's combinational circuit is represented with half subtractor table -

Logical expression for Half subtractor is -

``````D = A'B + AB' (A XOR B)
Bout = A'B``````
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Full Subtractor

When subtracting between three bits, we use a full subtractor: the minuend, the subtrahend, and the borrow-in bits. Also, it gives two outputs, which are the difference and borrow-out. The full adder overcame the disadvantage of the Half subtractor.

Logical expression for Full Subtractor

Truth table -

K-map for difference and borrow -

``````D   = Aâ€™Bâ€™Bin + Aâ€™BBinâ€™ + ABâ€™Binâ€™ + ABBin
= Bin(Aâ€™Bâ€™ + AB)  + Binâ€™(ABâ€™ + Aâ€™B)
= Bin( A XNOR B) + Binâ€™(A XOR B)
= Bin (A XOR B)â€™  +  Binâ€™(A XOR B)
= Bin XOR (A XOR B)
= (A XOR B) XOR Bin

Bout = Aâ€™Bâ€™Bin + Aâ€™BBinâ€™ + Aâ€™BBin + ABBin
= Aâ€™Bâ€™Bin +Aâ€™BBinâ€™ + Aâ€™BBin + Aâ€™BBin + Aâ€™BBin + ABBin
= Aâ€™Bin(B + Bâ€™) + Aâ€™B(Bin + Binâ€™) + BBin(A + Aâ€™)
= Aâ€™Bin + Aâ€™B + BBin

OR

Bout = Aâ€™Bâ€™Bin + Aâ€™BBinâ€™ + Aâ€™BBin + ABBin
= Bin(AB + Aâ€™Bâ€™) + Aâ€™B(Bin + Binâ€™)
= Bin( A XNOR B) + Aâ€™B
= Bin (A XOR B)â€™ + Aâ€™B``````

Full subtractor using two half subtractor-

Parallel Subtractor

For finding arithmetic differences between two binary digits, we use a digital circuit called parallel subtractor that is greater than one bit by performing concurrent operations on appropriate pairs of bits. In several ways, we can design parallel subtractors, for example, by the combination of half and full subtractor, all full subtractor, etc.

N-bit Parallel Subtractor

We can carry out the subtractor by taking the 1's or 2's complement of the number. For example, if we want to subtract A from B (A-B), we can add their 1's or 2's complement. So we can do binary subtraction with the help of a binary adder.

4 - bit Parallel Subtractor

To obtain the 1's complement, the number subtracted is passed through the inverter first. Then to produce subtraction addition of A and 2's complement of B is done by the 4-bit adder. The result of binary subtraction A-B is represented by S3, S2, S1, S0, and output Cout is carried out, representing the result's polarity. If A > B, Cout = 0, and the result of the binary form (A-B) are in the 2's complement form; otherwise, Cout = 1 and the result is in the binary form (A-B).

FAQs

1. What is 1's complement?
We can obtain the ones' complement of a binary number's value by inverting all the bits in the number's binary representation.

2. What is 2's complement?
It is a mathematical operation on binary numbers. It is an example of a radix complement. An N-bit number's two's complement is defined as its complement concerning 2^N; the sum of a number and its two's complement equals 2^N.

3. What are the advantages of using combinational circuits?
Here the present input decides the output.
Fast speed
Time independent
Easy to use as designed well with fundamental building blocks: logic gates

4. What is the advantage of a parallel subtractor?
All bits are subtracted simultaneously, which means output is provided at the same time. For the same reason, it is faster also less costly.

5. What is the disadvantage of a parallel subtractor?
Each adder must wait for the carry to be created by the preceding adder in the chain.

Key Takeaways

In this blog, we learned about Subtractors. Don't come to a halt here. Check out our Introduction to Sequential Circuits - Coding Ninjas Coding Ninjas Studio. You can also check out the Introduction to Combinational Circuits - Coding Ninjas Coding Ninjas Studio and Adder blogs. Check out more blogs here.

Happy Learning!

Live masterclass