Skip to content
BetterDL

RAM

Also called: random-access memory, random access memory, read/write memory, read-write memory

Random-access memory: memory that can be both read and written during normal operation, and that loses its contents when power is removed.

RAM is the memory a computer works in. You can read any word and write any word, as often as you like, while the system runs.

The name says "random access": any address can be reached directly, in about the same time, whatever was accessed before. Compare a tape, where you must wind past everything in between. (A ROM is random-access too; "RAM" is just the historical name for read/write memory.)

To support writing, a RAM chip has a read/write control as well as a chip select. On this site R/W = 1 means read and R/W = 0 means write.

The two main kinds:

  • SRAM (static): each bit in a small latch. Fast, no refresh, larger cells. Used for caches and on-chip memory.
  • DRAM (dynamic): each bit as charge on a tiny capacitor. Dense and cheap, but must be refreshed. Used for main memory.

Both are volatile: switch the power off and the contents are gone. That is why every computer also needs some non volatile memory to hold the program it runs at start-up.

CSR/WWritingReading

Worked example

Example

Tracing operations on a RAM

A 4-word RAM starts with every word 0. CS is active-high and R/W = 1 means read. The operations happen in order.

  1. 1.

    CS = 1, R/W = 0, address 2, data 6: write. Word 2 becomes 6.

  2. 2.

    CS = 1, R/W = 0, address 0, data 3: write. Word 0 becomes 3.

  3. 3.

    CS = 1, R/W = 1, address 2: read. The RAM outputs 6. Word 2 is unchanged.

  4. 4.

    CS = 0, R/W = 0, address 2, data 1: the chip isn't selected, so nothing is written.

  5. 5.

    CS = 1, R/W = 1, address 2: read again. Still 6.

Common mistakes

  • Thinking only RAM is random-access. ROM is too; "RAM" means read/write memory.

  • Believing RAM keeps its contents with the power off. All ordinary RAM, SRAM and DRAM alike, is volatile.

  • Thinking a read uses up or erases the word. A read leaves the stored word unchanged (a DRAM restores it automatically).

Practice RAM

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

RAM is taught in Memory.