Unit 1 - Notes

ECE213 6 min read

Unit 1: Number Systems

1. Introduction: Digital Systems and Logic

Analog vs. Digital Systems

  • Analog Systems: Process signals that are continuous in both time and amplitude.
    • Example: Audio signals, temperature sensors, classical clocks.
    • Characteristics: Susceptible to noise; difficult to store and process with precision.
  • Digital Systems: Process signals that are discrete. They represent information using a finite set of distinct values (usually two: 0 and 1).
    • Example: Computers, smartphones, digital watches.
    • Characteristics: High noise immunity, easy storage, programmable, reproducible accuracy.

Implementation of Digital Systems

  • Logic Circuits: The fundamental building blocks of digital systems. They manipulate binary information based on logic rules (AND, OR, NOT).
  • Levels of Integration: Digital systems are implemented using Integrated Circuits (ICs), ranging from SSI (Small Scale Integration) to VLSI (Very Large Scale Integration).

2. Positional Number Systems

A positional number system represents values using an ordered set of digits where the value of each digit depends on its position.

Key Concepts

  • Radix (Base, ): The number of unique digits used in the system.
  • Weights: The multiplier associated with each position (e.g., ).
  • Formula: Value =

Common Number Systems

Binary Number System (Base 2)

  • Digits: 0, 1.
  • Application: The native language of digital circuits (Switches: OFF=0, ON=1).

Octal Number System (Base 8)

  • Digits: 0, 1, 2, 3, 4, 5, 6, 7.
  • Application: Shorthand for binary (grouping 3 bits). Used in legacy computing (e.g., PDP-8) and file permissions (Unix).

Hexadecimal Number System (Base 16)

  • Digits: 0-9 and A, B, C, D, E, F (where A=10, ..., F=15).
  • Application: Standard shorthand for binary (grouping 4 bits). Used in memory addressing, color codes, and assembly language.

3. Methods of Base Conversions

Decimal to Any Base ()

  1. Integer Part (Successive Division):
    • Divide the decimal number by the target base .
    • Record the remainder.
    • Repeat with the quotient until it reaches 0.
    • Read remainders from bottom to top.
  2. Fractional Part (Successive Multiplication):
    • Multiply the fraction by base .
    • Record the integer part.
    • Repeat with the new fractional part.
    • Read integers from top to bottom.

Any Base () to Decimal

  • Sum of Weights Method: Multiply each digit by its positional weight () and sum the results.
    • Example (Hex to Dec): .

Binary Octal

  • Binary to Octal: Group bits into sets of 3 starting from the radix point (LSD). Convert each group to its Octal equivalent.
  • Octal to Binary: Convert each Octal digit into a 3-bit binary block.

Binary Hexadecimal

  • Binary to Hex: Group bits into sets of 4 starting from the radix point. Convert each group.
  • Hex to Binary: Convert each Hex digit into a 4-bit binary block.

4. Arithmetic Operations

Binary Arithmetic

  • Addition:
    • (Carry 1)
    • (Carry 1)
  • Subtraction:
    • (Borrow 1 from the next higher bit)

Octal Arithmetic

  • Addition: Add digits normally. If sum , subtract 8 to get the sum digit and generate a carry of 1.
    • Example: . (Sum), Carry 1. Result: .
  • Subtraction: If borrowing is needed, you borrow "8" (the base) from the next column.

Hexadecimal Arithmetic

  • Addition: Add digits. If sum , subtract 16 and carry 1.
    • Example: . , Carry 1. Result: .
  • Subtraction: If borrowing is needed, you borrow "16".

5. Complements and Signed Numbers

To perform subtraction using adder circuits and to represent negative numbers, we use complements.

Types of Complements

  1. 's Complement:
    • Decimal (9's comp): Subtract each digit from 9.
    • Binary (1's comp): Invert every bit ().
  2. 's Complement:
    • Formula: 's Complement = 's Complement + 1.
    • Binary (2's comp): Invert bits and add 1 to the LSB.

Representation of Signed Numbers

How digital systems store negative integers:

  1. Sign-Magnitude: MSB is sign (0=+, 1=-), remaining bits are magnitude.
    • Issue: Two zeros (+0 and -0). Hard to implement arithmetic.
  2. 1's Complement: Negative numbers are the bitwise inversion of positive numbers.
    • Issue: Two zeros exist.
  3. 2's Complement (Standard): MSB indicates sign. Negative numbers are stored as the 2's complement of the positive value.
    • Advantage: Only one zero; subtraction is performed as addition.

6. Fixed and Floating Point Numbers

Fixed Point Representation

  • The radix point is fixed (usually at the extreme right for integers or extreme left for fractions).
  • Limitations: Limited range; cannot represent very large or very small numbers easily without overflow/underflow.

Floating Point Representation (IEEE 754)

Allows representation of a vast range of real numbers (scientific notation).

  • Structure:
    1. Sign bit (S): 0 for positive, 1 for negative.
    2. Exponent (E): Biased exponent to handle negative powers.
    3. Mantissa/Significand (M): The precision bits (fractional part).
  • Value Formula:

7. Binary Codes

Binary codes map alphanumeric characters or numeric values to specific binary strings.

Weighted Codes

Each position has a specific weight.

  • BCD (Binary Coded Decimal / 8421 Code):
    • Each decimal digit (0-9) is represented by a 4-bit binary group.
    • Weights: 8, 4, 2, 1.
    • Invalid Codes: 1010 through 1111 (10-15) are invalid in BCD.
    • Use: Digital clocks, voltmeters.

Non-Weighted Codes

Positions do not have fixed weights.

  • Excess-3 Code (XS-3):
    • Created by adding 3 (0011) to the BCD code.
    • Property: Self-complementing (9's complement of decimal can be found by inverting bits).
  • Gray Code:
    • Unit Distance Code: Only one bit changes between successive numbers.
    • Not a positional system.
    • Application: Rotary encoders, K-Maps (prevents spurious output during transitions).
    • Binary to Gray Conversion:
      • MSB remains same.
      • (XOR current binary bit with next higher bit).

8. Error Detection and Correction

Data transmission often introduces errors due to noise. Codes are added to detect or correct these.

Parity Check Codes (Error Detection)

A simplified method to detect single-bit errors. An extra bit (parity bit) is appended to the data.

  1. Even Parity: The total number of 1s (including parity bit) must be Even.
    • If data has three 1s, Parity bit = 1 (total 4).
  2. Odd Parity: The total number of 1s must be Odd.
  3. Limitation: Cannot detect two bits flipping (which would preserve parity) and cannot correct the error.

Hamming Code (Error Correction)

A linear block code that can detect two-bit errors and correct single-bit errors.

  1. Redundant Bits (r): Calculate number of parity bits needed for data bits using .
  2. Positioning: Parity bits are placed at positions of powers of 2 (1, 2, 4, 8...).
  3. Parity Generation: Each parity bit checks specific bit positions based on binary representation.
    • checks positions 1, 3, 5, 7, 9...
    • checks positions 2, 3, 6, 7, 10...
    • checks positions 4, 5, 6, 7, 12...
  4. Correction: On the receiving end, parity checks are recalculated. The resulting binary word (Syndrome) points to the exact position of the error bit, which is then flipped.