Python Program to implement Full Subtractor
Prerequisite –Full Subtractor in Digital Logic
In this, we will discuss the overview of the full subtractor and will implement the full subractor logic in the python language. Also, we will cover with the help of examples. Let’s discuss it one by one.
Given three inputs of Full Subtractor A, B, Bin. The task is to implement the Full Subtractor circuit and Print output i.e Difference (d) and B-Out of three inputs.
Full Subtractor :
The full Subtractor is a combinational circuit that is used to perform subtraction of three input bits: the minuend, subtrahend, and borrow in. The full Subtractor generates two output bits: the difference and borrow out.
Logical Expression :
Difference = (A XOR B) XOR Bin Borrow Out = Ā Bin + Ā B + B Bin
Truth Table :
Input : 0 1 1 Output : Difference=0, B-Out=1 Explanation : According to logical expression Difference= (A XOR B) XOR Bin i.e (0 XOR 1) XOR 1 =0 , B-Out=Ā Bin + Ā B + B Bin i.e 1 AND 1 + 1 AND 1 + 1 AND 1 = 1 Input : 1 0 0 Output : Difference=1, B-Out=0
- We take three inputs A, B, and Bin.
- Applying (A XOR B) XOR Bin gives the Value of Difference.
- Applying Ā Bin + Ā B + B Bin gives the value of B-Out.
Below is the implementation :
Difference = 0 B-Out = 1
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics. To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.