I added a new policy LRU2 to the classic model, this is a copy of my wiki,
you have to note it was done for the gem5 stable version, for the new
version the changes to *src/mem/cache/builder.cc* are easier, you can use
this as reference.
The files LRU2.hh and LRU2.cc are in src/mem/cache/tags/
For classic model I added a new parameter to src/mem/cache/BaseCache.py for
choosing between the policies.
replPolicy = Param.String("LRU", "")
In *src/mem/cache/cache.cc* you have to add
#if defined(USE_CACHE_LRU2)
#include "mem/cache/tags/lru2.hh"
#endif
#if defined(USE_CACHE_LRU2)
template class Cache<LRU2>;
#endif
*src/mem/config/cache.hh*
#define USE_CACHE_LRU2 1
*src/mem/cache/builder.cc* is the main change
Add the files for the new policy
#if defined(USE_CACHE_LRU2)
#include "mem/cache/tags/lru2.hh"
#endif
Construct the policy
#if defined(USE_CACHE_LRU2)
#define BUILD_LRU2_CACHE do { \
LRU2 *tags = new LRU2(numSets, block_size, assoc, latency); \
BUILD_CACHE(LRU2, tags); \
} while (0)
#else
#define BUILD_LRU2_CACHE BUILD_CACHE_PANIC("lru2 cache")
#endif
Change the code below #define BUILD_CACHES for it:
#define BUILD_CACHES do { \
if (repl == NULL) { \
if (numSets == 1) { \
BUILD_FALRU_CACHE; \
} else { \
if(repl_Policy=="LRU") \
BUILD_LRU_CACHE; \
else \
BUILD_LRU2_CACHE; \
} \
} else { \
BUILD_IIC_CACHE; \
} \
} while (0)
Add the new policy in: *src/mem/cache/tags/SConscript*
Source('lru2.cc')
Using the new policy
The cache configuration is in:
configs/common/Caches.py
At the end of the cache you can define the policy using the new parameter.
repl_Policy = Param.String("LRU2", "")
Best Regards
Roberto
On Thu, Mar 7, 2013 at 12:30 PM, SUBRAMANIAN M <[email protected]> wrote:
> Hi,
> I am using ALPHA_MESI_CMP and i want to use
> two different replacement policies
> for L1 and L2 caches. for L1 , LRU (which i learnt is default)
> and for L2 i wanna
> use MRU. i ve created MRU.hh and MRU.cc files,
> exact replicas of LRU.hh and LRU.cc
> files with the class names and few functions alone
> changed according to my needs.
> Now what changes i have to do in what files so as to ensure
> that L2 alone runs my
> MRU algortihm ?? Any answers ll b greatly appreciated
> as i am badly in need of it!
>
> Regards,
> Subramanian.M,
> Hewlett-Packard Labs,
> India
>
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users