Nepedia
Back to Discover
Advanced Reader
💻

Subtractor

technology Maturity 7-9 Next article →

In the world of electronics, a subtractor is a digital circuit designed to perform subtraction. It works by processing binary numbers, which are composed of bits. These circuits are essential for arithmetic logic, allowing machines to calculate differences between values. Interestingly, a subtractor can be designed using a very similar approach to a binary adder. While an adder combines values, a subtractor handles the removal of one value from another. This process is a fundamental building block for how computers handle math.

To understand how the mechanism works, we must look at the specific bits involved. In a general calculation for multi-bit numbers, three bits are used for each position. The first is the minuend, which is the number being subtracted from. The second is the subtrahend, which is the number being taken away. The third is the borrow in, which comes from a less significant bit position. These inputs result in two specific outputs: the difference bit and the borrow out bit.

Half Subtractor Vektor
Half Subtractor Vektor

A simple version of this circuit is called a half subtractor. This is a combinational circuit used to subtract exactly two bits. It takes the minuend and the subtrahend as its only inputs. The circuit produces a difference bit and a borrow out signal. The borrow out is specifically set when the subtrahend is greater than the minuend. This signal tells the next digit in a larger calculation that it needs to borrow.

Half subtractor using NAND
Half subtractor using NAND

Logic gates drive the operation of the half subtractor. The difference bit is calculated using an exclusive or (XOR) gate. This gate produces a 1 if the inputs are different and a 0 if they are the same. The borrow out is determined by an AND gate. This gate only outputs a 1 if the subtrahend is 1 and the minuend is 0. This specific logic ensures the circuit follows the rules of binary subtraction accurately.

A more complex version is the full subtractor. This circuit is necessary for multi-bit subtraction because it can handle three input bits. In addition to the minuend and the subtrahend, it accepts a borrow in. This borrow in represents a value taken from a previous, less significant digit. The full subtractor then generates its own difference and borrow out bits.

Full-sub-Fixed
Full-sub-Fixed

The full subtractor follows a specific mathematical process. When a borrow in occurs, it is subtracted from the minuend along with the subtrahend. The formula for this operation is D = X ⊕ Y ⊕ Bin. If a borrow out must be generated, it means the combined value of the subtrahend and borrow in is larger than the minuend. In this case, a value of 2 is added to the current digit. This is very similar to decimal subtraction, where you add 10 when you borrow from the next column.

Engineers often use a clever method to make these circuits more efficient. Instead of building separate subtraction hardware, they use two's complement notation. This notation allows a standard binary adder to perform subtraction. To do this, the circuit only needs to invert the second operand. It also requires an addition/subtraction selector connected to the carry-in. This method is used because it comes at only a small cost to the circuit design.

By combining these elements, digital systems can perform complex arithmetic. The relationship between adders and subtractors shows how different mathematical operations can be linked. Whether using a simple half subtractor or a full subtractor, the logic remains consistent. These circuits allow for the precise, high-speed calculations required by all modern electronic technology.

588 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (3)
File:Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
File:Half subtractor using NAND.jpg
Half subtractor using NAND.jpg
File:Full-sub-Fixed.svg
Full-sub-Fixed.svg
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.