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

4. Suppose you have a cached computer system with 1M words in main memory and a

ID: 3809071 • Letter: 4

Question

4. Suppose you have a cached computer system with 1M words in main memory and a cache size of 4K words. Assume main memory is divided into blocks with each block containing 16 words. Assume word addressing.

(a) If the cache uses direct mapping, what cache frame does the physical (hex) address 0x949DA map into? What value needs to be in that cache frame’s tag to get a cache hit?

(b) Assume a set associative cache with 64 sets of 4 block frames per set. What set does the physical (hex) address 0x949DA map into? How many bits are there in each cache tag? What is the cache tag (in hex) for this physical address?

(c) If the cache is fully associative, what is the cache tag for the physical (hex) address 0x949DA?

Explanation / Answer

(a):In Direct Mapping each location in RAM has one specific place in cache where the data will be held. Thus physical address is broken into 3 segments: Tag,Line,Offset. Tag identifies the cache block where the word will be stored, line indicates the corresponding line in the cache block and offset indicates the word within a cahche line.

Length of address =20 (1M)

Cache block size and Main memory block size is always equal.

Memory is word addressable

Offset= 4(16 words within a block)

Line= no. of cache blocks=4K/16=256=8bits

Tag=20-8-4=8bits

Hence tag for cache hit is first 8bits of 0x949DA i.e. (94)16

(b) In set associative mapping we do direct mapping for set and associative mapping within set. Address is broken into 3 segments: Tag, Set, Offset.

No. of sets=64

Set bits=6

Offset=6( 4 blocks of 16 words)

Tag=20-6-6=8

Cache tag has 8 bits. Cache Tag for 0x0949DA is (94)16

(c) Fully associative mapping, a block can reside in any cache block. Thus physical address is broken into 2 segments: Tag, Offset

Offset=4bits(16 words in a block )

Tag=20-4=16bits

Cache tag of 0x949DA=(949D)16.

Hope this helps. In case of any query drop a comment.

Thanks

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