Starting from:

$29

Assignment 5 ache Simulator

CSCI 2500 Assignment 5
ache Simulator
For this assignment you will be constructing a software cache simulator similar to what will be reuired in the group proect. We will be simulating the dierences between a direct-mapped, 2-way, and -way set associative cache. imultaneously, we will be using either a least recently used or Bldys algorithm. wasdiscussedinclass, ontheslides, andinthetextbook. ssentially, whenanitemneedstobeevicted from the cache and we have a choice we will select the item in our set that was used longest ago. Bldys algorithm on the other hand will evict the item currently in the cache set that will be used furthest in the future. If an item is never accessed again, it will always be safe to evict it. Note that while Bldys algorithm sounds impressive, in practice it is not possible to implement due to the reuired foresight of memory accesses. Your cache will hold 2 items regardless of its configuration. In other words, 2 by 1 for direct-mapped, 12 by 2 for 2-way set associative, etc. You can initialie your cache lines with eroes as no eroes will appear in the memory trace. The memory trace will contain 1, non-ero addresses. In this simplified cache, finding your set will be as simple as taking the desired memory address and modding it by the set count int set memaddress setcount ample output below running on only 1 accesses bash-3.2$ ./a.out nter associativity 1 2 4: 2
ache sie 256 items ache has associativity of 2 ache has 128 sets
hoose either 1 or 2 elady: 1
1 33 2 34 65 1 66 2 97
1
65 tartin imulation... tatistics: ache ssociativity: 2 ache ccesses: 10 ache Hits: 3 ache isses: 7 verall Hit ate: 0.300000
bash-3.2$ ./a.out nter associativity 1 2 4: 2
ache sie 256 items ache has associativity of 2 ache has 128 sets
hoose either 1 or 2 elady: 2
1 33 2 34 65 1 66 2 97 65 tartin imulation... tatistics: elady ache ssociativity: 2 ache ccesses: 10 ache Hits: 3 ache isses: 7 verall Hit ate: 0.300000
2

More products