Logic Gates


On this page we will construct every one of the 16 two-input logic gates from only NAND gates.
 

A and B

The logic gates 0011 (A) and 0101 (B) are the simplest to construct, as they don't need any NAND gates:

NOT A and NOT B

The logic gates 1100 (NOT A) and 1010 (NOT B) are also very simple, as they are the inverse gates of A and B. Note that the inverse of a logic gate is just the same but with a NAND gate at the end to reverse the output:

NAND and AND

The logic gates 1110 (NAND) and 0001 (AND) are also each other's inverse:

A IMPLIES B and B IMPLIES A

The logic gates 1011 (A IMPLIES B) and 1101 (B IMPLIES A) both require two NAND gates, and are equivalent to A NAND (NOT B) and (NOT A) NAND B respectively:

B AND NOT A and A AND NOT B

The logic gates 0100 (B AND NOT A) and 0010 (A AND NOT B) are the inverses of A IMPLIES B and B IMPLIES A respectively:

OR and NOR

The logic gates 0111 (OR) and 1000 (NOR) are next. OR is equivalent to (NOT A) NAND (NOT B), and NOR is its inverse:

TRUE and FALSE

The logic gates 1111 (TRUE) and 0000 (FALSE) have constant outputs. To do this, we can use A NAND (NOT A) and its inverse:

XOR and XNOR

The logic gates 0110 (XOR) and 1001 (XNOR) are the most complicated ones. XOR is equivalent to (B IMPLIES A) NAND (A IMPLIES B), and XNOR is its inverse:



© Rujul Nayak 2024