I am trying to create a cache simulator with Excel VBA. I will have four sheets with data like so:
2 400170 8fa40000
0 7ffebc64 0
2 400174 3c1c1002
2 400178 279ce710
2 40017c 27a50004
2 400180 af85abb4
1 100192c4 0
2 400184 24a60004
2 400188 41080
2 40018c af80abb8
1 100192c8 0
2 400190 c23021
2 400194 27bdffe8
2 400198 af86a470
1 10018b80 0
2 40019c afa00014
1 7ffebc60 0
2 4001a0 c1057e7
2 4001a4 af84abb0
1 100192c0 0
2 415f9c 27bdff70
2 415fa0 afb00020
1 7ffebbdc 0
2 415fa4 afbf0044
1 7ffebc00 0
2 415fa8 afa40090
1 7ffebc4c 0
2 415fac afbe0040
1 7ffebbfc 0
I want to loop through these 'addresses' with the LRU policy and output the hit/miss ratios, either adjacent to each address, or in a table on another sheet of the workbook.
It will be a single-level cache with a 64KB size and 64KB cache block. It will also be Direct-mapped with a write-through policy, and it will be data integrated.
The logic for the loop I'm assuming would be to process each address from the sheet (the data above), and check to see if that address is in the cache or not. Once processed, it will output the address as either hit or miss, and then give the ratio for the data set.
Does anyone have any idea as to how my VBA structure should look (can you provide some code examples)? Is it possible to use any Excel formulas for this function? I haven't been able to find many resources online regarding cache simulation with Excel VBA.
Thank you!
Bookmarks