⚡ Digital Design Blog

Part 1 of 10

Digital Logic Basics

The foundation of all digital systems

By Praveen Kumar Vagala

1,089 views

Digital vs Analog

In digital systems, we work with only two values:

This simplicity makes digital circuits reliable and easy to design.

Basic Logic Gates

NOT Gate (Inverter)

Flips the input. 0 becomes 1, 1 becomes 0.

Symbol: Truth Table: A ──►○──► Y A │ Y ──┼─── 0 │ 1 1 │ 0 Y = A' = NOT A = Ā

AND Gate

Output is 1 only when ALL inputs are 1.

Symbol: Truth Table: A ──┬ A │ B │ Y │──D──► Y ──┼───┼─── B ──┘ 0 │ 0 │ 0 0 │ 1 │ 0 1 │ 0 │ 0 1 │ 1 │ 1 Y = A · B = A AND B

OR Gate

Output is 1 when ANY input is 1.

Symbol: Truth Table: A ──┬ A │ B │ Y │)──► Y ──┼───┼─── B ──┘ 0 │ 0 │ 0 0 │ 1 │ 1 1 │ 0 │ 1 1 │ 1 │ 1 Y = A + B = A OR B

XOR Gate (Exclusive OR)

Output is 1 when inputs are DIFFERENT.

Truth Table: A │ B │ Y ──┼───┼─── 0 │ 0 │ 0 0 │ 1 │ 1 1 │ 0 │ 1 1 │ 1 │ 0 Y = A ⊕ B = A XOR B

NAND and NOR Gates

These are "universal gates" - you can build any circuit using only NAND (or only NOR).

GateFunctionOutput
NANDNOT + ANDY = (A · B)'
NORNOT + ORY = (A + B)'

Boolean Algebra

Rules for simplifying logic expressions:

Basic Laws

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, Associative, Distributive

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)

De Morgan's Theorem

Very important for logic simplification!

(A · B)' = A' + B'    (Break the bar, change the sign)
(A + B)' = A' · B'

Karnaugh Maps (K-Maps)

Visual method to simplify Boolean expressions.

2-Variable K-Map

B=0 B=1 ┌─────┬─────┐ A=0 │ 0 │ 1 │ ├─────┼─────┤ A=1 │ 1 │ 1 │ └─────┴─────┘ Group adjacent 1s to simplify: - Bottom row: A (both B=0 and B=1) - Right column: B (both A=0 and A=1) - Result: Y = A + B

4-Variable K-Map

CD 00 01 11 10 ┌────┬────┬────┬────┐ AB 00 │ │ │ │ │ ├────┼────┼────┼────┤ 01 │ │ │ │ │ ├────┼────┼────┼────┤ 11 │ │ │ │ │ ├────┼────┼────┼────┤ 10 │ │ │ │ │ └────┴────┴────┴────┘ Note: Gray code ordering (00,01,11,10) so adjacent cells differ by only 1 bit.

Number Systems

SystemBaseDigitsExample
Binary20, 11010₂ = 10
Octal80-712₈ = 10
Decimal100-910₁₀ = 10
Hex160-9, A-FA₁₆ = 10

Conversions

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₂

Binary Arithmetic

Addition

  0 + 0 = 0
  0 + 1 = 1
  1 + 0 = 1
  1 + 1 = 10 (0 with carry 1)

Example:
    1011  (11)
  + 0110  (6)
  ------
   10001  (17)

2's Complement (for Negative Numbers)

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 ✓

Summary

GateSymbolFunction
NOTY = A'Invert
ANDY = A·BAll inputs 1
ORY = A+BAny input 1
XORY = A⊕BInputs different
NANDY = (A·B)'Universal gate
NORY = (A+B)'Universal gate