Constrtucting Logic Gates From NAND Gates
There really is only one logic gate, from which all other logic gates can be constructed. This most basic logic gate is the NAND gate. The diagrams below show how other logic gates may be constructed from NAND gates.
An OR gate is constructed from three NAND gates, with the inputs to the first two being used twice.
An OR gate is constructed from four NAND gates, by putting the output from the above circuit through another NAND gate, using the output twice.
AN XOR gate is constructed from five NAND gates.
AN XOR gate is constructed from five NAND gates by putting a NAND gate using the output from the above circuit twice – making this last NAND gate act like a NOT gate.