This program simulates a cache to analyze cache performance. It uses
command line arguments to configure the cache parameters and reads
a memory trace file to simulate memory operations on the cache.
The program reports cache hits, misses, and evictions.
Usage:
./csim [-v] -s <s> -b <b> -E <E> -t <trace>
./csim -h
-h Print this help message and exit
-v Verbose mode: report effects of each memory operation
-s <s> Number of set index bits (there are 2**s sets)
-b <b> Number of block bits (there are 2**b blocks)
-E <E> Number of lines per set (associativity)
-t <trace> File name of the memory trace to process
The -s, -b, -E, and -t options must be supplied for all simulations.
Design Decisions:
The program is designed to follow the structure of a real cache memory
system. It initializes a cache with configurable parameters and simulates
cache operations based on a memory trace file. The design uses a simple LRU
(Least Recently Used) replacement policy and supports both load and store
operations.
Modifying the Program:
To modify the program, you need to understand the cache parameters and the
LRU policy. Key structures are Arguments and cache_line, which store the
configuration and state of the cache, respectively. Be cautious when changing
the cache initialization and access logic, as they are critical to
maintaining the correct behavior of the cache.