Logic gates are the building blocks of digital circuits. They process binary inputs to produce binary outputs based on specific rules. AND, OR, and NOT gates are fundamental, while XOR and XNOR offer more complex operations.
NAND and NOR gates are special because they're universal. This means you can use combinations of just NAND gates or just NOR gates to create any other logic function. They're super versatile in circuit design.
Basic Logic Gates
AND and OR Gates
- AND gate outputs a 1 only if all inputs are 1, otherwise outputs 0
- Represented by the Boolean expression $Y = A \cdot B$ where $Y$ is the output and $A$ and $B$ are inputs
- Truth table for a two-input AND gate:
- OR gate outputs a 1 if at least one input is 1, otherwise outputs 0
- Represented by the Boolean expression $Y = A + B$ where $Y$ is the output and $A$ and $B$ are inputs
- Truth table for a two-input OR gate:
NOT, XOR, and XNOR Gates
- NOT gate, also known as an inverter, outputs the opposite of its input (0 becomes 1, 1 becomes 0)
- Represented by the Boolean expression $Y = \overline{A}$ where $Y$ is the output and $A$ is the input
- XOR (exclusive OR) gate outputs a 1 if exactly one input is 1, otherwise outputs 0
- Represented by the Boolean expression $Y = A \oplus B$ where $Y$ is the output and $A$ and $B$ are inputs
- XNOR (exclusive NOR) gate outputs a 1 if both inputs are the same (both 0 or both 1), otherwise outputs 0
- Represented by the Boolean expression $Y = \overline{A \oplus B}$ where $Y$ is the output and $A$ and $B$ are inputs
Universal Gates
NAND and NOR Gates
- NAND (NOT-AND) gate outputs a 0 only if all inputs are 1, otherwise outputs 1
- Can be used to create any other logic gate (AND, OR, NOT, XOR, XNOR) by combining multiple NAND gates
- Truth table for a two-input NAND gate:
- NOR (NOT-OR) gate outputs a 1 only if all inputs are 0, otherwise outputs 0
- Can also be used to create any other logic gate by combining multiple NOR gates
- Truth table for a two-input NOR gate:
Logic Circuits
Combinational and Sequential Logic
- Logic circuit is a collection of interconnected logic gates that performs a specific function
- Combinational logic circuits have outputs that depend only on the current inputs (no memory)
- Examples include adders, multiplexers, and decoders
- Sequential logic circuits have outputs that depend on both the current inputs and the previous state (memory)
- Require a clock signal to synchronize the operation of the circuit
- Examples include flip-flops, counters, and shift registers
- Combinational and sequential logic circuits can be combined to create more complex digital systems (computers, microcontrollers)