Question

Assume the cache can hold 64 kB. Data are transferred between main memory and the cache...

Assume the cache can hold 64 kB. Data are transferred between main memory and the cache in blocks of 4 bytes each. This means that the

cache is organized as 16K=2^14 lines of 4 bytes each. The main memory consists of 16 MB, with each byte directly addressable by a 24-bit

address (2^24 =16M). Thus, for mapping purposes, we can consider main memory to consist of 4M blocks of 4 bytes each.

Please show illustrations too for all work.

Part 1) For the hexadecimal main memory addresses F6125Chex, when it is loaded to cache memory using direct mapping, where will it be

stored? Show the following information: Tag, Line number and word offset (show in binary, no conversion to hex is needed)

Part 2) If the next instruction is the content stored at 160004 hex in main memory and in cache memory, line number 0001 hex

has a tag 00 hex. Will we have a cache hit event or cache miss, why? (hint: check the line number and tag of 160004, if matches with the cache line and tag,

then cache hit; if catch line does not match, then cannot determine. Otherwise, cache miss)

Part 3) For the hexadecimal main memory addresses FFF666, show the following information: Tag, set and word values for a four-way set- associative cache

(show in binary, no conversion to hex is needed)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

First some notes :

  • As already mentioned, each cache block consists of 4 (= 2^2) words. Thus, lowest 2 bits of physical address determine the word-offset.
  • Also, as already explained in the question, there are a total of 2^14 cache blocks (for direct-mapped cache, for first two questions). Thus, next 14 bits of physical address determine the cache line-number/block-number.
  • The remaining bits of the physical address, constitute the tag.

Part 1)

0xF6125C :

  • Address in binary = 1111 0110 0001 0010 0101 1100
  • Lowest 2 bits = word offset = 00 = 0x00 = decimal 0
  • Next 14 (bolded) bits = cache line (block) number = 00 0100 1001 0111 = 0x0497 = decimal 1175
  • Remaining bits = tag = 1111 0110 = 0xF6 = decimal 246

Part 2)

0x160004

  • Address in binary = 0001 0110 0000 0000 0000 0100
  • Lowest 2 bits = word offset = 00 = 0x00 = decimal 0
  • Next 14 (bolded) bits = cache line (block) number = 00 0000 0000 0001 = 0x0001 = decimal 1
  • Remaining bits = tag = 0001 0110 = 0x16 = decimal 22

So, 0x160004 corresponds to cache-line 0x0001 with tag 0x16.

Currently, cache-line 0x0001 has tag 0x00 stored, so this is a collision case, and hence we have a cache-miss.

C)

In this case,

  • Lowest 2 bits determine the word-offset, as usual.
  • Also, now the number of sets become equal to (Total blocks / associativity factor) = 2^14 / 4 = 2^12. Thus, now, the next 12 bits will determine the set-number.
  • Remaining bits form the tag.

(As a side-note, here in 4-way set-associative cache, each set can store a maximum of 4 tags).

So, for 0xFFF666,

  • Address in binary = 1111 1111 1111 0110 0110 0110
  • Lowest 2 bits = word offset = 10 = 0x02 = decimal 2
  • Next 12 (bolded) bits = set number = 1101 1001 1001 = 0xD99 = decimal 3481
  • Remaining bits = tag = 11 1111 1111 = 0x3FF = decimal 1023
Add a comment
Know the answer?
Add Answer to:
Assume the cache can hold 64 kB. Data are transferred between main memory and the cache...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Example 4.2 For all three cases, the example includes the following elements: The cache can hold...

    Example 4.2 For all three cases, the example includes the following elements: The cache can hold 64 Kbytes. Data are transferred between main memory and the cache in blocks of 4 bytes each. This means that the cache is organized as 16K = 214 lines of 4 bytes each. The main memory consists of 16 Mbytes, with each byte directly addressable by a 24-bit address (24 = 16M). Thus, for mapping purposes, we can consider main memory to consist of...

  • A computer system has a 64 KB main memory and a 4 KB (data area only) cache. There are 8 bytes/ca...

    A computer system has a 64 KB main memory and a 4 KB (data area only) cache. There are 8 bytes/cache line. Determine (1) the number of comparators needed and (2) the size of the tag field, for each of the following mapping schemes: a. Fully associative A computer system has a 64 KB main memory and a 4 KB (data area only) cache. There are 8 bytes/cache line. Determine (1) the number of comparators needed and (2) the size...

  • A 2-way set associative cache consists of four sets 0, 1, 2, 3. The main memory...

    A 2-way set associative cache consists of four sets 0, 1, 2, 3. The main memory is word addressable (i.e. treat the memory as an array of words indexed by the address). It contains 2048 blocks 0 through 2047, and each block has eight words. (a) How many bits are needed to address the main memory? (b) Show how a main memory address will be translated into a tag, a set number, and an offset within a block. Illustrate this...

  • Problem 6. Suppose we have a computer with 32 megabytes of main memory, 256 bytes of...

    Problem 6. Suppose we have a computer with 32 megabytes of main memory, 256 bytes of cache, and a block size of 16 bytes. For each configuration below, determine the memory address format, indicating the number of bits needed for each appropriate field (i.e. tag, block, set, offset). Show any relevant calculations. Direct cache mapping and memory is byte-addressable a) Direct cache mapping and memory is word-addressable with a word size of 16 bits b) c) 2-way set associative cache...

  • Please refer the following memory system : Main memory : 64 MB Cache memory: 64 KB...

    Please refer the following memory system : Main memory : 64 MB Cache memory: 64 KB Block size of 1 KB 1. Direct Mapping Offset bits? Number of lines in cache? Line number bits? Tag size? 2. Fully Associative Mapping Offset bits? Tag size? 3. 2-way set-associative mapping Offset bits? Number of lines in cache? Set number bits? Tag size? 4. 4-way set-associative mapping Offset bits? Number of lines in cache? Set number bits? Tag size?

  • A computer system has a 64 KB main memory and a 4 KB (data area only) cache. There are 8 bytes=ca...

    A computer system has a 64 KB main memory and a 4 KB (data area only) cache. There are 8 bytes=cache line. Determine (1) the number of comparators needed and (2) the size of the tag field, for the following mapping scheme: Direct.

  • This question investigates cache use in different types of cache. Consider a system of 8Kbytes of...

    This question investigates cache use in different types of cache. Consider a system of 8Kbytes of byte-addressable main memory partitioned into blocks of 32bytes each. The system has cache of size 512bytes. The main memory blocks are being accessed in the order shown in the tables (the numbers are in decimal). Assuming the cache is empty at the start. Scenario 1: The system uses directly mapped cache. How is the memory address to be interpreted? Address field Value Reason Word...

  • 3. (12 points) Consider a cache has lines of 16 bytes and a total size of...

    3. (12 points) Consider a cache has lines of 16 bytes and a total size of 16 kB. The main memory is 16MB and a word takes 4 bytes. For the hexadecimal main memory addresses FFF666, show the following information in hexadecimal format a. Tag and word values for associative cache b. Tag, set and word values for a two-way set-associative cache 3. (12 points) Consider a cache has lines of 16 bytes and a total size of 16 kB....

  • For a direct-mapped cache memory, the following data is given.                    Main memory              &nb

    For a direct-mapped cache memory, the following data is given.                    Main memory                                       Cache memory            Size = 64KB                                               Size = 128B           Block size = 8Bytes                                    Block size = 4Bytes Calculate the following: Number of blocks created in main memory. Number of blocks created in cache memory. The distribution of the address fields in the system. Q5. For a direct-mapped cache memory, the following data is given. Main memory Cache memory Size...

  • Consider a processor that has a 20-bit address and a 1K Byte Cache. The cache and...

    Consider a processor that has a 20-bit address and a 1K Byte Cache. The cache and main memory are divided into blocks where each block is 256 Bytes. If direct mapping is used, what is the tag size of each block in cache and how many tag comparisons are made for a one-cache access? Repeat part (1) for fully associative mapping. Repeat part (1) for 2 way set-associative cache. For the direct map find out which of the following accesses...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT