Skip to main content

Posts

Showing posts from September, 2021

How binary complements give difference? #Insight #OpenLearn

Source: unsplash.com The Binary subtraction of two numbers, as you know consists of adding one number to complement of the other. The complement can be a 2s or 1s complement. Consider the subtraction with 2s complement. After adding with 2s complement of the other number, there are two cases:-  If carry occurs, ignore it, and the answer is the difference required. If carry does not occur, find the 2s complement of the result to get the magnitude of difference, and add a negative sign to answer... Now, we just go a little deep and try to make a sense of why these rules are framed...   Let A and B the two binary numbers of n bits, and we need to find A - B, which we do by finding 2s complementing of B and adding it to A We can write the expression as:-  A + 2s complement of B = A + (2 n - B)  = A - B + 2 n   Based on A is greater or lesser than B, we have two cases :- Case I: If A > B A - B + 2 n   = (A - B) + 2 n =  (required value) + 2 n Thus A -...

About the XAND..

 We have different kind of basic digital gates, such as NOT, AND, OR and the Universal gates. Besides those we knew about the XOR ( Exclusive-OR ) logic. But why are we not informed about XAND ( Exclusive-AND )..? To know about XAND possibility, let us see about the genesis of XOR.. The idea behind XOR gate: Consider we have two inputs and an output. The OR gives output logic '1' if at least one input is logic '1', and the truth table, as we know, looks like: A B Y = A OR B 0 0 0 0 1 1 1 0 1 1 1 1 To recognize the case of only one input getting '1', we are "excluding" the case of both events getting '1', creating the Exclusive-OR (So, the XOR truth table output is '0' if both inputs are '1'). A B Y = A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 What about the XAND then..? If we adapt same explanation for the AND gate as well, we have to remove the case of getting A and B as '1' at the same time. In that case, we do not have any outp...