A RAM can do two things to the selected word, so it needs a control line to choose. The read/write line does that.
- R/W = 1: read. The chip drives the stored word onto the data lines.
- R/W = 0: write. The chip stores the word that is on the data lines.
The name is a reminder: the bar (in print, over W) says that writing is the low level. Nothing happens either way unless the chip select is active.
Some chips split the job differently: a write enable (WE) pin that is asserted for writes, often active low, plus an output enable for reads. The idea is the same.
A ROM has no read/write line at all, since it can only be read. That's one of the visible differences between RAM and ROM chips.
Timing matters. During a memory write, the address and data should be stable before R/W goes to 0 and CS becomes active; otherwise the chip might store into the wrong location while the address is still changing.
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |