问题
I want to know that if I can implement or,and
functions using only xor
. I think It is impossible but I need to prove that. Any ideas?
Thanks in advance.
回答1:
You cannot implement OR or AND gate only by using XOR because it is not a universal gate.
Also the XOR function can't tell the difference between '1,1' and '0,0' at it's inputs. Inverting the inputs/output in whatever combination makes a new gate with an XOR or XNOR function.
Here is an argument against XOR and XNOR as universal gates.
An XOR gate is a parity generator. Cascading parity generators always produce parity generators. AND and OR are not parity functions.
An XOR gate can be used as an inverter. An XNOR gate is an XOR followed by an inverter, so it is also a parity generator.
回答2:
Yes, we can make other Gates using just XOR gate. But its inadvisable as each XOR gate will use atleast 6 to 8 MOSFETS. Also, I will be assuming Open Drain gate designs so that we can use wired ANDing. Else it is impossible to make any Gate apart from NOT and XNOR using just XOR gates. Coming back to your question:
NOT GATE: Easiest one NOT GATE
OR GATE: A bit tricky but doable using wired AND. OR GATE
AND GATE: Can be done in 2 ways:
(1) Wired AND: Since we already have access to wired AND.
(2) Gates: This will improve drive strength but eat up gates. It’s basically bubbled OR followed by a Not Gate.
So to answer your question in brief: It’s not possible to design using purely logic because of the nature of XOR. It cannot differentiate between inputs as both ‘0’ and both ‘1’. But as you can see at transistor level it can be solved.
来源:https://stackoverflow.com/questions/19197416/implementing-or-and-using-xor