Prerequisite: Half Subtractor in Digital Logic
Given two inputs of Half Adder A, B. The task is to implement the Half Subtractor circuit and Print output i.e Difference and Borrow of two inputs.
The half subtractor is also a building block for subtracting two binary numbers. It has two inputs and two outputs. This circuit is used to subtract two single bit binary numbers A and B. The difference and borrow are the two output states of the half subtractor.
Input: A=0; B=1
Output: Difference: 1
Explanation: According to logical expression Difference=A XOR B i.e 0 XOR 1 =1, Borrow=Ā AND B i.e 1 AND 1 =1
Input: A=1; B=1
Output: Difference: 0
Difference = A XOR B Borrow = Ā AND B
- We take two inputs A and B.
- XOR operation on A and B gives the value of the Difference.
- AND operation on Ā and B gives the value of Borrow.
Difference: 1 Borrow: 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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course