Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CDA3101: Computer Organization This assignment will reinforce your knowledge of

ID: 664866 • Letter: C

Question

CDA3101: Computer Organization

This assignment will reinforce your knowledge of the data cache and memory accesses.
Your goal is to write a simulator for a data cache. The program should be able to read a configuration file and a memory trace as arguments. It should be able to write a list of the memory references and all relevant statistics to standard out. Your cache simulator should use an LRU replacement algorithm. For data writes, it should employ a write-back and write-allocate policy. You can make the following assumptions:
The access granularity will be 1B
The maximum size of the cache is 64KiB
The associativity will never be larger than 16 (set size <= 16) and will be a power of 2
The size of a line will never be larger than 32B and will never be smaller than 4B and will be a power of 2
You may assume that all references are word-aligned
You may assume that a reference will never be larger than the line size
You may assume that the address is 32b
The cache configuration file will be the first argument
The memory trace will be the second argument
The configuration file should have the format:
Set Size – Number of Lines in Each Set
Line Size – Number of Bytes in Each Line
Cache Size – Total Number of Bytes in The Cache
There are example configurations available at
dm.cache – 32B direct-mapped cache
2way.cache – 32B 2-way set associative cache
4way.cache – 32B 4-way set associative cache
The memory trace should have the format:
::
Where accesstype is a character, ‘R’ or ‘W’, size is the size of the reference in bytes, and hexaddress is the address of the reference. For example :
R:4:58
R:4:68
R:4:58
R:4:68
R:4:40
R:4:0c
R:4:40
R:4:48
R:4:40
R:4:0c
R:4:b8
R:4:58
R:4:b8


CDA3101: Computer Organization The output of the simulator should start by printing information about the configuration used. Then, it should print information for each reference – reference number in decimal, access type (read or write), address in hexadecimal, tag in hexadecimal, index in decimal, offset in decimal, and result (hit or miss). The output should also include a summary of the trace – the total number of hits, the total number of misses, the hit rate, and the miss rate.
Total Cache Size: 32B
Line Size: 4B
Set Size: 1
Number of Sets: 8
RefNum R/W Address Tag Index Offset H/M
***************************************************************
0 Read 00000058 2 6 0 Miss
1 Read 00000068 3 2 0 Miss
2 Read 00000058 2 6 0 Hit
3 Read 00000068 3 2 0 Hit
4 Read 00000040 2 0 0 Miss
5 Read 0000000c 0 3 0 Miss
6 Read 00000040 2 0 0 Hit
7 Read 00000048 2 2 0 Miss
8 Read 00000040 2 0 0 Hit
9 Read 0000000c 0 3 0 Hit
10 Read 000000b8 5 6 0 Miss
11 Read 00000058 2 6 0 Miss
12 Read 000000b8 5 6 0 Miss
Simulation Summary
**************************
Total Hits: 5
Total Misses: 8
Hit Rate: 0.38462
Miss Rate: 0.61538
You can access my binary using the following command:
You should use the linprog servers for all of your compilation and testing. Your output should match mine exactly.
There is an additional file supplied with this assignment with code snippets that will help you with the spacing.
You can determine if the results are identical by calculating the md5sum or by using diff. You must use C/C++ as your language and your solution should be a single file (e.g. ch03c.pr02.c or ch03c.pr02.cpp). You should submit this file through Blackboard. Your program should have comments inline and a header at the top. For example:

Some of the methods used to parse data from project one may be helpful. However, for this assignment you need to think about the cache as an object. What should its members be? What about its methods? The members may be objects themselves.

Explanation / Answer

#include #define SIZE 4096 int matrix[SIZE][SIZE]; int main(void) { int i, j; for (i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote