Basic Logic Gates
Logic gates are the fundamental building blocks of digital circuits. These gates perform basic logical functions that are essential for processing binary information (0s and 1s). Logic gates take one or more binary inputs and produce a single binary output. They are implemented using transistors and are used in various digital systems like computers, calculators, and other electronic devices.
Here are the basic logic gates and their operations:
1. AND Gate
- Symbol: A flat-ended shape (like a "D") with inputs on the left and output on the right.
- Operation: The AND gate produces a high output (1) only when both of its inputs are high (1). Otherwise, the output is low (0).
Truth Table for AND Gate:
| Input A |
Input B |
Output (A AND B) |
| 0 |
0 |
0 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
Example:
- If A = 1 and B = 1, then the output is 1.
- If A = 1 and B = 0, then the output is 0.
2. OR Gate
- Symbol: A curved shape like a "shield" with inputs on the left and output on the right.
- Operation: The OR gate produces a high output (1) if either input is high (1). It only produces a low output (0) when both inputs are low (0).
Truth Table for OR Gate:
| Input A |
Input B |
Output (A OR B) |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
1 |
Example:
- If A = 1 and B = 0, the output is 1.
- If A = 0 and B = 0, the output is 0.
3. NOT Gate (Inverter)
- Symbol: A triangle with a small circle (representing negation) at the output.
- Operation: The NOT gate takes a single input and inverts it. If the input is 0, the output is 1, and if the input is 1, the output is 0.
Truth Table for NOT Gate:
| Input |
Output (NOT A) |
| 0 |
1 |
| 1 |
0 |
Example:
- If the input A = 1, the output will be 0.
- If the input A = 0, the output will be 1.
4. NAND Gate (NOT AND)
- Symbol: The AND gate symbol with a small circle (representing negation) at the output.
- Operation: The NAND gate is the opposite of the AND gate. It produces a low output (0) only when both inputs are high (1). For all other cases, the output is high (1).
Truth Table for NAND Gate:
| Input A |
Input B |
Output (A NAND B) |
| 0 |
0 |
1 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
0 |
Example:
- If A = 1 and B = 1, the output is 0.
- If A = 0 and B = 0, the output is 1.
5. NOR Gate (NOT OR)
- Symbol: The OR gate symbol with a small circle at the output.
- Operation: The NOR gate is the opposite of the OR gate. It produces a high output (1) only when both inputs are low (0). For all other combinations of inputs, the output is low (0).
Truth Table for NOR Gate:
| Input A |
Input B |
Output (A NOR B) |
| 0 |
0 |
1 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
0 |
Example:
- If A = 0 and B = 0, the output is 1.
- If A = 1 and B = 1, the output is 0.
6. XOR Gate (Exclusive OR)
- Symbol: Similar to the OR gate but with an extra curved line before the output.
- Operation: The XOR gate produces a high output (1) when the inputs are different. It produces a low output (0) when the inputs are the same.
Truth Table for XOR Gate:
| Input A |
Input B |
Output (A XOR B) |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
0 |
Example:
- If A = 1 and B = 0, the output is 1.
- If A = 1 and B = 1, the output is 0.
7. XNOR Gate (Exclusive NOR)
- Symbol: The XOR gate symbol with a small circle (negation) at the output.
- Operation: The XNOR gate is the opposite of the XOR gate. It produces a high output (1) when the inputs are the same (either both 0 or both 1). It produces a low output (0) when the inputs are different.
Truth Table for XNOR Gate:
| Input A |
Input B |
Output (A XNOR B) |
| 0 |
0 |
1 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
Example:
- If A = 1 and B = 1, the output is 1.
- If A = 0 and B = 1, the output is 0.
Summary of Logic Gates:
| Gate |
Symbol |
Operation |
Truth Table Summary |
| AND |
• |
Output is 1 if both inputs are 1, else 0 |
1 if both are 1 |
| OR |
+ |
Output is 1 if either input is 1, else 0 |
1 if any is 1 |
| NOT |
¬ |
Inverts the input |
0 if input is 1, and vice-versa |
| NAND |
• with negation |
Output is 0 only if both inputs are 1 |
1 if not both are 1 |
| NOR |
+ with negation |
Output is 1 only if both inputs are 0 |
1 if both are 0 |
| XOR |
⊕ |
Output is 1 if inputs are different |
1 if inputs are different |
| XNOR |
⊙ |
Output is 1 if inputs are the same |
1 if inputs are the same |
Conclusion:
- Logic gates are the fundamental elements of digital circuits and form the basis for more complex operations in computers.
- Understanding how these gates work and their truth tables is essential for designing and analyzing digital systems.