Note: and
128.00
Step-by-Step Solution
Insight: This is a reverse-engineering problem — extract the index field from the address by matching the given cache block number, then maximise the index width.
Exam route:
- Address = 0xA2C28 = 1010 0010 1100 0010 1000 (20 bits). Block number = 176.
- In direct-mapped cache, cache block number = index field of the address.
- Try offset = 6 (block = 64 B): address >> 6 = 10416. ✓.
- Maximise index: ✓. ✗.
- Max index = 11 bits. Cache = B = 128 KB.
Answer: 128
Learning route:
This is a reverse-engineering question, recognisable because it gives a specific address and the cache block it maps to, and asks for the maximum cache size.
In a direct-mapped cache, the cache block number equals the index field of the address. So we need to find offset and index bits such that the index field of 0xA2C28 equals 176.
Step 1 — Convert to binary: 0xA2C28 = 1010 0010 1100 0010 1000 (20 bits).
Step 2 — The address splits as [Tag | Index | Offset]. If offset = bits, then the index value is .
Step 3 — Try offset = 6 (block = 64 B): . Check: ✓. So offset = 6, and 8 index bits gives block 176.
Step 4 — Maximise index bits. We need .
- : ✓
- : ✓
- : ✓
- : ✗
Maximum index = 11 bits.
Step 5 — Cache size = B = 128 KB.
Check: Tag = bits ≥ 1 ✓. Cache (128 KB) < Memory (1 MB) ✓.
Note: The smart_notes worked example (card c007) uses a heuristic offset of 4 based on the last nibble, which gives 512 KB — but that is incorrect because with offset = 4, the index would be . The correct offset is 6, giving 128 KB.