Understanding Memory in Computer Architecture

Aug 3, 2024

Memory Units in Computer Architecture

Overview of Memory

  • Memory is a key component in the Von Neumann architecture.
  • Different types of memory in hardware:
    • Main Memory: Hard-wired into the motherboard.
      • RAM (Random Access Memory): Temporary storage that is erased when power is cut.
      • Secondary Memory: Includes hard disks, memory sticks; retains data without power.
    • Volatile vs. Non-volatile Memory:
      • Volatile: RAM loses data when power is off.
      • Non-volatile: Disks and flash memory retain data.

RAM and Its Role

  • RAM stores data and instructions for programs.
  • Focus on logical organization of memory rather than physical aspects.
  • Register's state is the value stored inside a register.

Register Basics

  • A register is an abstraction of multiple 1-bit registers, e.g., 16-bit register.
  • Registers have a width (w), e.g., w = 16 for this course.
  • State is the current value expressed by a register's internal circuits.

Writing to a Register

  1. Set input value (e.g., 17).
  2. Assert the load bit (set to 1) to store the new value.
  3. The new state will be output in the next cycle.

Register Chip Example

  • Demonstration using a hardware simulator for the DRegister chip.
  • Clock Input: Used to simulate the progression of time in cycles.
  • Registers transition to the new state after a complete clock cycle.

Building Memory Units

  • Memory is constructed by stacking registers.
  • RAM is viewed as a sequence of addressable registers.
    • Each register has an address from 0 to n-1.
    • Only one register is selected at a time.
    • Address Input: Determines which register to operate on.

Addressing Registers

  • To select one of n registers:
    • Use log2(n) bits to create a binary code.
    • Example: For 8 registers, 3 bits are needed (000 to 111).

Reading and Writing in RAM

  1. Reading a Register:

    • Set the address of the desired register.
    • Probe the output of the RAM to get the value of the selected register.
  2. Writing to a Register:

    • Set the address and input value.
    • Assert the load bit (set to 1).
    • The new value is output after a complete cycle.

RAM Device Example

  • Demonstration of a RAM device (e.g., RAM8).
  • Load Values: Input values into registers.
  • Reading Example: Change address to read different registers.
  • Writing Example: Change values in registers through proper addressing and load bit assertion.

Types of RAM Chips to Build

  • RAM8: 8 registers, 3 address bits.
  • RAM64: 64 registers, 6 address bits.
  • Other types include RAM4K and RAM16K for building a Hack computer.

Importance of RAM

  • Random Access Memory allows selection and operations on any register in constant time, regardless of the number of registers.
  • Enables efficient data management in computing systems.

Next Steps

  • The next unit will cover a chip for implementing accounting operations, known as counters.