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

1) Supposed we have a 1KB direct-mapped data cache with 4 byte blocks. (30 point

ID: 3843370 • Letter: 1

Question

1)    Supposed we have a 1KB direct-mapped data cache with 4 byte blocks. (30 points)

a.    Show how a 32-bit memory address is divided into tag, index and offset. Show clearly how many bits are in each field.

b.    How many total bits are there in this cache?

c.    Consider this address trace:

0x807bfc4

0x807b1dc

0x907bfc4

0x806ce04

0x807b1e0

0x806ce0c

0x807b1e4

0x806ce0c

0x807bfc4

0x806ce14

For this cache, for each address in the above trace, show the tag, index and offset in binary. Indicate whether each reference is a hit or a miss. What is the miss rate?

Explanation / Answer

Cache size: 1KB
Block Size: 32B
# of blocks: 1KB/32B = 32


Therefore:
Block offset: log(32)bits = 5bits
Index : Log(32)bits = 5bits
Tag : 32 - (5 + 5) = 22bits


Bits required by each block:
Data: 32 * 8
Tag: 22
Valid: 1
Dirty: 1
----------
Total: 280

for 32 blocks: 8960 bits or 1120Bytes


HEX             TAG                    index offset hit/miss
0x807bfc4 100000000111101111 11110 00100   miss

0x807b1dc 100000000111101100 01110 11100   miss

0x907bfc4 100100000111101111 11110 00100   miss

0x806ce04 100000000110110011 10000 00100   miss

0x807b1e0 100000000111101100 01111 00000   miss

0x806ce0c 100000000110110011 10000 01100   hit

0x807b1e4 100000000111101100 01111 00100   hit

0x806ce0c 100000000110110011 10000 01100   hit

0x807bfc4 100000000111101111 11110 00100   miss

0x806ce14 100000000110110011 10000 10100   hit

miss rate = 6/10 = 0.6