|
Prerequisite : Half Subtractor Introduction : Here we have two inputs A, B and two outputs Difference, Borrow. The values of Difference and borrow will depend on A and B . The truth table for Half Subtractor is The Difference is calculated by XOR operation of A and B and the borrow is calculated by And operation of Ā and B. Here Ā is NOT operation of A which gives inverse output. Logical Expression : Difference = A XOR B Borrow = Ā AND B Examples – Input : A=1, B= 0 Output: Difference=1, Borrow=0 Explanation : Here from logical expression Difference = A XOR B i.e 1 XOR 0 = 1, and Ā = NOT(A) i,e NOT(1) = 0. So, Borrow=Ā AND B i.e 0 AND 0 = 0. Input : A=0, B= 1 Output: Difference=1, Borrow=1 Explanation: Here from logical expression Difference=A XOR B i.e. 0 XOR 1 =1 and Ā = NOT(A) i,e NOT(0) = 1. So, Borrow=Ā AND B i.e 1 AND 1 = 1. Approach :
C++
Output : Difference = 1 Borrow = 0 |
Reffered: https://www.geeksforgeeks.org
Digital Logic |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |