---
title: "Direct mapping with 64-block memory, 10 blocks used"
subject: "Computer Organization and Architecture"
chapter: 6
key: "semester_5/computer_organization_and_architecture:direct-mapping-example-64"
source: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/direct-mapping-example-64
site: BCT Engineering
---

# Direct mapping with 64-block memory, 10 blocks used

Computer Organization and Architecture · Chapter 6: Memory System

- Asked in: 2075 Chaitra, 6 marks
- Video: [Direct Memory Mapping – Solved Examples](https://www.youtube.com/watch?v=OxaYvJquPe0) — Neso Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/direct-mapping-example-64
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_organization_and_architecture/chapter-6

## Question

Suppose main memory has 64 blocks and cache memory has 8 blocks. When 10 blocks of main memory are used, show how mapping is performed in the direct mapping technique.

## Short answer

With 64 memory blocks and 8 cache lines, direct mapping uses line = block mod 8. For blocks 0-9 accessed sequentially, blocks 0-7 fill lines 0-7; block 8 replaces block 0 in line 0, block 9 replaces block 1 in line 1. Final cache: line 0 holds block 8 (tag 001), line 1 holds block 9 (tag 001), lines 2-7 hold blocks 2-7 (tag 000). No replacement algorithm needed as each block has a fixed line.

## Answer

In direct mapping a main-memory block j goes to cache line (j mod 8). Main memory has 64 blocks, so a block address has 6 bits; the cache has 8 lines, so the line field has 3 bits and the tag has 6-3 = 3 bits.

```text
Block address = Tag (3) | Line (3)
```

Assumption: the 10 blocks used are blocks 0 to 9, accessed in order.

| Block | Block address (6 bits) | Tag (3) | Line (3) | Cache line | Action |
|---|---|---|---|---|---|
| 0 | 000000 | 000 | 000 | 0 | loaded into empty line |
| 1 | 000001 | 000 | 001 | 1 | loaded into empty line |
| 2 | 000010 | 000 | 010 | 2 | loaded into empty line |
| 3 | 000011 | 000 | 011 | 3 | loaded into empty line |
| 4 | 000100 | 000 | 100 | 4 | loaded into empty line |
| 5 | 000101 | 000 | 101 | 5 | loaded into empty line |
| 6 | 000110 | 000 | 110 | 6 | loaded into empty line |
| 7 | 000111 | 000 | 111 | 7 | loaded into empty line |
| 8 | 001000 | 001 | 000 | 0 | replaces block 0 |
| 9 | 001001 | 001 | 001 | 1 | replaces block 1 |

Final cache contents:

| Cache line | Block held | Tag |
|---|---|---|
| 0 | B8 | 001 |
| 1 | B9 | 001 |
| 2 | B2 | 000 |
| 3 | B3 | 000 |
| 4 | B4 | 000 |
| 5 | B5 | 000 |
| 6 | B6 | 000 |
| 7 | B7 | 000 |

Blocks that differ by a multiple of 8 compete for the same line (for example block 0 and block 8). The tag stored with each line tells which of these blocks is present. A block is a hit if the line's tag equals the tag of the address; no replacement algorithm is needed because each block has only one possible line.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. 64 memory blocks, 8 cache lines. How many tag bits?
   A. 6
   B. 3
   C. 2
   D. 8
   Answer: B. 6-bit block address minus 3 line bits = 3. (Key point: Tag bits)

2. Which line does block 9 map to?
   A. Line 9
   B. Line 1
   C. Line 0
   D. Line 2
   Answer: B. 9 mod 8 = 1. (Key point: Line)

3. Which block does block 8 replace?
   A. Block 7
   B. Block 1
   C. Block 0
   D. None
   Answer: C. Both map to line 0. (Key point: Replacement)

4. After blocks 0 to 9, what does line 1 hold?
   A. B1 tag 000
   B. B9 tag 001
   C. B9 tag 000
   D. B1 tag 001
   Answer: B. Block 9 = 001001, tag 001 replaces B1. (Key point: Final)

## Close variants set in other exams

- [Direct mapping with 32-block memory, 10 blocks used](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Adirect-mapping-example-10) — Computer Organization and Architecture, chapter 6, asked 3×
- [Direct mapping with 32-block memory, 8-block cache](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Adirect-mapping-example) — Computer Organization and Architecture, chapter 6, asked 3×

## Related in Computer Organization and Architecture

- [Cache read and direct-mapping demerits](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Adirect-mapping-demerits) — Computer Organization and Architecture, chapter 6
- [Direct cache mapping](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Adirect-mapping) — Computer Organization and Architecture, chapter 6, asked 3×

## Related in other subjects

- [Cache memory mapping techniques](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Acache-mapping-techniques) — Embedded System, chapter 4, asked 3×
