Unit 3 - Notes

ECE249 6 min read

Unit 3: Introduction to number system and logic gates

1. Number Systems

A number system defines a set of values used to represent quantity. In digital electronics, we primarily use four systems based on their "Radix" or "Base" (the number of unique digits used).

1.1 Classification of Number Systems

System Base (Radix) Symbols / Digits Example
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal 16 0-9, A(10), B(11), C(12), D(13), E(14), F(15)

1.2 Number System Conversions

A diagram illustrating the pathways for Number System Conversions. A central hub labeled "Decimal (B...
AI-generated image — may contain inaccuracies

A. Decimal to Any Base (Base-10 Base-)

  • Integer Part: Perform Successive Division by the destination base and record the remainders in reverse order (Bottom to Top).
  • Fractional Part: Perform Successive Multiplication by the destination base and record the integer carry in forward order (Top to Bottom).

B. Any Base to Decimal (Base- Base-10)

Use the Sum of Weights method. Multiply each digit by its positional weight () and sum them up.

  • Example:

C. Binary Octal Hexadecimal

  • Binary Octal: Group bits in sets of 3 starting from LSB. Convert each group to decimal.
  • Binary Hex: Group bits in sets of 4 starting from LSB. Convert each group to Hex digit.
  • Octal/Hex Binary: Convert each digit to its 3-bit (Octal) or 4-bit (Hex) binary equivalent.

2. Binary Arithmetic and Complements

2.1 Types of Complements

Complements are used to simplify subtraction and signed number representation.

  1. (r-1)'s Complement: Simply invert the digits (e.g., 9's comp for decimal, 1's comp for binary).
  2. (r)'s Complement: (r-1)'s Complement + 1.

2.2 Binary Complements

  • 1's Complement: Invert every bit (Change and ).
    • Ex: 1's comp of $1010$ is $0101$.
  • 2's Complement: Add 1 to the 1's complement.
    • Ex: 2's comp of $1010$ .

2.3 Subtraction using 2's Complement

To perform :

  1. Find the 2's complement of .
  2. Add to the 2's complement of .
  3. Check Carry:
    • If a final carry is generated, discard it. The result is positive.
    • If no carry is generated, the result is negative. Take the 2's complement of the result to get the magnitude.

Example: (using 4-bit binary)


Addition:


Discard carry (1). Result (which is 2).


3. Binary Codes

3.1 BCD (Binary Coded Decimal / 8421 Code)

  • Type: Weighted Code.
  • Each decimal digit (0-9) is represented by its distinct 4-bit binary equivalent.
  • Valid codes: $0000$ to $1001$.
  • Invalid codes: $1010$ (10) to $1111$ (15).

3.2 Excess-3 Code (XS-3)

  • Type: Non-weighted, Self-complementing code.
  • Derivation: Add 3 () to the BCD code.
  • Example: Decimal 5 BCD $0101$ Add $0011$ XS-3 $1000$.

3.3 Gray Code

  • Type: Unit distance code (only one bit changes between successive numbers), Unweighted, Cyclic.
  • Used in rotary encoders to prevent error.

Conversions: Binary Gray

  • Binary to Gray ():
    • MSB remains same ().
    • Other bits are XOR of current and previous binary bit ().
  • Gray to Binary ():
    • MSB remains same ().
    • Other bits are XOR of the calculated previous binary bit and current Gray bit ().

Two logic schematic diagrams placed side-by-side illustrating Binary to Gray and Gray to Binary conv...
AI-generated image — may contain inaccuracies


4. Boolean Algebra and Logic Gates

4.1 Basic Logic Gates

  • AND Gate: Output is High only if all inputs are High. ()
  • OR Gate: Output is High if any input is High. ()
  • NOT Gate: Inverter. Output is opposite of input. ()

4.2 Universal Gates

  • NAND Gate: AND followed by NOT. ()
    • Universal because any logic function can be implemented using only NAND gates.
  • NOR Gate: OR followed by NOT. ()

4.3 Special Gates

  • XOR (Exclusive-OR): Output High if inputs are different. ()
  • XNOR (Exclusive-NOR): Output High if inputs are same. ()

A comprehensive reference chart for Logic Gates containing 7 rows. Each row corresponds to a gate: A...
AI-generated image — may contain inaccuracies

4.4 Boolean Laws

  1. Identity: ,
  2. Null: ,
  3. Idempotent: ,
  4. Inverse: ,
  5. De Morgan's Theorems:
    • Theorem 1: (Break the line, change the sign)
    • Theorem 2:

5. SOP and POS Forms

Standard forms are necessary for Karnaugh Maps.

5.1 Sum of Products (SOP) - Minterms

  • Logic expression is a sum (OR) of product (AND) terms.
  • Example: .
  • Canonical SOP: Each term contains all variables.
  • represented by .
  • Look for output 1 in Truth Table.

5.2 Product of Sums (POS) - Maxterms

  • Logic expression is a product (AND) of sum (OR) terms.
  • Example: .
  • represented by .
  • Look for output 0 in Truth Table.

6. Karnaugh Map (K-Map)

A graphical method to simplify Boolean expressions without complex algebra.

6.1 Structure

  • Based on Gray Code ordering (00, 01, 11, 10) so adjacent cells differ by only 1 bit.
  • 2-Variable: 4 cells.
  • 3-Variable: 8 cells ().
  • 4-Variable: 16 cells ().

6.2 Grouping Rules

  1. Group size: Must be powers of 2 (1, 2, 4, 8, 16).
  2. Priority: Make the largest possible groups first (Octet > Quad > Pair).
  3. Overlapping: Allowed to maximize group size.
  4. Rolling/Wrapping: The map folds (top/bottom and left/right are adjacent).
  5. Redundancy: Do not make a group if all its 1s are already covered by other groups.

A detailed 4-variable Karnaugh Map (K-Map) diagram for variables A, B, C, D. A 4x4 grid layout. Row ...
AI-generated image — may contain inaccuracies

6.3 Simplification Steps

  1. Draw the K-Map structure.
  2. Populate 1s for SOP (or 0s for POS).
  3. Form groups (Quads, Pairs, Octets).
  4. Write the simplified term for each group (Keep variables that do not change state within the group).
  5. OR the terms together for the final expression.

Example (4-Variable SOP):
If a Quad covers cells 5, 7, 13, 15:

  • Row: AB changes from 01 to 11 ( B remains 1)
  • Col: CD changes from 01 to 11 ( D remains 1)
  • Term: