Memory

The memory holds the program to be executed. The program consists of the instructions that need to be executed to complete the job. Memory also holds the data that the program works on. memory and data are kept in separate parts of the memory, sometimes even two separate memories.

Memory consists of locations that can contain a memory word. A word can hold an instruction or data. The information is not in the decimal, but in the so-called binary number system. Each memory word consists of a number of cells, which can assume one of two states: 0 or 1. A number in this system is a bit (binary digit). Donc, every word consists of a number of bits.

With one bit there are 2 possibilities (0 or 1), with two bits 4 (00, 01, 10 and 11), with three bits 8 (000, 001, 010, 011, 100, 101, 110 and 111), and so on. In general, with n bits there are 2n possibilities that can be memorised.

The number of memory locations determines the memory size: the number of words that can be stored in memory at the same time. The memory locations are numbered in sequence from 0. The sequence number of a memory location is the address of the location. Thus each memory location has a unique address, and by giving the address of a memory location, the CPU can reach each individual memory word.

The maximum memory size of a particular system is determined by the width of the address. With a 16-bit address range, up to 216 (65536) locations can be reached, a system with a 32-bit address bus can address 232 (4294967296) memory locations and a system with a 64-bit address bus can address 264 (1.844674407371E+19) locations.

A memory can be read or written to (there are exceptions to this). A mechanism must be present which indicates which of the two actions will take place.

  • Memory must be offered an address of a location by the CPU. This happens via address lines. For each bit of the address there is an address line. A number of lines over which this (parallel) information transport takes place is called a bus. Together the address lines are called the address bus.
  • Data exchange between CPU and memory takes place in the same way, over a data bus.
  • Which action a memory must perform is determined by one or more control lines, that are part of the control bus.

It is the CPU that generates addresses, controls read/write, and if necessary, offers data to memory to be written.

Reading a word from memory:

  • The CPU puts an address on the address bus
  • The CPU activates the read line of the control bus
  • The CPU accepts data from the databus

Writing a word to memory:

  • The CPU puts an address on the address bus
  • The CPU puts data on the data bus
  • The CPU activates the write line of the control bus