Logic gates perform basic logical functions and are the fundamental building blocks of digital integrated circuits. Most logic gates take an input of two binary values, and output a single value of a 1 or 0. Some circuits may have only a few logic gates, while others, such as microprocessors, may have millions of them. There are seven different types of logic gates, which are outlined below.
In the following examples, each logic gate except the NOT gate has two inputs, A and B, which can either be 1 (True) or 0 (False). The resulting output is a single value of 1 if the result is true, or 0 if the result is false.
- AND - True if A and B are both True
- OR - True if either A or B are True
- NOT - Inverts value: True if input is False; False if input is True
- XOR - True if either A or B are True, but False if both are True
- NAND - AND followed by NOT: False only if A and B are both True
- NOR - OR followed by NOT: True only if A and B are both False
- XNOR - XOR followed by NOT: True if A and B are both True or both False
By combining thousands or millions of logic gates, it is possible to perform highly complex operations. The maximum number of logic gates on an integrated circuit is determined by the size of the chip divided by the size of the logic gates. Since transistors make up most of the logic gates in computer processors, smaller transistors mean more complex and faster processors.