Question

Module 10 Assignment - Direct-mapped Cache Direct-Mapped Cache In this question youre given a 16-byte memory segment and an

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

Cache Type => Direct Mapped Cache

Memory Size = 16 Bytes

Cache Size = 8 Bytes

Block Size = 1 Byte

=> Byte Offset = \small log_2(#block\;size) = log_2(1) = 0 bits

So, Number of cache blocks = Cache Size / Block Size = 8/1 = 8

=> Index Bits Size = \small log_2(#cache\;blocks) = log_2(8) = 3 bits

Cache Index = Memory Block Number % #Cache Blocks = Memory Block Number % 8

Let's understand first memory access 0x48 and how can it map to cache block

Memory Access = 0x48

  • Memory address in Binary = 0100 1000
  • Cache Index = 000 => 0th Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = J

Memory Access = 0x4C

  • Memory address in Binary = 0100 1100
  • Cache Index = 100 => 4th Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = s

Memory Access = 0x46

  • Memory address in Binary = 0100 0110
  • Cache Index = 110 => 6th Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = p

Memory Access = 0x4D

  • Memory address in Binary = 0100 1101
  • Cache Index = 101 => 5th Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = A

Memory Access = 0x42

  • Memory address in Binary = 0100 0010
  • Cache Index = 010 => 2nd Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = 9

Memory Access = 0x4B

  • Memory address in Binary = 0100 1011
  • Cache Index = 011 => 3rd Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = V

Memory Access = 0x45

  • Memory address in Binary = 0100 0101
  • Cache Index = 101 => 5th Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = 8

Memory Access = 0x41

  • Memory address in Binary = 0100 0001
  • Cache Index = 001 => 1st Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = a

Memory Access = 0x48

  • Memory address in Binary = 0100 1000
  • Cache Index = 000 => 0th Cache Block
  • Tag = 01001
  • Cache Hit

Memory Access = 0x4F

  • Memory address in Binary = 0100 1111
  • Cache Index = 111 => 7th Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = 4

Memory Access = 0x4A

  • Memory address in Binary = 0100 1010
  • Cache Index = 010 => 2nd Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = ?

Memory Access = 0x47

  • Memory address in Binary = 0100 0111
  • Cache Index = 111 => 7th Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = d

Memory Access = 0x40

  • Memory address in Binary = 0100 0000
  • Cache Index = 000 => 0th Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = 3

Memory Access = 0x43

  • Memory address in Binary = 0100 0011
  • Cache Index = 011 => 3rd Cache Block
  • Tag = 01000
  • Cache Miss
  • Contents from memory = R

Memory Access = 0x4C

  • Memory address in Binary = 0100 1100
  • Cache Index = 100 => 4th Cache Block
  • Tag = 01001
  • Cache Hit

Memory Access = 0x4E

  • Memory address in Binary = 0100 1110
  • Cache Index = 110 => 6th Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = T

Memory Access = 0x40

  • Memory address in Binary = 0100 0000
  • Cache Index = 000 => 0th Cache Block
  • Tag = 01000
  • Cache Hit

Memory Access = 0x49

  • Memory address in Binary = 0100 1001
  • Cache Index = 001 => 1st Cache Block
  • Tag = 01001
  • Cache Miss
  • Contents from memory = 7

Memory Access = 0x47

  • Memory address in Binary = 0100 0111
  • Cache Index = 111 => 7th Cache Block
  • Tag = 01000
  • Cache Hit
Index Contents Tag Contents Tag
000 J 1001 3 1000
001 a 1000 7 1001
010 9 1000 ? 1001
011 V 1001 R 1000
100 s 1001
101 A 1001 8 1000
110 p 1000 T 1001
111 4 1001 d 1000

Total Cache Misses = 15

Total Cache Hits = 4

In Direct Mapped cache, replacement policy is in-built policy as indexed slot is always replaced if it is full. There is no other choice.

The major dis-advatage of this replacement approach is that if multiple block which are mapped to same slot are continuously referenced then they will be swapped in and out multiple times which can lead to thrashing. Also the blocks which are not used for long time but mapped to different cache slot will always be present and never chosen for replacement.

Add a comment
Know the answer?
Add Answer to:
Module 10 Assignment - Direct-mapped Cache Direct-Mapped Cache In this question you're given a 16-byte memory...
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
  • 6. (30) Consider a 64B direct-mapped cache with 16B blocks and 4 sets for an 8-bit architecture (...

    6. (30) Consider a 64B direct-mapped cache with 16B blocks and 4 sets for an 8-bit architecture (i.e., 256 bytes of memory): a. (5) Write a C function unsigned char getTag(unsigned char address) that returns the cache tag for the specified address using bitwise operators: b. (5) Write a C function unsigned char getSet(unsigned char address) that returns the cache set for the specified address using bitwise operators: c. (10) Considering the following sequence of memory addresses, which addresses will...

  • Question 33 10 pts For a direct mapped cache of 4 blocks with a cache block...

    Question 33 10 pts For a direct mapped cache of 4 blocks with a cache block size of 1 byte, in which cache block will each memory location map to? The order of accesses if given by the operation number. Indicate if each access is a hit or a miss, and what the tag value is for each entry. Assume that the cache is initially empty, and the accesses are in order of appearance. REDRAW AND COMPLETE THE CACHE TABLE...

  • Suppose a computer using direct mapped cache has 232 byte of byte-addressable main memory, and a...

    Suppose a computer using direct mapped cache has 232 byte of byte-addressable main memory, and a cache of 1024 blocks, where each cache block contains 32 bytes. a. How many blocks of main memory are there? b. What is the format of a memory address as seen by the cache, i.e., what are the sizes of the tag, block, and offset fields? c.To which cache block will the memory address 0x000063FA map?

  • For a 16K-byte, direct-mapped cache, suppose the block size is 32 bytes, draw a cache diagram....

    For a 16K-byte, direct-mapped cache, suppose the block size is 32 bytes, draw a cache diagram. Indicate the block size, number of blocks, and address field decomposition (block offset, index, and tag bit width) assuming a 32-bit memory address.

  • 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...

  • 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...

  • QUESTION 2 Suppose a computer using direct mapped cache has 216 bytes of byte-addressable main memory...

    QUESTION 2 Suppose a computer using direct mapped cache has 216 bytes of byte-addressable main memory and a cache of 64 blocks, where each cache block contains 32 bytes. a. How many blocks of main memory are there? b) What is the format of a memory address as seen by the cache, (include field names and their sizes) c) To which cache block will the memory address (F8C916 map? What address in that block does it map to?

  • Let's start with a memory system that is byte addressable and has 14-bit addresses. Now let's...

    Let's start with a memory system that is byte addressable and has 14-bit addresses. Now let's add a direct mapped cache that can hold 16 blocks (or has 16 lines) and each block is 4 bytes. The table shoun below details the contents of the cache at a particular point in time. if the valid bit is 1 there is a cache block loaded into the cache with Tag as detailed in the tag column. The columns B0-D3 then show...

  • Question 10 (10 points) Consider a cache of 8 lines of 16 bytes each. Main memory...

    Question 10 (10 points) Consider a cache of 8 lines of 16 bytes each. Main memory is divided into blocks of 16 bytes each. That is, block 0 has bytes with addresses 0 through 15, and so on. Now consider a program that accesses memory in the following sequence of addresses: Loop three times: 10 through 20; 32 through 52. Once: 20 through 35. Suppose the cache is organized as direct mapped. Memory blocks 0, 8, 16 and so on...

  • 1 Overview The goal of this assignment is to help you understand caches better. You are...

    1 Overview The goal of this assignment is to help you understand caches better. You are required to write a cache simulator using the C programming language. The programs have to run on iLab machines. We are providing real program memory traces as input to your cache simulator. The format and structure of the memory traces are described below. We will not give you improperly formatted files. You can assume all your input files will be in proper format as...

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
ADVERTISEMENT