N
A
N
D
and
N
O
R
gates are said to be the building block gates of all digital logic circuits because all other logic gates can be implemented using only the combinations of multiple
N
A
N
D
or
N
O
R
gates.
What is the minimum number of N A N D gates needed to implement X O R logic?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The written formula with N A N D s does contain 5 occurrences of N A N D . However, a silly mistake on my part, not realizing that I did not need to calculate r twice.
I answered 5, because i didn't noticed i had a shared term in the final result. a X O R b = a . b + a . b = a . a + a . b + a . b + b . b = a ( a + b ) + b ( a + b ) = a ( a + b ) + b ( a + b ) = a ( a + b ) . b ( a + b ) = a ( a + b ) . b ( a + b ) = a ( a . b ) . b ( a . b ) = a N A N D ( a N A N D b ) ) N A N D ( b N A N D ( a N A N D b ) )
Problem Loading...
Note Loading...
Set Loading...
The algebraic versions of the logic gates in question are, for inputs p , q
N A N D ⟷ 1 − p q
X O R ⟷ p + q − 2 p q
Let r = 1 − p q , which is the output of the first N A N D gate. Then
p ′ = 1 − r p
q ′ = 1 − r q
are the outputs of two more N A N D gates. From these, we use 1 more N A N D gate with the output
1 − p ′ q ′
When expanded, this works out to
p + q − p q − p 2 q − p q 2 + 2 p 2 q 2 − p 3 q 3
which, after eliminating the exponents (making them all 1 ), reduces to
p + q − 2 p q
which is the algebraic version of the X O R gate. Hence 4 N A N D gates are used. The solution leads from the fact the terms p and q must be introduced in order to emulate an X O R gate.
Note: These algebraic equivalents are based on T r u e ⟷ 1 and F a l s e ⟷ 0
Note also: This approach isn't orthodox.