Addressable Memory
Every byte of data stored in a computer's memory has a unique address — like a house number on a street. The CPU uses these addresses to find, read, and write data. Understanding memory addressing is essential for understanding how programs are stored and executed — and it connects directly to the system bus and FDE cycle topics.
Learning Objectives
- 12.3.4.1 Explain the principle of memory addressing
- 12.3.4.2 Explain the principle of storing programs and data
Memory Addressing
Main memory (RAM) is organized as a sequence of addressable locations. Each location has a unique numerical address and stores a fixed number of bits (typically 1 byte = 8 bits).
✓ Visualising Memory
Address Contents (1 byte each)
────────── ──────────────────────
0000 01001000
0001 01100101
0002 01101100
0003 01101100
0004 01101111
... ...
Each address holds exactly 1 byte (8 bits).
The address is used by the CPU to locate the data.Key Concepts
| Concept | Explanation |
|---|---|
| Memory address | A unique number identifying each memory location (like a house number) |
| Addressable unit | The smallest piece of data that has its own address — usually 1 byte |
| Address space | The total range of addresses available (determined by address bus width) |
| Address bus width | Number of bits in the address → max addresses = 2n |
| Word | A group of bytes the CPU processes at once (e.g., 4 bytes for 32-bit CPU) |
Calculating Address Space
Maximum addressable memory = 2n × addressable unit size
- 16-bit address bus → 216 = 65,536 locations = 64 KB
- 32-bit address bus → 232 = 4,294,967,296 locations = 4 GB
- 64-bit address bus → 264 = 16 exabytes (theoretical)
The Stored Program Concept
The stored program concept (Von Neumann architecture) is the idea that both programs (instructions) and data are stored in the same main memory. The CPU fetches instructions from memory in sequence and executes them.
| Principle | Explanation |
|---|---|
| Programs in memory | Instructions are stored in RAM alongside data — not on a separate device |
| Sequential execution | Instructions are fetched and executed in order (unless a branch/jump occurs) |
| Single memory | Both instructions and data share the same memory and bus (Von Neumann) |
| Modifiable programs | Because programs are in memory, they can be loaded, removed, or modified |
| Binary representation | Both instructions and data are stored as binary numbers |
✓ Program Stored in Memory
Address Contents Type
─────── ──────────────── ────────────
100 LDA 200 Instruction
101 ADD 201 Instruction
102 STO 202 Instruction
103 HLT Instruction
... ...
200 00001111 (= 15) Data
201 00011011 (= 27) Data
202 00000000 (= 0) Data (result)
Note: Instructions and data are in the SAME memory.
The CPU uses the PC to know which addresses contain instructions.Von Neumann vs Harvard Architecture
| Feature | Von Neumann | Harvard |
|---|---|---|
| Memory | Single shared memory for instructions + data | Separate memory for instructions and data |
| Buses | One set of buses (shared) | Separate buses for instructions and data |
| Speed | Slower (bottleneck — can't fetch instruction and data simultaneously) | Faster (can fetch both at the same time) |
| Use | General-purpose computers | DSP, microcontrollers, some modern CPUs |
| Bottleneck | Von Neumann bottleneck — bus is shared | No bottleneck — separate pathways |
Common Addressing Modes
| Mode | Description | Example |
|---|---|---|
| Immediate | The operand IS the data value | ADD #5 → add literal value 5 |
| Direct | The operand IS the memory address | ADD 200 → add value stored at address 200 |
| Indirect | The operand points to an address that CONTAINS the target address | ADD (200) → address 200 holds "300", actual data is at 300 |
| Register | The operand is a CPU register | ADD R1 → add value in register R1 |
| Indexed | Address = base address + index register | ADD 100+IX → address = 100 + value in index register |
Pitfalls & Common Errors
Confusing Memory Address with Memory Content
Address 200 is the location. The value stored at address 200 is the content. "LDA 200" means "load the VALUE at address 200" — not "load the number 200."
Thinking Programs Are Permanent in RAM
RAM is volatile — programs are lost when power is turned off. Programs are stored permanently on secondary storage (SSD/HDD) and loaded into RAM when executed.
Pro-Tips for Exams
Memory Questions Strategy
- Always connect memory addressing to the address bus and the MAR
- For "stored program concept" questions: mention shared memory, sequential execution, and binary representation
- If asked about the Von Neumann bottleneck — explain that the shared bus cannot carry instruction and data at the same time
- Know the formula: 2n = max addressable locations
Graded Tasks
Define: memory address, addressable unit, address space. State the formula for maximum addressable memory.
Explain the stored program concept and why it is important for modern computing.
A system has a 24-bit address bus. Calculate the maximum addressable memory in bytes, KB, and MB.
Compare Von Neumann and Harvard architectures. Explain the Von Neumann bottleneck and how Harvard architecture addresses it.