Question

In: Computer Science

Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache...

  1. 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.
    1. [2] How many blocks of main memory does this computer have?
    2. [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. [3] Given the memory address 0x00001328, to which cache block will this address map? (Give you answer in decimal.)
  2. A fully associative mapped cache has 8 blocks, with 16 bytes per block. Main memory is 128K bytes.
    1. [3] Show the format for a main memory address, assuming memory is byte addressable. Include the field names as well as their sizes.
    2. [3] Show the format for a main memory address, assuming memory is word addressable, where a word is 32 bits. Include the field names as well as their sizes.

Solutions

Expert Solution

Main Memory Size = 232 Bytes

Number of Cache Blocks = 1024 = 210

Block Size = 32 Bytes = 25

Answer a

Number of blocks in Main memory

= Main Memory Size / Block Size

= 232 / 25 = 227

=  134,217,728 blocks

Answer b

Cache is Direct Mapped. So

Block Offset = 10 bits (to access the blocks, number of blocks = 210)

Byte Offset = 5 Bits (to access each byte in selected block, block size = 25)

Tag bits = 32 - 10 - 5 = 17 bits

Main Memory Address = Tag(17) Block(10) Byte(5)

Answer c

0x00001328 = 00000000000000000 0010011001 01000

Block offset =  0010011001 = 153 block

Fully Associative Cache

Number of blocks in Cache = 8 = 23

Blocks Size = 16 Bytes

Main Memory Size = 128 K bytes = 217 which means main memory address = 17 bit

Answer a

Byte offset = 4 bits

Tag Field = 17-4 = 13 bits

Main memory address = Tag(13) Byte(4)

Answer b

Memory is word addressable which means block size = 16 bytes = 4 words where 1 word = 32 bits (4 bytes)

Word offset = 2 bits  

Tag Field = 17-2 = 15 bits

Main memory address = Tag(15) Word(2)


Related Solutions

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
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes each. Access time for the cache is 22ns, and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory(so if it is not found in cache, we do not have to...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes each. Access time for the cache is 22ns, and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory(so if it is not found in cache, we do not have to...
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
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
Assume a byte-addressable memory has 64K bytes. Blocks are 8 bytes in length and the cache...
Assume a byte-addressable memory has 64K bytes. Blocks are 8 bytes in length and the cache consists of 4K bytes. Show the format for a main memory address assuming a 4-way set associative cache mapping scheme. Include the field names as well as their sizes.
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?
Assume a computer with a cache that holds 64 bytes and has a block size of...
Assume a computer with a cache that holds 64 bytes and has a block size of 32 bytes. Direct address mapping is used and from the beginning the cache is empty. The following program sequence is executed: for (col = 0; col < 2; col++) { for (row = 0; row < 4; row++) A[row][col] = B[row] * C[col]; } Assume that for the variables row and col registers are used. The matrix A consists of 4 rows and 4...
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.
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT