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

Consider a 128-byte cache (data only, not including overhead) on a byte-addressa

ID: 3771125 • Letter: C

Question

Consider a 128-byte cache (data only, not including overhead) on a byte-addressable system with 32-bit memory addresses. First, assume the cache is fully associative and has a block size of 16 bytes. How many bytes of tag overhead does the cache keep in total (Tag overhead does not include valid/dirty/LRU bits.) Now, consider the case that the cache is 2-way set associative and that it block size is 8 bytes. How many bytes of tag overhead does the cache keep in total (Tag overhead does not include valid/dirty/LRU bits.) Now, assume that the cache is direct mapped, and that the cache has 100 Bytes of tag overhead in total. How many bits are used for the tag/index/block offset in a 32-bit address.

Explanation / Answer

a) Given Cache size is 128bytes i.e 27 bits

Memory address is 4Gbytes =32 bit i.e 25 bits

Block size is 16 bytes i.e 24 bits

physical address = 32 bits

According to main memory it is divided into 2 blocks i.e 1.block offset 2.block number

The block number further divided into 2 blocks i.e 1.set number 2.Tag and these blocks are referred as cache memory

number of lines = cache size / block size

= 128 bytes / 16 bytes

= 23 bytes

= 8 bytes

set number for a fully associative is 3 bits i.e 8 bytes and block offset = 4 bits i.e 16 bytes  

since the given physical address = 32 bits

therefore 32 - (3+4) = 32 - 7 = 25 bits are the Tag bits

b) Given Cache size is 28bytes i.e 27 bits

Memory address is 4Gbytes =32 bit i.e 25 bits

Block size is 8 bytes i.e 23 bits

physical address = 32 bits

According to main memory it is divided into 2 blocks i.e 1.block offset 2.block number

The block number further divided into 2 blocks i.e 1.set number 2.Tag and these blocks are referred as cache memory  

number of lines = cache size / block size

= 128 bytes / 8 bytes

= 24 bytes

= 16 bytes

set number for a 2-way set associative is 24 / 2 bits = 23 bits

therefore the set number of lines = 3 bits i.e 8 bytes and block offset = 3 bits i.e 8 bytes  

since the given physical address = 32 bits

therefore 32 - (3+3) = 32 - 6 = 26 bits are the Tag bits

c) Given Cache size is 28bytes i.e 27 bits

Memory address is 4Gbytes =32 bit i.e 25 bits

physical address = 32 bits

According to main memory it is divided into 2 blocks i.e 1.block offset 2.block number

The block number further divided into 2 blocks i.e 1.set number 2.Tag and these blocks are referred as cache memory  

number of lines = cache size / block size

But in this case we cannot find the block offset number since the set number is a combination of both block offset and cache size hence to the given data we can not calculate the tag and block offset

Tag set number Block offset 25 3 4
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