Determines if cache hit or cache miss depending on inputted cache parameters.
The first four lines of input contain the fundamental cache parameters.
- S - Number of sets
- E - Number of lines per set
- B - Block size (in bytes)
- m - Number of physical (main memory) address bits
- The 5th line is the replacement policy (LFU or LRU)
- The last two lines represent the hit time and the miss penalty respectively. Both are integers
This gives us a cache with 4 sets, each set has only 1 line and a block size of 8. The main memory address has 8 bits. This cache uses a 'Least Frequently Used' replacement policy. The cache hit time is 1 and the cache miss pentality is 30.
4
1
8
8
LFU
1
30
20
22
24
26
28
2a
30
Below is the corresponding output:
20 M
22 H
24 H
26 H
28 M
2a H
30 M