diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 16:34:31 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 16:34:31 -0800 |
commit | 7b8fcecf11813492d770a0d766fb9a9fb01be3e2 (patch) | |
tree | 7d07b91591e436f6127c2a7e89efad6afaaf35ee /src/mem/ruby/system/CacheMemory.cc | |
parent | 99338a7460ee495aa93009c33dec30c459680e42 (diff) | |
download | gem5-7b8fcecf11813492d770a0d766fb9a9fb01be3e2.tar.xz |
ruby: cache configuration fix to use bytes
Changed cache size to be in bytes instead of kb so that testers can use very
small caches and increase the chance of writeback races.
Diffstat (limited to 'src/mem/ruby/system/CacheMemory.cc')
-rw-r--r-- | src/mem/ruby/system/CacheMemory.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc index 04adbcf69..a5c881a61 100644 --- a/src/mem/ruby/system/CacheMemory.cc +++ b/src/mem/ruby/system/CacheMemory.cc @@ -52,12 +52,12 @@ CacheMemory::CacheMemory(const string & name) void CacheMemory::init(const vector<string> & argv) { - int cache_size = 0; + int cache_size = -1; string policy; m_controller = NULL; for (uint32 i=0; i<argv.size(); i+=2) { - if (argv[i] == "size_kb") { + if (argv[i] == "size") { cache_size = atoi(argv[i+1].c_str()); } else if (argv[i] == "latency") { m_latency = atoi(argv[i+1].c_str()); @@ -72,8 +72,12 @@ void CacheMemory::init(const vector<string> & argv) } } - m_cache_num_sets = cache_size / m_cache_assoc; + assert(cache_size != -1); + + m_cache_num_sets = (cache_size / m_cache_assoc) / RubySystem::getBlockSizeBytes(); + assert(m_cache_num_sets > 1); m_cache_num_set_bits = log_int(m_cache_num_sets); + assert(m_cache_num_set_bits > 0); if(policy == "PSEUDO_LRU") m_replacementPolicy_ptr = new PseudoLRUPolicy(m_cache_num_sets, m_cache_assoc); |