Introduction
Cache Basics Direct Mapped Cache Direct Mapped Example 1 Direct Mapped Example 2 Direct Mapped Problem 1 Direct Mapped Problem 2 Direct Mapped Problem 3 Direct Mapped Problem 4 Direct Mapped Comparators Direct Mapped Disadvantages Direct Mapped Locality Direct Mapped UVM Example Associative Mapped Cache Associative Mapped Problem 1 Associative Mapped Problem 2 Associative Mapped Problem 3 Associative Mapped Problem 4 Set Associative Mapped Cache Set Associative Mapped Comparators Set Associative Mapped Problem 1 Set Associative Mapped Problem 2 Set Associative Mapped Problem 3 Set Associative Mapped Problem 4 Set Associative Mapped Problem 5 Other Mapping Problem - Example 1 Cache Replacement Algorithms LRU Cache Replacement Algorithm FIFO Cache Replacement Algorithm MRU Cache Replacement Algorithm PLRU Cache Replacement Algorithm Round Robin Cache Replacement AlgorithmUVMArena
Associative Mapped Cache – Problem 4
This example analyzes a Fully Associative Cache system where the RAM size and block size are given. The objective is to determine the tag size used in the cache address structure.
Given Parameters
| Parameter | Value |
|---|---|
| RAM Size | 8 GB |
| Block Size | 8 KB |
| Cache Mapping | Fully Associative |
| Addressing Type | Byte Addressable |
Step 1 — Convert RAM Size
First convert the RAM size into powers of two.
RAM Size = 8 GB
8 GB = 2^3 × 2^30
= 2^33 bytes
Since the system is byte-addressable, each byte has its own address. Therefore, the number of physical address bits is:
Physical Address Size = 33 bits
Step 2 — Determine Offset Bits
The block size determines how many bits are required to select a specific byte within the block.
Block Size = 8 KB
8 KB = 2^3 × 2^10
= 2^13 bytes
Offset Bits = log2(2^13)
= 13 bits
Step 3 — Compute Tag Size
In Associative Mapping, the tag represents the frame number. The physical address is divided into:
Physical Address
+------------+-----------+
| TAG | OFFSET |
+------------+-----------+
The tag size is calculated by subtracting the offset bits from the total physical address size.
Tag Bits = Physical Address Bits − Offset Bits
Tag Bits = 33 − 13
= 20 bits
Final Result
| Parameter | Result |
|---|---|
| Physical Address Size | 33 bits |
| Offset Bits | 13 bits |
| Tag Size | 20 bits |
Key Concepts
- Associative mapping stores the full frame number as the tag.
- The physical address is divided into tag + offset.
- The number of offset bits depends on the block size.
- The tag size is the remaining bits of the physical address.
- This mapping removes conflict misses but requires hardware comparators.