Question: please use c + + for this Cache Simulator ( 7 0 points ) : Write a program to simulate caches of different configurations. Make
please use c for this
Cache Simulator points:
Write a program to simulate caches of different configurations. Make the following
assumptions about all the caches we simulate.
The replacement strategy is LRU Least Recently Used if needed.
The cache starts empty.
In writethrough, the processor stalls until the data is written to the memory
before proceeding. That is the memory and cache are always consistent.
The basic cache is
Cache Size: Bytes
Block Size: words, or bytes
Cache Placement Type: direct mapped
Write Policy: write back
You must simulate the basic cache, as well as the configurations in one of the
following categories. For example, if you choose the category of cache size, then
you will need to simulate four different configurations: bytes cache size,
words block size, direct mapped, and write back; bytes cache size,
words block size, direct mapped, and write back; bytes cache size,
words block size, direct mapped, and write back; bytes cache size,
words block size, direct mapped, and write back.
Cache Size in bytes:
Block Size in Words or Bytes:
Cache Placement Type:
Fully associative
way set associative
way set associative
Direct Mapped
Write Policy:
Write back
Write through
Note that you have to write only one program that simulates all cache
configurations, one after the other. You might want to use the fact that a direct
mapped cache is also a way set associative cache.
Input File Format: We will use trace files to simulate our cache configurations.
Each trace file is a sequence of memory accesses, one on each line, with the
format:
read addressHex OR
write addressHex
where address is a bit address given in hex. An example file, example.trace
is provided on canvas and can be viewed in any text editor.
Output File Format: Your program should summarize the result of simulation for
each cache configuration for a given trace file. The output must be a text file called
test.result.
Each line represents result for one specific cache configuration and is formatted
as follows:
FA WB
The above numbers represent the following:
Cache size in Bytes
Block size in Bytes
Mapping type DMWW and FA for directmapped, way and way
set associative, and fullyassociative caches respectively
Write policy WB WT
Hit rate two decimal points
Total Bytes transferred from memory to the cache
Total Bytes transferred from cache to memory
Number of blocks within each block set
An example file is provided under the assignment link. You can view this using
Notepad or other text editors.
Execution Format: Your program should, by default, be able to read in the input
trace file named testtrace and produce at the end an output file named
testresult Name your main executable in case of CCPython as simulate
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
