cachesim
A highly scalable cache simulator
cachesim provides a highly scalable skeleton of cache simulator. One can use this tool not only to simulate a conventional cache behavior but also introduce his own type of cache and even other level of storage in the storage hierarchy, which will introduce benefits into storage and memory research.
I have made an example to use this crate as a library in a local Rust project. Please refer to cachesim_example.
The basic usage is like:
use ;
To introduce a new type of cache, you need not to modify the source code. For example, if you want to introduce an 'Oracle Cache', firstly you could create a file 'oracle_cache.rs' or a module 'oracle_cache/mod.rs' under your own project directory. Then, define a struct representing the cache:
Then, implement the GeneralCacheBehavior for your new cache type:
use crate;
You can implement any other method for the cache.
Then, use your own cache in your project:
use ;
// Import your own cache.
use OracleCache;
By this way you could even introduce a hierarchical storage architecture by define and implement several struct that are well organized.
To use the example cache, you need to provide a config file.
For Default Cache, your file need to include following contents with strict format, each occurs in a single line:
type=default$# this must not be changedsets=<u32>$# to define the number of sets in the cacheassociativity=<u32>$# to define the number of ways(associativity) in one cache setblocksize=<u32>$# to define the size in byte of a cacheline(block)hit latency=<f64>$miss penalty=<f64>$# this 2 configs define the latency feature of the cache, the unit of these float numbers are not needed and must not be written here
do not add any white space in these lines, and do add '$' at the end of each line.
For Oracle Cache, your file need to include following contents in a single line:
type=default$# this must not be changed
do not add any white space in these lines, and do add '$' at the end of each line.
See examples/default.txt.