Closed brsf11 closed 2 months ago
I've pushed the commit for the typo, comment and cache test. For the clang-format, I'm not sure if my tool works properly since I've seen some modification on previous code when I used the format tool.
e.g.
switch (config->replacement_policy()) {
case CacheConfig::RP_RAND:
return std::make_unique<CachePolicyRAND>(config->associativity());
case CacheConfig::RP_LRU:
return std::make_unique<CachePolicyLRU>(
config->associativity(), config->set_count());
case CacheConfig::RP_LFU:
return std::make_unique<CachePolicyLFU>(
config->associativity(), config->set_count());
case CacheConfig::RP_PLRU:
return std::make_unique<CachePolicyPLRU>(
config->associativity(), config->set_count());
}
will be converted to
switch (config->replacement_policy()) {
case CacheConfig::RP_RAND:
return std::make_unique<CachePolicyRAND>(config->associativity());
case CacheConfig::RP_LRU:
return std::make_unique<CachePolicyLRU>(config->associativity(), config->set_count());
case CacheConfig::RP_LFU:
return std::make_unique<CachePolicyLFU>(config->associativity(), config->set_count());
case CacheConfig::RP_PLRU:
return std::make_unique<CachePolicyPLRU>(config->associativity(), config->set_count());
}
I've pushed the commit for the typo, comment and cache test. For the clang-format, I'm not sure if my tool works properly since I've seen some modification on previous code when I used the format tool.
e.g.
switch (config->replacement_policy()) { case CacheConfig::RP_RAND: return std::make_unique<CachePolicyRAND>(config->associativity()); case CacheConfig::RP_LRU: return std::make_unique<CachePolicyLRU>( config->associativity(), config->set_count()); case CacheConfig::RP_LFU: return std::make_unique<CachePolicyLFU>( config->associativity(), config->set_count()); case CacheConfig::RP_PLRU: return std::make_unique<CachePolicyPLRU>( config->associativity(), config->set_count()); }
will be converted to
switch (config->replacement_policy()) { case CacheConfig::RP_RAND: return std::make_unique<CachePolicyRAND>(config->associativity()); case CacheConfig::RP_LRU: return std::make_unique<CachePolicyLRU>(config->associativity(), config->set_count()); case CacheConfig::RP_LFU: return std::make_unique<CachePolicyLFU>(config->associativity(), config->set_count()); case CacheConfig::RP_PLRU: return std::make_unique<CachePolicyPLRU>(config->associativity(), config->set_count()); }
Yeah, for some parts may not be correctly formatted now. That is ok.
Thanks to @brsf11 for idea and implementation and @jdupak for help with integration.
Add PLRU replacement policy, which is more widely used in real-world hardware than ideal LRU.