rendered paste bodyWelcome to my CSC 1004 Cache Project!
This program demonstrates the behaviour of a 0.25KB cache (block
size is 8 Bytes) accompanied by a 1KB memory. It demonstrates the
use of both Direct Mapped and Fully Associative cache
organisations.
The program takes address references in the range 0 .. 1023 and
determines whether a given address reference is a hit or either a
compulsory/conflict miss. It also computes the Miss and Hit Rate
and displays all the information at the end of the cache contents.
The output begins with the required memory content listing
randomly generated at each run.
The extra feature of my implementation is that by using the
constructors of the various classes,the borders of the usage can
be extended to ANY size of cache (block) and/or memory. All the
computations would remain correct.
Please note that hence it was not part of the exercise, the code
does not handle any exceptional situations!
Enjoy!
Printing out memory contents from 152 to 167.
Index: 152 Content: 11
Index: 153 Content: -108
Index: 154 Content: -99
Index: 155 Content: 41
Index: 156 Content: 69
Index: 157 Content: -98
Index: 158 Content: 23
Index: 159 Content: 30
Index: 160 Content: 55
Index: 161 Content: -126
Index: 162 Content: -125
Index: 163 Content: -6
Index: 164 Content: -66
Index: 165 Content: 69
Index: 166 Content: 106
Index: 167 Content: 58
Printing out memory contents from 376 to 399.
Index: 376 Content: -89
Index: 377 Content: 98
Index: 378 Content: -77
Index: 379 Content: 124
Index: 380 Content: -34
Index: 381 Content: 102
Index: 382 Content: -12
Index: 383 Content: 86
Index: 384 Content: 58
Index: 385 Content: 45
Index: 386 Content: -24
Index: 387 Content: 47
Index: 388 Content: 25
Index: 389 Content: -93
Index: 390 Content: -102
Index: 391 Content: 83
Index: 392 Content: 107
Index: 393 Content: -74
Index: 394 Content: -87
Index: 395 Content: 100
Index: 396 Content: 83
Index: 397 Content: 31
Index: 398 Content: -8
Index: 399 Content: -61
Printing out memory contents from 496 to 551.
Index: 496 Content: 75
Index: 497 Content: -77
Index: 498 Content: 92
Index: 499 Content: -105
Index: 500 Content: 100
Index: 501 Content: 53
Index: 502 Content: 9
Index: 503 Content: 68
Index: 504 Content: -113
Index: 505 Content: -20
Index: 506 Content: -115
Index: 507 Content: -25
Index: 508 Content: 44
Index: 509 Content: 36
Index: 510 Content: 44
Index: 511 Content: 12
Index: 512 Content: -25
Index: 513 Content: -3
Index: 514 Content: 57
Index: 515 Content: -10
Index: 516 Content: -60
Index: 517 Content: 16
Index: 518 Content: -45
Index: 519 Content: -87
Index: 520 Content: -105
Index: 521 Content: 25
Index: 522 Content: 85
Index: 523 Content: -104
Index: 524 Content: 45
Index: 525 Content: -27
Index: 526 Content: -16
Index: 527 Content: -47
Index: 528 Content: 25
Index: 529 Content: -10
Index: 530 Content: -75
Index: 531 Content: -77
Index: 532 Content: -96
Index: 533 Content: 87
Index: 534 Content: 6
Index: 535 Content: -35
Index: 536 Content: 85
Index: 537 Content: 41
Index: 538 Content: 43
Index: 539 Content: -95
Index: 540 Content: -77
Index: 541 Content: -121
Index: 542 Content: 110
Index: 543 Content: -111
Index: 544 Content: 113
Index: 545 Content: -97
Index: 546 Content: 9
Index: 547 Content: 113
Index: 548 Content: 19
Index: 549 Content: 5
Index: 550 Content: 123
Index: 551 Content: 64
Printing out memory contents from 1000 to 1023.
Index: 1000 Content: 75
Index: 1001 Content: -109
Index: 1002 Content: -79
Index: 1003 Content: -17
Index: 1004 Content: -82
Index: 1005 Content: 19
Index: 1006 Content: -19
Index: 1007 Content: 110
Index: 1008 Content: 117
Index: 1009 Content: 74
Index: 1010 Content: -50
Index: 1011 Content: -37
Index: 1012 Content: -116
Index: 1013 Content: 117
Index: 1014 Content: -28
Index: 1015 Content: -111
Index: 1016 Content: 61
Index: 1017 Content: -54
Index: 1018 Content: -99
Index: 1019 Content: -43
Index: 1020 Content: -123
Index: 1021 Content: 116
Index: 1022 Content: -116
Index: 1023 Content: 9
Direct Mapped Cache:
Cache Index Validity Bit Cache Tag Data
========================================================================================
0 true 2 [-25, -3, 57, -10, -60, 16, -45, -87]
1 true 2 [-105, 25, 85, -104, 45, -27, -16, -47]
2 true 2 [25, -10, -75, -77, -96, 87, 6, -35]
3 true 2 [85, 41, 43, -95, -77, -121, 110, -111]
4 true 2 [113, -97, 9, 113, 19, 5, 123, 64]
5 true 2 [-75, -80, -37, 94, 9, -93, -95, -83]
6 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
7 true 0 [11, 123, 67, -32, -29, -123, -128, -25]
8 true 0 [3, -14, -79, -37, 60, -4, -19, -32]
9 true 0 [-128, 98, 88, 115, 52, -126, 54, 70]
10 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
11 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
12 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
13 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
14 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
15 true 1 [72, -86, 88, -83, 0, -77, 10, 18]
16 true 1 [-106, -125, 120, 90, 63, -68, -11, -78]
17 true 1 [119, -94, 50, -51, -45, -79, 116, 73]
18 true 1 [100, 26, 117, -98, -73, 79, 106, -30]
19 true 1 [11, -108, -99, 41, 69, -98, 23, 30]
20 true 1 [55, -126, -125, -6, -66, 69, 106, 58]
21 true 1 [59, -52, 84, -96, 35, 3, -52, 72]
22 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
23 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
24 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
25 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
26 false 0 [0, 0, 0, 0, 0, 0, 0, 0]
27 true 3 [-102, 18, -115, 95, -7, 111, -121, -13]
28 true 3 [-73, -1, 43, 52, 22, -14, 28, 101]
29 true 3 [-10, 34, 52, -101, 73, 91, -44, -125]
30 true 3 [-113, 102, 107, 71, -107, -128, 118, 4]
31 true 3 [-92, -20, -110, 44, 39, -75, -30, -36]
Total Operations: 84
Compulsory Misses: 21
Conflict Misses: 29
Total nr. of Misses: 50
Hits: 34
Hit Ratio: 40.476190476190474 %
Miss Ratio: 59.523809523809526 %
Fully Associative Cache:
Cache Index Validity Bit Cache Tag Data
========================================================================================
0 true 52 [-54, -40, 39, 70, -13, -75, 107, -24]
1 true 123 [-18, -49, 127, 78, 36, 86, -128, -50]
2 true 124 [47, 10, 31, 117, 58, 50, 127, 6]
3 true 126 [117, 74, -50, -37, -116, 117, -28, -111]
4 true 127 [61, -54, -99, -43, -123, 116, -116, 9]
5 true 113 [70, -19, 36, 40, 7, 61, -97, 124]
6 true 114 [80, 100, -59, -32, 73, 91, -2, -69]
7 true 115 [-105, -22, 49, 82, 86, 59, -29, 64]
8 true 116 [62, 123, 112, 120, 102, -55, -25, 104]
9 true 117 [33, 126, 104, 47, 42, 57, -43, 23]
10 true 59 [109, -33, -63, -123, 92, 62, -125, 89]
11 true 60 [42, -88, -117, -119, 61, -85, -119, 101]
12 true 61 [81, -7, -117, 116, -1, 98, 56, -16]
13 true 62 [75, -77, 92, -105, 100, 53, 9, 68]
14 true 64 [-25, -3, 57, -10, -60, 16, -45, -87]
15 true 65 [-105, 25, 85, -104, 45, -27, -16, -47]
16 true 66 [25, -10, -75, -77, -96, 87, 6, -35]
17 true 67 [85, 41, 43, -95, -77, -121, 110, -111]
18 true 68 [113, -97, 9, 113, 19, 5, 123, 64]
19 true 69 [-75, -80, -37, 94, 9, -93, -95, -83]
20 true 16 [-106, -125, 120, 90, 63, -68, -11, -78]
21 true 19 [11, -108, -99, 41, 69, -98, 23, 30]
22 true 20 [55, -126, -125, -6, -66, 69, 106, 58]
23 true 21 [59, -52, 84, -96, 35, 3, -52, 72]
24 true 17 [119, -94, 50, -51, -45, -79, 116, 73]
25 true 27 [-60, 0, 120, -58, -104, -2, -73, -7]
26 true 28 [103, 106, 13, -39, -6, 105, 102, -13]
27 true 29 [19, -21, -81, -36, -10, -53, -52, 61]
28 true 30 [-118, -109, 111, 115, 106, -13, -87, -79]
29 true 31 [-4, -51, -55, -87, 93, -105, -63, 6]
30 true 47 [-89, 98, -77, 124, -34, 102, -12, 86]
31 true 48 [58, 45, -24, 47, 25, -93, -102, 83]
Total Operations: 84
Compulsory Misses: 32
Conflict Misses: 10
Total nr. of Misses: 42
Hits: 42
Hit Ratio: 50.0 %
Miss Ratio: 50.0 %
Program ended successfully. Thank you!
2007 Zoltan Balogh @ Newcastle University 063656842