Addresses and cells
13Basic memory
- Stage 1
- Stage 2
- Stage 3
- Stage 4
- Stage 5
- Stage 6
- Stage 7
- Stage 8
- Stage 9
- Stage 10
- Stage 11
- Stage 12
- Stage 13 (this one)
- Stage 14
- Stage 15
Explanation
RAM is an array of registers. An address picks one cell: a decoder raises exactly one select line. Reading puts that cell's value on the data bus; writing, when write-enable is 1, stores the bus value into the selected cell on the clock edge.
With n address bits you can reach 2ⁿ cells. Bench-8 has 8-bit addresses, so 256 bytes, holding both the program and its data. A design like that, with one memory for both, is called a von Neumann machine.
A 16-byte RAM
Address = 3
Data in = 42
write-enable
Data out (read) = 99
| addr | select | value |
|---|---|---|
| 0 (0000) | ○ 0 | 12 |
| 1 (0001) | ○ 0 | 7 |
| 2 (0010) | ○ 0 | 0 |
| 3 (0011) | ● 1 | 99 |
| 4 (0100) | ○ 0 | 5 |
| 5 (0101) | ○ 0 | 0 |
| 6 (0110) | ○ 0 | 0 |
| 7 (0111) | ○ 0 | 0 |
| 8 (1000) | ○ 0 | 0 |
| 9 (1001) | ○ 0 | 0 |
| 10 (1010) | ○ 0 | 0 |
| 11 (1011) | ○ 0 | 0 |
| 12 (1100) | ○ 0 | 0 |
| 13 (1101) | ○ 0 | 0 |
| 14 (1110) | ○ 0 | 0 |
| 15 (1111) | ○ 0 | 0 |
Check yourself
Marked instantly in your browser. Use the interactive above to work it out.