Skip to content

Commit 84ad2d0

Browse files
committed
Cache lab implementation
1 parent 37cff64 commit 84ad2d0

20 files changed

+270191
-1
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,13 @@ dkms.conf
7575
.ionide
7676

7777
# End of https://www.toptal.com/developers/gitignore/api/c,visualstudiocode
78+
79+
80+
# Project Compiled Executables
81+
csim
82+
tracegen
83+
test-trans
84+
85+
86+
# Other Misc Files
87+
*.tar

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Student makefile for Cache Lab
3+
#
4+
CC = gcc
5+
CFLAGS = -g -Wall -Werror -std=c99
6+
7+
all: csim test-trans tracegen
8+
# Generate a handin tar file each time you compile
9+
-tar -cvf ${USER}-handin.tar csim.c trans.c
10+
chmod 600 ${USER}-handin.tar
11+
12+
csim: csim.c cachelab.c cachelab.h
13+
$(CC) $(CFLAGS) -o csim csim.c cachelab.c -lm
14+
15+
test-trans: test-trans.c trans.o cachelab.c cachelab.h
16+
$(CC) $(CFLAGS) -o test-trans test-trans.c cachelab.c trans.o
17+
18+
tracegen: tracegen.c trans.o cachelab.c
19+
$(CC) $(CFLAGS) -O0 -o tracegen tracegen.c trans.o cachelab.c
20+
21+
trans.o: trans.c
22+
$(CC) $(CFLAGS) -O0 -c trans.c
23+
24+
#
25+
# Clean the src dirctory
26+
#
27+
clean:
28+
rm -rf *.o
29+
rm -f csim
30+
rm -f test-trans tracegen
31+
rm -f trace.all trace.f*
32+
rm -f .csim_results .marker
33+
34+
#
35+
# Handin submission
36+
#
37+
handin:
38+
cp -i *-handin.tar /home/dbuchhol/dropbox/

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1-
# Cache-Simulator
1+
# Cache-Simulator
2+
3+
This is the handout directory for the CS:APP Cache Lab.
4+
5+
************************
6+
Running the autograders:
7+
************************
8+
9+
Before running the autograders, compile your code:
10+
linux> make
11+
12+
Check the correctness of your simulator:
13+
linux> ./test-csim
14+
15+
Check the correctness and performance of your transpose functions:
16+
linux> ./test-trans -M 32 -N 32
17+
linux> ./test-trans -M 64 -N 64
18+
linux> ./test-trans -M 61 -N 67
19+
20+
Check everything at once (this is the program that your instructorruns):
21+
linux> ./driver.py
22+
23+
******
24+
Files:
25+
******
26+
27+
# You will modifying and handing in these two files
28+
csim.c Your cache simulator
29+
trans.c Your transpose function
30+
31+
# Tools for evaluating your simulator and transpose function
32+
Makefile Builds the simulator and tools
33+
README This file
34+
driver.py* The driver program, runs test-csim and test-trans
35+
cachelab.c Required helper functions
36+
cachelab.h Required header file
37+
csim-ref* The executable reference cache simulator
38+
test-csim* Tests your cache simulator
39+
test-trans.c Tests your transpose function
40+
tracegen.c Helper program used by test-trans
41+
traces/ Trace files used by test-csim.c

actual.txt

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
S 0x600aa0,1 miss
2+
S 0x7ff000398,8 miss
3+
S 0x7ff000390,8 miss
4+
S 0x7ff000378,8 miss
5+
S 0x7ff000370,8 miss
6+
S 0x7ff000384,4 miss
7+
L 0x7ff000384,4 hit
8+
S 0x7ff000388,4 miss
9+
L 0x7ff000388,4 hit
10+
L 0x7ff000384,4 hit
11+
L 0x7ff000378,8 hit
12+
L 0x7ff000388,4 hit
13+
L 0x600a20,4 miss eviction
14+
S 0x7ff00038c,4 hit
15+
L 0x7ff000388,4 hit
16+
L 0x7ff000370,8 hit
17+
L 0x7ff000384,4 hit
18+
L 0x7ff00038c,4 hit
19+
S 0x600a60,4 miss eviction
20+
M 0x7ff000388,4 hit hit
21+
L 0x7ff000388,4 hit
22+
L 0x7ff000384,4 hit
23+
L 0x7ff000378,8 hit
24+
L 0x7ff000388,4 hit
25+
L 0x600a24,4 miss eviction
26+
S 0x7ff00038c,4 hit
27+
L 0x7ff000388,4 hit
28+
L 0x7ff000370,8 hit
29+
L 0x7ff000384,4 hit
30+
L 0x7ff00038c,4 hit
31+
S 0x600a70,4 miss eviction
32+
M 0x7ff000388,4 hit hit
33+
L 0x7ff000388,4 hit
34+
L 0x7ff000384,4 hit
35+
L 0x7ff000378,8 hit
36+
L 0x7ff000388,4 hit
37+
L 0x600a28,4 miss
38+
S 0x7ff00038c,4 hit
39+
L 0x7ff000388,4 hit
40+
L 0x7ff000370,8 hit
41+
L 0x7ff000384,4 hit
42+
L 0x7ff00038c,4 hit
43+
S 0x600a80,4 miss eviction
44+
M 0x7ff000388,4 hit hit
45+
L 0x7ff000388,4 hit
46+
L 0x7ff000384,4 hit
47+
L 0x7ff000378,8 hit
48+
L 0x7ff000388,4 hit
49+
L 0x600a2c,4 hit
50+
S 0x7ff00038c,4 hit
51+
L 0x7ff000388,4 hit
52+
L 0x7ff000370,8 hit
53+
L 0x7ff000384,4 hit
54+
L 0x7ff00038c,4 hit
55+
S 0x600a90,4 miss eviction
56+
M 0x7ff000388,4 hit hit
57+
L 0x7ff000388,4 hit
58+
M 0x7ff000384,4 hit hit
59+
L 0x7ff000384,4 hit
60+
S 0x7ff000388,4 hit
61+
L 0x7ff000388,4 hit
62+
L 0x7ff000384,4 hit
63+
L 0x7ff000378,8 hit
64+
L 0x7ff000388,4 hit
65+
L 0x600a30,4 miss eviction
66+
S 0x7ff00038c,4 hit
67+
L 0x7ff000388,4 hit
68+
L 0x7ff000370,8 miss eviction
69+
L 0x7ff000384,4 hit
70+
L 0x7ff00038c,4 hit
71+
S 0x600a64,4 miss eviction
72+
M 0x7ff000388,4 hit hit
73+
L 0x7ff000388,4 hit
74+
L 0x7ff000384,4 hit
75+
L 0x7ff000378,8 hit
76+
L 0x7ff000388,4 hit
77+
L 0x600a34,4 hit
78+
S 0x7ff00038c,4 hit
79+
L 0x7ff000388,4 hit
80+
L 0x7ff000370,8 hit
81+
L 0x7ff000384,4 hit
82+
L 0x7ff00038c,4 hit
83+
S 0x600a74,4 miss eviction
84+
M 0x7ff000388,4 hit hit
85+
L 0x7ff000388,4 hit
86+
L 0x7ff000384,4 hit
87+
L 0x7ff000378,8 hit
88+
L 0x7ff000388,4 hit
89+
L 0x600a38,4 miss eviction
90+
S 0x7ff00038c,4 hit
91+
L 0x7ff000388,4 hit
92+
L 0x7ff000370,8 hit
93+
L 0x7ff000384,4 hit
94+
L 0x7ff00038c,4 hit
95+
S 0x600a84,4 miss eviction
96+
M 0x7ff000388,4 hit hit
97+
L 0x7ff000388,4 hit
98+
L 0x7ff000384,4 hit
99+
L 0x7ff000378,8 hit
100+
L 0x7ff000388,4 hit
101+
L 0x600a3c,4 hit
102+
S 0x7ff00038c,4 hit
103+
L 0x7ff000388,4 hit
104+
L 0x7ff000370,8 hit
105+
L 0x7ff000384,4 hit
106+
L 0x7ff00038c,4 hit
107+
S 0x600a94,4 miss eviction
108+
M 0x7ff000388,4 hit hit
109+
L 0x7ff000388,4 hit
110+
M 0x7ff000384,4 hit hit
111+
L 0x7ff000384,4 hit
112+
S 0x7ff000388,4 hit
113+
L 0x7ff000388,4 hit
114+
L 0x7ff000384,4 hit
115+
L 0x7ff000378,8 hit
116+
L 0x7ff000388,4 hit
117+
L 0x600a40,4 miss eviction
118+
S 0x7ff00038c,4 hit
119+
L 0x7ff000388,4 hit
120+
L 0x7ff000370,8 hit
121+
L 0x7ff000384,4 hit
122+
L 0x7ff00038c,4 hit
123+
S 0x600a68,4 miss eviction
124+
M 0x7ff000388,4 hit hit
125+
L 0x7ff000388,4 hit
126+
L 0x7ff000384,4 hit
127+
L 0x7ff000378,8 hit
128+
L 0x7ff000388,4 hit
129+
L 0x600a44,4 hit
130+
S 0x7ff00038c,4 hit
131+
L 0x7ff000388,4 hit
132+
L 0x7ff000370,8 hit
133+
L 0x7ff000384,4 hit
134+
L 0x7ff00038c,4 hit
135+
S 0x600a78,4 miss eviction
136+
M 0x7ff000388,4 hit hit
137+
L 0x7ff000388,4 hit
138+
L 0x7ff000384,4 hit
139+
L 0x7ff000378,8 hit
140+
L 0x7ff000388,4 hit
141+
L 0x600a48,4 miss eviction
142+
S 0x7ff00038c,4 hit
143+
L 0x7ff000388,4 hit
144+
L 0x7ff000370,8 hit
145+
L 0x7ff000384,4 hit
146+
L 0x7ff00038c,4 hit
147+
S 0x600a88,4 miss eviction
148+
M 0x7ff000388,4 hit hit
149+
L 0x7ff000388,4 hit
150+
L 0x7ff000384,4 hit
151+
L 0x7ff000378,8 hit
152+
L 0x7ff000388,4 hit
153+
L 0x600a4c,4 miss eviction
154+
S 0x7ff00038c,4 hit
155+
L 0x7ff000388,4 hit
156+
L 0x7ff000370,8 hit
157+
L 0x7ff000384,4 hit
158+
L 0x7ff00038c,4 hit
159+
S 0x600a98,4 miss eviction
160+
M 0x7ff000388,4 hit hit
161+
L 0x7ff000388,4 hit
162+
M 0x7ff000384,4 hit hit
163+
L 0x7ff000384,4 hit
164+
S 0x7ff000388,4 hit
165+
L 0x7ff000388,4 hit
166+
L 0x7ff000384,4 hit
167+
L 0x7ff000378,8 hit
168+
L 0x7ff000388,4 hit
169+
L 0x600a50,4 miss eviction
170+
S 0x7ff00038c,4 hit
171+
L 0x7ff000388,4 hit
172+
L 0x7ff000370,8 hit
173+
L 0x7ff000384,4 hit
174+
L 0x7ff00038c,4 hit
175+
S 0x600a6c,4 miss eviction
176+
M 0x7ff000388,4 hit hit
177+
L 0x7ff000388,4 hit
178+
L 0x7ff000384,4 hit
179+
L 0x7ff000378,8 hit
180+
L 0x7ff000388,4 hit
181+
L 0x600a54,4 hit
182+
S 0x7ff00038c,4 hit
183+
L 0x7ff000388,4 hit
184+
L 0x7ff000370,8 hit
185+
L 0x7ff000384,4 hit
186+
L 0x7ff00038c,4 hit
187+
S 0x600a7c,4 miss eviction
188+
M 0x7ff000388,4 hit hit
189+
L 0x7ff000388,4 hit
190+
L 0x7ff000384,4 hit
191+
L 0x7ff000378,8 hit
192+
L 0x7ff000388,4 hit
193+
L 0x600a58,4 miss eviction
194+
S 0x7ff00038c,4 hit
195+
L 0x7ff000388,4 hit
196+
L 0x7ff000370,8 hit
197+
L 0x7ff000384,4 hit
198+
L 0x7ff00038c,4 hit
199+
S 0x600a8c,4 miss eviction
200+
M 0x7ff000388,4 hit hit
201+
L 0x7ff000388,4 hit
202+
L 0x7ff000384,4 hit
203+
L 0x7ff000378,8 hit
204+
L 0x7ff000388,4 hit
205+
L 0x600a5c,4 hit
206+
S 0x7ff00038c,4 hit
207+
L 0x7ff000388,4 hit
208+
L 0x7ff000370,8 hit
209+
L 0x7ff000384,4 hit
210+
L 0x7ff00038c,4 hit
211+
S 0x600a9c,4 miss eviction
212+
M 0x7ff000388,4 hit hit
213+
L 0x7ff000388,4 hit
214+
M 0x7ff000384,4 hit hit
215+
L 0x7ff000384,4 hit
216+
L 0x7ff000390,8 miss eviction
217+
L 0x7ff000398,8 miss eviction
218+
L 0x600aa0,1 miss eviction
219+
hits:201 misses:37 evictions:29

0 commit comments

Comments
 (0)