Question

In: Computer Science

A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider...

A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider the following loop (three instructions) in a program. Before the loop,the values in registersR0,R1,R2are 0, 054E, and 2 respectively. Consider that instructions arealready in separate cache memory. (See Table1.)The loop starts at location LOOP=02EC.LOOPAdd(R1)+,R0;DCRR2; BR>0LOOPShow the content of cache at the end of each pass of this loop if direct mapping cache is used.Compute hit rate.

Solutions

Expert Solution

Answer:

Consider the following loop in a program where all instructions and operands are 16 bits long.

Loop Add (R1) + R0

Decrement R2

BNE LOOP

  • Assume that, before this loop is entered, registers R0, R1, and R2 contain 0, 054E, and 3, respectively.
  • Also assume that the main memory contains the data shown in Fig 1, where all entries are given in hexadecimal notation. The loop starts at location LOOP = 02EC.

  • In the rst pass through the loop, the Add instruction is stored at address 4 in the cache, and its operand (A03C) at address 6.
  • Then the operand is overwritten by the Decrement instruction.
  • The BNE instruction is stored at address 0. In the second pass, the value 05D9 overwrites the BNE instruction, then BNE is read from the main memory and again stored in location 0.
  • The contents of the cache, the number of words read from the main memory and from the cache, and the execution time for each pass are as shown below.

  • All three instructions are stored in the cache after the rst pass, and they remain in place during subsequent passes.
  • In this case, there is a total of 6 read operations from the main memory and 6 from the cache. Execution time is 66 τ .
  • Instructions and data are best stored in separate caches to avoid the data overwriting instructions.

Related Solutions

A direct mapped cache has 32 cache lines.Each cache line consists of 4 words, and each...
A direct mapped cache has 32 cache lines.Each cache line consists of 4 words, and each word is four bytes.The address bus consists of 16 bits. How many bits are required for the tag in this direct-mapped cache?
a) consider a direct mapped cache with 10 blocks of 10 words each. Suppose main memory...
a) consider a direct mapped cache with 10 blocks of 10 words each. Suppose main memory is 1000 words. For ewach memory address below say what cache block it maps to, what is the offset, and what is the tag. 934, 666, 348, 522
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache...
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache of 1024 blocks, where each block contains 32 bytes. [2] How many blocks of main memory does this computer have? [4] Show the format of a memory address as seen by cache; be sure to include the field names as well as their sizes. [3] Given the memory address 0x00001328, to which cache block will this address map? (Give you answer in decimal.) A...
For a direct mapped cache design with 32 bit address, the following bits of the address...
For a direct mapped cache design with 32 bit address, the following bits of the address are used to access the cache Tag Index Offset 31 - 8 7 - 4 3 - 0 What is the cache block size (in words)? How many entries does the cache have? What is the ratio between total bits required for such a cache implementation over the data storage bits? Starting from power on, the following byte-addressed cache references are recorded. Address 0...
Suppose a computer using direct mapped cache has 224 bytes of byte-addressable main memory, and a...
Suppose a computer using direct mapped cache has 224 bytes of byte-addressable main memory, and a cache of 128 blocks, where each cache block contains 8 bytes. For fully associative cache, to which block of cache the address 0x189B5A maps? Group of answer choices Block 6 Block 75 Not enough information Block 10
Given an 8-word, direct mapped cache, and the sequence of address accesses below, enter the number...
Given an 8-word, direct mapped cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 24 13 24 10 8 8 Given an 8-word, 2-way set associative cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 22 1 9 22 22 22 Given an 8-word, 2-way set associative cache, and the sequence of address accesses below, enter the number of misses. CACHE CONFIG 23 23 8 20 9 20...
Below are listed parameters for different direct-mapped cache designs. Cache Data Size: 32 KiB Cache Block...
Below are listed parameters for different direct-mapped cache designs. Cache Data Size: 32 KiB Cache Block Size: 2 words Cache Access Time: 1 cycle Word: 4 bytes. Calculate the total number of bits required for the cache listed above, assuming a 32-bit address. Given that total size, find the total size of the closest direct-mapped cache with 16-word blocks of equal size or greater. Explain why the second cache, despite its larger data size, might provide slower performance than the...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where...
A direct mapped cache has 16 blocks and block size is 64-bits (8 bytes). a. Where will the memory block 45 reside in cache? (5 b. Where will be the memory address 1667 mapped in cache
Suppose we have a direct-mapped cache that can hold a total of 1024 blocks with 4...
Suppose we have a direct-mapped cache that can hold a total of 1024 blocks with 4 words per block. Compute the block index, block offset, and the tag for the following addresses: (a) 0x11001001 (b) 0x00010014 (c) 0x01000004 (d) 0x01001018 (e) 0x7bdcca10
Computer archieture 1. Assume that the cache size is 512kB, and each cache line is 128...
Computer archieture 1. Assume that the cache size is 512kB, and each cache line is 128 Bytes. If it’s a 4-way associative cache, how many sets are there? If it’s a 2-way associative cache, how many sets are there? Let’s assume the cache is initially empty, and LRU policy is used for cache line replacement. If the following memory blocks are accessed: Mem-block # 7, 1031, 2055, 4103, 1031, 7, 2055, 3079, 1031, 3079 What is the cache hit/miss rate...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT