Skip to content
BetterDL

Memory write

Also called: write operation, write cycle, memory write cycle, writing memory

The operation that stores the word on the data lines into the location chosen by the address, replacing what was there.

A memory write stores a new word at a given address. The steps, with active-high controls:

  1. Put the address on the address lines.
  2. Put the data word on the data lines.
  3. Set R/W = 0 (write) and activate CS.
  4. Inside, the address decoder activates one word line, and the data is stored into that row.
  5. Deactivate CS. The word stays stored.

The old contents of that location are overwritten completely. Every other location is untouched.

Why the order matters: the address must be stable before the write is enabled. If CS went active while the address lines were still changing, the decoder could briefly select other rows and the chip might store the data in the wrong place.

A write to a chip whose CS is inactive does nothing. And only RAM (and rewritable members of the ROM family, with special procedures) can be written at all.

In the diagram, the chip stores the word while CS = 1 and R/W = 0.

R/WCSStoring

Worked examples

Example

Overwriting a word

A 4-word RAM holds 7, 2, 2, 5 at addresses 0–3. The CPU writes 9 to address 2.

  1. 1.

    Address 2, data 9, R/W = 0, CS = 1.

  2. 2.

    Word 2 becomes 9. The old 2 is gone.

  3. 3.

    Contents are now 7, 2, 9, 5. Address 1 still holds 2; writes don't affect other locations.

Example

A write to a wide memory

A 1K × 16 memory is four 1K × 4 chips side by side. The CPU writes a 16-bit word.

  1. 1.

    All four chips get the same address and the same CS and R/W.

  2. 2.

    Each chip stores its own 4-bit slice of the word.

  3. 3.

    Together they store the whole 16 bits in one write.

Common mistakes

  • Enabling the write before the address is stable. The data could land in the wrong row.

  • Thinking a write affects neighboring words. Only the addressed location changes.

  • Using R/W = 1 for a write. On this site 0 means write.

Practice Memory write

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

Learn it step by step

Memory write is taught in Memory.