Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider a 16 kB 2-way set associative cache. Each block holds 32 bytes of data.

ID: 3822446 • Letter: C

Question

Consider a 16 kB 2-way set associative cache. Each block holds 32 bytes of data. Physical addresses and data words are all 32 bits. (a) Calculate the number of blocks in the cache (b) Calculate the number of bits of tag stored with each block entry. (c) What would be the miss rate of this cache for the following code. Assume that if it's a miss, it fetches all blocks for the set from memory. addi $t0, $0, 8 loop: beq $t0, $0, done lw $t1, 0x4 ($0) lw $t2, 0x8($0) lw $t3, 0x24($0) addi $t0, $t0, -1 j loop done:

Explanation / Answer

In a k-way set associate mapping, cache memory is divided into sets, each of size k blocks.
Size of Cache memory = 16 KB
As it is 4-way set associative,K = 4
Block size B = 32 bits
The word length is 32 bits.
size of Physical address space = 32 bits.

No of blocks in Cache Memory(N) = (size of cache memory / size of a block)

= (16*1024 bytes / 32*4 bytes) = 128 (as 1 word = 4 bytes)

No of sets(S) = (No of blocks in cache memory/ no of blocks in a set)

= N/K = 128/4 = 32

Now,size of physical address = 32bits = 4 bytes

These physical adresses are divided equally among the sets.

Hence, each set can access (4/32) bytes = 0.125 bytes

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote