Consider the main memory size is of 128 KB, the cache size is of 16 KB, the…

Consider the main memory size is of 128 KB, the cache size is of 16 KB, the block size is of 256 B, the set size is 2. Find Tag.

Answer: 4Given: main memory = 128 KB, cache = 16 KB, block size = 256 B, set associativity = 2. Total physical address bits = log2(main memory size) = log2(128 KB) =…

Attempted by 27 students.

Show answer & explanation

Correct answer: 4

Given: main memory = 128 KB, cache = 16 KB, block size = 256 B, set associativity = 2.

  • Total physical address bits = log2(main memory size) = log2(128 KB) = log2(131072) = 17 bits.

  • Block offset bits = log2(block size) = log2(256) = 8 bits.

  • Number of cache lines = cache size / block size = 16 KB / 256 B = 64 lines.

  • Number of sets = number of lines / associativity = 64 / 2 = 32 sets ⇒ set index bits = log2(32) = 5 bits.

Tag bits = total physical address bits − (set index bits + block offset bits) = 17 − (5 + 8) = 4 bits.

Answer: Tag = 4 bits.

Explore the full course: Zero To Hero

Loading lesson…