HP Forums

Full Version: Implement 'AND' function with 'XOR' function.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hi, everybody!

I appreciate it if someone could tell me how to implement 'AND' function with 'XOR' function.

Best regards,

email: td@chem.ch.huji.ac.il

I'm almost 100% sure you can't. 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.

You can of course make and AND function from the following:


This is not as silly as it seems as in transistor logic a NOR gate can be smaller/faster than an AND gate (which is made from an NAND gate followed by an inverter).

Please feel free to correct me on any of the above if I have made an error.

What are you up to now ???????????


It can also be accomplished with an OR and two XORs.

	| = OR  ^ = XOR

x ^ y ^ (x | y)

The logical reason an OR is required is that an XOR is derived from two ANDs, two NOTs, and an OR (or a logical equivalent thereof):

	(x & !y) | (!x & y)
So, if an AND is desired, the OR must be factored out which, of course, requires an OR operation.

If you were to bu trying to build an AND function from XOR gates, then it is indeed possible.

Imagine an XOR gate with one input held in a logic 1 state. The gate then acts as an inverter. Similarly, if the input is held low it acts as a non-inverting buffer.

Using an additional 2 diodes, and a resistor allows you to "wire-AND" the outputs of two buffers, and then buffer the output.

Depending on the nature of the surrounding logic, you could even dispense with the XOR gates :-)