Logic Gates
Logic gates are the fundamental building blocks of digital circuits and digital systems. They are devices that perform basic logical operations on one or more binary inputs to produce a single binary output. The operations performed by these gates are based on Boolean algebra, and they are implemented using electronic components like transistors.
Types of Logic Gates:
-
AND Gate ( ∧ ):
- The AND gate outputs 1 only if both of its inputs are 1. If either or both inputs are 0, the output is 0.
- Symbol: A flat-ended shape with two inputs and one output.
- Truth Table:
| A |
B |
A ∧ B |
| 0 |
0 |
0 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
- Example:
- If A = 1 and B = 1, the output is 1 (A ∧ B = 1).
- If A = 0 and B = 1, the output is 0 (A ∧ B = 0).
-
OR Gate ( ∨ ):
- The OR gate outputs 1 if at least one of its inputs is 1. It only outputs 0 if both inputs are 0.
- Symbol: A curved-ended shape with two inputs and one output.
- Truth Table:
| A |
B |
A ∨ B |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
1 |
- Example:
- If A = 0 and B = 1, the output is 1 (A ∨ B = 1).
- If A = 1 and B = 1, the output is 1 (A ∨ B = 1).
-
NOT Gate ( ¬ ):
- The NOT gate, also called an inverter, outputs the inverse of the input. If the input is 1, the output is 0, and if the input is 0, the output is 1.
- Symbol: A triangle with a small circle at the output end.
- Truth Table:
- Example:
- If A = 1, the output is 0 (¬A = 0).
- If A = 0, the output is 1 (¬A = 1).
-
NAND Gate ( ⊼ ):
- The NAND gate is the negation of the AND gate. It outputs 0 only if both inputs are 1, and it outputs 1 for all other combinations of inputs.
- Symbol: An AND gate symbol with a small circle (inversion) at the output.
- Truth Table:
| A |
B |
A ⊼ B |
| 0 |
0 |
1 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
0 |
- Example:
- If A = 1 and B = 1, the output is 0 (A ⊼ B = 0).
- If A = 0 and B = 1, the output is 1 (A ⊼ B = 1).
-
NOR Gate ( ⊽ ):
- The NOR gate is the negation of the OR gate. It outputs 1 only when both inputs are 0, and outputs 0 for all other combinations of inputs.
- Symbol: An OR gate symbol with a small circle (inversion) at the output.
- Truth Table:
| A |
B |
A ⊽ B |
| 0 |
0 |
1 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
0 |
- Example:
- If A = 0 and B = 0, the output is 1 (A ⊽ B = 1).
- If A = 1 and B = 1, the output is 0 (A ⊽ B = 0).
-
XOR Gate ( Exclusive OR ) ( ⊕ ):
- The XOR gate outputs 1 when the inputs are different (i.e., one is 0 and the other is 1). It outputs 0 when both inputs are the same (both 0 or both 1).
- Symbol: Similar to the OR gate, but with an additional curved line on the input side.
- Truth Table:
| A |
B |
A ⊕ B |
| 0 |
0 |
0 |
| 0 |
1 |
1 |
| 1 |
0 |
1 |
| 1 |
1 |
0 |
- Example:
- If A = 1 and B = 0, the output is 1 (A ⊕ B = 1).
- If A = 1 and B = 1, the output is 0 (A ⊕ B = 0).
-
XNOR Gate ( Exclusive NOR ) ( ⊙ ):
- The XNOR gate is the negation of the XOR gate. It outputs 1 when the inputs are the same, and 0 when the inputs are different.
- Symbol: Similar to the XOR gate but with a small circle (inversion) at the output.
- Truth Table:
| A |
B |
A ⊙ B |
| 0 |
0 |
1 |
| 0 |
1 |
0 |
| 1 |
0 |
0 |
| 1 |
1 |
1 |
- Example:
- If A = 0 and B = 0, the output is 1 (A ⊙ B = 1).
- If A = 1 and B = 0, the output is 0 (A ⊙ B = 0).
Summary of Logic Gate Functions:
- AND Gate: Output is 1 only if both inputs are 1.
- OR Gate: Output is 1 if at least one input is 1.
- NOT Gate: Output is the complement of the input.
- NAND Gate: Output is the complement of the AND gate (0 only when both inputs are 1).
- NOR Gate: Output is the complement of the OR gate (1 only when both inputs are 0).
- XOR Gate: Output is 1 if the inputs are different.
- XNOR Gate: Output is 1 if the inputs are the same.
Importance in Digital Systems:
- These gates are used to build combinational circuits like adders, multiplexers, and encoders.
- Sequential circuits like flip-flops and registers use logic gates in conjunction with memory elements to process information.
- Logic gates enable the design of arithmetic operations, data storage, and signal processing in digital computers and electronic systems.