In digital logic, there are **seven basic logic gates** that serve as the fundamental building blocks for designing digital circuits. These gates are used to perform basic operations on one or more binary inputs and produce a single binary output. The seven types of basic gates are:
### 1. **AND Gate**
- **Operation**: The AND gate outputs a **1** (true) only when **both** of its inputs are 1. If either of the inputs is 0, the output will be 0.
- **Symbol**: A flat-ended shape with two inputs and one output.
- **Truth Table**:
| A | B | Output (A AND B) |
|---|---|------------------|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
### 2. **OR Gate**
- **Operation**: The OR gate outputs a **1** (true) if **either** of its inputs is 1. It only outputs 0 when **both** inputs are 0.
- **Symbol**: A curved-ended shape with two inputs and one output.
- **Truth Table**:
| A | B | Output (A OR B) |
|---|---|------------------|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
### 3. **NOT Gate** (Inverter)
- **Operation**: The NOT gate, also known as an inverter, outputs the **opposite** of its input. If the input is 1, the output is 0, and if the input is 0, the output is 1.
- **Symbol**: A triangle pointing to the right with a small circle (representing negation) at the output.
- **Truth Table**:
| A | Output (NOT A) |
|---|----------------|
| 0 | 1 |
| 1 | 0 |
### 4. **NAND Gate**
- **Operation**: The NAND gate is the inverse of the AND gate. It outputs a **0** only when **both** inputs are 1; otherwise, it outputs 1.
- **Symbol**: Similar to the AND gate, but with a small circle (representing negation) at the output.
- **Truth Table**:
| A | B | Output (A NAND B) |
|---|---|-------------------|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
### 5. **NOR Gate**
- **Operation**: The NOR gate is the inverse of the OR gate. It outputs a **1** only when **both** inputs are 0; otherwise, it outputs 0.
- **Symbol**: Similar to the OR gate, but with a small circle (negation) at the output.
- **Truth Table**:
| A | B | Output (A NOR B) |
|---|---|------------------|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
### 6. **XOR Gate** (Exclusive OR)
- **Operation**: The XOR gate outputs a **1** when **either** of its inputs is 1, but not both. If both inputs are the same (either both 0 or both 1), it outputs 0.
- **Symbol**: Similar to the OR gate but with an additional curved line on the input side.
- **Truth Table**:
| A | B | Output (A XOR B) |
|---|---|------------------|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
### 7. **XNOR Gate** (Exclusive NOR)
- **Operation**: The XNOR gate is the inverse of the XOR gate. It outputs a **1** when **both** inputs are the same (either both 0 or both 1) and outputs 0 when the inputs are different.
- **Symbol**: Similar to the XOR gate but with a small circle at the output, indicating negation.
- **Truth Table**:
| A | B | Output (A XNOR B) |
|---|---|-------------------|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
### Summary of Basic Gates and Their Functions:
- **AND Gate**: Outputs 1 only if both inputs are 1.
- **OR Gate**: Outputs 1 if at least one input is 1.
- **NOT Gate**: Inverts the input.
- **NAND Gate**: Outputs 0 only if both inputs are 1 (inverse of AND).
- **NOR Gate**: Outputs 1 only if both inputs are 0 (inverse of OR).
- **XOR Gate**: Outputs 1 if inputs are different.
- **XNOR Gate**: Outputs 1 if inputs are the same (inverse of XOR).
These gates form the foundation of digital circuits, including complex operations like arithmetic, logic, and control functions in computers and other electronic devices. Each gate can be combined to form more complex logic circuits used in processors, memory, and other systems.