Uncategorized

Direct-mapped Cache C Program

Module 12 Assignment – Direct-mapped Cache C Program
Direct-Mapped Cache
This programming assignment builds off the Module 10 Direct-mapped Cache assignment. Write a C
program that simulates the 16-byte memory segment and 8-byte cache. Given the series of memory
accesses noted, write the necessary code to complete and output the table below.
Use the first Contents/Tag column to insert an item to the cache the first time and use the second
Contents/Tag column if a cache entry is overwritten. Note: no index will have more than two blocks
mapped to it. The first two examples have been provided.
Lastly, count and output how many cache hits occur given the memory accesses. Count and output how
many cache misses that have occurred.
Remember, the strategy is to overwrite existing elements in the cache if cache slot is already full.
Please make sure your code is fully documented. Include your name and section within the code
documentation. Submit the source code file (dmapcache.c) along with screenshots of your output to
Blackboard by Sunday 11:59 PM EST.
___________________________________________________________________________________
Memory access: 0x48, 0x4C, 0x46, 0x4D, 0x42, 0x4B, 0x45, 0x41, 0x48, 0x4F, 0x4A, 0x47, 0x40, 0x43,
0x4C, 0x4E, 0x4D, 0x49, 0x47

Memory Address Block
Contents
0x40 3
0x41 a
0x42 9
0x43 R
0x44 !
0x45 8
0x46 p
0x47 d
0x48 J
0x49 7
0x4A ?
0x4B V
0x4C s
0x4D A
0x4E T
0x4F 4
Index Contents Tag Contents Tag
000 J 1001
001
010
011
100 s 1001
101
110
111

The post Direct-mapped Cache C Program appeared first on My Assignment Online.

Leave a Reply

Your email address will not be published. Required fields are marked *