CacheMemory.cc (10919:80069a602c83) | CacheMemory.cc (10970:ea8bdb1d9f1e) |
---|---|
1/* 2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 47 unchanged lines hidden (view full) --- 56 dataArray(p->dataArrayBanks, p->dataAccessLatency, 57 p->start_index_bit, p->ruby_system), 58 tagArray(p->tagArrayBanks, p->tagAccessLatency, 59 p->start_index_bit, p->ruby_system) 60{ 61 m_cache_size = p->size; 62 m_latency = p->latency; 63 m_cache_assoc = p->assoc; | 1/* 2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 47 unchanged lines hidden (view full) --- 56 dataArray(p->dataArrayBanks, p->dataAccessLatency, 57 p->start_index_bit, p->ruby_system), 58 tagArray(p->tagArrayBanks, p->tagAccessLatency, 59 p->start_index_bit, p->ruby_system) 60{ 61 m_cache_size = p->size; 62 m_latency = p->latency; 63 m_cache_assoc = p->assoc; |
64 m_policy = p->replacement_policy; | 64 m_replacementPolicy_ptr = p->replacement_policy; |
65 m_start_index_bit = p->start_index_bit; 66 m_is_instruction_only_cache = p->is_icache; 67 m_resource_stalls = p->resourceStalls; 68} 69 70void 71CacheMemory::init() 72{ 73 m_cache_num_sets = (m_cache_size / m_cache_assoc) / 74 RubySystem::getBlockSizeBytes(); 75 assert(m_cache_num_sets > 1); 76 m_cache_num_set_bits = floorLog2(m_cache_num_sets); 77 assert(m_cache_num_set_bits > 0); 78 | 65 m_start_index_bit = p->start_index_bit; 66 m_is_instruction_only_cache = p->is_icache; 67 m_resource_stalls = p->resourceStalls; 68} 69 70void 71CacheMemory::init() 72{ 73 m_cache_num_sets = (m_cache_size / m_cache_assoc) / 74 RubySystem::getBlockSizeBytes(); 75 assert(m_cache_num_sets > 1); 76 m_cache_num_set_bits = floorLog2(m_cache_num_sets); 77 assert(m_cache_num_set_bits > 0); 78 |
79 if (m_policy == "PSEUDO_LRU") 80 m_replacementPolicy_ptr = 81 new PseudoLRUPolicy(m_cache_num_sets, m_cache_assoc); 82 else if (m_policy == "LRU") 83 m_replacementPolicy_ptr = 84 new LRUPolicy(m_cache_num_sets, m_cache_assoc); 85 else 86 assert(false); 87 | |
88 m_cache.resize(m_cache_num_sets); 89 for (int i = 0; i < m_cache_num_sets; i++) { 90 m_cache[i].resize(m_cache_assoc); 91 for (int j = 0; j < m_cache_assoc; j++) { 92 m_cache[i][j] = NULL; 93 } 94 } 95} --- 472 unchanged lines hidden --- | 79 m_cache.resize(m_cache_num_sets); 80 for (int i = 0; i < m_cache_num_sets; i++) { 81 m_cache[i].resize(m_cache_assoc); 82 for (int j = 0; j < m_cache_assoc; j++) { 83 m_cache[i][j] = NULL; 84 } 85 } 86} --- 472 unchanged lines hidden --- |