less than 1 minute read

1.Add a member variable in the BaseCache class in both .cc and .py called cache-level.

a. Add cache_level in /src/mem/cache/Cache.py

cache_level = Param.Int("The cache level of this cache")

b. Define cache_level in file /src/mem/cache/base.hh

const int cacheLevel;

c. Initialize cache_level in file /src/mem/cache/base.cc

cacheLevel(p->cache_level),

2.Pass the cache level information to the python constructor function of L1 and L2 caches.

Add the corresponding cache level settings in configs/common/CacheConfig.py

if options.l2cache:
    system.l2 = l2_cache_class(clk_domain=system.cpu_clk_domain,size=options.l2_size,assoc=options.l2_assoc,cache_level=2)

3.Use the cache level information in your source code with cacheLevel variable.

if(cacheLevel==2){
  ...
}

4.Add –l2cache in the gem5 command.

./build/X86/gem5.opt ./configs/example/se.py -c ./tests/test-progs/bin/x86/linux/hello --caches ...(L1 cache information) --l2cache ...(L2 cache information)

Tags:

Categories:

Updated: