Digital Logic and Memory Systems
UNIT-I: Logic Gates and Circuit
Logic Gates and Circuit: Gates (OR, AND, NOR, NAND, XOR & XNOR); DeMorgan’s Laws; Boolean Laws; Circuit Designing Techniques (SOP, POS, K-Map).
UNIT-II: Combinational Building Blocks
Combinational Building Blocks: Multiplexers; Decoders; Encoders; Adders and Subtractors.
UNIT-III: Memories
Memories: ROMs, PROMs, EPROMs, RAMs, Hard Disk, Floppy Disk, and CD-ROM.
UNIT-IV: Sequential Building Blocks
Sequential Building Blocks: Flip-Flops (RS, D, JK, Master-Slave & T Flip-Flops); Registers & Shift Registers; Counters; Synchronous and Asynchronous Designing Methods.
UNIT-V: Memory Organization
Memory Organization: Basic Cell of Static and Dynamic RAM; Building Large Memories Using Chips; Associative Memory; Cache Memory Organization; Virtual Memory Organization.

UNIT-I: Logic Gates and Circuit

1. Logic Gates

Logic gates are the basic building blocks of digital circuits. They perform logical operations on one or more binary inputs to produce a single binary output. Common logic gates include:

    Example:
    OR Gate Truth Table:
    A | B | Output
    0 | 0 |   0
    0 | 1 |   1
    1 | 0 |   1
    1 | 1 |   1
        

2. De Morgan’s Laws

De Morgan’s laws are used to simplify Boolean expressions and circuits:

    Example:
    Using De Morgan’s First Law:
    Original: \( \overline{A + B} \)
    Simplified: \( \overline{A} \cdot \overline{B} \)
        

3. Boolean Laws

Boolean algebra laws are rules for simplifying Boolean expressions. Key laws include:

    Example:
    Simplify \( A \cdot (A + B) \):
    Using Distributive Law:
    Result: \( A \cdot A + A \cdot B = A + A \cdot B = A \)
        

4. Circuit Designing Techniques

a. SOP (Sum of Products)

A Boolean expression in SOP form is a sum of minterms where each minterm is a product of literals.

    Example:
    Expression: \( AB + \overline{A}B + A\overline{B} \)
    Circuit: OR gate combines outputs of three AND gates.
        

b. POS (Product of Sums)

A Boolean expression in POS form is a product of maxterms where each maxterm is a sum of literals.

    Example:
    Expression: \( (A + B)(\overline{A} + B)(A + \overline{B}) \)
    Circuit: AND gate combines outputs of three OR gates.
        

c. K-Map (Karnaugh Map)

K-Map is a graphical method for simplifying Boolean expressions by grouping adjacent cells representing minterms or maxterms.

    Example:
    Given Truth Table:
    A | B | Output
    0 | 0 |   0
    0 | 1 |   1
    1 | 0 |   1
    1 | 1 |   1
    Simplified Expression: \( A + B \)
        

UNIT-II: Combinational Building Blocks

1. Multiplexers

A multiplexer (MUX) is a combinational circuit that selects one of many input signals and forwards the selected input to a single output line based on control signals.

    Example:
    A 4:1 MUX has 4 inputs (I0, I1, I2, I3), 2 control lines (S0, S1), and 1 output (Y).
    Output Equation: \( Y = S1'S0'I0 + S1'S0I1 + S1S0'I2 + S1S0I3 \)
        

2. Decoders

A decoder is a combinational circuit that converts binary information from \( n \) input lines into a maximum of \( 2^n \) unique output lines. It is used in applications like memory addressing and data routing.

    Example:
    A 3:8 decoder has 3 inputs (A, B, C) and 8 outputs (Y0 to Y7).
    Output Logic:
    Y0 = A'B'C', Y1 = A'B'C, ..., Y7 = ABC
        

3. Encoders

An encoder is the reverse of a decoder. It takes \( 2^n \) inputs and produces an \( n \)-bit output. Encoders are used for data compression and priority encoding.

    Example:
    An 8:3 encoder has 8 inputs (I0 to I7) and 3 outputs (A, B, C).
    Output Logic:
    A = I4 + I5 + I6 + I7,
    B = I2 + I3 + I6 + I7,
    C = I1 + I3 + I5 + I7
        

4. Adders

a. Half Adder

A half adder is a combinational circuit that adds two single-bit binary numbers and produces a sum (S) and a carry (C).

    Truth Table:
    A | B | Sum (S) | Carry (C)
    0 | 0 |    0    |    0
    0 | 1 |    1    |    0
    1 | 0 |    1    |    0
    1 | 1 |    0    |    1
    Sum = A ⊕ B, Carry = A · B
        

b. Full Adder

A full adder is a combinational circuit that adds three single-bit binary numbers (A, B, and Cin) and produces a sum (S) and a carry-out (Cout).

    Truth Table:
    A | B | Cin | Sum (S) | Carry (Cout)
    0 | 0 |  0  |    0    |      0
    0 | 1 |  0  |    1    |      0
    1 | 0 |  1  |    0    |      1
    Sum = A ⊕ B ⊕ Cin, Carry = (A · B) + (Cin · (A ⊕ B))
        

5. Subtractors

a. Half Subtractor

A half subtractor subtracts two single-bit binary numbers (A and B) and produces a difference (D) and a borrow (B).

    Truth Table:
    A | B | Difference (D) | Borrow (B)
    0 | 0 |        0       |     0
    0 | 1 |        1       |     1
    1 | 0 |        1       |     0
    1 | 1 |        0       |     0
    Difference = A ⊕ B, Borrow = A' · B
        

b. Full Subtractor

A full subtractor subtracts three binary inputs (A, B, and Bin) and produces a difference (D) and a borrow-out (Bout).

    Truth Table:
    A | B | Bin | Difference (D) | Borrow (Bout)
    0 | 0 |  0  |        0        |      0
    0 | 1 |  1  |        1        |      1
    Difference = A ⊕ B ⊕ Bin, Borrow = (B · Bin) + (B · A') + (Bin · A')
        

UNIT-III: Memories

1. ROM (Read-Only Memory)

ROM is non-volatile memory that stores data permanently. It is used to store firmware or software that rarely changes.

    Example:
    A ROM chip stores the bootloader for initializing a computer.
        

2. PROM (Programmable ROM)

PROM is a type of ROM that can be programmed once after manufacturing using a special device called a PROM programmer.

    Example:
    A microcontroller’s specific configuration stored on a PROM chip.
        

3. EPROM (Erasable Programmable ROM)

EPROM can be erased and reprogrammed using ultraviolet light. It is used for development and testing purposes.

    Example:
    EPROMs are used in development boards for testing firmware.
        

4. RAM (Random Access Memory)

RAM is volatile memory used for temporary storage during processing. It allows both read and write operations.

    Example:
    RAM stores data and instructions for active applications.
        

5. Hard Disk

The hard disk is a non-volatile storage device that uses magnetic storage to store and retrieve data.

    Example:
    A hard disk stores operating systems, applications, and user data.
        

6. Floppy Disk

A floppy disk is an outdated magnetic storage device used for transferring small amounts of data.

    Example:
    Early computer systems used floppy disks for booting and data storage.
        

7. CD-ROM (Compact Disc Read-Only Memory)

CD-ROM is an optical storage device that can store data in a read-only format.

    Example:
    Software installers were distributed on CD-ROMs before the advent of digital downloads.
        

UNIT-IV: Sequential Building Blocks

1. Flip-Flops

A flip-flop is a basic sequential circuit element that stores a single bit of data. It has two stable states and can be triggered by a clock signal.

a. RS Flip-Flop

The RS (Set-Reset) flip-flop sets or resets its output based on the inputs.

    Truth Table:
    S | R | Q (Next State) | Q' (Complement)
    0 | 0 |    No Change   |       No Change
    0 | 1 |       0        |          1
    1 | 0 |       1        |          0
    1 | 1 |     Invalid    |       Invalid
        

b. D Flip-Flop

The D (Data or Delay) flip-flop ensures a single input to avoid invalid states.

    Truth Table:
    D | Q (Next State)
    0 |        0
    1 |        1
        

c. JK Flip-Flop

The JK flip-flop resolves the invalid state of RS flip-flops and toggles the output when both inputs are high.

    Truth Table:
    J | K | Q (Next State)
    0 | 0 |     No Change
    0 | 1 |         0
    1 | 0 |         1
    1 | 1 |     Toggle
        

d. T Flip-Flop

The T (Toggle) flip-flop toggles its state with each clock pulse.

    Truth Table:
    T | Q (Next State)
    0 |     No Change
    1 |       Toggle
        

e. Master-Slave Flip-Flop

The Master-Slave flip-flop consists of two flip-flops connected in series. The master operates on the leading edge of the clock, and the slave operates on the trailing edge, ensuring synchronization.

2. Registers

A register is a group of flip-flops used to store multiple bits of data. Registers are used in processors for temporary data storage and manipulation.

3. Shift Registers

Shift registers move data in a serial fashion, either left or right, with each clock pulse.

    Example:
    A 4-bit SIPO shift register shifts the binary sequence 1010 into parallel outputs.
        

4. Counters

A counter is a sequential circuit that counts the number of clock pulses. Counters are classified as synchronous or asynchronous.

a. Synchronous Counter

All flip-flops are triggered by the same clock signal.

    Example:
    A 3-bit synchronous counter counts from 0 to 7.
        

b. Asynchronous Counter

Flip-flops are triggered by the output of the previous flip-flop, creating a ripple effect.

    Example:
    A 4-bit ripple counter counts from 0 to 15.
        

5. Designing Methods

Sequential circuits can be designed using different methods:

UNIT-V: Memory Organization

1. Basic Cell of Static and Dynamic RAM

a. Static RAM (SRAM)

SRAM stores data using flip-flops. It is faster and more reliable but consumes more power and is expensive.

    Example:
    SRAM is used in processor registers for quick data access.
        

b. Dynamic RAM (DRAM)

DRAM stores data using capacitors and requires periodic refreshing to retain information.

    Example:
    DRAM is used in the main memory of computers for storing active processes.
        

2. Building Large Memories Using Chips

Large memories are constructed by combining smaller memory chips to achieve the desired capacity and configuration. Common techniques include:

    Example:
    To build a 1 KB memory using 256-byte chips, 4 chips are connected with address decoding.
        

3. Associative Memory

Associative memory (or content-addressable memory) allows data retrieval based on content rather than address.

    Example:
    Associative memory is used in routers for efficient IP address lookup.
        

4. Cache Memory Organization

Cache memory is a small, high-speed memory located close to the CPU to store frequently accessed data.

    Example:
    A 4-way set-associative cache with 64 blocks uses 16 sets, where each set can store 4 blocks.
        

5. Virtual Memory Organization

Virtual memory is a memory management technique that uses secondary storage to extend the apparent memory available to programs.

    Example:
    A system with 4 GB of virtual memory can run applications larger than the physical RAM available.