The foundation of all digital systems
In digital systems, we work with only two values:
This simplicity makes digital circuits reliable and easy to design.
Flips the input. 0 becomes 1, 1 becomes 0.
Output is 1 only when ALL inputs are 1.
Output is 1 when ANY input is 1.
Output is 1 when inputs are DIFFERENT.
These are "universal gates" - you can build any circuit using only NAND (or only NOR).
| Gate | Function | Output |
|---|---|---|
| NAND | NOT + AND | Y = (A · B)' |
| NOR | NOT + OR | Y = (A + B)' |
Rules for simplifying logic expressions:
Identity: A + 0 = A A · 1 = A
Null: A + 1 = 1 A · 0 = 0
Idempotent: A + A = A A · A = A
Complement: A + A' = 1 A · A' = 0
Involution: (A')' = A
Commutative: A + B = B + A A · B = B · A
Associative: (A+B)+C = A+(B+C) (A·B)·C = A·(B·C)
Distributive: A·(B+C) = A·B + A·C A+(B·C) = (A+B)·(A+C)
Very important for logic simplification!
(A · B)' = A' + B' (Break the bar, change the sign)
(A + B)' = A' · B'
Visual method to simplify Boolean expressions.
| System | Base | Digits | Example |
|---|---|---|---|
| Binary | 2 | 0, 1 | 1010₂ = 10 |
| Octal | 8 | 0-7 | 12₈ = 10 |
| Decimal | 10 | 0-9 | 10₁₀ = 10 |
| Hex | 16 | 0-9, A-F | A₁₆ = 10 |
Binary to Decimal:
1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10
Decimal to Binary (divide by 2):
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders bottom-up: 1010₂
Hex to Binary (each hex digit = 4 bits):
A₁₆ = 1010₂
F₁₆ = 1111₂
3₁₆ = 0011₂
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (0 with carry 1)
Example:
1011 (11)
+ 0110 (6)
------
10001 (17)
To get -N from N:
1. Flip all bits (1's complement)
2. Add 1
Example: -5 in 4-bit
5 = 0101
Flip: 1010
Add 1: 1011 = -5
Why? So that 5 + (-5) = 0:
0101 + 1011 = 10000 (overflow ignored) = 0000 ✓
| Gate | Symbol | Function |
|---|---|---|
| NOT | Y = A' | Invert |
| AND | Y = A·B | All inputs 1 |
| OR | Y = A+B | Any input 1 |
| XOR | Y = A⊕B | Inputs different |
| NAND | Y = (A·B)' | Universal gate |
| NOR | Y = (A+B)' | Universal gate |